go/test
Russ Cox 96d90d0981 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
2014-04-02 14:09:42 -04:00
..
bench test: revert unintentional commits 2013-11-19 15:36:13 +04:00
bugs cmd/gc: fix wrong interaction between inlining and embedded builtins. 2012-12-22 19:16:31 +01:00
chan test/chan: avoid wrap-around in memstats comparison 2013-09-20 17:27:56 -07:00
ddd2.dir
dwarf test: make rundir match compiledir/errorcheckdir. 2013-01-11 22:00:48 +01:00
fixedbugs cmd/gc: fix spurious "bad negated constant" for complex constants. 2014-04-01 02:55:38 -04:00
import2.dir
import4.dir test: match gccgo import error messages 2013-12-12 19:02:11 -08:00
interface cmd/gc: don't attempt to generate wrappers for blank interface methods 2013-08-19 11:53:34 +10:00
ken
method4.dir cmd/gc: do not omit wrapper for expression (interface{...}).F 2014-01-07 13:26:48 +01:00
safe test: adapt old-style tests to new flag parsing. 2013-01-11 22:05:46 +01:00
stress test/stress: fix a goroutine leak in threadRing stresstest 2013-06-03 07:07:31 -07:00
syntax test: match gccgo error messages 2013-12-12 17:18:12 -08:00
64bit.go cmd/gc: Error out on division by constant zero. 2013-01-30 20:21:08 +01:00
235.go
alias.go
alias1.go test: ensure all failing tests exit nonzero. 2013-02-12 13:17:49 -05:00
append.go
args.go
assign.go
assign1.go
bigalg.go test: ensure all failing tests exit nonzero. 2013-02-12 13:17:49 -05:00
bigmap.go
blank.go test: revert changes made for Go SSA interpreter test. 2013-10-08 14:36:20 -04:00
blank1.go test: match gccgo error messages for blank1.go 2013-09-28 15:19:05 -07:00
bom.go
bombad.go
bounds.go
chancap.go
char_lit.go
char_lit1.go
closedchan.go
closure.go
cmp.go cmd/gc: do not nop-convert equivalent but different interface types. 2014-02-27 08:07:50 +01:00
cmp6.go cmd/gc: do not consider length zero arrays as comparable. 2014-01-31 00:30:56 +01:00
cmplx.go cmd/gc: reject complex calls with mismatched argument types. 2013-03-11 22:55:14 +01:00
cmplxdivide.c
cmplxdivide.go test: ensure all failing tests exit nonzero. 2013-02-12 13:17:49 -05:00
cmplxdivide1.go
complit.go
complit1.go
compos.go
const.go exp/ssa/interp: (#6 of 5): test interpretation of SSA form of $GOROOT/test/*.go. 2013-02-21 12:48:38 -05:00
const1.go test: match gccgo error messages 2013-12-12 17:18:12 -08:00
const2.go
const3.go
const4.go test: ensure all failing tests exit nonzero. 2013-02-12 13:17:49 -05:00
const5.go cmd/gc: reject non-Go constants 2013-02-01 23:10:02 -05:00
const6.go test: match gccgo error strings. 2013-06-26 18:05:02 +02:00
convT2X.go
convert.go
convert1.go
convert3.go
convlit.go
convlit1.go
copy.go test: ensure all failing tests exit nonzero. 2013-02-12 13:17:49 -05:00
crlf.go
ddd.go
ddd1.go
ddd2.go
decl.go test: ensure all failing tests exit nonzero. 2013-02-12 13:17:49 -05:00
declbad.go
defer.go test: ensure all failing tests exit nonzero. 2013-02-12 13:17:49 -05:00
deferfin.go runtime: combine small NoScan allocations 2014-01-24 22:35:11 +04:00
deferprint.go
deferprint.out
divide.go test: ensure all failing tests exit nonzero. 2013-02-12 13:17:49 -05:00
divmod.go all: fix a few spelling errors in source comments 2013-12-27 08:59:02 -08:00
empty.go
env.go
eof.go
eof1.go
errchk test/errchk: use "#!/usr/bin/env perl" shebang line 2013-05-23 04:41:22 +08:00
escape.go test: ensure all failing tests exit nonzero. 2013-02-12 13:17:49 -05:00
escape2.go cmd/gc: relax address-of escape analysis 2014-02-13 19:59:09 -05:00
escape3.go
escape4.go
escape5.go cmd/gc: distinguish unnamed vs blank-named return variables better 2014-02-13 20:59:39 -05:00
float_lit.go test: ensure all failing tests exit nonzero. 2013-02-12 13:17:49 -05:00
floatcmp.go test: ensure all failing tests exit nonzero. 2013-02-12 13:17:49 -05:00
for.go
func.go
func1.go cmd/gc: ensure unique parameter and result names in function types 2013-03-15 15:24:13 -04:00
func2.go
func3.go
func4.go
func5.go
func6.go
func7.go test: ensure all failing tests exit nonzero. 2013-02-12 13:17:49 -05:00
func8.go test: ensure all failing tests exit nonzero. 2013-02-12 13:17:49 -05:00
funcdup.go test: match gccgo error messages 2013-12-12 17:18:12 -08:00
funcdup2.go test: match gccgo error messages 2013-12-12 17:18:12 -08:00
gc.go
gc1.go
gc2.go
gcstring.go runtime: fix empty string handling in garbage collector 2014-03-11 23:58:39 -04:00
golden.out cmd/gc: do not generate code for var _ = ... unless necessary 2012-12-30 12:01:53 -05:00
goprint.go test: make goprint.go wait longer for go its routine to execute 2013-04-12 16:04:19 -07:00
goprint.out
goto.go
helloworld.go
helloworld.out
if.go
import.go
import1.go test: match gccgo import error messages 2013-12-12 19:02:11 -08:00
import2.go
import4.go
import5.go
index.go test: recognize gccgo error message in index.go 2013-09-27 20:38:52 -07:00
index0.go
index1.go
index2.go
indirect.go
indirect1.go
init.go
init1.go test: ensure all failing tests exit nonzero. 2013-02-12 13:17:49 -05:00
initcomma.go
initialize.go
initializerr.go test: add "duplicate" struct map key test 2012-12-17 11:05:58 -05:00
int_lit.go
intcvt.go
iota.go
label.go
label1.go
linkx.go
literal.go test: ensure all failing tests exit nonzero. 2013-02-12 13:17:49 -05:00
live.go cmd/gc: shorten even more temporary lifetimes 2014-04-02 14:09:42 -04:00
live1.go cmd/gc: correct liveness for fat variables 2014-02-15 10:58:55 -05:00
mallocfin.go
map.go test: fix flaky NaN-key map complexity test 2013-04-07 11:56:15 -07:00
map1.go
mapnan.go test/mapnan: use time.Now instead of syscall.Getrusage 2013-10-22 18:33:37 -04:00
method.go test: a number of fixes. 2013-02-11 18:20:52 -05:00
method1.go
method2.go cmd/gc: fix method values whose receiver is an unnamed interface. 2013-08-29 10:00:58 +02:00
method3.go
method4.go
method5.go cmd/gc: implement method values 2013-03-20 17:11:09 -04:00
named.go
named1.go
nil.go test: ensure all failing tests exit nonzero. 2013-02-12 13:17:49 -05:00
nilcheck.go cmd/gc: &x panics if x does 2013-08-15 14:38:32 -04:00
nilptr.go test/nilptr: add more tests 2013-09-05 23:06:34 -04:00
nilptr2.go test: revert changes made for Go SSA interpreter test. 2013-10-08 14:36:20 -04:00
nilptr3.go cmd/gc: eliminate redundant &x.Field nil checks 2013-09-17 16:54:22 -04:00
nilptr4.go cmd/gc: fix bad checknil with ints on 32 bit compilers 2014-02-26 12:25:13 -08:00
nul1.go
parentype.go
peano.go
printbig.go
printbig.out
range.go test: a number of fixes. 2013-02-11 18:20:52 -05:00
recover.go test: disable failing tests under ssa/interp. 2013-09-18 14:44:57 -04:00
recover1.go
recover2.go
recover3.go tests: remove two misuses of nil pointers 2013-08-15 11:51:04 -04:00
rename.go test: ensure all failing tests exit nonzero. 2013-02-12 13:17:49 -05:00
rename1.go
reorder.go test: a number of fixes. 2013-02-11 18:20:52 -05:00
reorder2.go cmd/gc: shorten temporary lifetimes when possible 2014-04-01 13:31:38 -04:00
return.go test: add cases to return.go that gccgo got wrong 2013-08-07 11:31:01 -07:00
rotate.go test: add rotate.go and fixedbugs/bug313 2013-01-11 22:42:55 +01:00
rotate0.go test: add rotate.go and fixedbugs/bug313 2013-01-11 22:42:55 +01:00
rotate1.go test: add rotate.go and fixedbugs/bug313 2013-01-11 22:42:55 +01:00
rotate2.go test: add rotate.go and fixedbugs/bug313 2013-01-11 22:42:55 +01:00
rotate3.go test: add rotate.go and fixedbugs/bug313 2013-01-11 22:42:55 +01:00
run test/run: add /usr/pkg/bin to PATH. 2014-03-03 02:16:15 -05:00
run.go test/run: make errorcheck tests faster 2014-03-11 23:58:24 -04:00
rune.go
runtime.go
shift1.go test/shift1.go: recognize gccgo errors 2013-06-26 08:23:52 -07:00
shift2.go test: add shift expression incorrectly rejected by gccgo. 2013-06-25 08:06:34 +02:00
sieve.go
sigchld.go test: skip SIGCHLD test on Plan 9 2014-01-29 09:28:23 +01:00
sigchld.out
simassign.go
sinit.go cmd/gc: do not generate code for var _ = ... unless necessary 2012-12-30 12:01:53 -05:00
sizeof.go test: correct sizeof.go. 2013-06-02 19:10:11 +02:00
slice3.go cmd/gc: support x[i:j:k] 2013-07-01 20:32:36 -04:00
slice3err.go test: match gccgo error messages 2013-12-12 17:18:12 -08:00
solitaire.go
stack.go
string_lit.go test: add []rune case to string_lit.go 2013-12-12 17:17:02 -08:00
stringrange.go
struct0.go
switch.go cmd/gc: disallow fallthrough in final case of switch 2013-03-15 00:35:09 -04:00
switch3.go
switch4.go cmd/gc: disallow fallthrough in final case of switch 2013-03-15 00:35:09 -04:00
testlib test/run: process build tags like go/build 2013-08-13 12:25:41 -04:00
tinyfin.go runtime: combine small NoScan allocations 2014-01-24 22:35:11 +04:00
torture.go cmd/8g: introduce temporaries in byte multiplication. 2012-12-21 23:46:16 +01:00
turing.go
typecheck.go cmd/gc: silence assignment errors to undefined symbols 2014-01-03 21:03:20 +01:00
typeswitch.go
typeswitch1.go
typeswitch2.go
typeswitch3.go
undef.go
utf.go
varerr.go
varinit.go
zerodivide.go test: ensure all failing tests exit nonzero. 2013-02-12 13:17:49 -05:00