From 58da4c35b15200b7279f18ea15bc8644618aae78 Mon Sep 17 00:00:00 2001 From: Dmitry Vyukov Date: Fri, 1 May 2020 17:19:27 +0200 Subject: prog: introduce Field type Remvoe FieldName from Type and add a separate Field type that holds field name. Use Field for struct fields, union options and syscalls arguments, only these really have names. Reduces size of sys/linux/gen/amd64.go from 5665583 to 5201321 (-8.2%). Allows to not create new type for squashed any pointer. But main advantages will follow, e.g. removing StructDesc, using TypeRef in Arg, etc. Update #1580 --- prog/prog.go | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'prog/prog.go') diff --git a/prog/prog.go b/prog/prog.go index 017a0dbbb..dc1c8dd6c 100644 --- a/prog/prog.go +++ b/prog/prog.go @@ -234,10 +234,11 @@ func (arg *GroupArg) fixedInnerSize() bool { type UnionArg struct { ArgCommon Option Arg + Index int // Index of the selected option in the union type. } -func MakeUnionArg(t Type, dir Dir, opt Arg) *UnionArg { - return &UnionArg{ArgCommon: ArgCommon{typ: t, dir: dir}, Option: opt} +func MakeUnionArg(t Type, dir Dir, opt Arg, index int) *UnionArg { + return &UnionArg{ArgCommon: ArgCommon{typ: t, dir: dir}, Option: opt, Index: index} } func (arg *UnionArg) Size() uint64 { -- cgit mrf-deployment