diff options
-rw-r--r-- | regexec.c | 2 | ||||
-rw-r--r-- | scope.c | 4 | ||||
-rw-r--r-- | scope.h | 9 |
3 files changed, 14 insertions, 1 deletions
@@ -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; @@ -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; @@ -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)) |