X-Git-Url: http://git.vpit.fr/?a=blobdiff_plain;f=Magic.xs;h=d579f9ee0e0f4ed31666cc4f9ba9f17add425c0a;hb=05fcc00b2495acf1caa47a7f5290fcafe16b7765;hp=b810d91f9db40a63c90e9a75711a8861a809967f;hpb=2ccccc5e7ea3f299777e0b67db864a1ea60688a6;p=perl%2Fmodules%2FVariable-Magic.git diff --git a/Magic.xs b/Magic.xs index b810d91..d579f9e 100644 --- a/Magic.xs +++ b/Magic.xs @@ -133,6 +133,12 @@ # define IN_PERL_COMPILETIME (PL_curcop == &PL_compiling) #endif +#ifdef DEBUGGING +# define VMG_ASSERT(C) assert(C) +#else +# define VMG_ASSERT(C) +#endif + /* uvar magic and Hash::Util::FieldHash were commited with 28419, but we only * enable them on 5.10 */ #if VMG_HAS_PERL(5, 10, 0) @@ -385,6 +391,9 @@ typedef enum { OPc_COP, #if VMG_HAS_PERL(5, 21, 5) OPc_METHOP, +#endif +#if VMG_HAS_PERL(5, 21, 7) + OPc_UNOP_AUX, #endif OPc_MAX } opclass; @@ -404,6 +413,9 @@ static const char *const vmg_opclassnames[] = { "B::COP", #if VMG_HAS_PERL(5, 21, 5) "B::METHOP", +#endif +#if VMG_HAS_PERL(5, 21, 7) + "B::UNOP_AUX", #endif NULL }; @@ -414,8 +426,13 @@ static opclass vmg_opclass(const OP *o) { return OPc_NULL; #endif - if (o->op_type == 0) + if (o->op_type == 0) { +#if VMG_HAS_PERL(5, 21, 7) + if (o->op_targ == OP_NEXTSTATE || o->op_targ == OP_DBSTATE) + return OPc_COP; +#endif return (o->op_flags & OPf_KIDS) ? OPc_UNOP : OPc_BASEOP; + } if (o->op_type == OP_SASSIGN) return ((o->op_private & OPpASSIGN_BACKWARDS) ? OPc_UNOP : OPc_BINOP); @@ -456,7 +473,12 @@ static opclass vmg_opclass(const OP *o) { case OA_PADOP: return OPc_PADOP; case OA_PVOP_OR_SVOP: - return (o->op_private & (OPpTRANS_TO_UTF|OPpTRANS_FROM_UTF)) ? OPc_SVOP : OPc_PVOP; + return (o->op_private & (OPpTRANS_TO_UTF|OPpTRANS_FROM_UTF)) +#if defined(USE_ITHREADS) && VMG_HAS_PERL(5, 8, 9) + ? OPc_PADOP : OPc_PVOP; +#else + ? OPc_SVOP : OPc_PVOP; +#endif case OA_LOOP: return OPc_LOOP; case OA_COP: @@ -480,6 +502,10 @@ static opclass vmg_opclass(const OP *o) { #if VMG_HAS_PERL(5, 21, 5) case OA_METHOP: return OPc_METHOP; +#endif +#if VMG_HAS_PERL(5, 21, 7) + case OA_UNOP_AUX: + return OPc_UNOP_AUX; #endif } @@ -488,9 +514,8 @@ static opclass vmg_opclass(const OP *o) { /* --- Error messages ------------------------------------------------------ */ -static const char vmg_invalid_wiz[] = "Invalid wizard object"; -static const char vmg_wrongargnum[] = "Wrong number of arguments"; -static const char vmg_argstorefailed[] = "Error while storing arguments"; +static const char vmg_invalid_wiz[] = "Invalid wizard object"; +static const char vmg_wrongargnum[] = "Wrong number of arguments"; /* --- Context-safe global data -------------------------------------------- */ @@ -1862,7 +1887,7 @@ static void vmg_teardown(pTHX_ void *param) { vmg_sv_magicext((SV *) PL_strtab, NULL, &vmg_global_teardown_vtbl, NULL, 0); } } else { - assert(vmg_loaded > 1); + VMG_ASSERT(vmg_loaded > 1); --vmg_loaded; } @@ -1891,7 +1916,7 @@ static void vmg_setup(pTHX) { MUTEX_INIT(&vmg_op_name_init_mutex); vmg_loaded = 1; } else { - assert(vmg_loaded > 0); + VMG_ASSERT(vmg_loaded > 0); ++vmg_loaded; } @@ -2025,7 +2050,7 @@ PPCODE: MY_CXT.depth = old_depth; MY_CXT.freed_tokens = NULL; VMG_LOADED_LOCK; - assert(vmg_loaded > 0); + VMG_ASSERT(vmg_loaded > 0); ++vmg_loaded; VMG_LOADED_UNLOCK; }