X-Git-Url: http://git.megacz.com/?a=blobdiff_plain;f=ghc%2Frts%2FException.cmm;h=4bb9e4893bab746457c1c8154cd734805bfb478a;hb=0dbbf1932d550293986af6244202cb735b2cd966;hp=3fdfdfd5446d35168854e19c926bf4ccfe4f346f;hpb=afd08a9c06ae4b15e33e26e5a2818801c7fee429;p=ghc-hetmet.git diff --git a/ghc/rts/Exception.cmm b/ghc/rts/Exception.cmm index 3fdfdfd..4bb9e48 100644 --- a/ghc/rts/Exception.cmm +++ b/ghc/rts/Exception.cmm @@ -102,10 +102,9 @@ blockAsyncExceptionszh_fast Sp(0) = stg_unblockAsyncExceptionszh_ret_info; } } - Sp_adj(-1); TICK_UNKNOWN_CALL(); TICK_SLOW_CALL_v(); - jump RET_LBL(stg_ap_v); + jump stg_ap_v_fast; } unblockAsyncExceptionszh_fast @@ -130,10 +129,9 @@ unblockAsyncExceptionszh_fast Sp(0) = stg_blockAsyncExceptionszh_ret_info; } } - Sp_adj(-1); TICK_UNKNOWN_CALL(); TICK_SLOW_CALL_v(); - jump RET_LBL(stg_ap_v); + jump stg_ap_v_fast; } @@ -307,10 +305,9 @@ catchzh_fast TICK_CATCHF_PUSHED(); /* Apply R1 to the realworld token */ - Sp_adj(-1); TICK_UNKNOWN_CALL(); TICK_SLOW_CALL_v(); - jump RET_LBL(stg_ap_v); + jump stg_ap_v_fast; } /* ----------------------------------------------------------------------------- @@ -372,19 +369,27 @@ retry_pop_stack: "ptr" trec = foreign "C" stmStartTransaction(MyCapability() "ptr", NO_TREC "ptr"); StgTSO_trec(CurrentTSO) = trec; R1 = StgAtomicallyFrame_code(Sp); - Sp_adj(-1); - jump RET_LBL(stg_ap_v); + jump stg_ap_v_fast; } } if (frame_type == STOP_FRAME) { - /* We've stripped the entire stack, the thread is now dead. */ - Sp = CurrentTSO + OFFSET_StgTSO_stack - + WDS(StgTSO_stack_size(CurrentTSO)) - WDS(1); - Sp(0) = R1; /* save the exception */ + /* + * We've stripped the entire stack, the thread is now dead. + * We will leave the stack in a GC'able state, see the stg_stop_thread + * entry code in StgStartup.cmm. + */ + Sp = CurrentTSO + TSO_OFFSET_StgTSO_stack + + WDS(StgTSO_stack_size(CurrentTSO)) - WDS(2); + Sp(1) = R1; /* save the exception */ + Sp(0) = stg_enter_info; /* so that GC can traverse this stack */ StgTSO_what_next(CurrentTSO) = ThreadKilled::I16; SAVE_THREAD_STATE(); /* inline! */ - R1 = ThreadFinished; + + /* The return code goes in BaseReg->rRet, and BaseReg is returned in R1 */ + StgRegTable_rRet(BaseReg) = ThreadFinished; + R1 = BaseReg; + jump StgReturn; }