[Git][ghc/ghc][master] support small arrays and CONSTR_NOCAF in ghc-heap
Marge Bot
gitlab at gitlab.haskell.org
Fri May 31 05:58:51 UTC 2019
Marge Bot pushed to branch master at Glasgow Haskell Compiler / GHC
Commits:
284cca51 by David Hewson at 2019-05-31T05:58:47Z
support small arrays and CONSTR_NOCAF in ghc-heap
- - - - -
3 changed files:
- libraries/ghc-heap/GHC/Exts/Heap.hs
- libraries/ghc-heap/GHC/Exts/Heap/Closures.hs
- rts/Heap.c
Changes:
=====================================
libraries/ghc-heap/GHC/Exts/Heap.hs
=====================================
@@ -248,6 +248,12 @@ getClosure x = do
++ "found " ++ show (length rawWds)
pure $ MutArrClosure itbl (rawWds !! 0) (rawWds !! 1) pts
+ t | t >= SMALL_MUT_ARR_PTRS_CLEAN && t <= SMALL_MUT_ARR_PTRS_FROZEN_CLEAN -> do
+ unless (length rawWds >= 1) $
+ fail $ "Expected at least 1 word to SMALL_MUT_ARR_PTRS_* "
+ ++ "found " ++ show (length rawWds)
+ pure $ SmallMutArrClosure itbl (rawWds !! 0) pts
+
t | t == MUT_VAR_CLEAN || t == MUT_VAR_DIRTY ->
pure $ MutVarClosure itbl (head pts)
=====================================
libraries/ghc-heap/GHC/Exts/Heap/Closures.hs
=====================================
@@ -221,6 +221,15 @@ data GenClosure b
-- Card table ignored
}
+ -- | A @SmallMutableArray#@
+ --
+ -- @since 8.10.1
+ | SmallMutArrClosure
+ { info :: !StgInfoTable
+ , mccPtrs :: !Word -- ^ Number of pointers
+ , mccPayload :: ![b] -- ^ Array payload
+ }
+
-- | An @MVar#@, with a queue of thread state objects blocking on them
| MVarClosure
{ info :: !StgInfoTable
@@ -321,6 +330,7 @@ allClosures (APStackClosure {..}) = fun:payload
allClosures (BCOClosure {..}) = [instrs,literals,bcoptrs]
allClosures (ArrWordsClosure {}) = []
allClosures (MutArrClosure {..}) = mccPayload
+allClosures (SmallMutArrClosure {..}) = mccPayload
allClosures (MutVarClosure {..}) = [var]
allClosures (MVarClosure {..}) = [queueHead,queueTail,value]
allClosures (FunClosure {..}) = ptrArgs
=====================================
rts/Heap.c
=====================================
@@ -110,6 +110,7 @@ StgMutArrPtrs *heap_view_closurePtrs(Capability *cap, StgClosure *closure) {
case CONSTR_1_1:
case CONSTR_0_2:
case CONSTR:
+ case CONSTR_NOCAF:
case PRIM:
@@ -192,6 +193,16 @@ StgMutArrPtrs *heap_view_closurePtrs(Capability *cap, StgClosure *closure) {
ptrs[nptrs++] = ((StgMutArrPtrs *)closure)->payload[i];
}
break;
+
+ case SMALL_MUT_ARR_PTRS_CLEAN:
+ case SMALL_MUT_ARR_PTRS_DIRTY:
+ case SMALL_MUT_ARR_PTRS_FROZEN_CLEAN:
+ case SMALL_MUT_ARR_PTRS_FROZEN_DIRTY:
+ for (i = 0; i < ((StgSmallMutArrPtrs *)closure)->ptrs; ++i) {
+ ptrs[nptrs++] = ((StgSmallMutArrPtrs *)closure)->payload[i];
+ }
+ break;
+
case MUT_VAR_CLEAN:
case MUT_VAR_DIRTY:
ptrs[nptrs++] = ((StgMutVar *)closure)->var;
View it on GitLab: https://gitlab.haskell.org/ghc/ghc/commit/284cca51f07c70c03ce602c963e22acf7333180b
--
View it on GitLab: https://gitlab.haskell.org/ghc/ghc/commit/284cca51f07c70c03ce602c963e22acf7333180b
You're receiving this email because of your account on gitlab.haskell.org.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.haskell.org/pipermail/ghc-commits/attachments/20190531/b2c07de7/attachment-0001.html>
More information about the ghc-commits
mailing list