X-Git-Url: http://git.megacz.com/?a=blobdiff_plain;f=ghc%2Fincludes%2FBlock.h;h=d7599c5931de7a5d17eab0cec867f70e61bbe95e;hb=423d477bfecd490de1449c59325c8776f91d7aac;hp=f924a8e93f2e47717f4120ae5f84934a276f37f7;hpb=7f309f1c021e7583f724cce599ce2dd3c439361b;p=ghc-hetmet.git diff --git a/ghc/includes/Block.h b/ghc/includes/Block.h index f924a8e..d7599c5 100644 --- a/ghc/includes/Block.h +++ b/ghc/includes/Block.h @@ -1,5 +1,5 @@ /* ----------------------------------------------------------------------------- - * $Id: Block.h,v 1.4 1999/02/05 16:02:19 simonm 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)) + | ((W_)p & ~MBLOCK_MASK) + ); +} + +#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 */ @@ -100,4 +141,20 @@ typedef struct _bdescr { #define BLOCKS_TO_MBLOCKS(n) \ (1 + (W_)MBLOCK_ROUND_UP((n-BLOCKS_PER_MBLOCK) * BLOCK_SIZE) / MBLOCK_SIZE) -#endif BLOCK_H + +/* 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 */