1
0
mirror of https://github.com/golang/go synced 2024-11-13 18:40:22 -07:00

stack allocation for the init function

R=r
OCL=17063
CL=17063
This commit is contained in:
Ken Thompson 2008-10-13 20:14:09 -07:00
parent 99c5b2ed4d
commit 1ea5bc7533
3 changed files with 10 additions and 4 deletions

View File

@ -987,7 +987,7 @@ fninit(Node *n)
// (2)
maxarg = 0;
stksize = 0;
stksize = initstksize;
snprint(namebuf, sizeof(namebuf), "init_%s_function", filename);

View File

@ -451,7 +451,8 @@ EXTERN Node* lastconst;
EXTERN int32 vargen;
EXTERN int32 exportgen;
EXTERN int32 maxarg;
EXTERN int32 stksize;
EXTERN int32 stksize; // stack size for current frame
EXTERN int32 initstksize; // stack size for init function
EXTERN ushort blockgen; // max block number
EXTERN ushort block; // current block number

View File

@ -178,7 +178,11 @@ hidden_import_list:
* declarations
*/
xdcl:
common_dcl
{ stksize = initstksize; } common_dcl
{
$$ = $2;
initstksize = stksize;
}
| xfndcl
{
$$ = N;
@ -187,10 +191,11 @@ xdcl:
{
$$ = N;
}
| LEXPORT { exportadj = 1; } common_dcl
| LEXPORT { exportadj = 1; stksize = initstksize; } common_dcl
{
$$ = $3;
exportadj = 0;
initstksize = stksize;
}
| LEXPORT '(' export_list_r ')'
{