OLD | NEW |
1 // Copyright 2009 The Go Authors. All rights reserved. | 1 // Copyright 2009 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 <bio.h> | 7 #include <bio.h> |
8 | 8 |
9 #undef OAPPEND | 9 #undef OAPPEND |
10 | 10 |
(...skipping 236 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
247 NodeList* cvars; // closure params | 247 NodeList* cvars; // closure params |
248 NodeList* dcl; // autodcl for this func/closure | 248 NodeList* dcl; // autodcl for this func/closure |
249 | 249 |
250 // OLITERAL/OREGISTER | 250 // OLITERAL/OREGISTER |
251 Val val; | 251 Val val; |
252 | 252 |
253 // ONAME | 253 // ONAME |
254 Node* ntype; | 254 Node* ntype; |
255 Node* defn; | 255 Node* defn; |
256 Node* pack; // real package for import . names | 256 Node* pack; // real package for import . names |
| 257 Node* curfn; // function for local variables |
257 | 258 |
258 // ONAME func param with PHEAP | 259 // ONAME func param with PHEAP |
259 Node* heapaddr; // temp holding heap address of param | 260 Node* heapaddr; // temp holding heap address of param |
260 Node* stackparam; // OPARAM node referring to stack copy of param | 261 Node* stackparam; // OPARAM node referring to stack copy of param |
261 Node* alloc; // allocation call | 262 Node* alloc; // allocation call |
262 | 263 |
263 // ONAME closure param with PPARAMREF | 264 // ONAME closure param with PPARAMREF |
264 Node* outer; // outer PPARAMREF in nested closure | 265 Node* outer; // outer PPARAMREF in nested closure |
265 Node* closure; // ONAME/PHEAP <-> ONAME/PPARAMREF | 266 Node* closure; // ONAME/PHEAP <-> ONAME/PPARAMREF |
266 | 267 |
(...skipping 243 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
510 PPARAM, | 511 PPARAM, |
511 PPARAMOUT, | 512 PPARAMOUT, |
512 PPARAMREF, // param passed by reference | 513 PPARAMREF, // param passed by reference |
513 PFUNC, | 514 PFUNC, |
514 | 515 |
515 PHEAP = 1<<7, | 516 PHEAP = 1<<7, |
516 }; | 517 }; |
517 | 518 |
518 enum | 519 enum |
519 { | 520 { |
520 » Etop = 1<<1,» // evaluated at statement level | 521 » Etop = 1<<1,» » // evaluated at statement level |
521 » Erv = 1<<2,» // evaluated in value context | 522 » Erv = 1<<2,» » // evaluated in value context |
522 Etype = 1<<3, | 523 Etype = 1<<3, |
523 » Ecall = 1<<4,» // call-only expressions are ok | 524 » Ecall = 1<<4,» » // call-only expressions are ok |
524 Efnstruct = 1<<5, // multivalue function returns are ok | 525 Efnstruct = 1<<5, // multivalue function returns are ok |
525 Eiota = 1<<6, // iota is ok | 526 Eiota = 1<<6, // iota is ok |
526 Easgn = 1<<7, // assigning to expression | 527 Easgn = 1<<7, // assigning to expression |
527 Eindir = 1<<8, // indirecting through expression | 528 Eindir = 1<<8, // indirecting through expression |
528 Eaddr = 1<<9, // taking address of expression | 529 Eaddr = 1<<9, // taking address of expression |
| 530 Eproc = 1<<10, // inside a go statement |
529 }; | 531 }; |
530 | 532 |
531 #define BITS 5 | 533 #define BITS 5 |
532 #define NVAR (BITS*sizeof(uint32)*8) | 534 #define NVAR (BITS*sizeof(uint32)*8) |
533 | 535 |
534 typedef struct Bits Bits; | 536 typedef struct Bits Bits; |
535 struct Bits | 537 struct Bits |
536 { | 538 { |
537 uint32 b[BITS]; | 539 uint32 b[BITS]; |
538 }; | 540 }; |
(...skipping 269 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
808 Bits bnot(Bits a); | 810 Bits bnot(Bits a); |
809 int bnum(Bits a); | 811 int bnum(Bits a); |
810 Bits bor(Bits a, Bits b); | 812 Bits bor(Bits a, Bits b); |
811 int bset(Bits a, uint n); | 813 int bset(Bits a, uint n); |
812 | 814 |
813 /* | 815 /* |
814 * closure.c | 816 * closure.c |
815 */ | 817 */ |
816 Node* closurebody(NodeList *body); | 818 Node* closurebody(NodeList *body); |
817 void closurehdr(Node *ntype); | 819 void closurehdr(Node *ntype); |
818 void» typecheckclosure(Node *func); | 820 void» typecheckclosure(Node *func, int top); |
819 Node* walkclosure(Node *func, NodeList **init); | 821 Node* walkclosure(Node *func, NodeList **init); |
820 void walkcallclosure(Node *n, NodeList **init); | 822 void walkcallclosure(Node *n, NodeList **init); |
821 | 823 |
822 /* | 824 /* |
823 * const.c | 825 * const.c |
824 */ | 826 */ |
825 int cmpslit(Node *l, Node *r); | 827 int cmpslit(Node *l, Node *r); |
826 int consttype(Node *n); | 828 int consttype(Node *n); |
827 void convconst(Node *con, Type *t, Val *val); | 829 void convconst(Node *con, Type *t, Val *val); |
828 void convlit(Node **np, Type *t); | 830 void convlit(Node **np, Type *t); |
(...skipping 413 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1242 int isfat(Type*); | 1244 int isfat(Type*); |
1243 Plist* newplist(void); | 1245 Plist* newplist(void); |
1244 Node* nodarg(Type*, int); | 1246 Node* nodarg(Type*, int); |
1245 void nopout(Prog*); | 1247 void nopout(Prog*); |
1246 void patch(Prog*, Prog*); | 1248 void patch(Prog*, Prog*); |
1247 void zfile(Biobuf *b, char *p, int n); | 1249 void zfile(Biobuf *b, char *p, int n); |
1248 void zhist(Biobuf *b, int line, vlong offset); | 1250 void zhist(Biobuf *b, int line, vlong offset); |
1249 void zname(Biobuf *b, Sym *s, int t); | 1251 void zname(Biobuf *b, Sym *s, int t); |
1250 void data(void); | 1252 void data(void); |
1251 void text(void); | 1253 void text(void); |
OLD | NEW |