1 /* -----------------------------------------------------------------------------
3 * (c) The GHC Team, 1998-2004
7 * ---------------------------------------------------------------------------*/
13 #include "BeginPrivate.h"
16 /* -----------------------------------------------------------------------------
18 -------------------------------------------------------------------------- */
21 * After all, we do *NOT* need to call LDV_RECORD_CREATE() for IND
22 * closures because they are inherently used. But, it corrupts
23 * the invariants that every closure keeps its creation time in the profiling
24 * field. So, we call LDV_RECORD_CREATE().
27 /* We have two versions of this macro (sadly), one for use in C-- code,
28 * and the other for C.
30 * The and_then argument is a performance hack so that we can paste in
31 * the continuation code directly. It helps shave a couple of
32 * instructions off the common case in the update code, which is
33 * worthwhile (the update code is often part of the inner loop).
34 * (except that gcc now appears to common up this code again and
35 * invert the optimisation. Grrrr --SDM).
39 #define updateWithIndirection(p1, p2, and_then) \
42 OVERWRITING_CLOSURE(p1); \
43 StgInd_indirectee(p1) = p2; \
44 prim %write_barrier() []; \
45 SET_INFO(p1, stg_BLACKHOLE_info); \
46 LDV_RECORD_CREATE(p1); \
48 if (bdescr_gen_no(bd) != 0 :: bits16) { \
49 recordMutableCap(p1, TO_W_(bdescr_gen_no(bd)), R1); \
57 #else /* !CMINUSMINUS */
59 INLINE_HEADER void updateWithIndirection (Capability *cap,
65 ASSERT( (P_)p1 != (P_)p2 );
66 /* not necessarily true: ASSERT( !closure_IND(p1) ); */
67 /* occurs in RaiseAsync.c:raiseAsync() */
68 OVERWRITING_CLOSURE(p1);
69 ((StgInd *)p1)->indirectee = p2;
71 SET_INFO(p1, &stg_BLACKHOLE_info);
72 LDV_RECORD_CREATE(p1);
73 bd = Bdescr((StgPtr)p1);
74 if (bd->gen_no != 0) {
75 recordMutableCap(p1, cap, bd->gen_no);
82 #endif /* CMINUSMINUS */
85 #include "EndPrivate.h"
88 #endif /* UPDATES_H */