1
0
mirror of https://github.com/golang/go synced 2024-10-04 04:31:21 -06:00
go/src/cmd
Russ Cox daca06f2e3 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 #7345

LGTM=khr
R=khr
CC=golang-codereviews
https://golang.org/cl/83090046
2014-04-01 20:02:54 -04:00
..
5a cmd/5a, cmd/5c, cmd/6a, cmd/6c, cmd/8a, cmd/8c, cmd/cc: support for Native Client 2014-02-27 06:57:06 +11:00
5c cmd/5c: fix arm build 2014-03-07 10:13:00 +11:00
5g cmd/gc: shorten more temporary lifetimes 2014-04-01 20:02:54 -04:00
5l cmd/gc: shorten temporary lifetimes when possible 2014-04-01 13:31:38 -04:00
6a cmd/6a: add support for nacl/amd64p32 2014-03-07 16:02:25 +11:00
6c cmd/cc, cmd/5c, cmd/6c, cmd/8c: introduce linkarchinit and add amd64p32 support 2014-03-07 09:55:59 +11:00
6g cmd/gc: shorten more temporary lifetimes 2014-04-01 20:02:54 -04:00
6l runtime: get rid of most uses of REP for copying/zeroing. 2014-04-01 12:51:02 -07:00
8a cmd/5a, cmd/5c, cmd/6a, cmd/6c, cmd/8a, cmd/8c, cmd/cc: support for Native Client 2014-02-27 06:57:06 +11:00
8c cmd/cc, cmd/5c, cmd/6c, cmd/8c: introduce linkarchinit and add amd64p32 support 2014-03-07 09:55:59 +11:00
8g cmd/gc: shorten more temporary lifetimes 2014-04-01 20:02:54 -04:00
8l runtime: get rid of most uses of REP for copying/zeroing. 2014-04-01 12:51:02 -07:00
addr2line cmd/addr2line: reimplement in Go 2014-02-19 14:33:11 -05:00
api cmd/api: ensure GOPATH always points to the correct go.tools 2014-01-14 16:56:22 +11:00
cc runtime: redo stack map entries to avoid false retention 2014-03-25 14:11:34 -07:00
cgo cmd/cgo: enforce typing of 0-sized types 2014-03-27 20:23:16 +00:00
dist cmd/dist: zero output variables on entry to goc2c functions 2014-03-27 14:05:31 -04:00
fix cmd/fix: remove obsolete testdata. 2013-06-02 15:40:32 +02:00
gc cmd/gc: shorten more temporary lifetimes 2014-04-01 20:02:54 -04:00
go cmd/go: Use exported CgoLDFlags when compiler=gccgo 2014-03-26 15:23:31 -07:00
gofmt cmd/gofmt: minor internal cleanups 2014-02-27 09:00:27 -08:00
ld cmd/ld: pass -Qunused-arguments to clang during host linking. 2014-03-29 17:10:25 -04:00
link cmd/link: change cloneProg to return the cloned value 2014-02-18 17:59:44 -08:00
nm debug/plan9obj: implement parsing of Plan 9 a.out executables 2014-01-22 23:30:52 +01:00
objdump runtime/pprof: support OS X CPU profiling 2012-02-28 16:18:24 -05:00
pack cmd/pack: fix match 2014-02-20 15:50:30 -05:00
prof libmach: use different names for different Ureg types 2014-01-08 20:37:27 -05:00
yacc cmd/yacc: expr example support windows 2013-12-19 12:14:07 -05:00