aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRuss Cox <rsc@golang.org>2013-08-08 16:44:16 -0400
committerRuss Cox <rsc@golang.org>2013-08-08 16:44:16 -0400
commit390656affd8993ce6332dca3fa86d57659622fdf (patch)
tree9f8eb3ca8ed7da3c6e0b15f4f5afb65916b688c6
parentf91e682cca2eb51a0a8b1511678a5e2b4d8a83de (diff)
downloadgo-390656affd8993ce6332dca3fa86d57659622fdf.tar.xz
cmd/gc: fix stkptrsize calculation
I moved the pointer block from one end of the frame to the other toward the end of working on the last CL, and of course that made the optimization no longer work. Now it works again: 0030 (bug361.go:12) DATA gclocals·0+0(SB)/4,$4 0030 (bug361.go:12) DATA gclocals·0+4(SB)/4,$3 0030 (bug361.go:12) GLOBL gclocals·0+0(SB),8,$8 Fixes arm build (this time for sure!). TBR=golang-dev CC=cshapiro, golang-dev, iant https://golang.org/cl/12627044
-rw-r--r--src/cmd/gc/pgen.c14
1 files changed, 4 insertions, 10 deletions
diff --git a/src/cmd/gc/pgen.c b/src/cmd/gc/pgen.c
index ad005a8f92..64b03b341f 100644
--- a/src/cmd/gc/pgen.c
+++ b/src/cmd/gc/pgen.c
@@ -341,7 +341,7 @@ dumpgclocals(Node* fn, Sym *sym)
node = ll->n;
if(node->class == PAUTO && node->op == ONAME) {
if(haspointers(node->type)) {
- xoffset = node->xoffset + stksize;
+ xoffset = node->xoffset + stkptrsize;
walktype1(node->type, &xoffset, bv);
}
}
@@ -397,7 +397,6 @@ allocauto(Prog* ptxt)
NodeList *ll;
Node* n;
vlong w;
- vlong ptrlimit;
if(curfn->dcl == nil) {
stksize = 0;
@@ -437,7 +436,7 @@ allocauto(Prog* ptxt)
// Reassign stack offsets of the locals that are still there.
stksize = 0;
- ptrlimit = -1;
+ stkptrsize = 0;
for(ll = curfn->dcl; ll != nil; ll=ll->next) {
n = ll->n;
if (n->class != PAUTO || n->op != ONAME)
@@ -449,8 +448,8 @@ allocauto(Prog* ptxt)
fatal("bad width");
stksize += w;
stksize = rnd(stksize, n->type->align);
- if(ptrlimit < 0 && haspointers(n->type))
- ptrlimit = stksize - w;
+ if(haspointers(n->type))
+ stkptrsize = stksize;
if(thechar == '5')
stksize = rnd(stksize, widthptr);
if(stksize >= (1ULL<<31)) {
@@ -460,11 +459,6 @@ allocauto(Prog* ptxt)
n->stkdelta = -stksize - n->xoffset;
}
stksize = rnd(stksize, widthptr);
-
- if(ptrlimit < 0)
- stkptrsize = 0;
- else
- stkptrsize = stksize - ptrlimit;
stkptrsize = rnd(stkptrsize, widthptr);
fixautoused(ptxt);