diff options
Diffstat (limited to 'src/cmd/8g/gsubr.c')
-rw-r--r-- | src/cmd/8g/gsubr.c | 19 |
1 files changed, 7 insertions, 12 deletions
diff --git a/src/cmd/8g/gsubr.c b/src/cmd/8g/gsubr.c index c4c184bb9..756bdd203 100644 --- a/src/cmd/8g/gsubr.c +++ b/src/cmd/8g/gsubr.c @@ -1150,6 +1150,7 @@ ismem(Node *n) case OINDREG: case ONAME: case OPARAM: + case OCLOSUREVAR: return 1; } return 0; @@ -2160,11 +2161,11 @@ gins(int as, Node *f, Node *t) // Generate an instruction referencing *n // to force segv on nil pointer dereference. void -checkref(Node *n) +checkref(Node *n, int force) { Node m; - if(n->type->type->width < unmappedzero) + if(!force && isptr[n->type->etype] && n->type->type->width < unmappedzero) return; regalloc(&m, types[TUINTPTR], n); @@ -2201,8 +2202,6 @@ checkoffset(Addr *a, int canemitcode) void naddr(Node *n, Addr *a, int canemitcode) { - Prog *p; - a->scale = 0; a->index = D_NONE; a->type = D_NONE; @@ -2239,13 +2238,8 @@ naddr(Node *n, Addr *a, int canemitcode) break; case OCLOSUREVAR: - if(!canemitcode) - fatal("naddr OCLOSUREVAR cannot emit code"); - p = gins(AMOVL, N, N); - p->from.type = D_DX+D_INDIR; - p->from.offset = n->xoffset; - p->to.type = D_BX; - a->type = D_BX; + a->type = D_DX+D_INDIR; + a->offset = n->xoffset; a->sym = S; break; @@ -2397,7 +2391,8 @@ naddr(Node *n, Addr *a, int canemitcode) int dotaddable(Node *n, Node *n1) { - int o, oary[10]; + int o; + int64 oary[10]; Node *nn; if(n->op != ODOT) |