summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--regexec.c2
-rw-r--r--scope.c4
-rw-r--r--scope.h9
3 files changed, 14 insertions, 1 deletions
diff --git a/regexec.c b/regexec.c
index 30dd35461b..c4d88cc99a 100644
--- a/regexec.c
+++ b/regexec.c
@@ -2094,7 +2094,7 @@ S_regtry(pTHX_ const regmatch_info *reginfo, char *startpos)
PerlIO_printf(Perl_debug_log, " setting stack tmpbase at %"IVdf"\n",
(IV)(PL_stack_sp - PL_stack_base));
));
- SAVEI32(cxstack[cxstack_ix].blk_oldsp);
+ SAVESTACK_CXPOS();
cxstack[cxstack_ix].blk_oldsp = PL_stack_sp - PL_stack_base;
/* Otherwise OP_NEXTSTATE will free whatever on stack now. */
SAVETMPS;
diff --git a/scope.c b/scope.c
index 8923104672..6a996ce7e6 100644
--- a/scope.c
+++ b/scope.c
@@ -831,6 +831,10 @@ Perl_leave_scope(pTHX_ I32 base)
i = SSPOPINT;
PL_stack_sp = PL_stack_base + i;
break;
+ case SAVEt_STACK_CXPOS: /* blk_oldsp on context stack */
+ i = SSPOPINT;
+ cxstack[i].blk_oldsp = SSPOPINT;
+ break;
case SAVEt_AELEM: /* array element */
value = (SV*)SSPOPPTR;
i = SSPOPINT;
diff --git a/scope.h b/scope.h
index 9943a05876..377a8b42fe 100644
--- a/scope.h
+++ b/scope.h
@@ -52,6 +52,7 @@
#define SAVEt_COP_ARYBASE 41
#define SAVEt_RE_STATE 42
#define SAVEt_COMPILE_WARNINGS 43
+#define SAVEt_STACK_CXPOS 44
#ifndef SCOPE_SAVES_SIGNAL_MASK
#define SCOPE_SAVES_SIGNAL_MASK 0
@@ -205,6 +206,14 @@ Closing bracket on a callback. See C<ENTER> and L<perlcall>.
SSPUSHINT(SAVEt_COMPILE_WARNINGS); \
} STMT_END
+#define SAVESTACK_CXPOS() \
+ STMT_START { \
+ SSCHECK(3); \
+ SSPUSHINT(cxstack[cxstack_ix].blk_oldsp); \
+ SSPUSHINT(cxstack_ix); \
+ SSPUSHINT(SAVEt_STACK_CXPOS); \
+ } STMT_END
+
#ifdef USE_ITHREADS
# define SAVECOPSTASH(c) SAVEPPTR(CopSTASHPV(c))
# define SAVECOPSTASH_FREE(c) SAVESHAREDPV(CopSTASHPV(c))