This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
OP_MULTIDEREF: ignore customised delete/exists
authorDavid Mitchell <davem@iabyn.com>
Wed, 28 Sep 2016 10:27:38 +0000 (11:27 +0100)
committerDavid Mitchell <davem@iabyn.com>
Wed, 28 Sep 2016 10:27:38 +0000 (11:27 +0100)
We already skip optmising to a multideref if an aelem op has a customised
PL_check[] routine; extend this skip to OP_EXISTS and OP_DELETE too.

See http://nntp.perl.org/group/perl.perl5.porters/227545

op.c

diff --git a/op.c b/op.c
index c2f5406..0fbee48 100644 (file)
--- a/op.c
+++ b/op.c
@@ -12992,6 +12992,13 @@ S_maybe_multideref(pTHX_ OP *start, OP *orig_o, UV orig_action, U8 hints)
             if (  (o->op_type == OP_AELEM || o->op_type == OP_HELEM)
                && PL_check[o->op_type] != Perl_ck_null)
                 return;
+            /* similarly for customised exists and delete */
+            if (  (o->op_type == OP_EXISTS)
+               && PL_check[o->op_type] != Perl_ck_exists)
+                return;
+            if (  (o->op_type == OP_DELETE)
+               && PL_check[o->op_type] != Perl_ck_delete)
+                return;
 
             if (   o->op_type != OP_AELEM
                 || (o->op_private &