[project @ 2002-07-03 15:17:15 by sof]
[ghc-hetmet.git] / ghc / rts / StgMiscClosures.hc
index 63da5b1..50530c3 100644 (file)
@@ -1,5 +1,5 @@
 /* -----------------------------------------------------------------------------
- * $Id: StgMiscClosures.hc,v 1.70 2001/11/22 14:25:12 simonmar Exp $
+ * $Id: StgMiscClosures.hc,v 1.76 2002/04/19 10:22:58 simonmar Exp $
  *
  * (c) The GHC Team, 1998-2000
  *
@@ -292,10 +292,10 @@ INFO_TABLE(stg_IND_info,stg_IND_entry,1,0,IND,,EF_,"IND","IND");
 STGFUN(stg_IND_entry)
 {
     FB_
-    TICK_ENT_IND(Node);        /* tick */
+    TICK_ENT_DYN_IND(Node);    /* tick */
     R1.p = (P_) ((StgInd*)R1.p)->indirectee;
     TICK_ENT_VIA_NODE();
-    JMP_(ENTRY_CODE(*R1.p));
+    JMP_(GET_ENTRY(R1.cl));
     FE_
 }
 
@@ -303,10 +303,10 @@ INFO_TABLE(stg_IND_STATIC_info,stg_IND_STATIC_entry,1,0,IND_STATIC,,EF_,"IND_STA
 STGFUN(stg_IND_STATIC_entry)
 {
     FB_
-    TICK_ENT_IND(Node);        /* tick */
+    TICK_ENT_STATIC_IND(Node); /* tick */
     R1.p = (P_) ((StgIndStatic*)R1.p)->indirectee;
     TICK_ENT_VIA_NODE();
-    JMP_(ENTRY_CODE(*R1.p));
+    JMP_(GET_ENTRY(R1.cl));
     FE_
 }
 
@@ -315,7 +315,7 @@ STGFUN(stg_IND_PERM_entry)
 {
     FB_
     /* Don't add INDs to granularity cost */
-    /* Dont: TICK_ENT_IND(Node); for ticky-ticky; this ind is here only to help profiling */
+    /* Dont: 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  */
@@ -350,7 +350,7 @@ STGFUN(stg_IND_PERM_entry)
     TICK_ENT_VIA_NODE();
 #endif
 
-    JMP_(ENTRY_CODE(*R1.p));
+    JMP_(GET_ENTRY(R1.cl));
     FE_
 }  
 
@@ -358,10 +358,10 @@ INFO_TABLE(stg_IND_OLDGEN_info,stg_IND_OLDGEN_entry,1,1,IND_OLDGEN,,EF_,"IND_OLD
 STGFUN(stg_IND_OLDGEN_entry)
 {
     FB_
-    TICK_ENT_IND(Node);        /* tick */
+    TICK_ENT_STATIC_IND(Node); /* tick */
     R1.p = (P_) ((StgInd*)R1.p)->indirectee;
     TICK_ENT_VIA_NODE();
-    JMP_(ENTRY_CODE(*R1.p));
+    JMP_(GET_ENTRY(R1.cl));
     FE_
 }
 
@@ -369,7 +369,7 @@ INFO_TABLE(stg_IND_OLDGEN_PERM_info,stg_IND_OLDGEN_PERM_entry,1,1,IND_OLDGEN_PER
 STGFUN(stg_IND_OLDGEN_PERM_entry)
 {
     FB_
-    /* Dont: TICK_ENT_IND(Node); for ticky-ticky; this ind is here only to help profiling */
+    /* Dont: 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  */
@@ -391,7 +391,7 @@ STGFUN(stg_IND_OLDGEN_PERM_entry)
 
     R1.p = (P_) ((StgInd*)R1.p)->indirectee;
     TICK_ENT_VIA_NODE();
-    JMP_(ENTRY_CODE(*R1.p));
+    JMP_(GET_ENTRY(R1.cl));
     FE_
 }
 
@@ -423,8 +423,8 @@ STGFUN(stg_BLACKHOLE_entry)
 #ifdef SMP
     {
       bdescr *bd = Bdescr(R1.p);
-      if (bd->back != (bdescr *)BaseReg) {
-       if (bd->gen->no >= 1 || bd->step->no >= 1) {
+      if (bd->u.back != (bdescr *)BaseReg) {
+       if (bd->gen_no >= 1 || bd->step->no >= 1) {
          CMPXCHG(R1.cl->header.info, &stg_BLACKHOLE_info, &stg_WHITEHOLE_info);
        } else {
          EXTFUN_RTS(stg_gc_enter_1_hponly);
@@ -487,8 +487,8 @@ STGFUN(stg_BLACKHOLE_BQ_entry)
 #ifdef SMP
     {
       bdescr *bd = Bdescr(R1.p);
-      if (bd->back != (bdescr *)BaseReg) {
-       if (bd->gen->no >= 1 || bd->step->no >= 1) {
+      if (bd->u.back != (bdescr *)BaseReg) {
+       if (bd->gen_no >= 1 || bd->step->no >= 1) {
          CMPXCHG(R1.cl->header.info, &stg_BLACKHOLE_info, &stg_WHITEHOLE_info);
        } else {
          EXTFUN_RTS(stg_gc_enter_1_hponly);
@@ -579,7 +579,7 @@ STGFUN(stg_CAF_BLACKHOLE_entry)
 #ifdef SMP
     {
       bdescr *bd = Bdescr(R1.p);
-      if (bd->back != (bdescr *)BaseReg) {
+      if (bd->u.back != (bdescr *)BaseReg) {
        if (bd->gen_no >= 1 || bd->step->no >= 1) {
          CMPXCHG(R1.cl->header.info, &stg_CAF_BLACKHOLE_info, &stg_WHITEHOLE_info);
        } else {
@@ -677,19 +677,12 @@ NON_ENTERABLE_ENTRY_CODE(EVACUATED);
 INFO_TABLE(stg_WEAK_info,stg_WEAK_entry,0,4,WEAK,,EF_,"WEAK","WEAK");
 NON_ENTERABLE_ENTRY_CODE(WEAK);
 
-// XXX! The garbage collector replaces a WEAK with a DEAD_WEAK
-// in-place, which causes problems if the heap is scanned linearly
-// after GC (certain kinds of profiling do this).  So when profiling,
-// we set the size of a DEAD_WEAK to 4 non-pointers, rather than its
-// usual 1.
-
-#ifdef PROFILING
-#define DEAD_WEAK_PAYLOAD_WORDS 4
-#else
-#define DEAD_WEAK_PAYLOAD_WORDS 1
-#endif
+// It's important when turning an existing WEAK into a DEAD_WEAK
+// (which is what finalizeWeak# does) that we don't lose the link
+// field and break the linked list of weak pointers.  Hence, we give
+// DEAD_WEAK 4 non-pointer fields, the same as WEAK.
 
-INFO_TABLE_CONSTR(stg_DEAD_WEAK_info,stg_DEAD_WEAK_entry,0,DEAD_WEAK_PAYLOAD_WORDS,0,CONSTR,,EF_,"DEAD_WEAK","DEAD_WEAK");
+INFO_TABLE_CONSTR(stg_DEAD_WEAK_info,stg_DEAD_WEAK_entry,0,4,0,CONSTR,,EF_,"DEAD_WEAK","DEAD_WEAK");
 NON_ENTERABLE_ENTRY_CODE(DEAD_WEAK);
 
 /* -----------------------------------------------------------------------------
@@ -923,8 +916,8 @@ static INFO_TBL_CONST StgInfoTable izh_static_info;
 #define Char_hash_static_info czh_static_info
 #define Int_hash_static_info izh_static_info
 #else
-#define Char_hash_static_info PrelBase_Czh_static_info
-#define Int_hash_static_info PrelBase_Izh_static_info
+#define Char_hash_static_info GHCziBase_Czh_static_info
+#define Int_hash_static_info GHCziBase_Izh_static_info
 #endif
 
 #define CHARLIKE_HDR(n)                                                \