gc: change "can we const evaluate this" from blacklist to whitelist

R=ken2
https://golang.org/cl/155074
This commit is contained in:
Russ Cox 2009-11-16 17:40:47 -08:00
parent 44e51fad28
commit 1ee83f851d

View File

@ -329,14 +329,38 @@ evconst(Node *n)
Val v;
Mpint b;
// pick off just the opcodes that can be
// constant evaluated.
switch(n->op) {
case OMAKE:
case OMAKEMAP:
case OMAKESLICE:
case OMAKECHAN:
case ODCLCONST:
case OCONVIFACE:
default:
return;
case OADD:
case OADDSTR:
case OAND:
case OANDAND:
case OANDNOT:
case OARRAYBYTESTR:
case OCOM:
case OCONV:
case ODIV:
case OEQ:
case OGE:
case OGT:
case OLE:
case OLSH:
case OLT:
case OMINUS:
case OMOD:
case OMUL:
case ONE:
case ONOT:
case OOR:
case OOROR:
case OPLUS:
case ORSH:
case OSUB:
case OXOR:
break;
}
nl = n->left;