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 /* | 5 /* |
6 * select | 6 * select |
7 */ | 7 */ |
8 | 8 |
9 #include <u.h> | 9 #include <u.h> |
10 #include <libc.h> | 10 #include <libc.h> |
(...skipping 242 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
253 sel->nbody = list1(r); | 253 sel->nbody = list1(r); |
254 goto out; | 254 goto out; |
255 }··············· | 255 }··············· |
256 | 256 |
257 init = sel->ninit; | 257 init = sel->ninit; |
258 sel->ninit = nil; | 258 sel->ninit = nil; |
259 | 259 |
260 // generate sel-struct | 260 // generate sel-struct |
261 setlineno(sel); | 261 setlineno(sel); |
262 selv = temp(selecttype(sel->xoffset)); | 262 selv = temp(selecttype(sel->xoffset)); |
263 selv->esc = EscNone; | |
264 r = nod(OAS, selv, N); | 263 r = nod(OAS, selv, N); |
265 typecheck(&r, Etop); | 264 typecheck(&r, Etop); |
266 init = list(init, r); | 265 init = list(init, r); |
267 var = conv(conv(nod(OADDR, selv, N), types[TUNSAFEPTR]), ptrto(types[TUI
NT8])); | 266 var = conv(conv(nod(OADDR, selv, N), types[TUNSAFEPTR]), ptrto(types[TUI
NT8])); |
268 r = mkcall("newselect", T, nil, var, nodintconst(selv->type->width), nod
intconst(sel->xoffset)); | 267 r = mkcall("newselect", T, nil, var, nodintconst(selv->type->width), nod
intconst(sel->xoffset)); |
269 typecheck(&r, Etop); | 268 typecheck(&r, Etop); |
270 init = list(init, r); | 269 init = list(init, r); |
271 | 270 |
272 // register cases | 271 // register cases |
273 for(l=sel->list; l; l=l->next) { | 272 for(l=sel->list; l; l=l->next) { |
(...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
365 arr = nod(OTARRAY, nodintconst(size), typenod(ptrto(types[TUINT8]))); | 364 arr = nod(OTARRAY, nodintconst(size), typenod(ptrto(types[TUINT8]))); |
366 sel->list = list(sel->list, nod(ODCLFIELD, newname(lookup("lockorderarr"
)), arr)); | 365 sel->list = list(sel->list, nod(ODCLFIELD, newname(lookup("lockorderarr"
)), arr)); |
367 arr = nod(OTARRAY, nodintconst(size), typenod(types[TUINT16])); | 366 arr = nod(OTARRAY, nodintconst(size), typenod(types[TUINT16])); |
368 sel->list = list(sel->list, nod(ODCLFIELD, newname(lookup("pollorderarr"
)), arr)); | 367 sel->list = list(sel->list, nod(ODCLFIELD, newname(lookup("pollorderarr"
)), arr)); |
369 typecheck(&sel, Etype); | 368 typecheck(&sel, Etype); |
370 sel->type->noalg = 1; | 369 sel->type->noalg = 1; |
371 sel->type->local = 1; | 370 sel->type->local = 1; |
372 | 371 |
373 return sel->type; | 372 return sel->type; |
374 } | 373 } |
OLD | NEW |