[project @ 2005-05-27 14:47:08 by tharris]
[ghc-hetmet.git] / ghc / rts / parallel / RBH.c
index faf2591..1612209 100644 (file)
@@ -1,5 +1,5 @@
 /*
-  Time-stamp: <Sun Dec 12 1999 20:39:04 Stardate: [-30]4039.09 software>
+  Time-stamp: <Tue Mar 13 2001 19:07:13 Stardate: [-30]6323.98 hwloidl>
 
   Revertible Black Hole Manipulation.
   Used in GUM and GranSim during the packing of closures. These black holes
 //* Conversion Functions::     
 //* Index::                    
 //@end menu
-//*/
 
 //@node Externs and prototypes, Conversion Functions
 //@section Externs and prototypes
 
-EXTFUN(RBH_Save_0_info);
-EXTFUN(RBH_Save_1_info);
-EXTFUN(RBH_Save_2_info);
+EXTFUN(stg_RBH_Save_0_info);
+EXTFUN(stg_RBH_Save_1_info);
+EXTFUN(stg_RBH_Save_2_info);
 
 //@node Conversion Functions, Index, Externs and prototypes
 //@section Conversion Functions
@@ -76,10 +75,10 @@ StgClosure *closure;
      RBH_Save_N closures, with N being the number of pointers for this
      closure.  */
   IF_GRAN_DEBUG(pack,
-               belch(":*   Converting closure %p (%s) into an RBH",
+               belch("*>::   %p (%s): Converting closure into an RBH",
                      closure, info_type(closure))); 
   IF_PAR_DEBUG(pack,
-               belch(":*   Converting closure %p (%s) into an RBH",
+               belch("*>::   %p (%s): Converting closure into an RBH",
                      closure, info_type(closure))); 
 
   ASSERT(closure_THUNK(closure));
@@ -88,11 +87,11 @@ StgClosure *closure;
                old_info = get_itbl(closure));
 
   /* Allocate a new closure for the holding data ripped out of closure */
-  if ((rbh_save = (StgRBHSave *)allocate(FIXED_HS + 2)) == NULL)
+  if ((rbh_save = (StgRBHSave *)allocate(_HS + 2)) == NULL)
     return NULL;  /* have to Garbage Collect; check that in the caller! */
 
   info_ptr = get_closure_info(closure, &size, &ptrs, &nonptrs, &vhs, str);
-  ASSERT(size >= MIN_UPD_SIZE);
+  ASSERT(size >= _HS+MIN_UPD_SIZE);
 
   /* Fill in the RBH_Save closure with the original data from closure */
   rbh_save->payload[0] = (StgPtr) ((StgRBH *)closure)->blocking_queue;
@@ -101,9 +100,9 @@ StgClosure *closure;
   /* Set the info_ptr for the rbh_Save closure according to the number of
      pointers in the original */
 
-  rbh_info_ptr = (StgInfoTable *) (ptrs == 0 ? &RBH_Save_0_info :
-                                  ptrs == 1 ? &RBH_Save_1_info :
-                                  &RBH_Save_2_info);
+  rbh_info_ptr = (StgInfoTable *) (ptrs == 0 ? &stg_RBH_Save_0_info :
+                                  ptrs == 1 ? &stg_RBH_Save_1_info :
+                                  &stg_RBH_Save_2_info);
   SET_INFO(rbh_save, rbh_info_ptr);
   /* same bitmask as the original closure */
   SET_GRAN_HDR(rbh_save, PROCS(closure));
@@ -118,9 +117,9 @@ StgClosure *closure;
   /*
     add closure to the mutable list!
     do this after having turned the closure into an RBH, because an
-    RBH is mutable but the think it was previously isn't
+    RBH is mutable but the closure it was before wasn't mutable
   */
-  //recordMutable((StgMutClosure *)closure);
+  recordMutable((StgMutClosure *)closure);
 
   //IF_GRAN_DEBUG(pack,
                /* sanity check; make sure that reverting the RBH yields the 
@@ -166,7 +165,7 @@ StgClosure *closure;
 
 # if defined(PAR)
 
-EXTFUN(FETCH_ME_info);
+EXTFUN(stg_FETCH_ME_info);
 
 //@cindex convertToFetchMe
 void
@@ -180,27 +179,27 @@ globalAddr *ga;
   ASSERT(get_itbl(rbh)->type==RBH);
 
   IF_PAR_DEBUG(pack,
-              belch(":*   Converting RBH %p (%s) into a FETCH_ME for GA ((%x, %d, %x))",
+              belch("**:: Converting RBH %p (%s) into a FETCH_ME for GA ((%x, %d, %x))",
                     rbh, info_type(rbh), 
                     ga->payload.gc.gtid, ga->payload.gc.slot, ga->weight)); 
 
   /* put closure on mutables list, while it is still a RBH */
-  //recordMutable((StgMutClosure *)rbh);
+  recordMutable((StgMutClosure *)rbh);
 
   /* actually turn it into a FETCH_ME */
-  SET_INFO((StgClosure *)rbh, &FETCH_ME_info);
+  SET_INFO((StgClosure *)rbh, &stg_FETCH_ME_info);
 
   /* set the global pointer in the FETCH_ME closure to the given value */
   ((StgFetchMe *)rbh)->ga = ga;
 
   IF_PAR_DEBUG(pack,
               if (get_itbl(bqe)->type==TSO || get_itbl(bqe)->type==BLOCKED_FETCH)
-                belch(":*     Awakening non-empty BQ of RBH closure %p (first TSO is %d (%p)",
+                belch("**:: Awakening non-empty BQ of RBH closure %p (first TSO is %d (%p)",
                      rbh, ((StgTSO *)bqe)->id, ((StgTSO *)bqe))); 
 
   /* awaken all TSOs and BLOCKED_FETCHES on the blocking queue */
   if (get_itbl(bqe)->type==TSO || get_itbl(bqe)->type==BLOCKED_FETCH)
-    awaken_blocked_queue(bqe, (StgClosure *)rbh);
+    awakenBlockedQueue(bqe, (StgClosure *)rbh);
 }
 # else  /* GRAN */
 /* Prototype */
@@ -225,23 +224,23 @@ StgClosure *closure;
                          ((StgTSO *)bqe)->id, ((StgTSO *)bqe));
                else 
                  strcpy(str, "empty");
-               belch(":*   Reverting RBH %p (%s) into a ??? closure again; BQ start: %s",
+               belch("*<:: Reverting RBH %p (%s) into a ??? closure again; BQ start: %s",
                      closure, info_type(closure), str));
 
   ASSERT(get_itbl(closure)->type==RBH);
 
-  /* awaken_blocked_queue also restores the RBH_Save closure
+  /* awakenBlockedQueue also restores the RBH_Save closure
      (have to call it even if there are no TSOs in the queue!) */
-  awaken_blocked_queue(bqe, closure);
+  awakenBlockedQueue(bqe, closure);
 
   /* Put back old info pointer (grabbed from the RBH's info table).
      We do that *after* awakening the BQ to be sure node is an RBH when
-     calling awaken_blocked_queue (different in GUM!)
+     calling awakenBlockedQueue (different in GUM!)
   */
   SET_INFO(closure, REVERT_INFOPTR(get_itbl(closure)));
 
   /* put closure on mutables list */
-  //recordMutable((StgMutClosure *)closure);
+  recordMutable((StgMutClosure *)closure);
 
 # if 0 /* rest of this fct */
     /* ngoq ngo' */