aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRuss Cox <rsc@golang.org>2014-05-27 23:58:36 -0400
committerRuss Cox <rsc@golang.org>2014-05-27 23:58:36 -0400
commit6c0bcb1863fbc84447590226911db9baab7a5c97 (patch)
tree969199b9ad45e95a2d87dff665a6ec63c8cce3e5
parenteeb87c3660932cb0dcc6db2e3784a66b6d06a82a (diff)
downloadgo-6c0bcb1863fbc84447590226911db9baab7a5c97.tar.gz
go-6c0bcb1863fbc84447590226911db9baab7a5c97.zip
cmd/gc: fix method value closures on nacl amd64p32
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
-rw-r--r--src/cmd/gc/closure.c2
-rw-r--r--src/cmd/gc/dcl.c2
2 files changed, 4 insertions, 0 deletions
diff --git a/src/cmd/gc/closure.c b/src/cmd/gc/closure.c
index 07cf13bc2f..ad4e5bd02b 100644
--- a/src/cmd/gc/closure.c
+++ b/src/cmd/gc/closure.c
@@ -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;
diff --git a/src/cmd/gc/dcl.c b/src/cmd/gc/dcl.c
index dcdaabec09..73c2581beb 100644
--- a/src/cmd/gc/dcl.c
+++ b/src/cmd/gc/dcl.c
@@ -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;