-/* -----------------------------------------------------------------------------
- Updates
-
- We have two layers of update macros. The top layer, UPD_IND() and
- friends perform all the work of an update. In detail:
-
- - if the closure being updated is a blocking queue, then all the
- threads waiting on the blocking queue are updated.
-
- - then the lower level updateWithIndirection() macro is invoked
- to actually replace the closure with an indirection (see below).
-
- -------------------------------------------------------------------------- */
-
-#ifdef TICKY_TICKY
-# define UPD_IND(updclosure, heapptr) \
- UPD_PERM_IND(updclosure,heapptr)
-# define UPD_SPEC_IND(updclosure, ind_info, heapptr, and_then) \
- UPD_PERM_IND(updclosure,heapptr); and_then
-#else
-# define SEMI ;
-# define UPD_IND(updclosure, heapptr) \
- UPD_REAL_IND(updclosure,INFO_PTR(stg_IND_info),heapptr,SEMI)
-# define UPD_SPEC_IND(updclosure, ind_info, heapptr, and_then) \
- UPD_REAL_IND(updclosure,ind_info,heapptr,and_then)
-#endif
-
-/* These macros have to work in both C and C--, so here's the
- * impedence matching:
- */
-#ifdef CMINUSMINUS
-#define BLOCK_BEGIN
-#define BLOCK_END
-#define DECLARE_IPTR(info) W_ info
-#define FCALL foreign "C"
-#define INFO_PTR(info) info
-#define ARG_PTR "ptr"
-#else
-#define BLOCK_BEGIN {
-#define BLOCK_END }
-#define DECLARE_IPTR(info) const StgInfoTable *(info)
-#define FCALL /* nothing */
-#define INFO_PTR(info) &info
-#define StgBlockingQueue_blocking_queue(closure) \
- (((StgBlockingQueue *)closure)->blocking_queue)
-#define ARG_PTR /* nothing */
-#endif
-
-/* UPD_IND actually does a PERM_IND if TICKY_TICKY is on;
- if you *really* need an IND use UPD_REAL_IND
- */
-#define UPD_REAL_IND(updclosure, ind_info, heapptr, and_then) \
- BLOCK_BEGIN \
- DECLARE_IPTR(info); \
- info = GET_INFO(updclosure); \
- updateWithIndirection(ind_info, \
- updclosure, \
- heapptr, \
- and_then); \
- BLOCK_END
-
-#if defined(PROFILING) || defined(TICKY_TICKY)
-#define UPD_PERM_IND(updclosure, heapptr) \
- BLOCK_BEGIN \
- updateWithPermIndirection(updclosure, \
- heapptr); \
- BLOCK_END
-#endif
-
-#if defined(RTS_SUPPORTS_THREADS)
-
-# ifdef TICKY_TICKY
-# define UPD_IND_NOLOCK(updclosure, heapptr) \
- BLOCK_BEGIN \
- updateWithPermIndirection(updclosure, \
- heapptr); \
- BLOCK_END
-# else
-# define UPD_IND_NOLOCK(updclosure, heapptr) \
- BLOCK_BEGIN \
- updateWithIndirection(INFO_PTR(stg_IND_info), \
- updclosure, \
- heapptr,); \
- BLOCK_END
-# endif
-
-#else
-#define UPD_IND_NOLOCK(updclosure,heapptr) UPD_IND(updclosure,heapptr)