diff options
author | Ben Gamari <bgamari.foss@gmail.com> | 2017-08-24 21:55:27 -0400 |
---|---|---|
committer | David Feuer <David.Feuer@gmail.com> | 2017-08-24 21:55:28 -0400 |
commit | 5f3d2d3be034e04ba872f2695ab6d7b75de66663 (patch) | |
tree | 131f644eb988628aaf65ca91d7ebaf0eaacbd2c6 /rts/Compact.cmm | |
parent | aeb4bd958439515e02e6f8f9bb22cf84f7cd7d75 (diff) | |
download | haskell-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.cmm | 24 |
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: |