Save and restore registers across calls to unlockClosure.
authorGeoffrey Mainland <gmainlan@microsoft.com>
Mon, 29 Oct 2012 17:32:10 +0000 (17:32 +0000)
committerGeoffrey Mainland <gmainlan@microsoft.com>
Tue, 30 Oct 2012 12:50:54 +0000 (12:50 +0000)
We may not assume that registers are saved across calls to unlockClosure because
it could call a C function on some platforms.

rts/HeapStackCheck.cmm

index 4fd4430..b3ae264 100644 (file)
@@ -509,7 +509,12 @@ INFO_TABLE_RET ( stg_block_takemvar, RET_SMALL, W_ info_ptr, P_ mvar )
 // code fragment executed just before we return to the scheduler
 stg_block_takemvar_finally
 {
+    W_ r1, r3;
+    r1 = R1;
+    r3 = R3;
     unlockClosure(R3, stg_MVAR_DIRTY_info);
+    R1 = r1;
+    R3 = r3;
     jump StgReturn [R1];
 }
 
@@ -532,7 +537,12 @@ INFO_TABLE_RET( stg_block_putmvar, RET_SMALL, W_ info_ptr,
 // code fragment executed just before we return to the scheduler
 stg_block_putmvar_finally
 {
+    W_ r1, r3;
+    r1 = R1;
+    r3 = R3;
     unlockClosure(R3, stg_MVAR_DIRTY_info);
+    R1 = r1;
+    R3 = r3;
     jump StgReturn [R1];
 }
 
@@ -565,7 +575,10 @@ stg_block_throwto_finally
     // unlocked.  It may have been unlocked if we revoked the message
     // due to an exception being raised during threadPaused().
     if (StgHeader_info(StgTSO_block_info(CurrentTSO)) == stg_WHITEHOLE_info) {
+        W_ r1;
+        r1 = R1;
         unlockClosure(StgTSO_block_info(CurrentTSO), stg_MSG_THROWTO_info);
+        R1 = r1;
     }
     jump StgReturn [R1];
 }