summaryrefslogtreecommitdiff
path: root/rts/Compact.cmm
diff options
context:
space:
mode:
authorBen Gamari <bgamari.foss@gmail.com>2017-08-24 21:55:27 -0400
committerDavid Feuer <David.Feuer@gmail.com>2017-08-24 21:55:28 -0400
commit5f3d2d3be034e04ba872f2695ab6d7b75de66663 (patch)
tree131f644eb988628aaf65ca91d7ebaf0eaacbd2c6 /rts/Compact.cmm
parentaeb4bd958439515e02e6f8f9bb22cf84f7cd7d75 (diff)
downloadhaskell-5f3d2d3be034e04ba872f2695ab6d7b75de66663.tar.gz
CNF: Implement compaction for small pointer arrays
Test Plan: Validate Reviewers: austin, erikd, simonmar, dfeuer Reviewed By: dfeuer Subscribers: rwbarton, andrewthad, thomie, dfeuer GHC Trac Issues: #13860, #13857 Differential Revision: https://phabricator.haskell.org/D3888
Diffstat (limited to 'rts/Compact.cmm')
-rw-r--r--rts/Compact.cmm24
1 files changed, 21 insertions, 3 deletions
diff --git a/rts/Compact.cmm b/rts/Compact.cmm
index f20fdbf8bf..72ad4dd437 100644
--- a/rts/Compact.cmm
+++ b/rts/Compact.cmm
@@ -188,9 +188,27 @@ eval:
case
SMALL_MUT_ARR_PTRS_FROZEN0,
SMALL_MUT_ARR_PTRS_FROZEN: {
- // (P_ to) = allocateForCompact(cap, compact, size);
- // use prim memcpy
- ccall barf("stg_compactAddWorkerzh: TODO: SMALL_MUT_ARR_PTRS");
+
+ W_ i, size, ptrs;
+ size = SIZEOF_StgMutArrPtrs + WDS(StgMutArrPtrs_size(p));
+ ptrs = StgMutArrPtrs_ptrs(p);
+ ALLOCATE(compact, BYTES_TO_WDS(size), p, to, tag);
+ P_[pp] = tag | to;
+ SET_HDR(to, StgHeader_info(p), StgHeader_ccs(p));
+ StgMutArrPtrs_ptrs(to) = ptrs;
+ StgMutArrPtrs_size(to) = StgMutArrPtrs_size(p);
+ prim %memcpy(to, p, size, 1);
+ i = 0;
+ loop0:
+ if (i < ptrs) {
+ W_ q;
+ q = to + SIZEOF_StgSmallMutArrPtrs + WDS(i);
+ call stg_compactAddWorkerzh(
+ compact, P_[p + SIZEOF_StgSmallMutArrPtrs + WDS(i)], q);
+ i = i + 1;
+ goto loop0;
+ }
+ return();
}
// Everything else we should copy and evaluate the components: