[project @ 2005-04-12 12:24:44 by simonmar]
[ghc-hetmet.git] / ghc / rts / PrimOps.cmm
index a7ba08a..3ddb2bc 100644 (file)
@@ -118,8 +118,6 @@ newArrayzh_fast
 
 unsafeThawArrayzh_fast
 {
-  SET_INFO(R1,stg_MUT_ARR_PTRS_info);
-
   // SUBTLETY TO DO WITH THE OLD GEN MUTABLE LIST
   //
   // A MUT_ARR_PTRS lives on the mutable list, but a MUT_ARR_PTRS_FROZEN 
@@ -127,15 +125,21 @@ unsafeThawArrayzh_fast
   // it on the mutable list for the GC to remove (removing something from
   // the mutable list is not easy, because the mut_list is only singly-linked).
   // 
+  // So that we can tell whether a MUT_ARR_PTRS_FROZEN is on the mutable list,
+  // when we freeze it we set the info ptr to be MUT_ARR_PTRS_FROZEN0 to indicate
+  // that it is still on the mutable list.
+
   // So, when we thaw a MUT_ARR_PTRS_FROZEN, we must cope with two cases:
   // either it is on a mut_list, or it isn't.  We adopt the convention that
   // the mut_link field is NULL if it isn't on a mut_list, and the GC
   // maintains this invariant.
   //
-  if (StgMutClosure_mut_link(R1) == NULL) {
+  if (%INFO_TYPE(%GET_STD_INFO(R1)) != HALF_W_(MUT_ARR_PTRS_FROZEN0)) {
        foreign "C" recordMutable(R1 "ptr");
   }
 
+  SET_INFO(R1,stg_MUT_ARR_PTRS_info);
+
   RET_P(R1);
 }
 
@@ -1137,7 +1141,7 @@ atomicallyzh_fast
   Sp = Sp - SIZEOF_StgAtomicallyFrame;
   frame = Sp;
 
-  SET_HDR(frame,stg_atomically_frame_info,CCCS);
+  SET_HDR(frame,stg_atomically_frame_info, W_[CCCS]);
   StgAtomicallyFrame_waiting(frame) = 0 :: CInt; // False
   StgAtomicallyFrame_code(frame) = R1;
 
@@ -1164,7 +1168,7 @@ catchSTMzh_fast
   Sp = Sp - SIZEOF_StgCatchSTMFrame;
   frame = Sp;
 
-  SET_HDR(frame, stg_catch_stm_frame_info, CCCS);
+  SET_HDR(frame, stg_catch_stm_frame_info, W_[CCCS]);
   StgCatchSTMFrame_handler(frame) = R2;
 
   /* Apply R1 to the realworld token */
@@ -1192,7 +1196,7 @@ catchRetryzh_fast
   Sp = Sp - SIZEOF_StgCatchRetryFrame;
   frame = Sp;
   
-  SET_HDR(frame, stg_catch_retry_frame_info, CCCS);
+  SET_HDR(frame, stg_catch_retry_frame_info, W_[CCCS]);
   StgCatchRetryFrame_running_alt_code(frame) = 0 :: CInt; // false;
   StgCatchRetryFrame_first_code(frame) = R1;
   StgCatchRetryFrame_alt_code(frame) = R2;