Make killThread# cmm primop use local stack allocation
[ghc-hetmet.git] / rts / Exception.cmm
index 479c9c9..cf24ef5 100644 (file)
@@ -187,6 +187,7 @@ killThreadzh_fast
     target = R1;
     exception = R2;
     
+    /* Needs 3 words because throwToSingleThreaded uses some stack */
     STK_CHK_GEN( WDS(3), R1_PTR & R2_PTR, killThreadzh_fast);
 
     /* 
@@ -215,8 +216,8 @@ killThreadzh_fast
     } else {
        W_ out;
        W_ retcode;
-       out = BaseReg + OFFSET_StgRegTable_rmp_tmp_w;
-       
+       out = Sp - WDS(1); /* ok to re-use stack space here */
+
        (retcode) = foreign "C" throwTo(MyCapability() "ptr",
                                      CurrentTSO "ptr",
                                      target "ptr",
@@ -253,7 +254,7 @@ INFO_TABLE_RET(stg_catch_frame, CATCH_FRAME,
 #if defined(PROFILING)
   W_ unused1, W_ unused2,
 #endif
-  W_ unused3, "ptr" W_ unused4)
+  W_ unused3, P_ unused4)
    {
       Sp = Sp + SIZEOF_StgCatchFrame;
       jump %ENTRY_CODE(Sp(SP_OFF));
@@ -315,7 +316,7 @@ section "data" {
   no_break_on_exception: W_[1];
 }
 
-INFO_TABLE_RET(stg_raise_ret, RET_SMALL, "ptr" W_ arg1)
+INFO_TABLE_RET(stg_raise_ret, RET_SMALL, P_ arg1)
 {
   R1 = Sp(1);
   Sp = Sp + WDS(2);