Commit Graph

13 Commits

Author SHA1 Message Date
Rémy Oudompheng
94ff311d1b gc: avoid false positives when using scalar struct fields.
The escape analysis code does not make a distinction between
scalar and pointers fields in structs. Non-pointer fields
that escape should not make the whole struct escape.

R=lvd, rsc
CC=golang-dev, remy
https://golang.org/cl/5489128
2012-01-12 12:08:40 +01:00
Russ Cox
4a6b07f235 gc: enable inlining by default
R=lvd, r
CC=golang-dev
https://golang.org/cl/5531058
2012-01-10 20:08:53 -08:00
Luuk van Dijk
9bf3478658 gc: better loopdepth analysis for labels
This avoids degraded performance caused by extra labels
emitted by inlining (breaking strconv ftoa alloc count unittest) and is better in any case.

R=rsc
CC=golang-dev
https://golang.org/cl/5483071
2011-12-15 17:35:59 +01:00
Russ Cox
434a6c85cb gc: use gofmt spacing when printing map type
R=ken2
CC=golang-dev
https://golang.org/cl/5450071
2011-12-02 14:45:07 -05:00
Luuk van Dijk
29a5ae657f gc: small fixes for printing.
mark OADDR inserted by typecheck as implicit
OCOPY takes ->left and ->right, not ->list
OMAKE*'s can all have arguments
precedence for OIND was initalized twice

fixes #2414

R=rsc, dave
CC=golang-dev
https://golang.org/cl/5319065
2011-11-02 15:36:33 +01:00
Russ Cox
b4df33a6ea gc: test + fix escape analysis bug
R=lvd
CC=golang-dev
https://golang.org/cl/5333049
2011-11-01 11:02:43 -04:00
Luuk van Dijk
b536adbfba gc: changes to export format in preparation for inlining.
string literals used as package qualifiers are now prefixed with '@'
which obviates the need for the extra ':' before tags.

R=rsc, gri, lvd
CC=golang-dev
https://golang.org/cl/5129057
2011-10-08 19:37:06 +02:00
Luuk van Dijk
f2460a8c57 gc: treat DOTMETH like DOT in escape analysis.
Fixes #2225

R=rsc, nigeltao, dave
CC=bradfitz, golang-dev, mikioh.mikioh
https://golang.org/cl/4972056
2011-09-07 19:03:11 +02:00
Russ Cox
60d47101aa gc: fix label recursion bugs
Was keeping a pointer to the labeled statement in n->right,
which meant that generic traversals of the tree visited it twice.
That combined with aggressive flattening of the block
structure when possible during parsing meant that
the kinds of label: code label: code label: code sequences
generated by yacc were giving the recursion 2ⁿ paths
through the program.

Fixes #2212.

R=lvd
CC=golang-dev
https://golang.org/cl/4960050
2011-09-01 13:44:46 -04:00
Russ Cox
77f0bdce07 gc: fix arm build
Escape analysis was incorrectly assuming that
functions without bodies don't leak their
parameters.  This meant that sync/atomic's
TestAddInt64 was allocating x on its stack,
and then x was not properly aligned for use
with the atomic 64-bit instructions.  Obviously
we should figure out the alignment story on 5g
too, but this fix is correct and should restore the
build to 'ok'.

TBR=lvd
CC=golang-dev
https://golang.org/cl/4964047
2011-08-28 23:29:34 -04:00
Russ Cox
db5f9da425 gc: tweak and enable escape analysis
-s now means *disable* escape analysis.

Fix escape leaks for struct/slice/map literals.
Add ... tracking.
Rewrite new(T) and slice literal into stack allocation when safe.

Add annotations to reflect.
Reflect is too chummy with the compiler,
so changes like these affect it more than they should.

R=lvd, dave, gustavo
CC=golang-dev
https://golang.org/cl/4954043
2011-08-28 12:05:00 -04:00
Russ Cox
0227c45ede gc: fix some spurious leaks
Probably will spark some discussion.  ☺

R=lvd
CC=golang-dev
https://golang.org/cl/4948041
2011-08-25 09:26:13 -04:00
Luuk van Dijk
847b61b554 gc: Escape analysis.
For now it's switch-on-and-offable with -s, and the effects can be inspected
with -m.  Defaults are the old codepaths.

R=rsc
CC=golang-dev
https://golang.org/cl/4634073
2011-08-24 19:07:08 +02:00