4 /* Here's where we hide things about heap and stack directions.
6 NB: The call to "setNewHeapUsage 0 words_required" in CgClosure in
7 the code generator is also direction-sensitive.
12 A stack: grows downwards
13 B stack: grows upwards
16 /* ALL THE ARITHMETIC IN HERE IS IN UNITS OF WORDS */
19 /****************************************************************
23 * ***************************************************************/
25 /* HEAP_FRAME_BASE( low-addr, size ) gives the address of the
26 first word to be allocated in the heap space
27 starting at address low-addr. size is in words.
29 HEAP_FRAME_LIMIT( low-addr, size ) gives the address of the
30 last word to be allocated.
32 #define HEAP_FRAME_BASE(space,size) (space)
33 #define HEAP_FRAME_LIMIT(space,size) (((P_) (space)) + (size) - 1)
36 /* Hp + HREL(n) addresses the n'th word into already-allocated space
37 from Hp. n=0 addresses the ``most recently allocated'' word.
39 OBSOLETE BECAUSE WE'VE FIXED THE DIRECTION OF HEAP GROWTH (upwards)
41 #define HREL(offset) (-(offset))
46 /* HEAP_OVERFLOW_OP( heap-ptr, heap-limit ) is true if the heap has
49 #define HEAP_OVERFLOW_OP(a,hplim) ((a) > (hplim))
52 /****************************************************************
56 * ***************************************************************/
58 /* STK_A_FRAME_BASE( low-addr, size ) gives the address of the bottom-most
59 word of A stack, given that A and B stack are to be allocated
60 from a block of store starting at low-addr. size is in words
62 STK_B_FRAME_BASE( low-addr, size) does the same for B stack
64 #define STK_A_FRAME_BASE(space,size) (((PP_) (space)) + (size) - 1)
65 #define STK_B_FRAME_BASE(space,size) (space)
68 /* SpA + AREL(n) addresses the n'th word from the top of A stack
72 #define AREL(offset) (offset)
73 #define BREL(offset) (-(offset))
76 /* STKS_OVERFLOW_OP( a-stack-space, b-stack-space ) is true if SpA and SpB
79 We cast SpA to StgPtr, because it is normally an StgPtrPtr.
81 #define STKS_OVERFLOW_OP(a,b) ((P_)(SpA) - AREL((a) + (b)) <= SpB)
83 /* And a version that generates slightly-worse
84 code, but which does not need to know about
85 SpA and SpB (used in RTS)
87 #define UNREG_STKS_OVERFLOW_OP(a,b) ((P_)(a) <= (b))
89 #endif /* ! STGDIRECTION_H */