diff options
| author | Dmitry Vyukov <dvyukov@google.com> | 2020-04-26 14:14:14 +0200 |
|---|---|---|
| committer | Dmitry Vyukov <dvyukov@google.com> | 2020-05-01 13:31:17 +0200 |
| commit | e54e9781a4e043b3140b0c908ba4f4e469fd317e (patch) | |
| tree | 16e6387d78a8577c5f3d9fb8d05a51752da6338e /prog/rand_test.go | |
| parent | 3f4dbb2f6fff9479d6c250e224bc3cb7f5cd66ed (diff) | |
prog: remove Dir from Type
Having Dir is Type is handy, but forces us to duplicate lots of types.
E.g. if a struct is referenced as both in and out, then we need to
have 2 copies and 2 copies of structs/types it includes.
If also prevents us from having the struct type as struct identity
(because we can have up to 3 of them).
Revert to the old way we used to do it: propagate Dir as we walk
syscall arguments. This moves lots of dir passing from pkg/compiler
to prog package.
Now Arg contains the dir, so once we build the tree, we can use dirs
as before.
Reduces size of sys/linux/gen/amd64.go from 6058336 to 5661150 (-6.6%).
Update #1580
Diffstat (limited to 'prog/rand_test.go')
| -rw-r--r-- | prog/rand_test.go | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/prog/rand_test.go b/prog/rand_test.go index 09f3b359c..6f251cb7c 100644 --- a/prog/rand_test.go +++ b/prog/rand_test.go @@ -102,14 +102,14 @@ func TestSizeGenerateConstArg(t *testing.T) { target, rs, iters := initRandomTargetTest(t, "test", "64") r := newRand(target, rs) for _, c := range target.Syscalls { - ForeachType(c, func(typ Type) { + foreachType(c, func(typ Type, ctx typeCtx) { if _, ok := typ.(*IntType); !ok { return } bits := typ.TypeBitSize() limit := uint64(1<<bits - 1) for i := 0; i < iters; i++ { - newArg, _ := typ.generate(r, nil) + newArg, _ := typ.generate(r, nil, ctx.Dir) newVal := newArg.(*ConstArg).Val if newVal > limit { t.Fatalf("invalid generated value: %d. (arg bitsize: %d; max value: %d)", newVal, bits, limit) |
