Skip to content

Commit 51e1819

Browse files
committed
[dev.regabi] cmd/compile: scan body of closure in tooHairy to check for disallowed nodes
Several of the bugs in #43818 are because we were not scanning the body of an possibly inlined closure in tooHairy(). I think this scanning got lost in the rebase past some of the ir changes. This fixes the issue related to the SELRECV2 and the bug reported from cuonglm. There is at least one other bug related to escape analysis which I'll fix in another change. Change-Id: I8f38cd12a287881155403bbabbc540ed5fc2248e Reviewed-on: https://go-review.googlesource.com/c/go/+/285676 Trust: Dan Scales <[email protected]> Run-TryBot: Dan Scales <[email protected]> TryBot-Result: Go Bot <[email protected]> Reviewed-by: Matthew Dempsky <[email protected]>
1 parent 7e0a81d commit 51e1819

File tree

1 file changed

+8
-2
lines changed
  • src/cmd/compile/internal/inline

1 file changed

+8
-2
lines changed

src/cmd/compile/internal/inline/inl.go

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -354,10 +354,16 @@ func (v *hairyVisitor) doNode(n ir.Node) bool {
354354
return true
355355

356356
case ir.OCLOSURE:
357-
// TODO(danscales) - fix some bugs when budget is lowered below 30
357+
// TODO(danscales) - fix some bugs when budget is lowered below 15
358358
// Maybe make budget proportional to number of closure variables, e.g.:
359359
//v.budget -= int32(len(n.(*ir.ClosureExpr).Func.ClosureVars) * 3)
360-
v.budget -= 30
360+
v.budget -= 15
361+
// Scan body of closure (which DoChildren doesn't automatically
362+
// do) to check for disallowed ops in the body and include the
363+
// body in the budget.
364+
if doList(n.(*ir.ClosureExpr).Func.Body, v.do) {
365+
return true
366+
}
361367

362368
case ir.ORANGE,
363369
ir.OSELECT,

0 commit comments

Comments
 (0)