projects
/
ghc-hetmet.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
[project @ 2003-08-13 12:51:01 by simonmar]
[ghc-hetmet.git]
/
ghc
/
includes
/
Block.h
diff --git
a/ghc/includes/Block.h
b/ghc/includes/Block.h
index
f924a8e
..
867a73c
100644
(file)
--- 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.13 2003/03/28 15:13:52 sof Exp $
*
* (c) The GHC Team, 1998-1999
*
*
* (c) The GHC Team, 1998-1999
*
@@
-14,22
+14,29
@@
* 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_MASK (BLOCK_SIZE-1)
#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_SIZE_W (BLOCK_SIZE/sizeof(W_))
#define BLOCK_MASK (BLOCK_SIZE-1)
#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_MASK (MBLOCK_SIZE-1)
#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_SIZE_W (MBLOCK_SIZE/sizeof(W_))
#define MBLOCK_MASK (MBLOCK_SIZE-1)
#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
@@
-44,15
+51,18
@@
typedef struct _bdescr {
StgPtr start; /* start addr of memory */
StgPtr free; /* first free byte of memory */
struct _bdescr *link; /* used for chaining blocks together */
StgPtr start; /* start addr of memory */
StgPtr free; /* first free byte of memory */
struct _bdescr *link; /* used for chaining blocks together */
- struct _bdescr *back; /* used (occasionally) for doubly-linked lists*/
- struct _generation *gen; /* generation */
+ union {
+ struct _bdescr *back; /* used (occasionally) for doubly-linked lists*/
+ StgWord *bitmap;
+ } u;
+ unsigned int gen_no; /* generation */
struct _step *step; /* step */
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 flags; /* block is in to-space */
#if SIZEOF_VOID_P == 8
#if SIZEOF_VOID_P == 8
- StgNat32 _padding[2];
+ StgWord32 _padding[2];
#else
#else
- StgNat32 _padding[0];
+ StgWord32 _padding[0];
#endif
} bdescr;
#endif
} bdescr;
@@
-66,12
+76,25
@@
typedef struct _bdescr {
#define BDESCR_SHIFT 5
#endif
#define BDESCR_SHIFT 5
#endif
+#define BF_EVACUATED 1
+#define BF_LARGE 2
+
+/* 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 */
#define FIRST_BLOCK_OFF \
/* 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 */
/* First data block in a given megablock */
@@
-100,4
+123,4
@@
typedef struct _bdescr {
#define BLOCKS_TO_MBLOCKS(n) \
(1 + (W_)MBLOCK_ROUND_UP((n-BLOCKS_PER_MBLOCK) * BLOCK_SIZE) / MBLOCK_SIZE)
#define BLOCKS_TO_MBLOCKS(n) \
(1 + (W_)MBLOCK_ROUND_UP((n-BLOCKS_PER_MBLOCK) * BLOCK_SIZE) / MBLOCK_SIZE)
-#endif BLOCK_H
+#endif /* BLOCK_H */