]> Cypherpunks repositories - gostls13.git/commitdiff
6g return struct fix:
authorRuss Cox <rsc@golang.org>
Mon, 2 Feb 2009 21:41:38 +0000 (13:41 -0800)
committerRuss Cox <rsc@golang.org>
Mon, 2 Feb 2009 21:41:38 +0000 (13:41 -0800)
make t->width of funarg struct be width of struct.

emit MOVSL for 4-byte copy.

R=ken
OCL=24108
CL=24111

src/cmd/6g/align.c
src/cmd/6g/cgen.c
src/cmd/6g/gsubr.c

index 5d55e2ca912787673bcac47c5fcd40de17678b98..a2a8e2808bd540de2b204481ba34aae3bbe98177 100644 (file)
@@ -68,7 +68,12 @@ widstruct(Type *t, uint32 o, int flag)
        // final width is rounded
        if(flag)
                o = rnd(o, maxround);
-       t->width = o;
+
+       // type width only includes back to first field's offset
+       if(t->type == T)
+               t->width = 0;
+       else
+               t->width = o - t->type->width;
        return o;
 }
 
index 4a7404e8ca8eead9a58ffe24f1767ddff80f6138..05dd256ffade408bef9bdfc0cddc5ffb75ecf154 100644 (file)
@@ -906,11 +906,9 @@ sgen(Node *n, Node *ns, int32 w)
                }
 
                if(c >= 4) {
-                       gconreg(AMOVQ, c, D_CX);
-                       gins(AREP, N, N);       // repeat
-                       gins(AMOVSB, N, N);     // MOVB *(SI)+,*(DI)+
-
-               } else
+                       gins(AMOVSL, N, N);     // MOVL *(SI)+,*(DI)+
+                       c -= 4;
+               }
                while(c > 0) {
                        gins(AMOVSB, N, N);     // MOVB *(SI)+,*(DI)+
                        c--;
index 67def9952718f6e7bc02e21d4eefa21b36279fbb..4d091da648d86c3c66de4a4fa627139ed5b4f3e0 100644 (file)
@@ -1887,11 +1887,9 @@ lsort(Sig *l, int(*f)(Sig*, Sig*))
 void
 setmaxarg(Type *t)
 {
-       Type *to;
        int32 w;
 
-       to = *getoutarg(t);
-       w = to->width;
+       w = t->argwid;
        if(w > maxarg)
                maxarg = w;
 }