X-Git-Url: http://git.megacz.com/?a=blobdiff_plain;f=ghc%2Fincludes%2FConstants.h;h=5ce56d92c9d1a15de91fd52ef33c2f2eca0972ab;hb=3c709aa79b9a887bf845eaaa0f99a51bdadf04fe;hp=d97016044d4ff31ff9b15280446aa25f95640792;hpb=ec48c5ab896b9334fa8d747c0a542e0679fe3a8f;p=ghc-hetmet.git diff --git a/ghc/includes/Constants.h b/ghc/includes/Constants.h index d970160..5ce56d9 100644 --- a/ghc/includes/Constants.h +++ b/ghc/includes/Constants.h @@ -1,11 +1,17 @@ /* ---------------------------------------------------------------------------- - * $Id: Constants.h,v 1.3 1999/01/21 10:31:41 simonm Exp $ + * $Id: Constants.h,v 1.22 2002/12/11 15:36:37 simonmar Exp $ + * + * (c) The GHC Team, 1998-2002 * * Constants * - * NOTE: this information is used by both the compiler and the RTS, - * and *must* be kept up-to-date with respect to the rest of the - * world. + * NOTE: this information is used by both the compiler and the RTS. + * Some of it is tweakable, and some of it must be kept up to date + * with various other parts of the system. + * + * Constants which are derived automatically from other definitions in + * the system (eg. structure sizes) are generated into the file + * DerivedConstants.h by a C program (mkDerivedConstantsHdr). * * -------------------------------------------------------------------------- */ @@ -13,35 +19,6 @@ #define CONSTANTS_H /* ----------------------------------------------------------------------------- - Header Sizes - - NOTE: keep these in line with the real definitions in Closures.h - -------------------------------------------------------------------------- */ - -#define STD_HDR_SIZE 1 -#define PROF_HDR_SIZE 1 -#define GRAN_HDR_SIZE 1 -#define TICKY_HDR_SIZE 0 - -#define ARR_HDR_SIZE 1 - -/* ----------------------------------------------------------------------------- - Info Table sizes - - The native code generator needs to know these things, and can't use - the C sizeof() function. - - NOTE: keep these in line with the real definitions in InfoTables.h - - NOTE: the PROF, and GRAN values are *wrong* (ToDo) - -------------------------------------------------------------------------- */ - -#define STD_ITBL_SIZE 3 -#define PROF_ITBL_SIZE 1 -#define GRAN_ITBL_SIZE 1 -#define TICKY_ITBL_SIZE 0 - -/* ----------------------------------------------------------------------------- Minimum closure sizes Here We define the minimum size for updatable closures. This must be at @@ -87,34 +64,13 @@ */ #define MAX_SPEC_AP_SIZE 8 +/* ToDo: make it 8 again */ -/* ----------------------------------------------------------------------------- - Update Frame Layout - -------------------------------------------------------------------------- */ - -#define NOSCC_UF_SIZE 3 -#define SCC_UF_SIZE 4 - -#if defined(PROFILING) -#define UF_SIZE SCC_UF_SIZE -#else -#define UF_SIZE NOSCC_UF_SIZE -#endif - -#define UF_RET 0 -#define UF_SU 1 -#define UF_UPDATEE 2 -#define UF_CCS 3 - -/* ----------------------------------------------------------------------------- - SEQ frame size - -------------------------------------------------------------------------- */ +/* Specialised FUN/THUNK/CONSTR closure types */ -#if defined(PROFILING) -#define SEQ_FRAME_SIZE 3 -#else -#define SEQ_FRAME_SIZE 2 -#endif +#define MAX_SPEC_THUNK_SIZE 2 +#define MAX_SPEC_FUN_SIZE 2 +#define MAX_SPEC_CONSTR_SIZE 2 /* ----------------------------------------------------------------------------- STG Registers. @@ -129,35 +85,20 @@ /* register is only used for returning (unboxed) 64-bit vals */ #define MAX_LONG_REG 1 -/*---- The size of an StgDouble, in StgWords. */ - -#if SIZEOF_VOID_P == SIZEOF_DOUBLE -#define DOUBLE_SIZE 1 -#else -#define DOUBLE_SIZE 2 -#endif - -/*---- The size of Stg{Int,Word}64e, in StgWords. */ -#if SIZEOF_VOID_P == 8 -#define WORD64_SIZE 1 -#define INT64_SIZE 1 -#else -#define WORD64_SIZE 2 -#define INT64_SIZE 2 -#endif - /*---- Maximum number of constructors in a data type for direct-returns. */ #define MAX_VECTORED_RTN 8 -/*---- Range of built-in table of static small int-like closures. */ +/*---- Range of built-in table of static small int-like and char-like closures. */ -#define MAX_INTLIKE (16) +#define MAX_INTLIKE 16 #define MIN_INTLIKE (-16) -/*---- Minimum number of words left in heap after GC to carry on */ +#define MAX_CHARLIKE 255 +#define MIN_CHARLIKE 0 -#define HEAP_HWM_WORDS 1024 +/* You can change these constants (I hope) but be sure to modify + rts/StgMiscClosures.hs accordingly. */ /* ----------------------------------------------------------------------------- Semi-Tagging constants @@ -178,18 +119,11 @@ #define INFO_FIRST_TAG 0 /* ----------------------------------------------------------------------------- - Context switch timing constants. - -------------------------------------------------------------------------- */ - -#define CS_MAX_FREQUENCY 100 /* context switches per second */ -#define CS_MIN_MILLISECS (1000/CS_MAX_FREQUENCY)/* milliseconds per slice */ - -/* ----------------------------------------------------------------------------- How much C stack to reserve for local temporaries when in the STG world. Used in StgRun.S and StgCRun.c. -------------------------------------------------------------------------- */ -#define RESERVED_C_STACK_BYTES (512 * SIZEOF_LONG) +#define RESERVED_C_STACK_BYTES (2048 * SIZEOF_LONG) /* ----------------------------------------------------------------------------- How much Haskell stack space to reserve for the saving of registers @@ -206,12 +140,10 @@ Storage manager constants -------------------------------------------------------------------------- */ -/* The size of a block */ -#define BLOCK_SIZE 0x2000 -#define BLOCK_SHIFT 13 +/* The size of a block (2^BLOCK_SHIFT bytes) */ +#define BLOCK_SHIFT 12 -/* The size of a megablock */ -#define MBLOCK_SIZE 0x100000 +/* 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 @@ -220,5 +152,23 @@ */ #define LARGE_OBJECT_THRESHOLD ((nat)(BLOCK_SIZE * 8 / 10)) -#endif /* CONSTANTS_H */ +/* ----------------------------------------------------------------------------- + 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. + */ +#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 */