[project @ 2005-01-28 12:55:17 by simonmar]
[ghc-hetmet.git] / ghc / rts / HeapStackCheck.cmm
index 516d0ad..c41b9b5 100644 (file)
@@ -55,7 +55,7 @@
             CLOSE_NURSERY();                                   \
             CurrentNursery = bdescr_link(CurrentNursery);      \
             OPEN_NURSERY();                                    \
-            if (CInt[context_switch] != 0) {                   \
+            if (CInt[context_switch] != 0 :: CInt) {           \
                 R1 = ThreadYielding;                           \
                 goto sched;                                    \
             } else {                                           \
@@ -594,7 +594,13 @@ __stg_gc_fun
        size = BITMAP_SIZE(StgFunInfoExtra_bitmap(info));
     } else { 
        if (type == ARG_GEN_BIG) {
+#ifdef TABLES_NEXT_TO_CODE
+            // bitmap field holds an offset
+            size = StgLargeBitmap_size( StgFunInfoExtra_bitmap(info)
+                                        + %GET_ENTRY(R1) /* ### */ );
+#else
            size = StgLargeBitmap_size( StgFunInfoExtra_bitmap(info) );
+#endif
        } else {
            size = BITMAP_SIZE(W_[stg_arg_bitmaps + WDS(type)]);
        }
@@ -854,7 +860,7 @@ stg_block_putmvar
     BLOCK_GENERIC;
 }
 
-#ifdef mingw32_TARGET_OS
+#ifdef mingw32_HOST_OS
 INFO_TABLE_RET( stg_block_async, 0/*framesize*/, 0/*bitmap*/, RET_SMALL )
 {
     W_ ares;
@@ -862,9 +868,9 @@ INFO_TABLE_RET( stg_block_async, 0/*framesize*/, 0/*bitmap*/, RET_SMALL )
 
     ares = StgTSO_block_info(CurrentTSO);
     len = StgAsyncIOResult_len(ares);
-    errC = StgAsyncIOResult_errC(ares);
+    errC = StgAsyncIOResult_errCode(ares);
     StgTSO_block_info(CurrentTSO) = NULL;
-    foreign "C" free(ares);
+    foreign "C" free(ares "ptr");
     R1 = len;
     Sp(0) = errC;
     jump %ENTRY_CODE(Sp(1));
@@ -877,4 +883,25 @@ stg_block_async
     BLOCK_GENERIC;
 }
 
+/* Used by threadDelay implementation; it would be desirable to get rid of
+ * this free()'ing void return continuation.
+ */
+INFO_TABLE_RET( stg_block_async_void, 0/*framesize*/, 0/*bitmap*/, RET_SMALL )
+{
+    W_ ares;
+
+    ares = StgTSO_block_info(CurrentTSO);
+    StgTSO_block_info(CurrentTSO) = NULL;
+    foreign "C" free(ares "ptr");
+    Sp_adj(1);
+    jump %ENTRY_CODE(Sp(0));
+}
+
+stg_block_async_void
+{
+    Sp_adj(-1);
+    Sp(0) = stg_block_async_void_info;
+    BLOCK_GENERIC;
+}
+
 #endif