• Russ Cox's avatar
    cmd/internal/gc: transitive inlining · 77ccb16e
    Russ Cox authored
    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/5952Reviewed-by: 's avatarAustin Clements <austin@google.com>
    77ccb16e
escape4.go 1.38 KB