Commit 66265ae0 authored by Simon Marlow's avatar Simon Marlow
Browse files

Fix trashing of the masking state in STM (#5238)

parent bea3992c
......@@ -543,13 +543,32 @@ retry_pop_stack:
*/
W_ frame;
frame = Sp;
if (frame_type == CATCH_FRAME) {
if (frame_type == CATCH_FRAME)
{
Sp = Sp + SIZEOF_StgCatchFrame;
if ((StgCatchFrame_exceptions_blocked(frame) & TSO_BLOCKEX) == 0) {
Sp_adj(-1);
Sp(0) = stg_unmaskAsyncExceptionszh_ret_info;
}
} else {
/* Ensure that async excpetions are blocked when running the handler.
*/
StgTSO_flags(CurrentTSO) = %lobits32(
TO_W_(StgTSO_flags(CurrentTSO)) | TSO_BLOCKEX | TSO_INTERRUPTIBLE);
/* The interruptible state is inherited from the context of the
* catch frame, but note that TSO_INTERRUPTIBLE is only meaningful
* if TSO_BLOCKEX is set. (we got this wrong earlier, and #4988
* was a symptom of the bug).
*/
if ((StgCatchFrame_exceptions_blocked(frame) &
(TSO_BLOCKEX | TSO_INTERRUPTIBLE)) == TSO_BLOCKEX) {
StgTSO_flags(CurrentTSO) = %lobits32(
TO_W_(StgTSO_flags(CurrentTSO)) & ~TSO_INTERRUPTIBLE);
}
}
else /* CATCH_STM_FRAME */
{
W_ trec, outer;
trec = StgTSO_trec(CurrentTSO);
outer = StgTRecHeader_enclosing_trec(trec);
......@@ -559,22 +578,6 @@ retry_pop_stack:
Sp = Sp + SIZEOF_StgCatchSTMFrame;
}
/* Ensure that async excpetions are blocked when running the handler.
*/
StgTSO_flags(CurrentTSO) = %lobits32(
TO_W_(StgTSO_flags(CurrentTSO)) | TSO_BLOCKEX | TSO_INTERRUPTIBLE);
/* The interruptible state is inherited from the context of the
* catch frame, but note that TSO_INTERRUPTIBLE is only meaningful
* if TSO_BLOCKEX is set. (we got this wrong earlier, and #4988
* was a symptom of the bug).
*/
if ((StgCatchFrame_exceptions_blocked(frame) &
(TSO_BLOCKEX | TSO_INTERRUPTIBLE)) == TSO_BLOCKEX) {
StgTSO_flags(CurrentTSO) = %lobits32(
TO_W_(StgTSO_flags(CurrentTSO)) & ~TSO_INTERRUPTIBLE);
}
/* Call the handler, passing the exception value and a realworld
* token as arguments.
*/
......
Supports Markdown
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