mirror of
https://github.com/golang/go
synced 2024-09-15 22:20:06 +00:00
static initialization
structure set up - no change yet R=r OCL=28966 CL=28966
This commit is contained in:
parent
8ee7688af6
commit
52b0f77bf9
|
@ -23,11 +23,15 @@ cgen(Node *n, Node *res)
|
||||||
dump("cgen-res", res);
|
dump("cgen-res", res);
|
||||||
}
|
}
|
||||||
if(n == N || n->type == T)
|
if(n == N || n->type == T)
|
||||||
return;
|
goto ret;
|
||||||
|
|
||||||
if(res == N || res->type == T)
|
if(res == N || res->type == T)
|
||||||
fatal("cgen: res nil");
|
fatal("cgen: res nil");
|
||||||
|
|
||||||
|
// static initializations
|
||||||
|
if(gen_as_init(n, res))
|
||||||
|
goto ret;
|
||||||
|
|
||||||
if(n->ullman >= UINF) {
|
if(n->ullman >= UINF) {
|
||||||
if(n->op == OINDREG)
|
if(n->op == OINDREG)
|
||||||
fatal("cgen: this is going to misscompile");
|
fatal("cgen: this is going to misscompile");
|
||||||
|
|
|
@ -697,3 +697,9 @@ clearfat(Node *nl)
|
||||||
c--;
|
c--;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int
|
||||||
|
gen_as_init(Node *nr, Node *nl)
|
||||||
|
{
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
|
@ -77,6 +77,7 @@ void genconv(Type*, Type*);
|
||||||
void allocparams(void);
|
void allocparams(void);
|
||||||
void checklabels();
|
void checklabels();
|
||||||
void ginscall(Node*, int);
|
void ginscall(Node*, int);
|
||||||
|
int gen_as_init(Node*, Node*);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* cgen
|
* cgen
|
||||||
|
|
|
@ -185,7 +185,8 @@ dumpfuncs(void)
|
||||||
for(pl=plist; pl!=nil; pl=pl->link) {
|
for(pl=plist; pl!=nil; pl=pl->link) {
|
||||||
for(p=pl->firstpc; p!=P; p=p->link) {
|
for(p=pl->firstpc; p!=P; p=p->link) {
|
||||||
p->loc = pcloc;
|
p->loc = pcloc;
|
||||||
pcloc++;
|
if(p->as != ADATA && p->as != AGLOBL)
|
||||||
|
pcloc++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1411,7 +1411,9 @@ fninit(Node *n)
|
||||||
//dump("r", fn->nbody);
|
//dump("r", fn->nbody);
|
||||||
|
|
||||||
popdcl();
|
popdcl();
|
||||||
|
initflag = 1; // flag for loader static initialization
|
||||||
compile(fn);
|
compile(fn);
|
||||||
|
initflag = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -228,7 +228,6 @@ struct Node
|
||||||
int32 vargen; // unique name for OTYPE/ONAME
|
int32 vargen; // unique name for OTYPE/ONAME
|
||||||
int32 lineno;
|
int32 lineno;
|
||||||
vlong xoffset;
|
vlong xoffset;
|
||||||
int32 ostk;
|
|
||||||
};
|
};
|
||||||
#define N ((Node*)0)
|
#define N ((Node*)0)
|
||||||
|
|
||||||
|
@ -569,6 +568,7 @@ EXTERN Dcl* typelist;
|
||||||
EXTERN int dclcontext; // PEXTERN/PAUTO
|
EXTERN int dclcontext; // PEXTERN/PAUTO
|
||||||
EXTERN int importflag;
|
EXTERN int importflag;
|
||||||
EXTERN int inimportsys;
|
EXTERN int inimportsys;
|
||||||
|
EXTERN int initflag; // compiling the init fn
|
||||||
|
|
||||||
EXTERN uint32 iota;
|
EXTERN uint32 iota;
|
||||||
EXTERN Node* lastconst;
|
EXTERN Node* lastconst;
|
||||||
|
|
Loading…
Reference in a new issue