summaryrefslogtreecommitdiff
path: root/rts/Apply.cmm
diff options
context:
space:
mode:
authorSimon Marlow <marlowsd@gmail.com>2014-11-04 21:31:00 +0000
committerSimon Marlow <marlowsd@gmail.com>2014-11-05 18:13:50 +0000
commit3bebf3c2d92e6defc6d17ffa237cc4a9cad71dcf (patch)
treec538dca65ddbdaa879427ec0245fcd9798034c56 /rts/Apply.cmm
parent4cd277b4dcb91c6c6aa7e071ef0364570566de37 (diff)
downloadhaskell-3bebf3c2d92e6defc6d17ffa237cc4a9cad71dcf.tar.gz
Fix a couple of inaccurate stack checks
Diffstat (limited to 'rts/Apply.cmm')
-rw-r--r--rts/Apply.cmm9
1 files changed, 6 insertions, 3 deletions
diff --git a/rts/Apply.cmm b/rts/Apply.cmm
index 9d18e95524..149a320f25 100644
--- a/rts/Apply.cmm
+++ b/rts/Apply.cmm
@@ -70,7 +70,7 @@ stg_PAP_apply /* no args => explicit stack */
// We have a hand-rolled stack check fragment here, because none of
// the canned ones suit this situation.
//
- if ((Sp - WDS(Words)) < SpLim) {
+ if (Sp - (WDS(Words) + 2/* see ARG_BCO below */) < SpLim) {
// there is a return address in R2 in the event of a
// stack check failure. The various stg_apply functions arrange
// this before calling stg_PAP_entry.
@@ -168,7 +168,9 @@ INFO_TABLE(stg_AP,/*special layout*/0,0,AP,"AP","AP")
* closure, in which case we must enter the blackhole on return rather
* than continuing to evaluate the now-defunct closure.
*/
- STK_CHK_ENTER(WDS(Words) + SIZEOF_StgUpdateFrame, R1);
+ STK_CHK_ENTER(WDS(Words) +
+ SIZEOF_StgUpdateFrame +
+ 2/* see ARG_BCO below */, R1);
PUSH_UPD_FRAME(Sp - SIZEOF_StgUpdateFrame, R1);
Sp = Sp - SIZEOF_StgUpdateFrame - WDS(Words);
@@ -239,7 +241,8 @@ INFO_TABLE(stg_AP_NOUPD,/*special layout*/0,0,AP,"AP_NOUPD","AP_NOUPD")
* closure, in which case we must enter the blackhole on return rather
* than continuing to evaluate the now-defunct closure.
*/
- STK_CHK_ENTER(WDS(Words), R1);
+ STK_CHK_ENTER(WDS(Words) +
+ 2/* see ARG_BCO below */, R1);
Sp = Sp - WDS(Words);
TICK_ENT_AP();