[project @ 2004-02-12 02:04:59 by mthomas]
[ghc-hetmet.git] / ghc / includes / Constants.h
index ec20df6..8974052 100644 (file)
@@ -1,7 +1,7 @@
 /* ----------------------------------------------------------------------------
- * $Id: Constants.h,v 1.18 2001/10/03 13:57:42 simonmar Exp $
+ * $Id: Constants.h,v 1.25 2003/04/28 09:55:20 simonmar Exp $
  *
- * (c) The GHC Team, 1998-1999
+ * (c) The GHC Team, 1998-2002
  *
  * Constants
  *
@@ -21,7 +21,7 @@
 /* -----------------------------------------------------------------------------
    Minimum closure sizes
 
-   Here We define the minimum size for updatable closures. This must be at
+   Here we define the minimum size for updatable closures. This must be at
    least 2, to allow for cons cells and linked indirections. All updates
    will be performed on closures of this size. For non-updatable closures
    the minimum size is 1 to allow for a forwarding pointer.
    Constants to do with specialised closure types.
    -------------------------------------------------------------------------- */
 
-/* We have some pre-compiled selector thunks defined in
- * StgSelectors.hc in the runtime system.  This constant defines the
- * highest selectee index that we can replace with a reference to the
- * pre-compiled code.
+/* We have some pre-compiled selector thunks defined in rts/StgStdThunks.hc.
+ * This constant defines the highest selectee index that we can replace with a 
+ * reference to the pre-compiled code.
  */
 
 #define MAX_SPEC_SELECTEE_SIZE 15
@@ -64,6 +63,7 @@
  */
 
 #define MAX_SPEC_AP_SIZE       8
+/* ToDo: make it 8 again */
 
 /* Specialised FUN/THUNK/CONSTR closure types */
 
 /* You can change these constants (I hope) but be sure to modify
    rts/StgMiscClosures.hs accordingly. */
 
-/*---- Minimum number of words left in heap after GC to carry on */
-
-#define HEAP_HWM_WORDS 1024
-
 /* -----------------------------------------------------------------------------
    Semi-Tagging constants
 
 
 /* -----------------------------------------------------------------------------
    How much C stack to reserve for local temporaries when in the STG
-   world.  Used in StgRun.S and StgCRun.c.
+   world.  Used in StgCRun.c.
    -------------------------------------------------------------------------- */
 
 #define RESERVED_C_STACK_BYTES (2048 * SIZEOF_LONG)
    
    This must be large enough to accomodate the largest stack frame
    pushed in one of the heap check fragments in HeapStackCheck.hc
-   (ie. currently the generic heap checks - 19 words).
+   (ie. currently the generic heap checks - 3 words for StgRetDyn,
+   18 words for the saved registers, see StgMacros.h).  
+
+   In the event of an unboxed tuple or let-no-escape stack/heap check
+   failure, there will be other words on the stack which are covered
+   by the RET_DYN frame.  These will have been accounted for by stack
+   checks however, so we don't need to allow for them here.
    -------------------------------------------------------------------------- */
 
-#define RESERVED_STACK_WORDS 19
+#define RESERVED_STACK_WORDS 21
 
 /* -----------------------------------------------------------------------------
    Storage manager constants
 /* The size of a megablock (2^MBLOCK_SHIFT bytes) */
 #define MBLOCK_SHIFT   20
 
-/* 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.
+/* -----------------------------------------------------------------------------
+   Bitmap/size fields (used in info tables)
+   -------------------------------------------------------------------------- */
+
+/* In a 32-bit bitmap field, we use 5 bits for the size, and 27 bits
+ * for the bitmap.  If the bitmap requires more than 27 bits, then we
+ * store it in a separate array, and leave a pointer in the bitmap
+ * field.  On a 64-bit machine, the sizes are extended accordingly.
  */
-#define LARGE_OBJECT_THRESHOLD ((nat)(BLOCK_SIZE * 8 / 10))
+#if SIZEOF_VOID_P == 4
+#define BITMAP_SIZE_MASK     0x1f
+#define BITMAP_BITS_SHIFT    5
+#elif SIZEOF_VOID_P == 8
+#define BITMAP_SIZE_MASK     0x3f
+#define BITMAP_BITS_SHIFT    6
+#else
+#error unknown SIZEOF_VOID_P
+#endif
 
 #endif /* CONSTANTS_H */
-