OLD | NEW |
1 // Copyright 2011 The Go Authors. All rights reserved. | 1 // Copyright 2011 The Go Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style | 2 // Use of this source code is governed by a BSD-style |
3 // license that can be found in the LICENSE file. | 3 // license that can be found in the LICENSE file. |
4 | 4 |
5 #include <u.h> | 5 #include <u.h> |
6 #include <libc.h> | 6 #include <libc.h> |
7 #include "gg.h" | 7 #include "gg.h" |
8 #include "opt.h" | 8 #include "opt.h" |
9 #include "../../pkg/runtime/funcdata.h" | 9 #include "../../pkg/runtime/funcdata.h" |
10 | 10 |
11 static void allocauto(Prog* p); | 11 static void allocauto(Prog* p); |
12 static int pointermap(Sym*, int, Node*); | 12 static int pointermap(Sym*, int, Node*); |
13 static void gcsymbol(Sym*, Node*); | 13 static void gcsymbol(Sym*, Node*); |
14 | 14 |
15 void | 15 void |
16 compile(Node *fn) | 16 compile(Node *fn) |
17 { | 17 { |
18 Plist *pl; | 18 Plist *pl; |
19 Node nod1, *n, *gcnod; | 19 Node nod1, *n, *gcnod; |
20 » Prog *pfuncdata, *ptxt, *p, *p1; | 20 » Prog *ptxt, *p, *p1; |
21 int32 lno; | 21 int32 lno; |
22 Type *t; | 22 Type *t; |
23 Iter save; | 23 Iter save; |
24 vlong oldstksize; | 24 vlong oldstksize; |
25 NodeList *l; | 25 NodeList *l; |
26 Sym *gcsym; | 26 Sym *gcsym; |
27 static int ngcsym; | 27 static int ngcsym; |
28 | 28 |
29 if(newproc == N) { | 29 if(newproc == N) { |
30 newproc = sysfunc("newproc"); | 30 newproc = sysfunc("newproc"); |
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
92 afunclit(&ptxt->from, curfn->nname); | 92 afunclit(&ptxt->from, curfn->nname); |
93 | 93 |
94 ginit(); | 94 ginit(); |
95 | 95 |
96 snprint(namebuf, sizeof namebuf, "gc·%d", ngcsym++); | 96 snprint(namebuf, sizeof namebuf, "gc·%d", ngcsym++); |
97 gcsym = lookup(namebuf); | 97 gcsym = lookup(namebuf); |
98 gcnod = newname(gcsym); | 98 gcnod = newname(gcsym); |
99 gcnod->class = PEXTERN; | 99 gcnod->class = PEXTERN; |
100 | 100 |
101 nodconst(&nod1, types[TINT32], FUNCDATA_GC); | 101 nodconst(&nod1, types[TINT32], FUNCDATA_GC); |
102 » pfuncdata = gins(AFUNCDATA, &nod1, gcnod); | 102 » gins(AFUNCDATA, &nod1, gcnod); |
103 | 103 |
104 for(t=curfn->paramfld; t; t=t->down) | 104 for(t=curfn->paramfld; t; t=t->down) |
105 gtrack(tracksym(t->type)); | 105 gtrack(tracksym(t->type)); |
106 | 106 |
107 for(l=fn->dcl; l; l=l->next) { | 107 for(l=fn->dcl; l; l=l->next) { |
108 n = l->n; | 108 n = l->n; |
109 if(n->op != ONAME) // might be OTYPE or OLITERAL | 109 if(n->op != ONAME) // might be OTYPE or OLITERAL |
110 continue; | 110 continue; |
111 switch(n->class) { | 111 switch(n->class) { |
112 case PAUTO: | 112 case PAUTO: |
(...skipping 294 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
407 fixautoused(ptxt); | 407 fixautoused(ptxt); |
408 | 408 |
409 // The debug information needs accurate offsets on the symbols. | 409 // The debug information needs accurate offsets on the symbols. |
410 for(ll = curfn->dcl ;ll != nil; ll=ll->next) { | 410 for(ll = curfn->dcl ;ll != nil; ll=ll->next) { |
411 if (ll->n->class != PAUTO || ll->n->op != ONAME) | 411 if (ll->n->class != PAUTO || ll->n->op != ONAME) |
412 continue; | 412 continue; |
413 ll->n->xoffset += ll->n->stkdelta; | 413 ll->n->xoffset += ll->n->stkdelta; |
414 ll->n->stkdelta = 0; | 414 ll->n->stkdelta = 0; |
415 } | 415 } |
416 } | 416 } |
OLD | NEW |