summaryrefslogtreecommitdiff
path: root/inline.h
diff options
context:
space:
mode:
authorTony Cook <tony@develop-help.com>2021-02-10 11:18:45 +1100
committerPaul "LeoNerd" Evans <leonerd@leonerd.org.uk>2021-02-14 13:40:50 +0000
commit6b729d2440b795f848f610a8cc410a3f6be6388b (patch)
tree68143844990d5b45cbe0ceccf9b3fef2458a505a /inline.h
parent683e0651b057a7be4b2765ceb3d9f6617cd4c464 (diff)
downloadperl-6b729d2440b795f848f610a8cc410a3f6be6388b.tar.gz
try isn't treated as a sub call like eval is
The try change added code to pp_return to skip past try contexts when looking for the sub/sort/eval context to return from. This was only needed because cx_pusheval() sets si_cxsubix to the current frame and try uses that function to push it's context, that value is then used by the dopopto_cursub() macro to shortcut walking the context stack. Since we don't need to treat try as a sub for return, list vs array checks or lvalue sub checks, don't set si_cxsubix on try.
Diffstat (limited to 'inline.h')
-rw-r--r--inline.h29
1 files changed, 24 insertions, 5 deletions
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)