diff options
author | Ondřej Surý <ondrej@sury.org> | 2012-04-06 15:14:11 +0200 |
---|---|---|
committer | Ondřej Surý <ondrej@sury.org> | 2012-04-06 15:14:11 +0200 |
commit | 505c19580e0f43fe5224431459cacb7c21edd93d (patch) | |
tree | 79e2634c253d60afc0cc0b2f510dc7dcbb48497b /src/cmd/gc/pgen.c | |
parent | 1336a7c91e596c423a49d1194ea42d98bca0d958 (diff) | |
download | golang-505c19580e0f43fe5224431459cacb7c21edd93d.tar.gz |
Imported Upstream version 1upstream/1
Diffstat (limited to 'src/cmd/gc/pgen.c')
-rw-r--r-- | src/cmd/gc/pgen.c | 27 |
1 files changed, 19 insertions, 8 deletions
diff --git a/src/cmd/gc/pgen.c b/src/cmd/gc/pgen.c index abe8ea892..f2b75d61b 100644 --- a/src/cmd/gc/pgen.c +++ b/src/cmd/gc/pgen.c @@ -2,10 +2,12 @@ // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. +#include <u.h> +#include <libc.h> #include "gg.h" #include "opt.h" -static void compactframe(Prog* p); +static void allocauto(Prog* p); void compile(Node *fn) @@ -52,14 +54,16 @@ compile(Node *fn) t = structnext(&save); } } - + + order(curfn); + if(nerrors != 0) + goto ret; + hasdefer = 0; walk(curfn); if(nerrors != 0) goto ret; - allocparams(); - continpc = P; breakpc = P; @@ -70,6 +74,8 @@ compile(Node *fn) nodconst(&nod1, types[TINT32], 0); ptxt = gins(ATEXT, isblank(curfn->nname) ? N : curfn->nname, &nod1); + if(fn->dupok) + ptxt->TEXTFLAG = DUPOK; afunclit(&ptxt->from); ginit(); @@ -113,9 +119,13 @@ compile(Node *fn) } oldstksize = stksize; - compactframe(ptxt); + allocauto(ptxt); if(0) - print("compactframe: %ld to %ld\n", oldstksize, stksize); + print("allocauto: %lld to %lld\n", oldstksize, (vlong)stksize); + + setlineno(curfn); + if((int64)stksize+maxarg > (1ULL<<31)) + yyerror("stack frame too large (>2GB)"); defframe(ptxt); @@ -145,13 +155,13 @@ cmpstackvar(Node *a, Node *b) // TODO(lvd) find out where the PAUTO/OLITERAL nodes come from. static void -compactframe(Prog* ptxt) +allocauto(Prog* ptxt) { NodeList *ll; Node* n; vlong w; - if (stksize == 0) + if(curfn->dcl == nil) return; // Mark the PAUTO's unused. @@ -188,6 +198,7 @@ compactframe(Prog* ptxt) if (n->class != PAUTO || n->op != ONAME) continue; + dowidth(n->type); w = n->type->width; if(w >= MAXWIDTH || w < 0) fatal("bad width"); |