4 #include "caps.h" /* XSH_HAS_PERL() */
5 #include "util.h" /* NOOP */
8 # error threads.h must be loaded at the very end
11 #ifndef XSH_THREADS_GLOBAL_SETUP
12 # define XSH_THREADS_GLOBAL_SETUP 1
15 #ifndef XSH_THREADS_GLOBAL_TEARDOWN
16 # define XSH_THREADS_GLOBAL_TEARDOWN 1
21 # define OpSIBLING(O) OP_SIBLING(O)
23 # define OpSIBLING(O) ((O)->op_sibling)
27 #ifndef OpMAYBESIB_set
28 # define OpMAYBESIB_set(O, S, P) ((O)->op_sibling = (S))
32 # define OP_NAME(O) (PL_op_name[(O)->op_type])
36 # define OP_CLASS(O) (PL_opargs[(O)->op_type] & OA_CLASS_MASK)
39 #if defined(OP_CHECK_MUTEX_LOCK) && defined(OP_CHECK_MUTEX_UNLOCK)
40 # define XSH_CHECK_LOCK OP_CHECK_MUTEX_LOCK
41 # define XSH_CHECK_UNLOCK OP_CHECK_MUTEX_UNLOCK
42 #elif XSH_HAS_PERL(5, 9, 3)
43 # define XSH_CHECK_LOCK OP_REFCNT_LOCK
44 # define XSH_CHECK_UNLOCK OP_REFCNT_UNLOCK
46 /* Before perl 5.9.3, da_ck_*() calls are already protected by the XSH_LOADED
47 * mutex, which falls back to the OP_REFCNT mutex. Make sure we don't lock it
49 # define XSH_CHECK_LOCK NOOP
50 # define XSH_CHECK_UNLOCK NOOP
53 typedef OP *(*xsh_check_t)(pTHX_ OP *);
55 #ifdef wrap_op_checker
57 # define xsh_ck_replace(T, NC, OCP) wrap_op_checker((T), (NC), (OCP))
61 static void xsh_ck_replace(pTHX_ OPCODE type, xsh_check_t new_ck, xsh_check_t *old_ck_p) {
62 #define xsh_ck_replace(T, NC, OCP) xsh_ck_replace(aTHX_ (T), (NC), (OCP))
65 *old_ck_p = PL_check[type];
66 PL_check[type] = new_ck;
73 static void xsh_ck_restore(pTHX_ OPCODE type, xsh_check_t *old_ck_p) {
74 #define xsh_ck_restore(T, OCP) xsh_ck_restore(aTHX_ (T), (OCP))
77 PL_check[type] = *old_ck_p;
83 #endif /* XSH_OPS_H */