X-Git-Url: http://git.megacz.com/?a=blobdiff_plain;f=ghc%2Frts%2FApply.hc;h=30fbb5017b8ed05edebea1e6bd6d681bbc12136b;hb=553e90d9a32ee1b1809430f260c401cc4169c6c7;hp=d8999f15a0624949ce973301d2e589121d98fc89;hpb=e60d7bb1d012cc1c6425222e8948cc10f8af664f;p=ghc-hetmet.git diff --git a/ghc/rts/Apply.hc b/ghc/rts/Apply.hc index d8999f1..30fbb50 100644 --- a/ghc/rts/Apply.hc +++ b/ghc/rts/Apply.hc @@ -163,8 +163,11 @@ STGFUN(stg_AP_entry) Words = ap->n_args; - // Check for stack overflow. - STK_CHK_GEN(Words+sizeofW(StgUpdateFrame), R1_PTR, stg_AP_entry); + // Check for stack overflow. IMPORTANT: use a _NP check here, + // because if the check fails, we might end up blackholing this very + // closure, in which case we must enter the blackhole on return rather + // than continuing to evaluate the now-defunct closure. + STK_CHK_NP(Words+sizeofW(StgUpdateFrame),); PUSH_UPD_FRAME(R1.p, 0); Sp -= sizeofW(StgUpdateFrame) + Words; @@ -230,8 +233,11 @@ STGFUN(stg_AP_STACK_entry) Words = ap->size; - // Check for stack overflow. - STK_CHK_GEN(Words+sizeofW(StgUpdateFrame), R1_PTR, stg_AP_STACK_entry); + // Check for stack overflow. IMPORTANT: use a _NP check here, + // because if the check fails, we might end up blackholing this very + // closure, in which case we must enter the blackhole on return rather + // than continuing to evaluate the now-defunct closure. + STK_CHK_NP(Words+sizeofW(StgUpdateFrame),); PUSH_UPD_FRAME(R1.p, 0); Sp -= sizeofW(StgUpdateFrame) + Words;