cmd/gc: shorten even more temporary lifetimes
1. Use n->alloc, not n->left, to hold the allocated temp being passed from orderstmt/orderexpr to walk. 2. Treat method values the same as closures. 3. Use killed temporary for composite literal passed to non-escaping function argument. 4. Clean temporaries promptly in if and for statements. 5. Clean temporaries promptly in select statements. As part of this, move all the temporary-generating logic out of select.c into order.c, so that the temporaries can be reclaimed. With the new temporaries, can re-enable the 1-entry select optimization. Fixes issue 7672. While we're here, fix a 1-line bug in select processing turned up by the new liveness test (but unrelated; select.c:72). Fixes #7686. 6. Clean temporaries (but not particularly promptly) in switch and range statements. 7. Clean temporary used during convT2E/convT2I. 8. Clean temporaries promptly during && and || expressions. --- CL 81940043 reduced the number of ambiguously live temps in the godoc binary from 860 to 711. CL 83090046 reduced the number from 711 to 121. This CL reduces the number from 121 to 23. 15 the 23 that remain are in fact ambiguously live. The final 8 could be fixed but are not trivial and not common enough to warrant work at this point in the release cycle. These numbers only count ambiguously live temps, not ambiguously live user-declared variables. There are 18 such variables in the godoc binary after this CL, so a total of 41 ambiguously live temps or user-declared variables. The net effect is that zeroing anything on entry to a function should now be a rare event, whereas earlier it was the common case. This is good enough for Go 1.3, and probably good enough for future releases too. Fixes #7345. LGTM=khr R=khr CC=golang-codereviews https://golang.org/cl/83000048
Showing
Please
register
or
sign in
to comment