/* -----------------------------------------------------------------------------
- * $Id: StgMacros.h,v 1.51 2003/04/22 16:25:08 simonmar Exp $
+ * $Id: StgMacros.h,v 1.53 2003/04/28 10:02:15 simonmar Exp $
*
* (c) The GHC Team, 1998-1999
*
we assume that the size of a double is always 2 pointers (wasting a
word when it is only one pointer, but avoiding lots of #ifdefs).
+ NOTE: if you change the layout of RET_DYN stack frames, then you
+ might also need to adjust the value of RESERVED_STACK_WORDS in
+ Constants.h.
-------------------------------------------------------------------------- */
// VERY MAGIC CONSTANTS!
-// must agree with code in HeapStackCheck.c, stg_gen_chk
+// must agree with code in HeapStackCheck.c, stg_gen_chk, and
+// RESERVED_STACK_WORDS in Constants.h.
//
#define RET_DYN_BITMAP_SIZE 8
#define RET_DYN_NONPTR_REGS_SIZE 10
#define ALL_NON_PTRS 0xff
+// Sanity check that RESERVED_STACK_WORDS is reasonable. We can't
+// just derive RESERVED_STACK_WORDS because it's used in Haskell code
+// too.
+#if RESERVED_STACK_WORDS != (3 + RET_DYN_BITMAP_SIZE + RET_DYN_NONPTR_REGS_SIZE)
+#error RESERVED_STACK_WORDS may be wrong!
+#endif
+
#define LIVENESS_MASK(ptr_regs) (ALL_NON_PTRS ^ (ptr_regs))
// We can have up to 255 pointers and 255 nonpointers in the stack