/* -----------------------------------------------------------------------------
- * $Id: StgMacros.h,v 1.50 2002/12/11 15:36:39 simonmar Exp $
+ * $Id: StgMacros.h,v 1.55 2003/07/31 10:07:02 simonmar Exp $
*
* (c) The GHC Team, 1998-1999
*
The stack frame layout for a RET_DYN is like this:
- some pointers
- some nonpointers
- DblReg1-2
- FltReg1-4
- R1-8
- return address
- liveness mask
- stg_gen_chk_info
+ some pointers |-- GET_PTRS(liveness) words
+ some nonpointers |-- GET_NONPTRS(liveness) words
+
+ L1 \
+ D1-2 |-- RET_DYN_NONPTR_REGS_SIZE words
+ F1-4 /
+
+ R1-8 |-- RET_DYN_BITMAP_SIZE words
+
+ return address \
+ liveness mask |-- StgRetDyn structure
+ stg_gen_chk_info /
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 ALL_NON_PTRS 0xffff
-#define RET_DYN_SIZE 16
+#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))
# else
// An object is replaced by a blackhole, so we fill the slop with zeros.
//
+// This looks like it can't work - we're overwriting the contents of
+// the THUNK with slop! Perhaps this never worked??? --SDM
+//
// Todo: maybe use SET_HDR() and remove LDV_recordCreate()?
//
# define UPD_BH_UPDATABLE(info) \
# define UPD_BH_SINGLE_ENTRY(thunk) /* nothing */
#endif /* EAGER_BLACKHOLING */
-#define UPD_FRAME_UPDATEE(p) ((P_)(((StgUpdateFrame *)(p))->updatee))
-
/* -----------------------------------------------------------------------------
Moving Floats and Doubles