update submodules for GHC.HetMet.GArrow -> Control.GArrow renaming
[ghc-hetmet.git] / rts / StgMiscClosures.cmm
index 830bde5..b4a037d 100644 (file)
@@ -19,6 +19,23 @@ import EnterCriticalSection;
 import LeaveCriticalSection;
 
 /* ----------------------------------------------------------------------------
+   Stack underflow
+   ------------------------------------------------------------------------- */
+
+INFO_TABLE_RET (stg_stack_underflow_frame, UNDERFLOW_FRAME, P_ unused)
+{
+    W_ new_tso;
+    W_ ret_off;
+
+    SAVE_THREAD_STATE();
+    ("ptr" ret_off) = foreign "C" threadStackUnderflow(MyCapability(),
+                                                       CurrentTSO);
+    LOAD_THREAD_STATE();
+
+    jump %ENTRY_CODE(Sp(ret_off));
+}
+
+/* ----------------------------------------------------------------------------
    Support for the bytecode interpreter.
    ------------------------------------------------------------------------- */
 
@@ -235,45 +252,6 @@ INFO_TABLE(stg_IND_PERM,1,0,IND_PERM,"IND_PERM","IND_PERM")
     jump %GET_ENTRY(R1);
 }  
 
-
-INFO_TABLE(stg_IND_OLDGEN,1,0,IND_OLDGEN,"IND_OLDGEN","IND_OLDGEN")
-{
-    TICK_ENT_STATIC_IND();     /* tick */
-    R1 = UNTAG(StgInd_indirectee(R1));
-    TICK_ENT_VIA_NODE();
-    jump %GET_ENTRY(R1);
-}
-
-INFO_TABLE(stg_IND_OLDGEN_PERM,1,0,IND_OLDGEN_PERM,"IND_OLDGEN_PERM","IND_OLDGEN_PERM")
-{
-    /* Don't: TICK_ENT_STATIC_IND(Node); for ticky-ticky; 
-       this ind is here only to help profiling */
-
-#if defined(TICKY_TICKY) && !defined(PROFILING)
-    /* TICKY_TICKY && !PROFILING means PERM_IND *replaces* an IND, 
-       rather than being extra  */
-    TICK_ENT_PERM_IND(); /* tick */
-#endif
-
-    LDV_ENTER(R1);
-
-    /* Enter PAP cost centre -- lexical scoping only */
-    ENTER_CCS_PAP_CL(R1);
-
-    /* see comment in IND_PERM */
-#ifdef TICKY_TICKY
-#  ifdef PROFILING
-#    error Profiling and ticky-ticky do not mix at present!
-#  endif  /* PROFILING */
-    StgHeader_info(R1) = stg_IND_OLDGEN_info;
-#endif /* TICKY_TICKY */
-
-    R1 = UNTAG(StgInd_indirectee(R1));
-
-    TICK_ENT_VIA_NODE();
-    jump %GET_ENTRY(R1);
-}
-
 /* ----------------------------------------------------------------------------
    Black holes.
 
@@ -311,7 +289,7 @@ retry:
         ("ptr" msg) = foreign "C" allocate(MyCapability() "ptr", 
                                            BYTES_TO_WDS(SIZEOF_MessageBlackHole)) [R1];
         
-        StgHeader_info(msg) = stg_MSG_BLACKHOLE_info;
+        SET_HDR(msg, stg_MSG_BLACKHOLE_info, CCS_SYSTEM);
         MessageBlackHole_tso(msg) = CurrentTSO;
         MessageBlackHole_bh(msg) = R1;
                
@@ -392,6 +370,9 @@ loop:
 INFO_TABLE(stg_TSO, 0,0,TSO, "TSO", "TSO")
 { foreign "C" barf("TSO object entered!") never returns; }
 
+INFO_TABLE(stg_STACK, 0,0, STACK, "STACK", "STACK")
+{ foreign "C" barf("STACK object entered!") never returns; }
+
 /* ----------------------------------------------------------------------------
    Weak pointers
 
@@ -491,8 +472,6 @@ CLOSURE(stg_NO_TREC_closure,stg_NO_TREC);
    ------------------------------------------------------------------------- */
 
 // PRIM rather than CONSTR, because PRIM objects cannot be duplicated by the GC.
-INFO_TABLE_CONSTR(stg_MSG_WAKEUP,2,0,0,PRIM,"MSG_WAKEUP","MSG_WAKEUP")
-{ foreign "C" barf("MSG_WAKEUP object entered!") never returns; }
 
 INFO_TABLE_CONSTR(stg_MSG_TRY_WAKEUP,2,0,0,PRIM,"MSG_TRY_WAKEUP","MSG_TRY_WAKEUP")
 { foreign "C" barf("MSG_TRY_WAKEUP object entered!") never returns; }
@@ -503,6 +482,10 @@ INFO_TABLE_CONSTR(stg_MSG_THROWTO,4,0,0,PRIM,"MSG_THROWTO","MSG_THROWTO")
 INFO_TABLE_CONSTR(stg_MSG_BLACKHOLE,3,0,0,PRIM,"MSG_BLACKHOLE","MSG_BLACKHOLE")
 { foreign "C" barf("MSG_BLACKHOLE object entered!") never returns; }
 
+// used to overwrite a MSG_THROWTO when the message has been used/revoked
+INFO_TABLE_CONSTR(stg_MSG_NULL,1,0,0,PRIM,"MSG_NULL","MSG_NULL")
+{ foreign "C" barf("MSG_NULL object entered!") never returns; }
+
 /* ----------------------------------------------------------------------------
    END_TSO_QUEUE
 
@@ -569,6 +552,13 @@ INFO_TABLE( stg_dummy_ret, 0, 0, CONSTR_NOCAF_STATIC, "DUMMY_RET", "DUMMY_RET")
 CLOSURE(stg_dummy_ret_closure,stg_dummy_ret);
 
 /* ----------------------------------------------------------------------------
+   MVAR_TSO_QUEUE
+   ------------------------------------------------------------------------- */
+
+INFO_TABLE_CONSTR(stg_MVAR_TSO_QUEUE,2,0,0,PRIM,"MVAR_TSO_QUEUE","MVAR_TSO_QUEUE")
+{ foreign "C" barf("MVAR_TSO_QUEUE object entered!") never returns; }
+
+/* ----------------------------------------------------------------------------
    CHARLIKE and INTLIKE closures.  
 
    These are static representations of Chars and small Ints, so that
@@ -576,7 +566,7 @@ CLOSURE(stg_dummy_ret_closure,stg_dummy_ret);
    replace them with references to the static objects.
    ------------------------------------------------------------------------- */
 
-#if defined(__PIC__) && defined(mingw32_TARGET_OS)
+#if defined(__PIC__) && defined(mingw32_HOST_OS)
 /*
  * When sticking the RTS in a Windows DLL, we delay populating the
  * Charlike and Intlike tables until load-time, which is only