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/target.go | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'prog/target.go') diff --git a/prog/target.go b/prog/target.go index f71730b1b..89940a61a 100644 --- a/prog/target.go +++ b/prog/target.go @@ -187,12 +187,12 @@ func restoreLinks(syscalls []*Syscall, resources []*ResourceDesc, structs []*Key for _, desc := range structs { keyedStructs[desc.Key] = desc.Desc for i := range desc.Desc.Fields { - unref(&desc.Desc.Fields[i], types) + unref(&desc.Desc.Fields[i].Type, types) } } for _, c := range syscalls { for i := range c.Args { - unref(&c.Args[i], types) + unref(&c.Args[i].Type, types) } if c.Ret != nil { unref(&c.Ret, types) @@ -262,7 +262,7 @@ func (g *Gen) GenerateSpecialArg(typ Type, dir Dir, pcalls *[]*Call) Arg { func (g *Gen) generateArg(typ Type, dir Dir, pcalls *[]*Call, ignoreSpecial bool) Arg { arg, calls := g.r.generateArgImpl(g.s, typ, dir, ignoreSpecial) *pcalls = append(*pcalls, calls...) - g.r.target.assignSizesArray([]Arg{arg}, nil) + g.r.target.assignSizesArray([]Arg{arg}, []Field{{Name: "", Type: arg.Type()}}, nil) return arg } -- cgit mrf-deployment