1
0
mirror of https://github.com/golang/go synced 2024-11-25 06:07:58 -07:00

gc: select functions are no longer special

R=ken2
CC=golang-dev
https://golang.org/cl/4794049
This commit is contained in:
Russ Cox 2011-07-21 14:10:39 -04:00
parent 6b2ec06587
commit 22853098a9
4 changed files with 12 additions and 35 deletions

View File

@ -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);

View File

@ -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)
{

View File

@ -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:

View File

@ -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);
}