Commit 1d31a25d authored by Ken Thompson's avatar Ken Thompson

more coroutine

fixed a,b,c := x,x,x

SVN=126250
parent f86c6f67
...@@ -172,17 +172,17 @@ cgen(Node *n, Node *res) ...@@ -172,17 +172,17 @@ cgen(Node *n, Node *res)
break; break;
case OCALLMETH: case OCALLMETH:
cgen_callmeth(n); cgen_callmeth(n, 0);
cgen_callret(n, res); cgen_callret(n, res);
break; break;
case OCALLINTER: case OCALLINTER:
cgen_callinter(n, res); cgen_callinter(n, res, 0);
cgen_callret(n, res); cgen_callret(n, res);
break; break;
case OCALL: case OCALL:
cgen_call(n); cgen_call(n, 0);
cgen_callret(n, res); cgen_callret(n, res);
break; break;
...@@ -281,17 +281,17 @@ agen(Node *n, Node *res) ...@@ -281,17 +281,17 @@ agen(Node *n, Node *res)
// break; // break;
case OCALLMETH: case OCALLMETH:
cgen_callmeth(n); cgen_callmeth(n, 0);
cgen_aret(n, res); cgen_aret(n, res);
break; break;
case OCALLINTER: case OCALLINTER:
cgen_callinter(n, res); cgen_callinter(n, res, 0);
cgen_aret(n, res); cgen_aret(n, res);
break; break;
case OCALL: case OCALL:
cgen_call(n); cgen_call(n, 0);
cgen_aret(n, res); cgen_aret(n, res);
break; break;
......
...@@ -14,6 +14,7 @@ enum ...@@ -14,6 +14,7 @@ enum
}; };
static Node* curfn; static Node* curfn;
static Node* newproc;
void void
compile(Node *fn) compile(Node *fn)
...@@ -23,6 +24,16 @@ compile(Node *fn) ...@@ -23,6 +24,16 @@ compile(Node *fn)
Prog *ptxt; Prog *ptxt;
long lno; long lno;
if(newproc == N) {
newproc = nod(ONAME, N, N);
memset(newproc, 0, sizeof(*newproc));
newproc->op = ONAME;
newproc->sym = pkglookup("_newproc", "sys");
newproc->class = PEXTERN;
newproc->addable = 1;
newproc->ullman = 0;
}
if(fn->nbody == N) if(fn->nbody == N)
return; return;
lno = setlineno(fn); lno = setlineno(fn);
...@@ -298,15 +309,19 @@ loop: ...@@ -298,15 +309,19 @@ loop:
break; break;
case OCALLMETH: case OCALLMETH:
cgen_callmeth(n); cgen_callmeth(n, 0);
break; break;
case OCALLINTER: case OCALLINTER:
cgen_callinter(n, N); cgen_callinter(n, N, 0);
break; break;
case OCALL: case OCALL:
cgen_call(n); cgen_call(n, 0);
break;
case OPROC:
cgen_proc(n);
break; break;
case ORETURN: case ORETURN:
...@@ -552,7 +567,21 @@ genpanic(void) ...@@ -552,7 +567,21 @@ genpanic(void)
} }
void void
cgen_callinter(Node *n, Node *res) ginscall(Node *f, int proc)
{
Node regax;
if(proc) {
nodreg(&regax, types[TINT64], D_AX);
gins(ALEAQ, f, &regax);
gins(ACALL, N, newproc);
return;
}
gins(ACALL, N, f);
}
void
cgen_callinter(Node *n, Node *res, int proc)
{ {
Node *i, *f; Node *i, *f;
Node tmpi, nodo, nodr, nodsp; Node tmpi, nodo, nodr, nodsp;
...@@ -588,21 +617,19 @@ cgen_callinter(Node *n, Node *res) ...@@ -588,21 +617,19 @@ cgen_callinter(Node *n, Node *res)
nodo.xoffset -= widthptr; nodo.xoffset -= widthptr;
cgen(&nodo, &nodr); // REG = 0(REG) -- i.m cgen(&nodo, &nodr); // REG = 0(REG) -- i.m
//print("field = %N\n", f);
//print("offset = %ld\n", n->left->xoffset);
nodo.xoffset = n->left->xoffset + 4*widthptr; nodo.xoffset = n->left->xoffset + 4*widthptr;
cgen(&nodo, &nodr); // REG = 32+offset(REG) -- i.m->fun[f] cgen(&nodo, &nodr); // REG = 32+offset(REG) -- i.m->fun[f]
gins(ACALL, N, &nodr); ginscall(&nodr, proc);
regfree(&nodr);
regfree(&nodr); regfree(&nodr);
regfree(&nodo);
setmaxarg(n->left->type); setmaxarg(n->left->type);
} }
void void
cgen_callmeth(Node *n) cgen_callmeth(Node *n, int proc)
{ {
Node *l; Node *l;
...@@ -619,14 +646,14 @@ cgen_callmeth(Node *n) ...@@ -619,14 +646,14 @@ cgen_callmeth(Node *n)
if(n->left->op == ONAME) if(n->left->op == ONAME)
n->left->class = PEXTERN; n->left->class = PEXTERN;
cgen_call(n); cgen_call(n, proc);
} }
void void
cgen_call(Node *n) cgen_call(Node *n, int proc)
{ {
Type *t; Type *t;
Node nod, afun; Node nod, afun, regax;
if(n == N) if(n == N)
return; return;
...@@ -652,7 +679,7 @@ cgen_call(Node *n) ...@@ -652,7 +679,7 @@ cgen_call(Node *n)
if(n->left->ullman >= UINF) { if(n->left->ullman >= UINF) {
regalloc(&nod, types[tptr], N); regalloc(&nod, types[tptr], N);
cgen_as(&nod, &afun, 0); cgen_as(&nod, &afun, 0);
gins(ACALL, N, &nod); ginscall(&nod, proc);
regfree(&nod); regfree(&nod);
goto ret; goto ret;
} }
...@@ -661,19 +688,41 @@ cgen_call(Node *n) ...@@ -661,19 +688,41 @@ cgen_call(Node *n)
if(isptr[n->left->type->etype]) { if(isptr[n->left->type->etype]) {
regalloc(&nod, types[tptr], N); regalloc(&nod, types[tptr], N);
cgen_as(&nod, n->left, 0); cgen_as(&nod, n->left, 0);
gins(ACALL, N, &nod); ginscall(&nod, proc);
regfree(&nod); regfree(&nod);
goto ret; goto ret;
} }
// call direct // call direct
n->left->method = 1; n->left->method = 1;
gins(ACALL, N, n->left); ginscall(n->left, proc);
ret: ret:
; ;
} }
void
cgen_proc(Node *n)
{
switch(n->left->op) {
default:
fatal("cgen_proc: unknown call %O", n->left->op);
case OCALLMETH:
cgen_callmeth(n->left, 1);
break;
case OCALLINTER:
cgen_callinter(n->left, N, 1);
break;
case OCALL:
cgen_call(n->left, 1);
break;
}
}
void void
cgen_callret(Node *n, Node *res) cgen_callret(Node *n, Node *res)
{ {
......
...@@ -113,9 +113,10 @@ void agen_inter(Node*, Node*); ...@@ -113,9 +113,10 @@ void agen_inter(Node*, Node*);
void cgen_as(Node*, Node*, int); void cgen_as(Node*, Node*, int);
void cgen_asop(Node*); void cgen_asop(Node*);
void cgen_ret(Node*); void cgen_ret(Node*);
void cgen_call(Node*); void cgen_call(Node*, int);
void cgen_callmeth(Node*); void cgen_callmeth(Node*, int);
void cgen_callinter(Node*, Node*); void cgen_callinter(Node*, Node*, int);
void cgen_proc(Node*);
void cgen_callret(Node*, Node*); void cgen_callret(Node*, Node*);
void cgen_div(int, Node*, Node*, Node*); void cgen_div(int, Node*, Node*, Node*);
void cgen_shift(int, Node*, Node*, Node*); void cgen_shift(int, Node*, Node*, Node*);
......
...@@ -1673,7 +1673,6 @@ tempname(Node *n, Type *t) ...@@ -1673,7 +1673,6 @@ tempname(Node *n, Type *t)
n->op = ONAME; n->op = ONAME;
n->sym = s; n->sym = s;
n->type = t; n->type = t;
n->sym = s;
n->etype = t->etype; n->etype = t->etype;
n->class = PAUTO; n->class = PAUTO;
n->addable = 1; n->addable = 1;
......
...@@ -581,7 +581,6 @@ Node* nodpanic(long); ...@@ -581,7 +581,6 @@ Node* nodpanic(long);
Node* newcompat(Node*); Node* newcompat(Node*);
Node* stringop(Node*, int); Node* stringop(Node*, int);
Node* mapop(Node*, int); Node* mapop(Node*, int);
Node* procop(Node*);
Node* convas(Node*); Node* convas(Node*);
void arrayconv(Type*, Node*); void arrayconv(Type*, Node*);
Node* colas(Node*, Node*); Node* colas(Node*, Node*);
......
...@@ -44,8 +44,6 @@ func mapaccess2(hmap *map[any]any, key any) (val any, pres bool); ...@@ -44,8 +44,6 @@ func mapaccess2(hmap *map[any]any, key any) (val any, pres bool);
func mapassign1(hmap *map[any]any, key any, val any); func mapassign1(hmap *map[any]any, key any, val any);
func mapassign2(hmap *map[any]any, key any, val any, pres bool); func mapassign2(hmap *map[any]any, key any, val any, pres bool);
func newproc() bool; // create a new coroutine; true is child
func readfile(string) (string, bool); // read file into string; boolean status func readfile(string) (string, bool); // read file into string; boolean status
func exit(int32); func exit(int32);
...@@ -93,9 +91,6 @@ export ...@@ -93,9 +91,6 @@ export
mapassign1 mapassign1
mapassign2 mapassign2
// threads/coroutines
newproc
// files // files
readfile readfile
......
...@@ -3,10 +3,10 @@ char* sysimport = ...@@ -3,10 +3,10 @@ char* sysimport =
"type sys._e002 {}\n" "type sys._e002 {}\n"
"type sys.any 24\n" "type sys.any 24\n"
"type sys._e003 *sys.any\n" "type sys._e003 *sys.any\n"
"type sys._o254 {_e252 sys._e003}\n" "type sys._o257 {_e255 sys._e003}\n"
"type sys.uint32 6\n" "type sys.uint32 6\n"
"type sys._i256 {_e253 sys.uint32}\n" "type sys._i259 {_e256 sys.uint32}\n"
"type sys._e001 (sys._e002 sys._o254 sys._i256)\n" "type sys._e001 (sys._e002 sys._o257 sys._i259)\n"
"var !sys.mal sys._e001\n" "var !sys.mal sys._e001\n"
"type sys._e005 {}\n" "type sys._e005 {}\n"
"type sys._e006 {}\n" "type sys._e006 {}\n"
...@@ -16,186 +16,181 @@ char* sysimport = ...@@ -16,186 +16,181 @@ char* sysimport =
"type sys._e009 {}\n" "type sys._e009 {}\n"
"type sys._e010 {}\n" "type sys._e010 {}\n"
"type sys.int32 5\n" "type sys.int32 5\n"
"type sys._i262 {_e261 sys.int32}\n" "type sys._i265 {_e264 sys.int32}\n"
"type sys._e008 (sys._e009 sys._e010 sys._i262)\n" "type sys._e008 (sys._e009 sys._e010 sys._i265)\n"
"var !sys.panicl sys._e008\n" "var !sys.panicl sys._e008\n"
"type sys._e012 {}\n" "type sys._e012 {}\n"
"type sys._e013 {}\n" "type sys._e013 {}\n"
"type sys.bool 12\n" "type sys.bool 12\n"
"type sys._i267 {_e266 sys.bool}\n" "type sys._i270 {_e269 sys.bool}\n"
"type sys._e011 (sys._e012 sys._e013 sys._i267)\n" "type sys._e011 (sys._e012 sys._e013 sys._i270)\n"
"var !sys.printbool sys._e011\n" "var !sys.printbool sys._e011\n"
"type sys._e015 {}\n" "type sys._e015 {}\n"
"type sys._e016 {}\n" "type sys._e016 {}\n"
"type sys.float64 10\n" "type sys.float64 10\n"
"type sys._i272 {_e271 sys.float64}\n" "type sys._i275 {_e274 sys.float64}\n"
"type sys._e014 (sys._e015 sys._e016 sys._i272)\n" "type sys._e014 (sys._e015 sys._e016 sys._i275)\n"
"var !sys.printfloat sys._e014\n" "var !sys.printfloat sys._e014\n"
"type sys._e018 {}\n" "type sys._e018 {}\n"
"type sys._e019 {}\n" "type sys._e019 {}\n"
"type sys.int64 7\n" "type sys.int64 7\n"
"type sys._i277 {_e276 sys.int64}\n" "type sys._i280 {_e279 sys.int64}\n"
"type sys._e017 (sys._e018 sys._e019 sys._i277)\n" "type sys._e017 (sys._e018 sys._e019 sys._i280)\n"
"var !sys.printint sys._e017\n" "var !sys.printint sys._e017\n"
"type sys._e021 {}\n" "type sys._e021 {}\n"
"type sys._e022 {}\n" "type sys._e022 {}\n"
"type sys._e023 25\n" "type sys._e023 25\n"
"type sys.string *sys._e023\n" "type sys.string *sys._e023\n"
"type sys._i282 {_e281 sys.string}\n" "type sys._i285 {_e284 sys.string}\n"
"type sys._e020 (sys._e021 sys._e022 sys._i282)\n" "type sys._e020 (sys._e021 sys._e022 sys._i285)\n"
"var !sys.printstring sys._e020\n" "var !sys.printstring sys._e020\n"
"type sys._e025 {}\n" "type sys._e025 {}\n"
"type sys._e026 {}\n" "type sys._e026 {}\n"
"type sys.uint8 2\n" "type sys.uint8 2\n"
"type sys._e027 *sys.uint8\n" "type sys._e027 *sys.uint8\n"
"type sys._i287 {_e286 sys._e027}\n" "type sys._i290 {_e289 sys._e027}\n"
"type sys._e024 (sys._e025 sys._e026 sys._i287)\n" "type sys._e024 (sys._e025 sys._e026 sys._i290)\n"
"var !sys.printpointer sys._e024\n" "var !sys.printpointer sys._e024\n"
"type sys._e029 {}\n" "type sys._e029 {}\n"
"type sys._o294 {_e291 sys.string}\n" "type sys._o297 {_e294 sys.string}\n"
"type sys._i296 {_e292 sys.string _e293 sys.string}\n" "type sys._i299 {_e295 sys.string _e296 sys.string}\n"
"type sys._e028 (sys._e029 sys._o294 sys._i296)\n" "type sys._e028 (sys._e029 sys._o297 sys._i299)\n"
"var !sys.catstring sys._e028\n" "var !sys.catstring sys._e028\n"
"type sys._e031 {}\n" "type sys._e031 {}\n"
"type sys._o304 {_e301 sys.int32}\n" "type sys._o307 {_e304 sys.int32}\n"
"type sys._i306 {_e302 sys.string _e303 sys.string}\n" "type sys._i309 {_e305 sys.string _e306 sys.string}\n"
"type sys._e030 (sys._e031 sys._o304 sys._i306)\n" "type sys._e030 (sys._e031 sys._o307 sys._i309)\n"
"var !sys.cmpstring sys._e030\n" "var !sys.cmpstring sys._e030\n"
"type sys._e033 {}\n" "type sys._e033 {}\n"
"type sys._o315 {_e311 sys.string}\n" "type sys._o318 {_e314 sys.string}\n"
"type sys._i317 {_e312 sys.string _e313 sys.int32 _e314 sys.int32}\n" "type sys._i320 {_e315 sys.string _e316 sys.int32 _e317 sys.int32}\n"
"type sys._e032 (sys._e033 sys._o315 sys._i317)\n" "type sys._e032 (sys._e033 sys._o318 sys._i320)\n"
"var !sys.slicestring sys._e032\n" "var !sys.slicestring sys._e032\n"
"type sys._e035 {}\n" "type sys._e035 {}\n"
"type sys._o326 {_e323 sys.uint8}\n" "type sys._o329 {_e326 sys.uint8}\n"
"type sys._i328 {_e324 sys.string _e325 sys.int32}\n" "type sys._i331 {_e327 sys.string _e328 sys.int32}\n"
"type sys._e034 (sys._e035 sys._o326 sys._i328)\n" "type sys._e034 (sys._e035 sys._o329 sys._i331)\n"
"var !sys.indexstring sys._e034\n" "var !sys.indexstring sys._e034\n"
"type sys._e037 {}\n" "type sys._e037 {}\n"
"type sys._o335 {_e333 sys.string}\n" "type sys._o338 {_e336 sys.string}\n"
"type sys._i337 {_e334 sys.int64}\n" "type sys._i340 {_e337 sys.int64}\n"
"type sys._e036 (sys._e037 sys._o335 sys._i337)\n" "type sys._e036 (sys._e037 sys._o338 sys._i340)\n"
"var !sys.intstring sys._e036\n" "var !sys.intstring sys._e036\n"
"type sys._e039 {}\n" "type sys._e039 {}\n"
"type sys._o344 {_e341 sys.string}\n" "type sys._o347 {_e344 sys.string}\n"
"type sys._e040 *sys.uint8\n" "type sys._e040 *sys.uint8\n"
"type sys._i346 {_e342 sys._e040 _e343 sys.int32}\n" "type sys._i349 {_e345 sys._e040 _e346 sys.int32}\n"
"type sys._e038 (sys._e039 sys._o344 sys._i346)\n" "type sys._e038 (sys._e039 sys._o347 sys._i349)\n"
"var !sys.byteastring sys._e038\n" "var !sys.byteastring sys._e038\n"
"type sys._e042 {}\n" "type sys._e042 {}\n"
"type sys._e043 <>\n" "type sys._e043 <>\n"
"type sys._o355 {_e351 sys._e043}\n" "type sys._o358 {_e354 sys._e043}\n"
"type sys._e044 *sys.uint8\n" "type sys._e044 *sys.uint8\n"
"type sys._e045 *sys.uint8\n" "type sys._e045 *sys.uint8\n"
"type sys._s362 {}\n" "type sys._s365 {}\n"
"type sys._e046 *sys._s362\n" "type sys._e046 *sys._s365\n"
"type sys._i357 {_e352 sys._e044 _e353 sys._e045 _e354 sys._e046}\n" "type sys._i360 {_e355 sys._e044 _e356 sys._e045 _e357 sys._e046}\n"
"type sys._e041 (sys._e042 sys._o355 sys._i357)\n" "type sys._e041 (sys._e042 sys._o358 sys._i360)\n"
"var !sys.mkiface sys._e041\n" "var !sys.mkiface sys._e041\n"
"type sys._e048 {}\n" "type sys._e048 {}\n"
"type sys._o366 {_e365 sys.int32}\n" "type sys._o369 {_e368 sys.int32}\n"
"type sys._e049 {}\n" "type sys._e049 {}\n"
"type sys._e047 (sys._e048 sys._o366 sys._e049)\n" "type sys._e047 (sys._e048 sys._o369 sys._e049)\n"
"var !sys.argc sys._e047\n" "var !sys.argc sys._e047\n"
"type sys._e051 {}\n" "type sys._e051 {}\n"
"type sys._o370 {_e369 sys.int32}\n" "type sys._o373 {_e372 sys.int32}\n"
"type sys._e052 {}\n" "type sys._e052 {}\n"
"type sys._e050 (sys._e051 sys._o370 sys._e052)\n" "type sys._e050 (sys._e051 sys._o373 sys._e052)\n"
"var !sys.envc sys._e050\n" "var !sys.envc sys._e050\n"
"type sys._e054 {}\n" "type sys._e054 {}\n"
"type sys._o375 {_e373 sys.string}\n" "type sys._o378 {_e376 sys.string}\n"
"type sys._i377 {_e374 sys.int32}\n" "type sys._i380 {_e377 sys.int32}\n"
"type sys._e053 (sys._e054 sys._o375 sys._i377)\n" "type sys._e053 (sys._e054 sys._o378 sys._i380)\n"
"var !sys.argv sys._e053\n" "var !sys.argv sys._e053\n"
"type sys._e056 {}\n" "type sys._e056 {}\n"
"type sys._o383 {_e381 sys.string}\n" "type sys._o386 {_e384 sys.string}\n"
"type sys._i385 {_e382 sys.int32}\n" "type sys._i388 {_e385 sys.int32}\n"
"type sys._e055 (sys._e056 sys._o383 sys._i385)\n" "type sys._e055 (sys._e056 sys._o386 sys._i388)\n"
"var !sys.envv sys._e055\n" "var !sys.envv sys._e055\n"
"type sys._e058 {}\n" "type sys._e058 {}\n"
"type sys._o392 {_e389 sys.int32 _e390 sys.float64}\n" "type sys._o395 {_e392 sys.int32 _e393 sys.float64}\n"
"type sys._i394 {_e391 sys.float64}\n" "type sys._i397 {_e394 sys.float64}\n"
"type sys._e057 (sys._e058 sys._o392 sys._i394)\n" "type sys._e057 (sys._e058 sys._o395 sys._i397)\n"
"var !sys.frexp sys._e057\n" "var !sys.frexp sys._e057\n"
"type sys._e060 {}\n" "type sys._e060 {}\n"
"type sys._o401 {_e398 sys.float64}\n" "type sys._o404 {_e401 sys.float64}\n"
"type sys._i403 {_e399 sys.int32 _e400 sys.float64}\n" "type sys._i406 {_e402 sys.int32 _e403 sys.float64}\n"
"type sys._e059 (sys._e060 sys._o401 sys._i403)\n" "type sys._e059 (sys._e060 sys._o404 sys._i406)\n"
"var !sys.ldexp sys._e059\n" "var !sys.ldexp sys._e059\n"
"type sys._e062 {}\n" "type sys._e062 {}\n"
"type sys._o411 {_e408 sys.float64 _e409 sys.float64}\n" "type sys._o414 {_e411 sys.float64 _e412 sys.float64}\n"
"type sys._i413 {_e410 sys.float64}\n" "type sys._i416 {_e413 sys.float64}\n"
"type sys._e061 (sys._e062 sys._o411 sys._i413)\n" "type sys._e061 (sys._e062 sys._o414 sys._i416)\n"
"var !sys.modf sys._e061\n" "var !sys.modf sys._e061\n"
"type sys._e064 {}\n" "type sys._e064 {}\n"
"type sys._o420 {_e417 sys.bool}\n" "type sys._o423 {_e420 sys.bool}\n"
"type sys._i422 {_e418 sys.float64 _e419 sys.int32}\n" "type sys._i425 {_e421 sys.float64 _e422 sys.int32}\n"
"type sys._e063 (sys._e064 sys._o420 sys._i422)\n" "type sys._e063 (sys._e064 sys._o423 sys._i425)\n"
"var !sys.isInf sys._e063\n" "var !sys.isInf sys._e063\n"
"type sys._e066 {}\n" "type sys._e066 {}\n"
"type sys._o429 {_e427 sys.bool}\n" "type sys._o432 {_e430 sys.bool}\n"
"type sys._i431 {_e428 sys.float64}\n" "type sys._i434 {_e431 sys.float64}\n"
"type sys._e065 (sys._e066 sys._o429 sys._i431)\n" "type sys._e065 (sys._e066 sys._o432 sys._i434)\n"
"var !sys.isNaN sys._e065\n" "var !sys.isNaN sys._e065\n"
"type sys._e068 {}\n" "type sys._e068 {}\n"
"type sys._o437 {_e435 sys.float64}\n" "type sys._o440 {_e438 sys.float64}\n"
"type sys._i439 {_e436 sys.int32}\n" "type sys._i442 {_e439 sys.int32}\n"
"type sys._e067 (sys._e068 sys._o437 sys._i439)\n" "type sys._e067 (sys._e068 sys._o440 sys._i442)\n"
"var !sys.Inf sys._e067\n" "var !sys.Inf sys._e067\n"
"type sys._e070 {}\n" "type sys._e070 {}\n"
"type sys._o444 {_e443 sys.float64}\n" "type sys._o447 {_e446 sys.float64}\n"
"type sys._e071 {}\n" "type sys._e071 {}\n"
"type sys._e069 (sys._e070 sys._o444 sys._e071)\n" "type sys._e069 (sys._e070 sys._o447 sys._e071)\n"
"var !sys.NaN sys._e069\n" "var !sys.NaN sys._e069\n"
"type sys._e073 {}\n" "type sys._e073 {}\n"
"type sys._e075 [sys.any] sys.any\n" "type sys._e075 [sys.any] sys.any\n"
"type sys._e074 *sys._e075\n" "type sys._e074 *sys._e075\n"
"type sys._o447 {hmap sys._e074}\n" "type sys._o450 {hmap sys._e074}\n"
"type sys._i449 {keysize sys.uint32 valsize sys.uint32 keyalg sys.uint32 valalg sys.uint32 hint sys.uint32}\n" "type sys._i452 {keysize sys.uint32 valsize sys.uint32 keyalg sys.uint32 valalg sys.uint32 hint sys.uint32}\n"
"type sys._e072 (sys._e073 sys._o447 sys._i449)\n" "type sys._e072 (sys._e073 sys._o450 sys._i452)\n"
"var !sys.newmap sys._e072\n" "var !sys.newmap sys._e072\n"
"type sys._e077 {}\n" "type sys._e077 {}\n"
"type sys._o458 {val sys.any}\n" "type sys._o461 {val sys.any}\n"
"type sys._e079 [sys.any] sys.any\n" "type sys._e079 [sys.any] sys.any\n"
"type sys._e078 *sys._e079\n" "type sys._e078 *sys._e079\n"
"type sys._i460 {hmap sys._e078 key sys.any}\n" "type sys._i463 {hmap sys._e078 key sys.any}\n"
"type sys._e076 (sys._e077 sys._o458 sys._i460)\n" "type sys._e076 (sys._e077 sys._o461 sys._i463)\n"
"var !sys.mapaccess1 sys._e076\n" "var !sys.mapaccess1 sys._e076\n"
"type sys._e081 {}\n" "type sys._e081 {}\n"
"type sys._o466 {val sys.any pres sys.bool}\n" "type sys._o469 {val sys.any pres sys.bool}\n"
"type sys._e083 [sys.any] sys.any\n" "type sys._e083 [sys.any] sys.any\n"
"type sys._e082 *sys._e083\n" "type sys._e082 *sys._e083\n"
"type sys._i468 {hmap sys._e082 key sys.any}\n" "type sys._i471 {hmap sys._e082 key sys.any}\n"
"type sys._e080 (sys._e081 sys._o466 sys._i468)\n" "type sys._e080 (sys._e081 sys._o469 sys._i471)\n"
"var !sys.mapaccess2 sys._e080\n" "var !sys.mapaccess2 sys._e080\n"
"type sys._e085 {}\n" "type sys._e085 {}\n"
"type sys._e086 {}\n" "type sys._e086 {}\n"
"type sys._e088 [sys.any] sys.any\n" "type sys._e088 [sys.any] sys.any\n"
"type sys._e087 *sys._e088\n" "type sys._e087 *sys._e088\n"
"type sys._i475 {hmap sys._e087 key sys.any val sys.any}\n" "type sys._i478 {hmap sys._e087 key sys.any val sys.any}\n"
"type sys._e084 (sys._e085 sys._e086 sys._i475)\n" "type sys._e084 (sys._e085 sys._e086 sys._i478)\n"
"var !sys.mapassign1 sys._e084\n" "var !sys.mapassign1 sys._e084\n"
"type sys._e090 {}\n" "type sys._e090 {}\n"
"type sys._e091 {}\n" "type sys._e091 {}\n"
"type sys._e093 [sys.any] sys.any\n" "type sys._e093 [sys.any] sys.any\n"
"type sys._e092 *sys._e093\n" "type sys._e092 *sys._e093\n"
"type sys._i481 {hmap sys._e092 key sys.any val sys.any pres sys.bool}\n" "type sys._i484 {hmap sys._e092 key sys.any val sys.any pres sys.bool}\n"
"type sys._e089 (sys._e090 sys._e091 sys._i481)\n" "type sys._e089 (sys._e090 sys._e091 sys._i484)\n"
"var !sys.mapassign2 sys._e089\n" "var !sys.mapassign2 sys._e089\n"
"type sys._e095 {}\n" "type sys._e095 {}\n"
"type sys._o489 {_e488 sys.bool}\n" "type sys._o494 {_e491 sys.string _e492 sys.bool}\n"
"type sys._e096 {}\n" "type sys._i496 {_e493 sys.string}\n"
"type sys._e094 (sys._e095 sys._o489 sys._e096)\n" "type sys._e094 (sys._e095 sys._o494 sys._i496)\n"
"var !sys.newproc sys._e094\n" "var !sys.readfile sys._e094\n"
"type sys._e097 {}\n"
"type sys._e098 {}\n" "type sys._e098 {}\n"
"type sys._o495 {_e492 sys.string _e493 sys.bool}\n" "type sys._i501 {_e500 sys.int32}\n"
"type sys._i497 {_e494 sys.string}\n" "type sys._e096 (sys._e097 sys._e098 sys._i501)\n"
"type sys._e097 (sys._e098 sys._o495 sys._i497)\n" "var !sys.exit sys._e096\n"
"var !sys.readfile sys._e097\n"
"type sys._e100 {}\n"
"type sys._e101 {}\n"
"type sys._i502 {_e501 sys.int32}\n"
"type sys._e099 (sys._e100 sys._e101 sys._i502)\n"
"var !sys.exit sys._e099\n"
"))\n" "))\n"
; ;
...@@ -159,7 +159,7 @@ loop: ...@@ -159,7 +159,7 @@ loop:
case OPROC: case OPROC:
if(top != Etop) if(top != Etop)
goto nottop; goto nottop;
*n = *procop(n); walktype(n->left, Etop);
goto ret; goto ret;
case OCALLMETH: case OCALLMETH:
...@@ -1594,27 +1594,6 @@ nottop: ...@@ -1594,27 +1594,6 @@ nottop:
return N; return N;
} }
Node*
procop(Node *n)
{
Node *r, *on;
switch(n->op) {
default:
fatal("mapop: unknown op %E", n->op);
case OPROC: // rewrite if(sys.newproc()) (n->left)
on = syslook("newproc", 0);
r = nod(OIF, N, N);
r->ntest = nod(OCALL, on, N);
r->nbody = n->left;
dump("newproc", r);
walktype(r, Etop);
break;
}
return r;
}
void void
diagnamed(Type *t) diagnamed(Type *t)
{ {
...@@ -1772,6 +1751,7 @@ colas(Node *nl, Node *nr) ...@@ -1772,6 +1751,7 @@ colas(Node *nl, Node *nr)
l = listnext(&savel); l = listnext(&savel);
r = listnext(&saver); r = listnext(&saver);
} }
n = rev(n);
return n; return n;
multi: multi:
...@@ -1827,6 +1807,7 @@ multi: ...@@ -1827,6 +1807,7 @@ multi:
n = nod(OLIST, n, a); n = nod(OLIST, n, a);
break; break;
} }
n = rev(n);
return n; return n;
badt: badt:
......
...@@ -179,6 +179,12 @@ easy: ...@@ -179,6 +179,12 @@ easy:
TEXT _endmorestack(SB), 7, $-8 TEXT _endmorestack(SB), 7, $-8
RET RET
// call a subroutine in a new coroutine
// argument list is on the stack addr of fn is in AX
TEXT sys·_newproc(SB), 7, $0
JMP AX
RET
TEXT FLUSH(SB),7,$-8 TEXT FLUSH(SB),7,$-8
RET RET
...@@ -186,5 +192,4 @@ TEXT getu(SB),7,$-8 ...@@ -186,5 +192,4 @@ TEXT getu(SB),7,$-8
MOVQ R15, AX MOVQ R15, AX
RET RET
GLOBL peruser<>(SB),$64 GLOBL peruser<>(SB),$64
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment