Commit 1ee83f85 authored by Russ Cox's avatar Russ Cox

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

R=ken2
https://golang.org/cl/155074
parent 44e51fad
...@@ -329,14 +329,38 @@ evconst(Node *n) ...@@ -329,14 +329,38 @@ evconst(Node *n)
Val v; Val v;
Mpint b; Mpint b;
// pick off just the opcodes that can be
// constant evaluated.
switch(n->op) { switch(n->op) {
case OMAKE: default:
case OMAKEMAP:
case OMAKESLICE:
case OMAKECHAN:
case ODCLCONST:
case OCONVIFACE:
return; 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; nl = n->left;
......
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