This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
In S_magic_methcall1(), tweak the initialisation of arg1 to reduce code size.
[perl5.git] / pp.h
diff --git a/pp.h b/pp.h
index 50fec83..c36502a 100644 (file)
--- a/pp.h
+++ b/pp.h
@@ -86,7 +86,7 @@ Refetch the stack pointer.  Used after a callback.  See L<perlcall>.
 #define dTARG SV *targ
 
 #define NORMAL PL_op->op_next
-#define DIE return Perl_die
+#define DIE Perl_die
 
 /*
 =for apidoc Ams||PUTBACK
@@ -473,14 +473,28 @@ Does not use C<TARG>.  See also C<XPUSHu>, C<mPUSHu> and C<PUSHu>.
 
 #define tryAMAGICftest(chr)                            \
     STMT_START {                                       \
-       if (SvAMAGIC(TOPs)) {                           \
+       assert(chr != '?');                             \
+       if ((PL_op->op_flags & OPf_KIDS)                \
+               && SvAMAGIC(TOPs)) {                    \
            const char tmpchr = (chr);                  \
            SV * const tmpsv = amagic_call(TOPs,        \
                newSVpvn_flags(&tmpchr, 1, SVs_TEMP),   \
                ftest_amg, AMGf_unary);                 \
                                                        \
            if (tmpsv) {                                \
+               const OP *next = PL_op->op_next;        \
+                                                       \
                SPAGAIN;                                \
+                                                       \
+               if (next->op_type >= OP_FTRREAD &&      \
+                   next->op_type <= OP_FTBINARY &&     \
+                   next->op_private & OPpFT_STACKED    \
+               ) {                                     \
+                   if (SvTRUE(tmpsv))                  \
+                       /* leave the object alone */    \
+                       RETURN;                         \
+               }                                       \
+                                                       \
                SETs(tmpsv);                            \
                RETURN;                                 \
            }                                           \