diff options
author | Giovanni Campagna <gcampagn@cs.stanford.edu> | 2016-07-15 19:47:26 +0100 |
---|---|---|
committer | Simon Marlow <marlowsd@gmail.com> | 2016-07-20 16:35:23 +0100 |
commit | cf989ffe490c146be4ed0fd7e0c00d3ff8fe1453 (patch) | |
tree | 1bdf626d6e713506852bf0015dae1e1be7d280c0 /rts/sm/CNF.h | |
parent | 93acc02f7db7eb86967b4ec586359f408d62f75d (diff) | |
download | haskell-cf989ffe490c146be4ed0fd7e0c00d3ff8fe1453.tar.gz |
Compact Regions
This brings in initial support for compact regions, as described in the
ICFP 2015 paper "Efficient Communication and Collection with Compact
Normal Forms" (Edward Z. Yang et.al.) and implemented by Giovanni
Campagna.
Some things may change before the 8.2 release, but I (Simon M.) wanted
to get the main patch committed so that we can iterate.
What documentation there is is in the Data.Compact module in the new
compact package. We'll need to extend and polish the documentation
before the release.
Test Plan:
validate
(new test cases included)
Reviewers: ezyang, simonmar, hvr, bgamari, austin
Subscribers: vikraman, Yuras, RyanGlScott, qnikst, mboes, facundominguez, rrnewton, thomie, erikd
Differential Revision: https://phabricator.haskell.org/D1264
GHC Trac Issues: #11493
Diffstat (limited to 'rts/sm/CNF.h')
-rw-r--r-- | rts/sm/CNF.h | 71 |
1 files changed, 71 insertions, 0 deletions
diff --git a/rts/sm/CNF.h b/rts/sm/CNF.h new file mode 100644 index 0000000000..b34d9c96c1 --- /dev/null +++ b/rts/sm/CNF.h @@ -0,0 +1,71 @@ +/* ----------------------------------------------------------------------------- + * + * (c) The GHC Team 1998-2014 + * + * GC support for immutable non-GCed structures + * + * Documentation on the architecture of the Garbage Collector can be + * found in the online commentary: + * + * http://ghc.haskell.org/trac/ghc/wiki/Commentary/Rts/Storage/GC + * + * ---------------------------------------------------------------------------*/ + +#ifndef SM_CNF_H +#define SM_CNF_H + +#include "BeginPrivate.h" + +void initCompact (void); +void exitCompact (void); + +StgCompactNFData *compactNew (Capability *cap, + StgWord size); +StgPtr compactAppend(Capability *cap, + StgCompactNFData *str, + StgClosure *what, + StgWord share); +void compactResize(Capability *cap, + StgCompactNFData *str, + StgWord new_size); +void compactFree (StgCompactNFData *str); +void compactMarkKnown(StgCompactNFData *str); +StgWord compactContains(StgCompactNFData *str, + StgPtr what); +StgWord countCompactBlocks(bdescr *outer); + +StgCompactNFDataBlock *compactAllocateBlock(Capability *cap, + StgWord size, + StgCompactNFDataBlock *previous); +StgPtr compactFixupPointers(StgCompactNFData *str, + StgClosure *root); + +INLINE_HEADER StgCompactNFDataBlock *objectGetCompactBlock (StgClosure *closure); +INLINE_HEADER StgCompactNFDataBlock *objectGetCompactBlock (StgClosure *closure) +{ + bdescr *object_block, *head_block; + + object_block = Bdescr((StgPtr)closure); + + ASSERT ((object_block->flags & BF_COMPACT) != 0); + + if (object_block->blocks == 0) + head_block = object_block->link; + else + head_block = object_block; + + ASSERT ((head_block->flags & BF_COMPACT) != 0); + + return (StgCompactNFDataBlock*)(head_block->start); +} + +INLINE_HEADER StgCompactNFData *objectGetCompact (StgClosure *closure); +INLINE_HEADER StgCompactNFData *objectGetCompact (StgClosure *closure) +{ + StgCompactNFDataBlock *block = objectGetCompactBlock (closure); + return block->owner; +} + +#include "EndPrivate.h" + +#endif // SM_COMPACT_H |