summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--op.c6
-rw-r--r--t/perf/opcount.t12
2 files changed, 18 insertions, 0 deletions
diff --git a/op.c b/op.c
index 770b2f949a..64b6cfd557 100644
--- a/op.c
+++ b/op.c
@@ -17924,6 +17924,12 @@ Perl_rpeep(pTHX_ OP *o)
DEFER(cLOGOPo->op_other);
break;
+ case OP_ENTERTRYCATCH:
+ assert(cLOGOPo->op_other->op_type == OP_CATCH);
+ /* catch body is the ->op_other of the OP_CATCH */
+ DEFER(cLOGOPx(cLOGOPo->op_other)->op_other);
+ break;
+
case OP_SUBST:
if ((o->op_flags & OPf_WANT) == OPf_WANT_SCALAR)
S_check_for_bool_cxt(o, 1, OPpTRUEBOOL, 0);
diff --git a/t/perf/opcount.t b/t/perf/opcount.t
index 2d3f196174..372c47f3d6 100644
--- a/t/perf/opcount.t
+++ b/t/perf/opcount.t
@@ -675,6 +675,18 @@ test_opcount(0, "multiconcat: local assign",
});
{
+ use feature 'try';
+ no warnings 'experimental::try';
+
+ test_opcount(0, "try/catch: catch block is optimized",
+ sub { my @a; try {} catch($e) { $a[0] } },
+ {
+ aelemfast_lex => 1,
+ aelem => 0,
+ });
+}
+
+{
use feature 'defer';
no warnings 'experimental::defer';