1
0
mirror of https://github.com/golang/go synced 2024-11-26 14:56:47 -07:00

go call fn address

SVN=127151
This commit is contained in:
Ken Thompson 2008-07-14 20:40:48 -07:00
parent 42ae6851c0
commit c6e8e1cebf
2 changed files with 12 additions and 6 deletions

View File

@ -606,8 +606,11 @@ ginscall(Node *f, int proc)
if(proc) { if(proc) {
nodreg(&reg, types[TINT64], D_AX); nodreg(&reg, types[TINT64], D_AX);
if(f->op != OREGISTER) {
gins(ALEAQ, f, &reg); gins(ALEAQ, f, &reg);
gins(APUSHQ, &reg, N); gins(APUSHQ, &reg, N);
} else
gins(APUSHQ, f, N);
nodconst(&con, types[TINT32], argsize(f->type)); nodconst(&con, types[TINT32], argsize(f->type));
gins(APUSHQ, &con, N); gins(APUSHQ, &con, N);
gins(ACALL, N, newproc); gins(ACALL, N, newproc);
@ -658,6 +661,7 @@ cgen_callinter(Node *n, Node *res, int proc)
nodo.xoffset = n->left->xoffset + 4*widthptr; nodo.xoffset = n->left->xoffset + 4*widthptr;
cgen(&nodo, &nodr); // REG = 32+offset(REG) -- i.m->fun[f] cgen(&nodo, &nodr); // REG = 32+offset(REG) -- i.m->fun[f]
// BOTCH nodr.type = fntype;
ginscall(&nodr, proc); ginscall(&nodr, proc);
regfree(&nodr); regfree(&nodr);
@ -717,6 +721,7 @@ cgen_call(Node *n, int proc)
if(n->left->ullman >= UINF) { if(n->left->ullman >= UINF) {
regalloc(&nod, types[tptr], N); regalloc(&nod, types[tptr], N);
cgen_as(&nod, &afun, 0); cgen_as(&nod, &afun, 0);
nod.type = t;
ginscall(&nod, proc); ginscall(&nod, proc);
regfree(&nod); regfree(&nod);
goto ret; goto ret;
@ -726,6 +731,7 @@ cgen_call(Node *n, int proc)
if(isptr[n->left->type->etype]) { if(isptr[n->left->type->etype]) {
regalloc(&nod, types[tptr], N); regalloc(&nod, types[tptr], N);
cgen_as(&nod, n->left, 0); cgen_as(&nod, n->left, 0);
nod.type = t;
ginscall(&nod, proc); ginscall(&nod, proc);
regfree(&nod); regfree(&nod);
goto ret; goto ret;

View File

@ -118,7 +118,7 @@ dumpexportvar(Sym *s)
n = s->oname; n = s->oname;
if(n == N || n->type == T) { if(n == N || n->type == T) {
yyerror("variable exported but not defined: %S\n", s); yyerror("variable exported but not defined: %S", s);
return; return;
} }
@ -144,7 +144,7 @@ dumpexporttype(Sym *s)
t = s->otype; t = s->otype;
if(t == T) { if(t == T) {
yyerror("type exported but not defined: %S\n", s); yyerror("type exported but not defined: %S", s);
return; return;
} }
@ -251,10 +251,10 @@ dumpe(Sym *s)
{ {
switch(s->lexical) { switch(s->lexical) {
default: default:
yyerror("unknown export symbol: %S\n", s, s->lexical); yyerror("unknown export symbol: %S", s, s->lexical);
break; break;
case LPACK: case LPACK:
yyerror("package export symbol: %S\n", s); yyerror("package export symbol: %S", s);
break; break;
case LATYPE: case LATYPE:
case LBASETYPE: case LBASETYPE: