diff options
Diffstat (limited to 'rts/Exception.cmm')
-rw-r--r-- | rts/Exception.cmm | 40 |
1 files changed, 15 insertions, 25 deletions
diff --git a/rts/Exception.cmm b/rts/Exception.cmm index 0ef74a8c57..f246d60a1e 100644 --- a/rts/Exception.cmm +++ b/rts/Exception.cmm @@ -57,7 +57,6 @@ import CLOSURE base_GHCziExceptionziType_overflowException_closure; -------------------------------------------------------------------------- */ - INFO_TABLE_RET(stg_unmaskAsyncExceptionszh_ret, RET_SMALL, W_ info_ptr) /* explicit stack */ { @@ -151,9 +150,11 @@ stg_maskAsyncExceptionszh /* explicit stack */ Sp(0) = stg_unmaskAsyncExceptionszh_ret_info; } } else { + Sp_adj(-1); if ((TO_W_(StgTSO_flags(CurrentTSO)) & TSO_INTERRUPTIBLE) == 0) { - Sp_adj(-1); Sp(0) = stg_maskUninterruptiblezh_ret_info; + } else { + Sp(0) = stg_maskAsyncExceptionszh_ret_info; } } @@ -179,10 +180,12 @@ stg_maskUninterruptiblezh /* explicit stack */ Sp(0) = stg_unmaskAsyncExceptionszh_ret_info; } } else { - if ((TO_W_(StgTSO_flags(CurrentTSO)) & TSO_INTERRUPTIBLE) != 0) { - Sp_adj(-1); - Sp(0) = stg_maskAsyncExceptionszh_ret_info; - } + Sp_adj(-1); + if ((TO_W_(StgTSO_flags(CurrentTSO)) & TSO_INTERRUPTIBLE) == 0) { + Sp(0) = stg_maskUninterruptiblezh_ret_info; + } else { + Sp(0) = stg_maskAsyncExceptionszh_ret_info; + } } StgTSO_flags(CurrentTSO) = %lobits32( @@ -203,12 +206,15 @@ stg_unmaskAsyncExceptionszh /* explicit stack */ io = R1; STK_CHK_P_LL (WDS(4), stg_unmaskAsyncExceptionszh, io); - /* 4 words: one for the unmask frame, 3 for setting up the + /* 4 words: one for the mask frame, 3 for setting up the * stack to call maybePerformBlockedException() below. */ - /* If exceptions are already unmasked, there's nothing to do */ - if ((TO_W_(StgTSO_flags(CurrentTSO)) & TSO_BLOCKEX) != 0) { + /* If exceptions are already unmasked, no need to check for a masked exception */ + if ((TO_W_(StgTSO_flags(CurrentTSO)) & TSO_BLOCKEX) == 0) { + Sp_adj(-1); + Sp(0) = stg_unmaskAsyncExceptionszh_ret_info; + } else { /* avoid growing the stack unnecessarily */ if (Sp(0) == stg_unmaskAsyncExceptionszh_ret_info) { @@ -377,22 +383,6 @@ INFO_TABLE_RET(stg_catch_frame, CATCH_FRAME, return (ret); } -/* ----------------------------------------------------------------------------- - * The catch infotable - * - * This should be exactly the same as would be generated by this STG code - * - * catch = {x,h} \n {} -> catch#{x,h} - * - * It is used in deleteThread when reverting blackholes. - * -------------------------------------------------------------------------- */ - -INFO_TABLE(stg_catch,2,0,FUN,"catch","catch") - (P_ node) -{ - jump stg_catchzh(StgClosure_payload(node,0),StgClosure_payload(node,1)); -} - stg_catchzh ( P_ io, /* :: IO a */ P_ handler /* :: Exception -> IO a */ ) { |