aboutsummaryrefslogtreecommitdiff
path: root/src/cmd/compile/internal/inline
diff options
context:
space:
mode:
authorKeith Randall <khr@golang.org>2021-03-12 12:57:39 -0800
committerKeith Randall <khr@golang.org>2021-04-10 14:58:18 +0000
commit1129a60f1c1e64147ca1133857c4571ce9b87a35 (patch)
tree6ea37d4fb479f7009ccf43aacc07a547db7e7287 /src/cmd/compile/internal/inline
parent11f159456b1dba3ec499da916852dd188d1e04a7 (diff)
downloadgo-1129a60f1c1e64147ca1133857c4571ce9b87a35.tar.gz
go-1129a60f1c1e64147ca1133857c4571ce9b87a35.zip
cmd/compile: include typecheck information in export/import
Include type information on exported function bodies, so that the importer does not have to re-typecheck the body. This involves including type information in the encoded output, as well as avoiding some of the opcode rewriting and other changes that the old exporter did assuming there would be a re-typechecking pass. This CL could be considered a cleanup, but is more important than that because it is an enabling change for generics. Without this CL, we'd have to upgrade the current typechecker to understand generics. With this CL, the current typechecker can mostly go away in favor of the types2 typechecker. For now, inlining of functions that contain closures is turned off. We will hopefully resolve this before freeze. Object files are only 0.07% bigger. Change-Id: I85c9da09f66bfdc910dc3e26abb2613a1831634d Reviewed-on: https://go-review.googlesource.com/c/go/+/301291 Trust: Keith Randall <khr@golang.org> Trust: Dan Scales <danscales@google.com> Reviewed-by: Dan Scales <danscales@google.com>
Diffstat (limited to 'src/cmd/compile/internal/inline')
-rw-r--r--src/cmd/compile/internal/inline/inl.go6
1 files changed, 4 insertions, 2 deletions
diff --git a/src/cmd/compile/internal/inline/inl.go b/src/cmd/compile/internal/inline/inl.go
index 1941dc44bc..4470df1d2a 100644
--- a/src/cmd/compile/internal/inline/inl.go
+++ b/src/cmd/compile/internal/inline/inl.go
@@ -354,7 +354,7 @@ func (v *hairyVisitor) doNode(n ir.Node) bool {
return true
case ir.OCLOSURE:
- if base.Debug.InlFuncsWithClosures == 0 {
+ if base.Debug.InlFuncsWithClosures == 0 || typecheck.Go117ExportTypes { // TODO: remove latter condition
v.reason = "not inlining functions with closures"
return true
}
@@ -1013,7 +1013,9 @@ func mkinlcall(n *ir.CallExpr, fn *ir.Func, maxCost int32, inlMap map[*ir.Func]b
lab := ir.NewLabelStmt(base.Pos, retlabel)
body = append(body, lab)
- typecheck.Stmts(body)
+ if !typecheck.Go117ExportTypes {
+ typecheck.Stmts(body)
+ }
if base.Flag.GenDwarfInl > 0 {
for _, v := range inlfvars {