X-Git-Url: http://git.megacz.com/?a=blobdiff_plain;f=ghc%2Fincludes%2FBlock.h;h=d7599c5931de7a5d17eab0cec867f70e61bbe95e;hb=423d477bfecd490de1449c59325c8776f91d7aac;hp=d6bfdfe603c07ad92356289bc90cbd6a82d2c07e;hpb=6f83fbc0a8b201a3d2ad20e4d8c707613d45cf2a;p=ghc-hetmet.git diff --git a/ghc/includes/Block.h b/ghc/includes/Block.h index d6bfdfe..d7599c5 100644 --- a/ghc/includes/Block.h +++ b/ghc/includes/Block.h @@ -1,5 +1,5 @@ /* ----------------------------------------------------------------------------- - * $Id: Block.h,v 1.8 2001/07/23 10:47:16 simonmar Exp $ + * $Id: Block.h,v 1.17 2004/08/13 13:09:09 simonmar Exp $ * * (c) The GHC Team, 1998-1999 * @@ -14,22 +14,29 @@ * includes/Constants.h, all constants here are derived from these. */ -/* Block related constants (4k blocks) */ +/* Block related constants (BLOCK_SHIFT is defined in Constants.h) */ +#define BLOCK_SIZE (1<> (BLOCK_SHIFT-BDESCR_SHIFT)) \ + | ((p) & ~MBLOCK_MASK)) + +#else + +INLINE_HEADER bdescr *Bdescr(StgPtr p) { return (bdescr *) ((((W_)p & MBLOCK_MASK & ~BLOCK_MASK) >> (BLOCK_SHIFT-BDESCR_SHIFT)) @@ -76,12 +105,14 @@ static inline bdescr *Bdescr(StgPtr p) ); } +#endif + /* Useful Macros ------------------------------------------------------------ */ /* Offset of first real data block in a megablock */ #define FIRST_BLOCK_OFF \ - ((W_)BLOCK_ROUND_UP(MBLOCK_SIZE / BLOCK_SIZE * BDESCR_SIZE)) + ((W_)BLOCK_ROUND_UP(BDESCR_SIZE * (MBLOCK_SIZE / BLOCK_SIZE))) /* First data block in a given megablock */ @@ -110,4 +141,20 @@ static inline bdescr *Bdescr(StgPtr p) #define BLOCKS_TO_MBLOCKS(n) \ (1 + (W_)MBLOCK_ROUND_UP((n-BLOCKS_PER_MBLOCK) * BLOCK_SIZE) / MBLOCK_SIZE) + +/* Double-linked block lists: --------------------------------------------- */ + +#ifndef CMINUSMINUS +INLINE_HEADER void +dbl_link_onto(bdescr *bd, bdescr **list) +{ + bd->link = *list; + bd->u.back = NULL; + if (*list) { + (*list)->u.back = bd; /* double-link the list */ + } + *list = bd; +} +#endif + #endif /* BLOCK_H */