X-Git-Url: http://git.megacz.com/?a=blobdiff_plain;f=ghc%2Fincludes%2FBlock.h;h=bf21ba38a159665056abe8e2ff6fe21496bb94fe;hb=61663f75b09d05a083bcb2c0c3821528e129fcc2;hp=113145e4a4932d4ca4b24bcbc68750a84b02886e;hpb=4391e44f910ce579f269986faef9e5db8907a6c0;p=ghc-hetmet.git diff --git a/ghc/includes/Block.h b/ghc/includes/Block.h index 113145e..bf21ba3 100644 --- a/ghc/includes/Block.h +++ b/ghc/includes/Block.h @@ -1,5 +1,7 @@ /* ----------------------------------------------------------------------------- - * $Id: Block.h,v 1.3 1999/01/13 17:25:51 simonm Exp $ + * $Id: Block.h,v 1.7 2000/04/05 14:26:31 panne Exp $ + * + * (c) The GHC Team, 1998-1999 * * Block structure for the storage manager * @@ -45,12 +47,12 @@ typedef struct _bdescr { struct _bdescr *back; /* used (occasionally) for doubly-linked lists*/ struct _generation *gen; /* generation */ struct _step *step; /* step */ - StgNat32 blocks; /* no. of blocks (if grp head, 0 otherwise) */ - StgNat32 evacuated; /* block is in to-space */ + StgWord32 blocks; /* no. of blocks (if grp head, 0 otherwise) */ + StgWord32 evacuated; /* block is in to-space */ #if SIZEOF_VOID_P == 8 - StgNat32 _padding[2]; + StgWord32 _padding[2]; #else - StgNat32 _padding[0]; + StgWord32 _padding[0]; #endif } bdescr; @@ -64,6 +66,16 @@ typedef struct _bdescr { #define BDESCR_SHIFT 5 #endif +/* 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) + ); +} + /* Useful Macros ------------------------------------------------------------ */ /* Offset of first real data block in a megablock */ @@ -98,4 +110,4 @@ typedef struct _bdescr { #define BLOCKS_TO_MBLOCKS(n) \ (1 + (W_)MBLOCK_ROUND_UP((n-BLOCKS_PER_MBLOCK) * BLOCK_SIZE) / MBLOCK_SIZE) -#endif BLOCK_H +#endif /* BLOCK_H */