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-08-02 18:23:25 by panne]
[ghc-hetmet.git]
/
ghc
/
includes
/
Block.h
diff --git
a/ghc/includes/Block.h
b/ghc/includes/Block.h
index
1f84f78
..
ac30e8c
100644
(file)
--- a/
ghc/includes/Block.h
+++ b/
ghc/includes/Block.h
@@
-1,5
+1,5
@@
/* -----------------------------------------------------------------------------
/* -----------------------------------------------------------------------------
- * $Id: Block.h,v 1.10 2001/10/03 13:57:42 simonmar Exp $
+ * $Id: Block.h,v 1.16 2003/11/26 12:14:26 simonmar Exp $
*
* (c) The GHC Team, 1998-1999
*
*
* (c) The GHC Team, 1998-1999
*
@@
-14,7
+14,7
@@
* includes/Constants.h, all constants here are derived from these.
*/
* 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)
#define BLOCK_SIZE_W (BLOCK_SIZE/sizeof(W_))
#define BLOCK_SIZE (1<<BLOCK_SHIFT)
#define BLOCK_SIZE_W (BLOCK_SIZE/sizeof(W_))
@@
-23,7
+23,7
@@
#define BLOCK_ROUND_UP(p) ((void *) (((W_)(p)+BLOCK_SIZE-1) & ~BLOCK_MASK))
#define BLOCK_ROUND_DOWN(p) ((void *) ((W_)(p) & ~BLOCK_MASK))
#define BLOCK_ROUND_UP(p) ((void *) (((W_)(p)+BLOCK_SIZE-1) & ~BLOCK_MASK))
#define BLOCK_ROUND_DOWN(p) ((void *) ((W_)(p) & ~BLOCK_MASK))
-/* Megablock related constants (1M megablocks) */
+/* Megablock related constants (MBLOCK_SHIFT is defined in Constants.h) */
#define MBLOCK_SIZE (1<<MBLOCK_SHIFT)
#define MBLOCK_SIZE_W (MBLOCK_SIZE/sizeof(W_))
#define MBLOCK_SIZE (1<<MBLOCK_SHIFT)
#define MBLOCK_SIZE_W (MBLOCK_SIZE/sizeof(W_))
@@
-32,6
+32,11
@@
#define MBLOCK_ROUND_UP(p) ((void *)(((W_)(p)+MBLOCK_SIZE-1) & ~MBLOCK_MASK))
#define MBLOCK_ROUND_DOWN(p) ((void *)((W_)(p) & ~MBLOCK_MASK ))
#define MBLOCK_ROUND_UP(p) ((void *)(((W_)(p)+MBLOCK_SIZE-1) & ~MBLOCK_MASK))
#define MBLOCK_ROUND_DOWN(p) ((void *)((W_)(p) & ~MBLOCK_MASK ))
+/* The largest size an object can be before we give it a block of its
+ * own and treat it as an immovable object during GC, expressed as a
+ * fraction of BLOCK_SIZE.
+ */
+#define LARGE_OBJECT_THRESHOLD ((nat)(BLOCK_SIZE * 8 / 10))
/* -----------------------------------------------------------------------------
* Block descriptor. This structure *must* be the right length, so we
/* -----------------------------------------------------------------------------
* Block descriptor. This structure *must* be the right length, so we
@@
-71,12
+76,18
@@
typedef struct _bdescr {
#define BDESCR_SHIFT 5
#endif
#define BDESCR_SHIFT 5
#endif
+// Block contains objects evacuated during this GC
#define BF_EVACUATED 1
#define BF_EVACUATED 1
+// Block is a large object
#define BF_LARGE 2
#define BF_LARGE 2
+// Block is pinned
+#define BF_PINNED 4
+// Block is part of a compacted generation
+#define BF_COMPACTED 8
/* Finding the block descriptor for a given block -------------------------- */
/* Finding the block descriptor for a given block -------------------------- */
-static inline bdescr *Bdescr(StgPtr p)
+INLINE_HEADER bdescr *Bdescr(StgPtr p)
{
return (bdescr *)
((((W_)p & MBLOCK_MASK & ~BLOCK_MASK) >> (BLOCK_SHIFT-BDESCR_SHIFT))
{
return (bdescr *)
((((W_)p & MBLOCK_MASK & ~BLOCK_MASK) >> (BLOCK_SHIFT-BDESCR_SHIFT))
@@
-89,7
+100,7
@@
static inline bdescr *Bdescr(StgPtr p)
/* Offset of first real data block in a megablock */
#define FIRST_BLOCK_OFF \
/* 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 */
/* First data block in a given megablock */