6 COMMENT__(The COMMON_ITBLS macro determines whether we use commoned-up
7 info tables and rep tables instead of the old info table system.)
12 COMMENT__(This code has to go through a Haskell compiler too)
14 COMMENT__(We assume 8 bit bytes.)
15 #define BITS_PER_BYTE 8
16 #define BITS_IN(x) (BITS_PER_BYTE * sizeof(x))
20 #define NON_PROTO(x) /* nothing */
21 #define STG_VOLATILE volatile
22 #define STG_NO_ARGS void
23 #define CAT2(a,b) a##b
24 #define CAT3(a,b,c) a##b##c
25 #define CAT4(a,b,c,d) a##b##c##d
26 #define CAT5(a,b,c,d,e) a##b##c##d##e
27 #define CAT6(a,b,c,d,e,f) a##b##c##d##e##f
31 #define NON_PROTO(x) x
32 #define STG_VOLATILE /* no volatile */
33 #define STG_NO_ARGS /* no such thing either */
34 #define CAT2(a,b) a/**/b
35 #define CAT3(a,b,c) a/**/b/**/c
36 #define CAT4(a,b,c,d) a/**/b/**/c/**/d
37 #define CAT5(a,b,c,d,e) a/**/b/**/c/**/d/**/e
38 #define CAT6(a,b,c,d,e,f) a/**/b/**/c/**/d/**/e/**/f
39 #endif /* ! __STDC__ */
42 #define STG_NORETURN __attribute__((noreturn))
43 #define STG_INLINE __inline__
45 #define STG_NORETURN /* no such thing */
46 #define STG_INLINE /* no inline functions */
50 ------------------------------------------------------------------------
51 Steve Maguires "Writing Solid Code" suggests that (in the debugging
52 version) we should work hard to make bugs show themselves at the
53 earliest possible moment.
55 In particular, it suggests that the memory management system should
56 trash memory when it is allocated and when it is deallocated so that
57 references to uninitialised memory or to released memory will show up
60 By "trashing", I mean writing easily recognisable "nonsense" bit
61 patterns over the block of memory. It is worth taking some care to
64 1) Are meaningless pointers (ideally causing memory exceptions)
68 2) Are "weird-looking" integers (whether treated as 8, 16, 32 or 64
69 bits) (A large (definately non-zero) value).
71 3) Make strange-looking strings when concatenated.
73 4) Are meaningless machine code (ideally causing exceptions)
75 We should also choose different values for initialisation and
76 deallocation to make it easier to identify the source of the bug.
79 ------------------------------------------------------------------------
84 #define DEALLOCATED_TRASH 0xdeadbeefdeadbeef
86 #define DEALLOCATED_TRASH 0xdeadbeef
89 #endif /* ! STGMACHDEPS_H */