]> Cypherpunks.ru repositories - gostls13.git/commit
[dev.unified] cmd/compile: implement simple inline body pruning heuristic
authorMatthew Dempsky <mdempsky@google.com>
Wed, 27 Jul 2022 04:52:42 +0000 (21:52 -0700)
committerMatthew Dempsky <mdempsky@google.com>
Thu, 28 Jul 2022 07:31:47 +0000 (07:31 +0000)
commitf9959460940140b280be1f5591ae38b9ab74182e
tree24dc74e64bc237275446759246b829a819307f01
parentf2851c67fd103b8dd7e84e3d35b896ea49ea4af5
[dev.unified] cmd/compile: implement simple inline body pruning heuristic

An important optimization in the existing export data format is the
pruning of unreachable inline bodies. That is, when re-exporting
transitively imported types, omitting the inline bodies for methods
that can't actually be needed due to importing that package.

The existing logic (implemented in typecheck/crawler.go) is fairly
sophisticated, but also relies on actually expanding inline bodies in
the process, which is undesirable. However, including all inline
bodies is also prohibitive for testing GOEXPERIMENT=unified against
very large Go code bases that impose size limits on build action
inputs.

As a short-term solution, this CL implements a simple heuristic for
GOEXPERIMENT=unified: include the inline bodies for all
locally-declared functions/methods, and for any imported
functions/methods that were inlined into this package.

Change-Id: I686964a0cd9262b77d3d5587f89cfbcfe8b2e521
Reviewed-on: https://go-review.googlesource.com/c/go/+/419675
Run-TryBot: Matthew Dempsky <mdempsky@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: David Chase <drchase@google.com>
src/cmd/compile/internal/noder/import.go
src/cmd/compile/internal/noder/linker.go
src/cmd/compile/internal/noder/reader.go
src/cmd/compile/internal/noder/unified.go