diff options
author | Ondřej Surý <ondrej@sury.org> | 2012-03-26 16:50:58 +0200 |
---|---|---|
committer | Ondřej Surý <ondrej@sury.org> | 2012-03-26 16:50:58 +0200 |
commit | 519725bb3c075ee2462c929f5997cb068e18466a (patch) | |
tree | 5b162e8488ad147a645048c073577821b4a2bee9 /src/cmd/6l/pass.c | |
parent | 842623c5dd2819d980ca9c58048d6bc6ed82475f (diff) | |
download | golang-upstream-weekly/2012.03.22.tar.gz |
Imported Upstream version 2012.03.22upstream-weekly/2012.03.22
Diffstat (limited to 'src/cmd/6l/pass.c')
-rw-r--r-- | src/cmd/6l/pass.c | 13 |
1 files changed, 10 insertions, 3 deletions
diff --git a/src/cmd/6l/pass.c b/src/cmd/6l/pass.c index 2357a7f77..c9b477627 100644 --- a/src/cmd/6l/pass.c +++ b/src/cmd/6l/pass.c @@ -501,10 +501,17 @@ dostkoff(void) q = p; } - /* 160 comes from 3 calls (3*8) 4 safes (4*8) and 104 guard */ + // If we ask for more stack, we'll get a minimum of StackMin bytes. + // We need a stack frame large enough to hold the top-of-stack data, + // the function arguments+results, our caller's PC, our frame, + // a word for the return PC of the next call, and then the StackLimit bytes + // that must be available on entry to any function called from a function + // that did a stack check. If StackMin is enough, don't ask for a specific + // amount: then we can use the custom functions and save a few + // instructions. moreconst1 = 0; - if(autoffset+160+textarg > 4096) - moreconst1 = (autoffset+160) & ~7LL; + if(StackTop + textarg + PtrSize + autoffset + PtrSize + StackLimit >= StackMin) + moreconst1 = autoffset; moreconst2 = textarg; // 4 varieties varieties (const1==0 cross const2==0) |