diff options
author | Matthew Dempsky <mdempsky@google.com> | 2021-08-02 23:56:13 -0700 |
---|---|---|
committer | Matthew Dempsky <mdempsky@google.com> | 2021-08-03 19:01:04 +0000 |
commit | 7ab875402985ea5a31512fb9750dc0f809e06861 (patch) | |
tree | 4c387276f5191cc3c52159e2959bc33bf45d75f4 /src/cmd/compile/internal/reflectdata/reflect.go | |
parent | fe73f28dc5e22ab6b54b7433dd6e63caf5c9da72 (diff) | |
download | go-7ab875402985ea5a31512fb9750dc0f809e06861.tar.gz go-7ab875402985ea5a31512fb9750dc0f809e06861.zip |
[dev.typeparams] cmd/compile: avoid redundant method wrappers in unified IR
Currently, unified IR takes a simple approach of generating method
wrappers for every anonymous type that it sees. This is correct, but
spends a lot of time in code generation and bloats the object files
with duplicate method wrappers that the linker discards.
This CL changes it to distinguish anonymous types that were found in
imported packages vs the local package. The simple win here is that
now we stop emitting wrappers for imported types; but by keeping track
of them and marking them as "have" instead of "need", we can avoid
emitting wrappers for types that appear in both the local package and
imported packages.
This can be improved further, but this is a simple first step that
prevents large protobuf projects from blowing up build cache limits.
Change-Id: Ia65e8981cb1f067eca2bd072b9bbb77c27b95207
Reviewed-on: https://go-review.googlesource.com/c/go/+/339411
Trust: Matthew Dempsky <mdempsky@google.com>
Run-TryBot: Matthew Dempsky <mdempsky@google.com>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Cuong Manh Le <cuong.manhle.vn@gmail.com>
Diffstat (limited to 'src/cmd/compile/internal/reflectdata/reflect.go')
-rw-r--r-- | src/cmd/compile/internal/reflectdata/reflect.go | 3 |
1 files changed, 1 insertions, 2 deletions
diff --git a/src/cmd/compile/internal/reflectdata/reflect.go b/src/cmd/compile/internal/reflectdata/reflect.go index dca8de74f3..19cf2a0a12 100644 --- a/src/cmd/compile/internal/reflectdata/reflect.go +++ b/src/cmd/compile/internal/reflectdata/reflect.go @@ -1809,9 +1809,8 @@ func methodWrapper(rcvr *types.Type, method *types.Field, forItab bool) *obj.LSy newnam.SetSiggen(true) // Except in quirks mode, unified IR creates its own wrappers. - // Complain loudly if it missed any. if base.Debug.Unified != 0 && base.Debug.UnifiedQuirks == 0 { - base.FatalfAt(method.Pos, "missing wrapper for %+v (%+v, %v) / %+v / %+v", rcvr, orig, types.IsDirectIface(orig), method.Sym, newnam) + return lsym } if !generic && types.Identical(rcvr, method.Type.Recv().Type) { |