X-Git-Url: http://git.vpit.fr/?a=blobdiff_plain;f=autovivification.xs;h=9577d87547cbe1170b45919eddd0ae0ea78b8635;hb=fc5a59c6495fe7d4c4607fa2379b5f0084e1dd13;hp=0d7e5ed34e1b0257f1e6aefb1bcb32a7d47b63e6;hpb=d52659669c6fc0309f89083ff0c6835931e75a33;p=perl%2Fmodules%2Fautovivification.git diff --git a/autovivification.xs b/autovivification.xs index 0d7e5ed..9577d87 100644 --- a/autovivification.xs +++ b/autovivification.xs @@ -93,11 +93,11 @@ #endif #if defined(OP_CHECK_MUTEX_LOCK) && defined(OP_CHECK_MUTEX_UNLOCK) -# define A_CHECK_MUTEX_LOCK OP_CHECK_MUTEX_LOCK -# define A_CHECK_MUTEX_UNLOCK OP_CHECK_MUTEX_UNLOCK +# define A_CHECK_LOCK OP_CHECK_MUTEX_LOCK +# define A_CHECK_UNLOCK OP_CHECK_MUTEX_UNLOCK #else -# define A_CHECK_MUTEX_LOCK OP_REFCNT_LOCK -# define A_CHECK_MUTEX_UNLOCK OP_REFCNT_UNLOCK +# define A_CHECK_LOCK OP_REFCNT_LOCK +# define A_CHECK_UNLOCK OP_REFCNT_UNLOCK #endif typedef OP *(*a_ck_t)(pTHX_ OP *); @@ -110,24 +110,24 @@ typedef OP *(*a_ck_t)(pTHX_ OP *); static void a_ck_replace(pTHX_ OPCODE type, a_ck_t new_ck, a_ck_t *old_ck_p) { #define a_ck_replace(T, NC, OCP) a_ck_replace(aTHX_ (T), (NC), (OCP)) - A_CHECK_MUTEX_LOCK; + A_CHECK_LOCK; if (!*old_ck_p) { *old_ck_p = PL_check[type]; PL_check[type] = new_ck; } - A_CHECK_MUTEX_UNLOCK; + A_CHECK_UNLOCK; } #endif static void a_ck_restore(pTHX_ OPCODE type, a_ck_t *old_ck_p) { #define a_ck_restore(T, OCP) a_ck_restore(aTHX_ (T), (OCP)) - A_CHECK_MUTEX_LOCK; + A_CHECK_LOCK; if (*old_ck_p) { PL_check[type] = *old_ck_p; *old_ck_p = 0; } - A_CHECK_MUTEX_UNLOCK; + A_CHECK_UNLOCK; } /* --- Helpers ------------------------------------------------------------- */ @@ -800,6 +800,15 @@ static OP *a_pp_root_binop(pTHX) { /* ... pp_multideref ....................................................... */ +/* This pp replacement is actually only called for topmost exists/delete ops, + * because we hijack the [ah]elem check functions and this disables the + * optimization for lvalue and rvalue dereferencing. In particular, the + * OPf_MOD branches should never be covered. In the future, the multideref + * optimization might also be disabled for custom exists/delete check functions, + * which will make this section unnecessary. However, the code tries to be as + * general as possible in case I think of a way to reenable the multideref + * optimization even when this module is in use. */ + static UV a_do_multideref(const OP *o, UV flags) { UV isexdel, other_flags;