Commit 1ea5bc75 authored by Ken Thompson's avatar Ken Thompson

stack allocation for the init function

R=r
OCL=17063
CL=17063
parent 99c5b2ed
......@@ -987,7 +987,7 @@ fninit(Node *n)
// (2)
maxarg = 0;
stksize = 0;
stksize = initstksize;
snprint(namebuf, sizeof(namebuf), "init_%s_function", filename);
......
......@@ -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
......
......@@ -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 ')'
{
......
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