Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code | Sign in
(2551)

Issue 83090046: code review 83090046: cmd/gc: shorten more temporary lifetimes (Closed)

Can't Edit
Can't Publish+Mail
Start Review
Created:
10 years ago by rsc
Modified:
10 years ago
Reviewers:
gobot, khr, dave
CC:
khr, golang-codereviews
Visibility:
Public.

Description

cmd/gc: shorten more temporary lifetimes 1. In functions with heap-allocated result variables or with defer statements, the return sequence requires more than just a single RET instruction. There is an optimization that arranges for all returns to jump to a single copy of the return epilogue in this case. Unfortunately, that optimization is fundamentally incompatible with PC-based liveness information: it takes PCs at many different points in the function and makes them all land at one PC, making the combined liveness information at that target PC a mess. Disable this optimization, so that each return site gets its own copy of the 'call deferreturn' and the copying of result variables back from the heap. This removes quite a few spurious 'ambiguously live' variables. 2. Let orderexpr allocate temporaries that are passed by address to a function call and then die on return, so that we can arrange an appropriate VARKILL. 2a. Do this for ... slices. 2b. Do this for closure structs. 2c. Do this for runtime.concatstring, which is the implementation of large string additions. Change representation of OADDSTR to an explicit list in typecheck to avoid reconstructing list in both walk and order. 3. Let orderexpr allocate the temporary variable copies used for range loops, so that they can be killed when the loop is over. Similarly, let it allocate the temporary holding the map iterator. CL 81940043 reduced the number of ambiguously live temps in the godoc binary from 860 to 711. This CL reduces the number to 121. Still more to do, but another good checkpoint. Update issue 7345

Patch Set 1 #

Patch Set 2 : diff -r a33823379ef0 https://code.google.com/p/go/ #

Patch Set 3 : diff -r a33823379ef0 https://code.google.com/p/go/ #

Patch Set 4 : diff -r 1427fb6bcfa3 https://code.google.com/p/go/ #

Patch Set 5 : diff -r 1427fb6bcfa3 https://code.google.com/p/go/ #

Patch Set 6 : diff -r 1b80f9a5165b https://code.google.com/p/go/ #

Unified diffs Side-by-side diffs Delta from patch set Stats (+369 lines, -102 lines) Patch
M src/cmd/5g/ggen.c View 1 2 3 1 chunk +3 lines, -1 line 0 comments Download
M src/cmd/6g/ggen.c View 1 2 chunks +9 lines, -7 lines 0 comments Download
M src/cmd/8g/ggen.c View 1 2 3 4 5 1 chunk +3 lines, -1 line 0 comments Download
M src/cmd/gc/closure.c View 1 1 chunk +8 lines, -0 lines 0 comments Download
M src/cmd/gc/const.c View 1 4 chunks +42 lines, -10 lines 0 comments Download
M src/cmd/gc/esc.c View 1 2 3 4 chunks +36 lines, -8 lines 0 comments Download
M src/cmd/gc/fmt.c View 1 2 chunks +8 lines, -1 line 0 comments Download
M src/cmd/gc/go.h View 1 1 chunk +0 lines, -1 line 0 comments Download
M src/cmd/gc/order.c View 1 10 chunks +83 lines, -7 lines 0 comments Download
M src/cmd/gc/pgen.c View 1 3 chunks +3 lines, -14 lines 0 comments Download
M src/cmd/gc/range.c View 1 4 chunks +15 lines, -17 lines 0 comments Download
M src/cmd/gc/sinit.c View 1 2 chunks +26 lines, -10 lines 0 comments Download
M src/cmd/gc/typecheck.c View 1 1 chunk +13 lines, -1 line 0 comments Download
M src/cmd/gc/walk.c View 1 7 chunks +27 lines, -24 lines 0 comments Download
M test/live.go View 1 2 3 1 chunk +93 lines, -0 lines 0 comments Download

Messages

Total messages: 7
rsc
Hello khr (cc: golang-codereviews@googlegroups.com), I'd like you to review this change to https://code.google.com/p/go/
10 years ago (2014-04-01 19:58:52 UTC) #1
khr
On 2014/04/01 19:58:52, rsc wrote: > Hello khr (cc: mailto:golang-codereviews@googlegroups.com), > > I'd like you ...
10 years ago (2014-04-01 21:25:10 UTC) #2
rsc
*** Submitted as https://code.google.com/p/go/source/detail?r=018897bad935 *** cmd/gc: shorten more temporary lifetimes 1. In functions with heap-allocated ...
10 years ago (2014-04-02 00:03:00 UTC) #3
gobot
This CL appears to have broken the darwin-386-cheney builder. See http://build.golang.org/log/90d26a606727fea276864cbd1602eb9eca5d8fd6
10 years ago (2014-04-02 00:04:13 UTC) #4
dave_cheney.net
/Users/builder/workspace/darwin-386-cheney-018897bad935/go/src/cmd/8g/ggen.c:466:5: error: use of undeclared identifier 'retpc' /Users/builder/workspace/darwin-386-cheney-018897bad935/go/src/cmd/8g/ggen.c:467:8: error: use of undeclared identifier 'retpc' go ...
10 years ago (2014-04-02 00:14:26 UTC) #5
dave_cheney.net
rsc, maybe you better take a look at this, the failure is more than just ...
10 years ago (2014-04-02 00:17:57 UTC) #6
rsc
10 years ago (2014-04-02 00:20:59 UTC) #7
fixing
Sign in to reply to this message.

Powered by Google App Engine
RSS Feeds Recent Issues | This issue
This is Rietveld f62528b