mirror of
https://github.com/Perl/perl5.git
synced 2026-01-26 08:38:23 +00:00
make RC-stack-aware: eval_sv()
Similar to the previous commit which fixed up call_sv() and similar, the commit updates eval_sv() to handle a reference-counted stack environment. Note that these functions are slightly unusual in that they can be called from either a reference-counted or non-RC stack environment, so must be able to handle either case. This is done mostly by relying on CALLRUNOPS() to fix things up, but for anything pushed/pulled around that, by checking rpp_stack_is_rc(): which currently always returns false, but once ref-counting is enabled in a few commits' time, may start returning true.
This commit is contained in:
parent
5ff0c5f0e4
commit
00fc1d567b
21
perl.c
21
perl.c
@ -3258,13 +3258,13 @@ Perl_eval_sv(pTHX_ SV *sv, I32 flags)
|
||||
myop.op_ppaddr = PL_ppaddr[OP_ENTEREVAL];
|
||||
myop.op_type = OP_ENTEREVAL;
|
||||
|
||||
{
|
||||
dSP;
|
||||
oldmark = SP - PL_stack_base;
|
||||
EXTEND(SP, 1);
|
||||
PUSHs(sv);
|
||||
PUTBACK;
|
||||
}
|
||||
oldmark = PL_stack_sp - PL_stack_base;
|
||||
rpp_extend(1);
|
||||
*++PL_stack_sp = sv;
|
||||
#if defined PERL_RC_STACK && !defined PERL_XXX_TMP_NORC
|
||||
if (rpp_stack_is_rc())
|
||||
SvREFCNT_inc_simple_void_NN(sv);
|
||||
#endif
|
||||
|
||||
if (!(flags & G_NOARGS))
|
||||
myop.op_flags = OPf_STACKED;
|
||||
@ -3345,7 +3345,12 @@ Perl_eval_sv(pTHX_ SV *sv, I32 flags)
|
||||
|
||||
JMPENV_POP;
|
||||
if (flags & G_DISCARD) {
|
||||
PL_stack_sp = PL_stack_base + oldmark;
|
||||
#if defined PERL_RC_STACK && !defined PERL_XXX_TMP_NORC
|
||||
if (rpp_stack_is_rc())
|
||||
rpp_popfree_to(PL_stack_base + oldmark);
|
||||
else
|
||||
#endif
|
||||
PL_stack_sp = PL_stack_base + oldmark;
|
||||
retval = 0;
|
||||
FREETMPS;
|
||||
LEAVE;
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user