Commit 22853098 authored by Russ Cox's avatar Russ Cox

gc: select functions are no longer special

R=ken2
CC=golang-dev
https://golang.org/cl/4794049
parent 6b2ec065
......@@ -1106,7 +1106,6 @@ int isinter(Type *t);
int isnil(Node *n);
int isnilinter(Type *t);
int isptrto(Type *t, int et);
int isselect(Node *n);
int isslice(Type *t);
int istype(Type *t, int et);
void linehist(char *file, int32 off, int relative);
......
......@@ -1719,29 +1719,6 @@ isblank(Node *n)
return p[0] == '_' && p[1] == '\0';
}
int
isselect(Node *n)
{
Sym *s;
if(n == N)
return 0;
n = n->left;
s = pkglookup("selectsend", runtimepkg);
if(s == n->sym)
return 1;
s = pkglookup("selectrecv", runtimepkg);
if(s == n->sym)
return 1;
s = pkglookup("selectrecv2", runtimepkg);
if(s == n->sym)
return 1;
s = pkglookup("selectdefault", runtimepkg);
if(s == n->sym)
return 1;
return 0;
}
int
isinter(Type *t)
{
......
......@@ -501,17 +501,6 @@ walkexpr(Node **np, NodeList **init)
ll = ascompatte(n->op, n->isddd, getinarg(t), n->list, 0, init);
n->list = reorder1(ll);
if(isselect(n)) {
// special prob with selectsend and selectrecv:
// if chan is nil, they don't know big the channel
// element is and therefore don't know how to find
// the output bool, so we clear it before the call.
Node *b;
b = nodbool(0);
typecheck(&b, Erv);
lr = ascompatte(n->op, 0, getoutarg(t), list1(b), 0, init);
n->list = concat(n->list, lr);
}
goto ret;
case OCALLMETH:
......
......@@ -632,6 +632,9 @@ static void selectsend(Select *sel, Hchan *c, void *pc, void *elem, int32 so);
void
runtime·selectsend(Select *sel, Hchan *c, void *elem, bool selected)
{
selected = false;
FLUSH(&selected);
// nil cases do not compete
if(c == nil)
return;
......@@ -670,6 +673,9 @@ static void selectrecv(Select *sel, Hchan *c, void *pc, void *elem, bool*, int32
void
runtime·selectrecv(Select *sel, Hchan *c, void *elem, bool selected)
{
selected = false;
FLUSH(&selected);
// nil cases do not compete
if(c == nil)
return;
......@@ -682,6 +688,9 @@ runtime·selectrecv(Select *sel, Hchan *c, void *elem, bool selected)
void
runtime·selectrecv2(Select *sel, Hchan *c, void *elem, bool *received, bool selected)
{
selected = false;
FLUSH(&selected);
// nil cases do not compete
if(c == nil)
return;
......@@ -721,6 +730,9 @@ static void selectdefault(Select*, void*, int32);
void
runtime·selectdefault(Select *sel, bool selected)
{
selected = false;
FLUSH(&selected);
selectdefault(sel, runtime·getcallerpc(&sel), (byte*)&selected - (byte*)&sel);
}
......
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