]> Cypherpunks repositories - gostls13.git/commit
cmd/internal/gc: transitive inlining
authorRuss Cox <rsc@golang.org>
Tue, 24 Feb 2015 17:19:01 +0000 (12:19 -0500)
committerRuss Cox <rsc@golang.org>
Thu, 26 Feb 2015 17:36:00 +0000 (17:36 +0000)
commit77ccb16eb12f461eaea5fdf652a2e929dc154192
tree254c4fb61ef0df8da7efe617513e4667f8f3c563
parent5d1828269540fa7ba1dee60ce6b4a938463a696f
cmd/internal/gc: transitive inlining

Inlining refuses to inline bodies containing an actual function call, so that
if that call or a child uses runtime.Caller it cannot observe
the inlining.

However, inlining was also refusing to inline bodies that contained
function calls that were themselves inlined away. For example:

func f() int {
return f1()
}

func f1() int {
return f2()
}

func f2() int {
return 2
}

The f2 call in f1 would be inlined, but the f1 call in f would not,
because f1's call to f2 blocked the inlining, despite itself eventually
being inlined away.

Account properly for this kind of transitive inlining and enable.

Also bump the inlining budget a bit, so that the runtime's
heapBits.next is inlined.

This reduces the time for '6g *.go' in html/template by around 12% (!).
(For what it's worth, closing Chrome reduces the time by about 17%.)

Change-Id: If1aa673bf3e583082dcfb5f223e67355c984bfc1
Reviewed-on: https://go-review.googlesource.com/5952
Reviewed-by: Austin Clements <austin@google.com>
src/cmd/internal/gc/go.go
src/cmd/internal/gc/inl.go
src/cmd/internal/gc/lex.go
test/escape4.go
test/inline.go [new file with mode: 0644]