projects
/
ghc-hetmet.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
[project @ 2004-02-12 14:58:46 by simonpj]
[ghc-hetmet.git]
/
ghc
/
rts
/
BlockAlloc.h
diff --git
a/ghc/rts/BlockAlloc.h
b/ghc/rts/BlockAlloc.h
index
d3e6d53
..
32db948
100644
(file)
--- a/
ghc/rts/BlockAlloc.h
+++ b/
ghc/rts/BlockAlloc.h
@@
-1,5
+1,7
@@
/* -----------------------------------------------------------------------------
/* -----------------------------------------------------------------------------
- * $Id: BlockAlloc.h,v 1.2 1998/12/02 13:28:13 simonm Exp $
+ * $Id: BlockAlloc.h,v 1.10 2003/11/12 17:49:06 sof Exp $
+ *
+ * (c) The GHC Team, 1998-1999
*
* Block Allocator Interface
*
*
* Block Allocator Interface
*
@@
-22,20
+24,28
@@
extern bdescr *allocBlock(void);
extern void freeGroup(bdescr *p);
extern void freeChain(bdescr *p);
extern void freeGroup(bdescr *p);
extern void freeChain(bdescr *p);
-/* Finding the block descriptor for a given block -------------------------- */
+/* Round a value to megablocks --------------------------------------------- */
+
+#define WORDS_PER_MBLOCK (BLOCKS_PER_MBLOCK * BLOCK_SIZE_W)
-static inline bdescr *Bdescr(StgPtr p)
+INLINE_HEADER nat
+round_to_mblocks(nat words)
{
{
- return (bdescr *)
- ((((W_)p & MBLOCK_MASK & ~BLOCK_MASK) >> (BLOCK_SHIFT-BDESCR_SHIFT))
- | ((W_)p & ~MBLOCK_MASK)
- );
+ 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
extern void checkFreeListSanity(void);
}
/* Debugging -------------------------------------------------------------- */
#ifdef DEBUG
extern void checkFreeListSanity(void);
+nat countFreeList(void);
#endif
#endif
-#endif BLOCK_ALLOC_H
+#endif /* BLOCK_ALLOC_H */