]> Cypherpunks repositories - gostls13.git/commit
[dev.typeparams] cmd/compile: avoid redundant method wrappers in unified IR
authorMatthew Dempsky <mdempsky@google.com>
Tue, 3 Aug 2021 06:56:13 +0000 (23:56 -0700)
committerMatthew Dempsky <mdempsky@google.com>
Tue, 3 Aug 2021 19:01:04 +0000 (19:01 +0000)
commit7ab875402985ea5a31512fb9750dc0f809e06861
tree4c387276f5191cc3c52159e2959bc33bf45d75f4
parentfe73f28dc5e22ab6b54b7433dd6e63caf5c9da72
[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>
src/cmd/compile/internal/noder/reader.go
src/cmd/compile/internal/reflectdata/reflect.go