summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRichard Leach <richardleach@users.noreply.github.com>2022-09-05 13:28:05 +0000
committerRichard Leach <richardleach@users.noreply.github.com>2022-09-06 22:21:13 +0100
commitc5bbf81a67393c24727402cfeca0bfe002966ee0 (patch)
tree2a7989f39de9ccbf4a49e7265b930749bad93e77
parent63efc0f6e82b219590bfa015155e91a164571df0 (diff)
downloadperl-c5bbf81a67393c24727402cfeca0bfe002966ee0.tar.gz
peep.c:OP_PADSV_STORE - skip SASSIGN created by Memoize::Once
Memoize::Once produces a non-standard SASSIGN which should not and need not be optimized. Because this SASSIGN has only one child, something that hasn't been seen elsewhere, that can be used as a heuristic for skipping this type of SASSIGN in rpeep().
-rw-r--r--peep.c6
1 files changed, 5 insertions, 1 deletions
diff --git a/peep.c b/peep.c
index 41bb46d7e7..9e558e4186 100644
--- a/peep.c
+++ b/peep.c
@@ -3908,8 +3908,12 @@ Perl_rpeep(pTHX_ OP *o)
!(lval->op_private & OPpDEREF)
/* skip if padrange has already gazumped the padsv */
&& (lval == oldop)
+ /* Memoize::Once produces a non-standard SASSIGN that
+ * doesn't actually point to pp_sassign, has only one
+ * child (PADSV), and gets to it via op_other rather
+ * than op_next. Don't try to optimize this. */
+ && (lval != rhs)
) {
-
/* SASSIGN's bitfield flags, such as op_moresib and
* op_slabbed, will be carried over unchanged. */
OpTYPE_set(o, OP_PADSV_STORE);