X-Git-Url: http://git.megacz.com/?a=blobdiff_plain;f=ghc%2Frts%2FBlockAlloc.h;h=1472ac6f76be5de28af1cf9f45c702ecc4ad3b6a;hb=4dd415e9d8e564ca09937042b5c5605f7f2991c9;hp=a121917c212ae48937a9a5257bad4d4733784cef;hpb=8d0e9847953007239e2c19dd1987f0a78825b897;p=ghc-hetmet.git diff --git a/ghc/rts/BlockAlloc.h b/ghc/rts/BlockAlloc.h index a121917..1472ac6 100644 --- a/ghc/rts/BlockAlloc.h +++ b/ghc/rts/BlockAlloc.h @@ -1,5 +1,6 @@ /* ----------------------------------------------------------------------------- - * $Id: BlockAlloc.h,v 1.4 1999/02/03 16:32:47 simonm Exp $ + * + * (c) The GHC Team, 1998-1999 * * Block Allocator Interface * @@ -8,47 +9,6 @@ #ifndef BLOCK_ALLOC_H #define BLOCK_ALLOC_H -/* Initialisation ---------------------------------------------------------- */ - -extern void initBlockAllocator(void); - -/* Allocation -------------------------------------------------------------- */ - -extern bdescr *allocGroup(nat n); -extern bdescr *allocBlock(void); - -/* De-Allocation ----------------------------------------------------------- */ - -extern void freeGroup(bdescr *p); -extern void freeChain(bdescr *p); - -/* Finding the block descriptor for a given block -------------------------- */ - -static inline bdescr *Bdescr(StgPtr p) -{ - return (bdescr *) - ((((W_)p & MBLOCK_MASK & ~BLOCK_MASK) >> (BLOCK_SHIFT-BDESCR_SHIFT)) - | ((W_)p & ~MBLOCK_MASK) - ); -} - -/* Round a value to megablocks --------------------------------------------- */ - -#define WORDS_PER_MBLOCK (BLOCKS_PER_MBLOCK * BLOCK_SIZE_W) - -static inline nat -round_to_mblocks(nat words) -{ - if (words > WORDS_PER_MBLOCK) { - if ((words % WORDS_PER_MBLOCK) < (WORDS_PER_MBLOCK / 2)) { - words = (words / WORDS_PER_MBLOCK) * WORDS_PER_MBLOCK; - } else { - words = ((words / WORDS_PER_MBLOCK) + 1) * WORDS_PER_MBLOCK; - } - } - return words; -} - /* Debugging -------------------------------------------------------------- */ #ifdef DEBUG @@ -56,4 +16,4 @@ extern void checkFreeListSanity(void); nat countFreeList(void); #endif -#endif BLOCK_ALLOC_H +#endif /* BLOCK_ALLOC_H */