X-Git-Url: http://git.megacz.com/?a=blobdiff_plain;f=ghc%2Frts%2FPrimOps.cmm;fp=ghc%2Frts%2FPrimOps.cmm;h=630319fef2bf4c35891dc03ce6ac792848571659;hb=6470f502f738e3b7b1348089deb3a7fbec221f1e;hp=1eaf727021991c760a43b5b492163b3488e7b45e;hpb=7aad3eb9db1071a0c644e28b4d046b5cd241a32b;p=ghc-hetmet.git diff --git a/ghc/rts/PrimOps.cmm b/ghc/rts/PrimOps.cmm index 1eaf727..630319f 100644 --- a/ghc/rts/PrimOps.cmm +++ b/ghc/rts/PrimOps.cmm @@ -126,21 +126,25 @@ unsafeThawArrayzh_fast // 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. - + // 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 closure type is MUT_ARR_PTRS_FROZEN0 if it is on the mutable list, - // and MUT_ARR_PTRS_FROZEN otherwise. + // and MUT_ARR_PTRS_FROZEN otherwise. In fact it wouldn't matter if + // we put it on the mutable list more than once, but it would get scavenged + // multiple times during GC, which would be unnecessarily slow. // - if (%INFO_TYPE(%GET_STD_INFO(R1)) != HALF_W_(MUT_ARR_PTRS_FROZEN0)) { + if (StgHeader_info(R1) != stg_MUT_ARR_PTRS_FROZEN0_info) { + SET_INFO(R1,stg_MUT_ARR_PTRS_info); foreign "C" recordMutableLock(R1 "ptr") [R1]; + // must be done after SET_INFO, because it ASSERTs closure_MUTABLE() + RET_P(R1); + } else { + SET_INFO(R1,stg_MUT_ARR_PTRS_info); + RET_P(R1); } - - SET_INFO(R1,stg_MUT_ARR_PTRS_info); - - RET_P(R1); } /* -----------------------------------------------------------------------------