diff options
| author | Dmitry Vyukov <dvyukov@google.com> | 2020-05-01 17:19:27 +0200 |
|---|---|---|
| committer | Dmitry Vyukov <dvyukov@google.com> | 2020-05-02 12:16:06 +0200 |
| commit | 58da4c35b15200b7279f18ea15bc8644618aae78 (patch) | |
| tree | 412d59572c980c4eb582d6d0e187eb6ec32345c9 /pkg/compiler/compiler.go | |
| parent | bc734e7ada413654f1b7d948b2a857260a52dd9c (diff) | |
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
Diffstat (limited to 'pkg/compiler/compiler.go')
| -rw-r--r-- | pkg/compiler/compiler.go | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/pkg/compiler/compiler.go b/pkg/compiler/compiler.go index 8e5afddde..f61d02036 100644 --- a/pkg/compiler/compiler.go +++ b/pkg/compiler/compiler.go @@ -249,13 +249,13 @@ func (comp *compiler) getTypeDesc(t *ast.Type) *typeDesc { return nil } -func (comp *compiler) getArgsBase(t *ast.Type, field string, isArg bool) (*typeDesc, []*ast.Type, prog.IntTypeCommon) { +func (comp *compiler) getArgsBase(t *ast.Type, isArg bool) (*typeDesc, []*ast.Type, prog.IntTypeCommon) { desc := comp.getTypeDesc(t) if desc == nil { panic(fmt.Sprintf("no type desc for %#v", *t)) } args, opt := removeOpt(t) - com := genCommon(t.Ident, field, sizeUnassigned, opt != nil) + com := genCommon(t.Ident, sizeUnassigned, opt != nil) base := genIntCommon(com, 0, false) if desc.NeedBase { base.TypeSize = comp.ptrSize @@ -305,7 +305,7 @@ func (comp *compiler) foreachType(n0 ast.Node, func (comp *compiler) foreachSubType(t *ast.Type, isArg bool, cb func(*ast.Type, *typeDesc, []*ast.Type, prog.IntTypeCommon)) { - desc, args, base := comp.getArgsBase(t, "", isArg) + desc, args, base := comp.getArgsBase(t, isArg) cb(t, desc, args, base) for i, arg := range args { if desc.Args[i].Type == typeArgType { |
