summaryrefslogtreecommitdiff
path: root/src/cmd/gc/dcl.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/cmd/gc/dcl.c')
-rw-r--r--src/cmd/gc/dcl.c14
1 files changed, 13 insertions, 1 deletions
diff --git a/src/cmd/gc/dcl.c b/src/cmd/gc/dcl.c
index ecd72a56b..bb81d2a22 100644
--- a/src/cmd/gc/dcl.c
+++ b/src/cmd/gc/dcl.c
@@ -1276,7 +1276,7 @@ addmethod(Sym *sf, Type *t, int local)
}
void
-funccompile(Node *n)
+funccompile(Node *n, int isclosure)
{
stksize = BADWIDTH;
maxarg = 0;
@@ -1289,6 +1289,18 @@ funccompile(Node *n)
// assign parameter offsets
checkwidth(n->type);
+
+ // record offset to actual frame pointer.
+ // for closure, have to skip over leading pointers and PC slot.
+ nodfp->xoffset = 0;
+ if(isclosure) {
+ NodeList *l;
+ for(l=n->nname->ntype->list; l; l=l->next) {
+ nodfp->xoffset += widthptr;
+ if(l->n->left == N) // found slot for PC
+ break;
+ }
+ }
if(curfn)
fatal("funccompile %S inside %S", n->nname->sym, curfn->nname->sym);