]> Cypherpunks repositories - gostls13.git/commitdiff
cmd/gc: fix method value closures on nacl amd64p32
authorRuss Cox <rsc@golang.org>
Wed, 28 May 2014 03:58:36 +0000 (23:58 -0400)
committerRuss Cox <rsc@golang.org>
Wed, 28 May 2014 03:58:36 +0000 (23:58 -0400)
The code was assuming that pointer alignment is the
maximum alignment, but on NaCl uint64 alignment is
even more strict.

Brad checked in the test earlier today; this fixes the build.

Fixes #7863.

TBR=iant
CC=golang-codereviews
https://golang.org/cl/98630046

src/cmd/gc/closure.c
src/cmd/gc/dcl.c

index 07cf13bc2f19f1a418bf8ad95a2af9b4283032d2..ad4e5bd02b02ad5b0dc324c841c3af4fd6c22b07 100644 (file)
@@ -374,6 +374,8 @@ makepartialcall(Node *fn, Type *t0, Node *meth)
        cv = nod(OCLOSUREVAR, N, N);
        cv->xoffset = widthptr;
        cv->type = rcvrtype;
+       if(cv->type->align > widthptr)
+               cv->xoffset = cv->type->align;
        ptr = nod(ONAME, N, N);
        ptr->sym = lookup("rcvr");
        ptr->class = PAUTO;
index dcdaabec093e259e4c002e8e460142fa4af5a4cc..73c2581beb63a0d7ab4c7825dee7190103bab3e9 100644 (file)
@@ -1438,6 +1438,8 @@ funccompile(Node *n, int isclosure)
        
        // record offset to actual frame pointer.
        // for closure, have to skip over leading pointers and PC slot.
+       // TODO(rsc): this is the old jit closure handling code.
+       // with the new closures, isclosure is always 0; delete this block.
        nodfp->xoffset = 0;
        if(isclosure) {
                NodeList *l;