further fix for floating point primitives
[ghc-hetmet.git] / ghc / rts / StgStartup.cmm
index d727cb5..2f2a759 100644 (file)
@@ -29,7 +29,7 @@
     ASSERT(Sp != 0);                   \
     ASSERT(SpLim != 0);                        \
     ASSERT(HpLim != 0);                        \
-    ASSERT(SpLim - RESERVED_STACK_WORDS <= Sp); \
+    ASSERT(SpLim - WDS(RESERVED_STACK_WORDS) <= Sp); \
     ASSERT(HpLim >= Hp);
 
 /* -----------------------------------------------------------------------------
@@ -92,8 +92,9 @@ INFO_TABLE_RET( stg_stop_thread, STOP_THREAD_WORDS, STOP_THREAD_BITMAP,
 
     SAVE_THREAD_STATE();
 
-    /* R1 contains the return value of the thread */
-    R1 = ThreadFinished;
+    /* The return code goes in BaseReg->rRet, and BaseReg is returned in R1 */
+    StgRegTable_rRet(BaseReg) = ThreadFinished;
+    R1 = BaseReg;
 
     jump StgReturn;
 }
@@ -117,7 +118,17 @@ stg_returnToStackTop
 stg_returnToSched
 {
   SAVE_THREAD_STATE();
-  foreign "C" threadPaused(CurrentTSO);
+  foreign "C" threadPaused(MyCapability() "ptr", CurrentTSO);
+  jump StgReturn;
+}
+
+// A variant of stg_returntToSched that doesn't call threadPaused() on the
+// current thread.  This is used for switching from compiled execution to the
+// interpreter, where calling threadPaused() on every switch would be too
+// expensive.
+stg_returnToSchedNotPaused
+{
+  SAVE_THREAD_STATE();
   jump StgReturn;
 }
 
@@ -128,7 +139,7 @@ stg_returnToSched
 stg_returnToSchedButFirst
 {
   SAVE_THREAD_STATE();
-  foreign "C" threadPaused(CurrentTSO);
+  foreign "C" threadPaused(MyCapability() "ptr", CurrentTSO);
   jump R2;
 }