LEFT | RIGHT |
(no file at all) | |
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 <bio.h> | 5 #include <bio.h> |
6 | 6 |
7 #undef OAPPEND | 7 #undef OAPPEND |
8 | 8 |
9 // avoid <ctype.h> | 9 // avoid <ctype.h> |
10 #undef isblank | 10 #undef isblank |
(...skipping 113 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
124 Mpflt* fval; // float CTFLT | 124 Mpflt* fval; // float CTFLT |
125 Mpcplx* cval; // float CTCPLX | 125 Mpcplx* cval; // float CTCPLX |
126 Strlit* sval; // string CTSTR | 126 Strlit* sval; // string CTSTR |
127 } u; | 127 } u; |
128 }; | 128 }; |
129 | 129 |
130 typedef struct Pkg Pkg; | 130 typedef struct Pkg Pkg; |
131 typedef struct Sym Sym; | 131 typedef struct Sym Sym; |
132 typedef struct Node Node; | 132 typedef struct Node Node; |
133 typedef struct NodeList NodeList; | 133 typedef struct NodeList NodeList; |
| 134 typedef struct Field Field; |
| 135 typedef struct FieldList FieldList; |
134 typedef struct Type Type; | 136 typedef struct Type Type; |
135 typedef struct Label Label; | 137 typedef struct Label Label; |
136 | 138 |
137 struct Type | 139 struct Type |
138 { | 140 { |
139 uchar etype; | 141 uchar etype; |
140 uchar nointerface; | 142 uchar nointerface; |
141 uchar chan; | 143 uchar chan; |
142 uchar trecur; // to detect loops | 144 uchar trecur; // to detect loops |
143 uchar printed; | 145 uchar printed; |
(...skipping 197 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
341 * Such a walk cannot call another such walk recursively, | 343 * Such a walk cannot call another such walk recursively, |
342 * because of the use of the global walkgen. | 344 * because of the use of the global walkgen. |
343 */ | 345 */ |
344 EXTERN uint32 walkgen; | 346 EXTERN uint32 walkgen; |
345 | 347 |
346 struct NodeList | 348 struct NodeList |
347 { | 349 { |
348 Node* n; | 350 Node* n; |
349 NodeList* next; | 351 NodeList* next; |
350 NodeList* end; | 352 NodeList* end; |
| 353 }; |
| 354 |
| 355 // A Field represents either a function argument or |
| 356 // a field in a struct or interface. |
| 357 struct Field |
| 358 { |
| 359 Sym* name; |
| 360 Type* type; |
| 361 Val tag; |
| 362 int lineno; |
| 363 uchar isddd; |
| 364 }; |
| 365 #define F ((Field*)0) |
| 366 |
| 367 struct FieldList |
| 368 { |
| 369 Field* f; |
| 370 FieldList* next; |
| 371 FieldList* end; |
351 }; | 372 }; |
352 | 373 |
353 enum | 374 enum |
354 { | 375 { |
355 SymExport = 1<<0, // to be exported | 376 SymExport = 1<<0, // to be exported |
356 SymPackage = 1<<1, | 377 SymPackage = 1<<1, |
357 SymExported = 1<<2, // already written out by export | 378 SymExported = 1<<2, // already written out by export |
358 SymUniq = 1<<3, | 379 SymUniq = 1<<3, |
359 SymSiggen = 1<<4, | 380 SymSiggen = 1<<4, |
360 SymGcgen = 1<<5, | 381 SymGcgen = 1<<5, |
(...skipping 652 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1013 void complexminus(Node *nl, Node *res); | 1034 void complexminus(Node *nl, Node *res); |
1014 void complexmove(Node *f, Node *t); | 1035 void complexmove(Node *f, Node *t); |
1015 void complexmul(Node *nl, Node *nr, Node *res); | 1036 void complexmul(Node *nl, Node *nr, Node *res); |
1016 int complexop(Node *n, Node *res); | 1037 int complexop(Node *n, Node *res); |
1017 void nodfconst(Node *n, Type *t, Mpflt* fval); | 1038 void nodfconst(Node *n, Type *t, Mpflt* fval); |
1018 | 1039 |
1019 /* | 1040 /* |
1020 * dcl.c | 1041 * dcl.c |
1021 */ | 1042 */ |
1022 void addmethod(Sym *sf, Type *t, int local, int nointerface); | 1043 void addmethod(Sym *sf, Type *t, int local, int nointerface); |
| 1044 int mustaddmethod(Sym*, FieldList*, FieldList*, FieldList*); |
1023 void addvar(Node *n, Type *t, int ctxt); | 1045 void addvar(Node *n, Type *t, int ctxt); |
1024 NodeList* checkarglist(NodeList *all, int input); | 1046 NodeList* checkarglist(NodeList *all, int input); |
1025 Node* colas(NodeList *left, NodeList *right, int32 lno); | 1047 Node* colas(NodeList *left, NodeList *right, int32 lno); |
1026 void colasdefn(NodeList *left, Node *defn); | 1048 void colasdefn(NodeList *left, Node *defn); |
1027 NodeList* constiter(NodeList *vl, Node *t, NodeList *cl); | 1049 NodeList* constiter(NodeList *vl, Node *t, NodeList *cl); |
1028 Node* dclname(Sym *s); | 1050 Node* dclname(Sym *s); |
1029 void declare(Node *n, int ctxt); | 1051 void declare(Node *n, int ctxt); |
1030 void dumpdcl(char *st); | 1052 void dumpdcl(char *st); |
1031 Node* embedded(Sym *s); | 1053 Node* embedded(Sym *s); |
1032 Node* fakethis(void); | 1054 Node* fakethis(void); |
| 1055 Field* fakefldthis(void); |
1033 void funcbody(Node *n); | 1056 void funcbody(Node *n); |
1034 void funccompile(Node *n, int isclosure); | 1057 void funccompile(Node *n, int isclosure); |
1035 void funchdr(Node *n); | 1058 void funchdr(Node *n); |
1036 Type*» functype(Node *this, NodeList *in, NodeList *out); | 1059 Type*» functype(Field *this, FieldList *in, FieldList *out); |
| 1060 Type*» makefunctype(Node *this, NodeList *in, NodeList *out); |
1037 void ifacedcl(Node *n); | 1061 void ifacedcl(Node *n); |
1038 int isifacemethod(Type *f); | 1062 int isifacemethod(Type *f); |
1039 void markdcl(void); | 1063 void markdcl(void); |
1040 Node* methodname(Node *n, Type *t); | 1064 Node* methodname(Node *n, Type *t); |
1041 Node* methodname1(Node *n, Node *t); | 1065 Node* methodname1(Node *n, Node *t); |
1042 Sym* methodsym(Sym *nsym, Type *t0, int iface); | 1066 Sym* methodsym(Sym *nsym, Type *t0, int iface); |
1043 Node* newname(Sym *s); | 1067 Node* newname(Sym *s); |
1044 Node* oldname(Sym *s); | 1068 Node* oldname(Sym *s); |
1045 void popdcl(void); | 1069 void popdcl(void); |
1046 void poptodcl(void); | 1070 void poptodcl(void); |
(...skipping 204 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1251 void badtype(int o, Type *tl, Type *tr); | 1275 void badtype(int o, Type *tl, Type *tr); |
1252 int brcom(int a); | 1276 int brcom(int a); |
1253 int brrev(int a); | 1277 int brrev(int a); |
1254 NodeList* concat(NodeList *a, NodeList *b); | 1278 NodeList* concat(NodeList *a, NodeList *b); |
1255 int convertop(Type *src, Type *dst, char **why); | 1279 int convertop(Type *src, Type *dst, char **why); |
1256 Node* copyexpr(Node*, Type*, NodeList**); | 1280 Node* copyexpr(Node*, Type*, NodeList**); |
1257 int count(NodeList *l); | 1281 int count(NodeList *l); |
1258 int cplxsubtype(int et); | 1282 int cplxsubtype(int et); |
1259 int eqtype(Type *t1, Type *t2); | 1283 int eqtype(Type *t1, Type *t2); |
1260 int eqtypenoname(Type *t1, Type *t2); | 1284 int eqtypenoname(Type *t1, Type *t2); |
| 1285 int eqfunctype(Type *t, FieldList *this, FieldList *in, FieldList *out); |
1261 void errorexit(void); | 1286 void errorexit(void); |
1262 void expandmeth(Type *t); | 1287 void expandmeth(Type *t); |
1263 void fatal(char *fmt, ...); | 1288 void fatal(char *fmt, ...); |
1264 void flusherrors(void); | 1289 void flusherrors(void); |
1265 void frame(int context); | 1290 void frame(int context); |
1266 Type* funcfirst(Iter *s, Type *t); | 1291 Type* funcfirst(Iter *s, Type *t); |
1267 Type* funcnext(Iter *s); | 1292 Type* funcnext(Iter *s); |
1268 void genwrapper(Type *rcvr, Type *method, Sym *newnam, int iface); | 1293 void genwrapper(Type *rcvr, Type *method, Sym *newnam, int iface); |
1269 void genhash(Sym *sym, Type *t); | 1294 void genhash(Sym *sym, Type *t); |
1270 void geneq(Sym *sym, Type *t); | 1295 void geneq(Sym *sym, Type *t); |
(...skipping 16 matching lines...) Expand all Loading... |
1287 int isnilinter(Type *t); | 1312 int isnilinter(Type *t); |
1288 int isptrto(Type *t, int et); | 1313 int isptrto(Type *t, int et); |
1289 int isslice(Type *t); | 1314 int isslice(Type *t); |
1290 int istype(Type *t, int et); | 1315 int istype(Type *t, int et); |
1291 void linehist(char *file, int32 off, int relative); | 1316 void linehist(char *file, int32 off, int relative); |
1292 NodeList* list(NodeList *l, Node *n); | 1317 NodeList* list(NodeList *l, Node *n); |
1293 NodeList* list1(Node *n); | 1318 NodeList* list1(Node *n); |
1294 void listsort(NodeList**, int(*f)(Node*, Node*)); | 1319 void listsort(NodeList**, int(*f)(Node*, Node*)); |
1295 Node* liststmt(NodeList *l); | 1320 Node* liststmt(NodeList *l); |
1296 NodeList* listtreecopy(NodeList *l); | 1321 NodeList* listtreecopy(NodeList *l); |
| 1322 Field* fld(Sym*, Type*); |
| 1323 FieldList* fldlist(FieldList*, Field*); |
1297 Sym* lookup(char *name); | 1324 Sym* lookup(char *name); |
1298 void* mal(int32 n); | 1325 void* mal(int32 n); |
1299 Type* maptype(Type *key, Type *val); | 1326 Type* maptype(Type *key, Type *val); |
1300 Type* methtype(Type *t, int mustname); | 1327 Type* methtype(Type *t, int mustname); |
1301 Pkg* mkpkg(Strlit *path); | 1328 Pkg* mkpkg(Strlit *path); |
1302 Sym* ngotype(Node *n); | 1329 Sym* ngotype(Node *n); |
1303 int noconv(Type *t1, Type *t2); | 1330 int noconv(Type *t1, Type *t2); |
1304 Node* nod(int op, Node *nleft, Node *nright); | 1331 Node* nod(int op, Node *nleft, Node *nright); |
1305 Node* nodbool(int b); | 1332 Node* nodbool(int b); |
1306 void nodconst(Node *n, Type *t, int64 v); | 1333 void nodconst(Node *n, Type *t, int64 v); |
(...skipping 160 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1467 #pragma varargck type "T" Type* | 1494 #pragma varargck type "T" Type* |
1468 #pragma varargck type "lT" Type* | 1495 #pragma varargck type "lT" Type* |
1469 #pragma varargck type "V" Val* | 1496 #pragma varargck type "V" Val* |
1470 #pragma varargck type "Y" char* | 1497 #pragma varargck type "Y" char* |
1471 #pragma varargck type "Z" Strlit* | 1498 #pragma varargck type "Z" Strlit* |
1472 | 1499 |
1473 /* | 1500 /* |
1474 * racewalk.c | 1501 * racewalk.c |
1475 */ | 1502 */ |
1476 void racewalk(Node *fn); | 1503 void racewalk(Node *fn); |
LEFT | RIGHT |