]> Cypherpunks repositories - gostls13.git/commitdiff
cmd/6g: relax constraint on variables that need zeroing.
authorRémy Oudompheng <oudomphe@phare.normalesup.org>
Wed, 9 Apr 2014 19:23:36 +0000 (21:23 +0200)
committerRémy Oudompheng <oudomphe@phare.normalesup.org>
Wed, 9 Apr 2014 19:23:36 +0000 (21:23 +0200)
On amd64p32 pointers are 32-bit-aligned and cannot be assumed to
have an offset multiple of widthreg. Instead check that they are
withptr-aligned.

Also change the threshold for region merging to 2*widthreg
instead of 2*widthptr because performance on amd64 and amd64p32
is expected to be the same.

Fixes #7712.

LGTM=khr
R=rsc, dave, khr, brad, bradfitz
CC=golang-codereviews
https://golang.org/cl/84690044

src/cmd/6g/ggen.c

index 2633b19e4d1e98612a165efb4a617f2ac0f091c4..991783bc578494dea08bc7198e369937c1a4ef4a 100644 (file)
@@ -42,12 +42,12 @@ defframe(Prog *ptxt)
                        continue;
                if(n->class != PAUTO)
                        fatal("needzero class %d", n->class);
-               if(n->type->width % widthreg != 0 || n->xoffset % widthreg != 0 || n->type->width == 0)
+               if(n->type->width % widthptr != 0 || n->xoffset % widthptr != 0 || n->type->width == 0)
                        fatal("var %lN has size %d offset %d", n, (int)n->type->width, (int)n->xoffset);
 
-               if(lo != hi && n->xoffset + n->type->width >= lo - 2*widthptr) {
+               if(lo != hi && n->xoffset + n->type->width >= lo - 2*widthreg) {
                        // merge with range we already have
-                       lo = n->xoffset;
+                       lo = rnd(n->xoffset, widthreg);
                        continue;
                }
                // zero old range