summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--embed.fnc1
-rw-r--r--embed.h1
-rw-r--r--inline.h29
-rw-r--r--pp_ctl.c12
-rw-r--r--proto.h5
5 files changed, 32 insertions, 16 deletions
diff --git a/embed.fnc b/embed.fnc
index 24d429bbd3..eb7b47601a 100644
--- a/embed.fnc
+++ b/embed.fnc
@@ -3647,6 +3647,7 @@ Cixp |void |cx_pushformat |NN PERL_CONTEXT *cx|NN CV *cv \
Cixp |void |cx_popformat |NN PERL_CONTEXT *cx
Cixp |void |cx_pusheval |NN PERL_CONTEXT *cx \
|NULLOK OP *retop|NULLOK SV *namesv
+Cixp |void |cx_pushtry |NN PERL_CONTEXT *cx|NULLOK OP *retop
Cixp |void |cx_popeval |NN PERL_CONTEXT *cx
Cixp |void |cx_pushloop_plain|NN PERL_CONTEXT *cx
Cixp |void |cx_pushloop_for |NN PERL_CONTEXT *cx \
diff --git a/embed.h b/embed.h
index bb592b1d4e..10214db1fb 100644
--- a/embed.h
+++ b/embed.h
@@ -822,6 +822,7 @@
#define cx_pushloop_for(a,b,c) Perl_cx_pushloop_for(aTHX_ a,b,c)
#define cx_pushloop_plain(a) Perl_cx_pushloop_plain(aTHX_ a)
#define cx_pushsub(a,b,c,d) Perl_cx_pushsub(aTHX_ a,b,c,d)
+#define cx_pushtry(a,b) Perl_cx_pushtry(aTHX_ a,b)
#define cx_pushwhen(a) Perl_cx_pushwhen(aTHX_ a)
#define cx_topblock(a) Perl_cx_topblock(aTHX_ a)
#define gimme_V() Perl_gimme_V(aTHX)
diff --git a/inline.h b/inline.h
index 777f9f6743..bbf27da6f5 100644
--- a/inline.h
+++ b/inline.h
@@ -2313,12 +2313,8 @@ Perl_cx_popformat(pTHX_ PERL_CONTEXT *cx)
PERL_STATIC_INLINE void
-Perl_cx_pusheval(pTHX_ PERL_CONTEXT *cx, OP *retop, SV *namesv)
+Perl_push_evalortry_common(pTHX_ PERL_CONTEXT *cx, OP *retop, SV *namesv)
{
- PERL_ARGS_ASSERT_CX_PUSHEVAL;
-
- cx->blk_eval.old_cxsubix = PL_curstackinfo->si_cxsubix;
- PL_curstackinfo->si_cxsubix= cx - PL_curstackinfo->si_cxstack;
cx->blk_eval.retop = retop;
cx->blk_eval.old_namesv = namesv;
cx->blk_eval.old_eval_root = PL_eval_root;
@@ -2331,6 +2327,29 @@ Perl_cx_pusheval(pTHX_ PERL_CONTEXT *cx, OP *retop, SV *namesv)
cx->blk_u16 = (PL_in_eval & 0x3F) | ((U16)PL_op->op_type << 7);
}
+PERL_STATIC_INLINE void
+Perl_cx_pusheval(pTHX_ PERL_CONTEXT *cx, OP *retop, SV *namesv)
+{
+ PERL_ARGS_ASSERT_CX_PUSHEVAL;
+
+ Perl_push_evalortry_common(aTHX_ cx, retop, namesv);
+
+ cx->blk_eval.old_cxsubix = PL_curstackinfo->si_cxsubix;
+ PL_curstackinfo->si_cxsubix = cx - PL_curstackinfo->si_cxstack;
+}
+
+PERL_STATIC_INLINE void
+Perl_cx_pushtry(pTHX_ PERL_CONTEXT *cx, OP *retop)
+{
+ PERL_ARGS_ASSERT_CX_PUSHTRY;
+
+ Perl_push_evalortry_common(aTHX_ cx, retop, NULL);
+
+ /* Don't actually change it, just store the current value so it's restored
+ * by the common popeval */
+ cx->blk_eval.old_cxsubix = PL_curstackinfo->si_cxsubix;
+}
+
PERL_STATIC_INLINE void
Perl_cx_popeval(pTHX_ PERL_CONTEXT *cx)
diff --git a/pp_ctl.c b/pp_ctl.c
index 9d7de39bcf..a480bb762d 100644
--- a/pp_ctl.c
+++ b/pp_ctl.c
@@ -2486,16 +2486,6 @@ PP(pp_return)
PERL_CONTEXT *cx;
I32 cxix = dopopto_cursub();
-again:
- if (cxix >= 0) {
- cx = &cxstack[cxix];
- if (CxTRY(cx)) {
- /* This was a try {}. keep going */
- cxix = dopoptosub_at(cxstack, cxix - 1);
- goto again;
- }
- }
-
assert(cxstack_ix >= 0);
if (cxix < cxstack_ix) {
if (cxix < 0) {
@@ -4639,7 +4629,7 @@ PP(pp_entertrycatch)
cx = cx_pushblock((CXt_EVAL|CXp_EVALBLOCK|CXp_TRY), gimme,
PL_stack_sp, PL_savestack_ix);
- cx_pusheval(cx, cLOGOP->op_other, NULL);
+ cx_pushtry(cx, cLOGOP->op_other);
PL_in_eval = EVAL_INEVAL;
diff --git a/proto.h b/proto.h
index 3d2e6b58c1..faca6d1366 100644
--- a/proto.h
+++ b/proto.h
@@ -4479,6 +4479,11 @@ PERL_STATIC_INLINE void Perl_cx_pushsub(pTHX_ PERL_CONTEXT *cx, CV *cv, OP *reto
assert(cx); assert(cv)
#endif
#ifndef PERL_NO_INLINE_FUNCTIONS
+PERL_STATIC_INLINE void Perl_cx_pushtry(pTHX_ PERL_CONTEXT *cx, OP *retop);
+#define PERL_ARGS_ASSERT_CX_PUSHTRY \
+ assert(cx)
+#endif
+#ifndef PERL_NO_INLINE_FUNCTIONS
PERL_STATIC_INLINE void Perl_cx_pushwhen(pTHX_ PERL_CONTEXT *cx);
#define PERL_ARGS_ASSERT_CX_PUSHWHEN \
assert(cx)