1
0
mirror of https://github.com/golang/go synced 2024-11-20 06:14:53 -07:00

cmd/gc: prevent ngotype from allocating.

R=golang-dev, dave, rsc
CC=golang-dev
https://golang.org/cl/6904061
This commit is contained in:
Rémy Oudompheng 2012-12-09 19:27:23 +01:00
parent 45fe306ac8
commit 10d14b63c2
3 changed files with 13 additions and 3 deletions

View File

@ -1211,6 +1211,7 @@ void dumptypestructs(void);
Type* methodfunc(Type *f, Type*); Type* methodfunc(Type *f, Type*);
Node* typename(Type *t); Node* typename(Type *t);
Sym* typesym(Type *t); Sym* typesym(Type *t);
Sym* typenamesym(Type *t);
Sym* tracksym(Type *t); Sym* tracksym(Type *t);
Sym* typesymprefix(char *prefix, Type *t); Sym* typesymprefix(char *prefix, Type *t);
int haspointers(Type *t); int haspointers(Type *t);

View File

@ -652,8 +652,8 @@ typesymprefix(char *prefix, Type *t)
return s; return s;
} }
Node* Sym*
typename(Type *t) typenamesym(Type *t)
{ {
Sym *s; Sym *s;
Node *n; Node *n;
@ -674,7 +674,16 @@ typename(Type *t)
signatlist = list(signatlist, typenod(t)); signatlist = list(signatlist, typenod(t));
} }
return s->def->sym;
}
Node*
typename(Type *t)
{
Sym *s;
Node *n;
s = typenamesym(t);
n = nod(OADDR, s->def, N); n = nod(OADDR, s->def, N);
n->type = ptrto(s->def->type); n->type = ptrto(s->def->type);
n->addable = 1; n->addable = 1;

View File

@ -3517,7 +3517,7 @@ ngotype(Node *n)
{ {
if(n->sym != S && n->realtype != T) if(n->sym != S && n->realtype != T)
if(strncmp(n->sym->name, "autotmp_", 8) != 0) if(strncmp(n->sym->name, "autotmp_", 8) != 0)
return typename(n->realtype)->left->sym; return typenamesym(n->realtype);
return S; return S;
} }