Commit 12082728 authored by Ken Thompson's avatar Ken Thompson

select/chan

R=r
DELTA=517  (137 added, 98 deleted, 282 changed)
OCL=13495
CL=13495
parent 949ab5c7
......@@ -47,7 +47,7 @@ func mapassign2(hmap *map[any]any, key any, val any, pres bool);
func newchan(elemsize uint32, elemalg uint32, hint uint32) (hchan *chan any);
func chanrecv1(hchan *chan any) (elem any);
func chanrecv2(hchan *chan any) (elem any, pres bool);
func chanrecv3(hchan *chan any) (elem any, pres bool);
func chanrecv3(hchan *chan any, elem *any) (pres bool);
func chansend1(hchan *chan any, elem any);
func chansend2(hchan *chan any, elem any) (pres bool);
......
This diff is collapsed.
......@@ -1910,7 +1910,6 @@ chanop(Node *n, int top)
goto shape;
// chanrecv2(hchan *chan any) (elem any, pres bool);
t = fixchan(n->right->left->type);
if(t == T)
break;
......@@ -1950,19 +1949,27 @@ chanop(Node *n, int top)
break;
recv2:
// chanrecv2(hchan *chan any) (elem any, pres bool);
fatal("recv2 not yet");
// chanrecv3(hchan *chan any, *elem any) (pres bool);
t = fixchan(n->right->type);
if(t == T)
break;
a = n->right; // chan
r = a;
a = n->left; // elem
if(a == N) {
a = nil;
a = nod(OLITERAL, N, N);
a->val.ctype = CTNIL;
a->val.vval = 0;
} else
a = nod(OADDR, a, N);
on = syslook("chanrecv2", 1);
on = syslook("chanrecv3", 1);
argtype(on, t->type); // any-1
argtype(on, t->type); // any-2
r = nod(OCALL, on, r);
n->right = r;
r = n;
......
This diff is collapsed.
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