Commit 33da9afc authored by Ken Thompson's avatar Ken Thompson

optimization of static initialization

R=rsc
CC=golang-dev
https://golang.org/cl/1677049
parent 56f3c701
...@@ -1016,7 +1016,7 @@ void walkselect(Node *sel); ...@@ -1016,7 +1016,7 @@ void walkselect(Node *sel);
/* /*
* sinit.c * sinit.c
*/ */
void anylit(Node *n, Node *var, NodeList **init); void anylit(int ctxt, Node *n, Node *var, NodeList **init);
int gen_as_init(Node *n); int gen_as_init(Node *n);
NodeList* initfix(NodeList *l); NodeList* initfix(NodeList *l);
int oaslit(Node *n, NodeList **init); int oaslit(Node *n, NodeList **init);
......
...@@ -617,7 +617,7 @@ typename(Type *t) ...@@ -617,7 +617,7 @@ typename(Type *t)
Sym *s; Sym *s;
Node *n; Node *n;
if((isptr[t->etype] && t->type == T) || isideal(t)) if(t == T || (isptr[t->etype] && t->type == T) || isideal(t))
fatal("typename %T", t); fatal("typename %T", t);
s = typesym(t); s = typesym(t);
if(s->def == N) { if(s->def == N) {
......
This diff is collapsed.
...@@ -813,7 +813,7 @@ walkexpr(Node **np, NodeList **init) ...@@ -813,7 +813,7 @@ walkexpr(Node **np, NodeList **init)
goto ret; goto ret;
case ODOTTYPE: case ODOTTYPE:
case ODOTTYPE2: case ODOTTYPE2:
// Build name of function: assertI2E2 etc. // Build name of function: assertI2E2 etc.
strcpy(buf, "assert"); strcpy(buf, "assert");
p = buf+strlen(buf); p = buf+strlen(buf);
...@@ -1081,7 +1081,7 @@ walkexpr(Node **np, NodeList **init) ...@@ -1081,7 +1081,7 @@ walkexpr(Node **np, NodeList **init)
case OMAPLIT: case OMAPLIT:
case OSTRUCTLIT: case OSTRUCTLIT:
nvar = makenewvar(n->type, init, &nstar); nvar = makenewvar(n->type, init, &nstar);
anylit(n->left, nstar, init); anylit(0, n->left, nstar, init);
n = nvar; n = nvar;
goto ret; goto ret;
} }
...@@ -1262,7 +1262,7 @@ walkexpr(Node **np, NodeList **init) ...@@ -1262,7 +1262,7 @@ walkexpr(Node **np, NodeList **init)
case OSTRUCTLIT: case OSTRUCTLIT:
nvar = nod(OXXX, N, N); nvar = nod(OXXX, N, N);
tempname(nvar, n->type); tempname(nvar, n->type);
anylit(n, nvar, init); anylit(0, n, nvar, init);
n = nvar; n = nvar;
goto ret; goto ret;
......
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