diff options
Diffstat (limited to 'src')
| -rw-r--r-- | src/cmd/compile/internal/inline/inl.go | 11 | ||||
| -rw-r--r-- | src/cmd/compile/internal/test/inl_test.go | 22 |
2 files changed, 14 insertions, 19 deletions
diff --git a/src/cmd/compile/internal/inline/inl.go b/src/cmd/compile/internal/inline/inl.go index 1458f1a0e4..b6949bb5ac 100644 --- a/src/cmd/compile/internal/inline/inl.go +++ b/src/cmd/compile/internal/inline/inl.go @@ -504,6 +504,8 @@ 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 @@ -635,13 +637,10 @@ 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, diff --git a/src/cmd/compile/internal/test/inl_test.go b/src/cmd/compile/internal/test/inl_test.go index 2a16b21cef..205b746dd8 100644 --- a/src/cmd/compile/internal/test/inl_test.go +++ b/src/cmd/compile/internal/test/inl_test.go @@ -180,19 +180,15 @@ func TestIntendedInlining(t *testing.T) { "net": { "(*UDPConn).ReadFromUDP", }, - // These testpoints commented out for now, since CL 479095 - // had to be reverted. We can re-enable this once we roll - // forward with a new version of 479095. - /* - "sync": { - // Both OnceFunc and its returned closure need to be inlinable so - // that the returned closure can be inlined into the caller of OnceFunc. - "OnceFunc", - "OnceFunc.func2", // The returned closure. - // TODO(austin): It would be good to check OnceValue and OnceValues, - // too, but currently they aren't reported because they have type - // parameters and aren't instantiated in sync. - }, */ + "sync": { + // Both OnceFunc and its returned closure need to be inlinable so + // that the returned closure can be inlined into the caller of OnceFunc. + "OnceFunc", + "OnceFunc.func2", // The returned closure. + // TODO(austin): It would be good to check OnceValue and OnceValues, + // too, but currently they aren't reported because they have type + // parameters and aren't instantiated in sync. + }, "sync/atomic": { // (*Bool).CompareAndSwap handled below. "(*Bool).Load", |
