assert (re != (REGEXP*) &PL_sv_undef);
eng = re ? RX_ENGINE(re) : current_re_engine();
- /*
- In the below logic: these are basically the same - check if this regcomp is part of a split.
-
- (PL_op->op_pmflags & PMf_split )
- (PL_op->op_next->op_type == OP_PUSHRE)
-
- We could add a new mask for this and copy the PMf_split, if we did
- some bit definition fiddling first.
-
- For now we leave this
- */
-
new_re = (eng->op_comp
? eng->op_comp
: &Perl_re_op_compile
}
}
+/* also used for: pp_mapstart() */
PP(pp_grepstart)
{
dSP;
static void
S_pop_eval_context_maybe_croak(pTHX_ PERL_CONTEXT *cx, SV *errsv, int action)
{
- SV *namesv = NULL; /* just to silence compiler warnings */
+ SV *namesv = NULL; /* init to avoid dumb compiler warning */
bool do_croak;
CX_LEAVE_SCOPE(cx);
if (in_eval) {
I32 cxix;
- /* We need to keep this SV alive through all the stack unwinding
- * and FREETMPSing below, while ensuing that it doesn't leak
- * if we call out to something which then dies (e.g. sub STORE{die}
- * when unlocalising a tied var). So we do a dance with
- * mortalising and SAVEFREEing.
- */
- sv_2mortal(SvREFCNT_inc_simple_NN(exceptsv));
+ exceptsv = sv_2mortal(SvREFCNT_inc_simple_NN(exceptsv));
/*
* Historically, perl used to set ERRSV ($@) early in the die
restartjmpenv = cx->blk_eval.cur_top_env;
restartop = cx->blk_eval.retop;
-
- /* We need a FREETMPS here to avoid late-called destructors
- * clobbering $@ *after* we set it below, e.g.
- * sub DESTROY { eval { die "X" } }
- * eval { my $x = bless []; die $x = 0, "Y" };
- * is($@, "Y")
- * Here the clearing of the $x ref mortalises the anon array,
- * which needs to be freed *before* $& is set to "Y",
- * otherwise it gets overwritten with "X".
- *
- * However, the FREETMPS will clobber exceptsv, so preserve it
- * on the savestack for now.
- */
- SAVEFREESV(SvREFCNT_inc_simple_NN(exceptsv));
- FREETMPS;
- /* now we're about to pop the savestack, so re-mortalise it */
- sv_2mortal(SvREFCNT_inc_simple_NN(exceptsv));
-
/* Note that unlike pp_entereval, pp_require isn't supposed to
* trap errors. So if we're a require, after we pop the
* CXt_EVAL that pp_require pushed, rethrow the error with
{
PERL_CONTEXT *cx;
U8 gimme;
+ SV **base;
SV **oldsp;
- SV **mark;
cx = CX_CUR();
assert(CxTYPE_is_LOOP(cx));
- mark = PL_stack_base + cx->blk_oldsp;
- oldsp = CxTYPE(cx) == CXt_LOOP_LIST
+ oldsp = PL_stack_base + cx->blk_oldsp;
+ base = CxTYPE(cx) == CXt_LOOP_LIST
? PL_stack_base + cx->blk_loop.state_u.stack.basesp
- : mark;
+ : oldsp;
gimme = cx->blk_gimme;
if (gimme == G_VOID)
- PL_stack_sp = oldsp;
+ PL_stack_sp = base;
else
- leave_adjust_stacks(MARK, oldsp, gimme,
+ leave_adjust_stacks(oldsp, base, gimme,
PL_op->op_private & OPpLVALUE ? 3 : 1);
CX_LEAVE_SCOPE(cx);
? SvTRUE(*PL_stack_sp)
: PL_stack_sp > oldsp);
- if (gimme == G_VOID) {
+ if (gimme == G_VOID)
PL_stack_sp = oldsp;
- /* free now to avoid late-called destructors clobbering $@ */
- FREETMPS;
- }
else
leave_adjust_stacks(oldsp, oldsp, gimme, 0);
oldsp = PL_stack_base + cx->blk_oldsp;
gimme = cx->blk_gimme;
- if (gimme == G_VOID) {
+ if (gimme == G_VOID)
PL_stack_sp = oldsp;
- /* free now to avoid late-called destructors clobbering $@ */
- FREETMPS;
- }
else
leave_adjust_stacks(oldsp, oldsp, gimme, 1);
CX_LEAVE_SCOPE(cx);