diff options
| author | Than McIntosh <thanm@google.com> | 2023-04-03 14:25:58 +0000 |
|---|---|---|
| committer | Than McIntosh <thanm@google.com> | 2023-04-03 14:51:33 +0000 |
| commit | f5371581c73f2153bb7e7c85648896ff8bdce845 (patch) | |
| tree | 1de973da16c221d45b85d8e4b442bc29defd4479 /src | |
| parent | 8edcdddb23c6d3f786b465c43b49e8d9a0015082 (diff) | |
| download | go-f5371581c73f2153bb7e7c85648896ff8bdce845.tar.xz | |
Revert "cmd/compile: allow more inlining of functions that construct closures"
This reverts commit http://go.dev/cl//479095
Reason for revert: causes failures in google-internal testing
Change-Id: If1018b35be0b8627e2959f116179ada24d44d67c
Reviewed-on: https://go-review.googlesource.com/c/go/+/481637
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Michael Pratt <mpratt@google.com>
Run-TryBot: Than McIntosh <thanm@google.com>
Diffstat (limited to 'src')
| -rw-r--r-- | src/cmd/compile/internal/inline/inl.go | 11 |
1 files changed, 6 insertions, 5 deletions
diff --git a/src/cmd/compile/internal/inline/inl.go b/src/cmd/compile/internal/inline/inl.go index b8f3f9baee..80be841efa 100644 --- a/src/cmd/compile/internal/inline/inl.go +++ b/src/cmd/compile/internal/inline/inl.go @@ -446,8 +446,6 @@ func (v *hairyVisitor) tooHairy(fn *ir.Func) bool { return false } -// doNode visits n and its children, updates the state in v, and returns true if -// n makes the current function too hairy for inlining. func (v *hairyVisitor) doNode(n ir.Node) bool { if n == nil { return false @@ -579,10 +577,13 @@ func (v *hairyVisitor) doNode(n ir.Node) bool { // TODO(danscales): Maybe make budget proportional to number of closure // variables, e.g.: //v.budget -= int32(len(n.(*ir.ClosureExpr).Func.ClosureVars) * 3) - // TODO(austin): However, if we're able to inline this closure into - // v.curFunc, then we actually pay nothing for the closure captures. We - // should try to account for that if we're going to account for captures. v.budget -= 15 + // Scan body of closure (which DoChildren doesn't automatically + // do) to check for disallowed ops in the body and include the + // body in the budget. + if doList(n.(*ir.ClosureExpr).Func.Body, v.do) { + return true + } case ir.OGO, ir.ODEFER, |
