Skip to content

Commit

Permalink
Define cv_forget_slab under PL_OP_SLAB_ALLOC
Browse files Browse the repository at this point in the history
Instead of using #ifndef every time we call cv_forget_slab, just
define it as a no-op under PL_OP_SLAB_ALLOC.
  • Loading branch information
Father Chrysostomos committed Jun 29, 2012
1 parent 7d82c9c commit be49fd9
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 14 deletions.
4 changes: 4 additions & 0 deletions cv.h
Original file line number Diff line number Diff line change
Expand Up @@ -191,6 +191,10 @@ See L<perlguts/Autoloading with XSUBs>.
/* Flags for newXS_flags */
#define XS_DYNAMIC_FILENAME 0x01 /* The filename isn't static */

#ifdef PL_OP_SLAB_ALLOC
# define cv_forget_slab(cv) NOOP
#endif

/*
=head1 CV reference counts and CvOUTSIDE
Expand Down
10 changes: 0 additions & 10 deletions op.c
Original file line number Diff line number Diff line change
Expand Up @@ -3064,9 +3064,7 @@ Perl_newPROG(pTHX_ OP *o)
PL_main_root->op_next = 0;
CALL_PEEP(PL_main_start);
finalize_optree(PL_main_root);
#ifndef PL_OP_SLAB_ALLOC
cv_forget_slab(PL_compcv);
#endif
PL_compcv = 0;

/* Register with debugger */
Expand Down Expand Up @@ -4586,10 +4584,8 @@ Perl_pmruntime(pTHX_ OP *o, OP *expr, bool isreg, I32 floor)
* confident that nothing used that CV's pad while the
* regex was parsed */
assert(AvFILLp(PL_comppad) == 0); /* just @_ */
#ifndef PL_OP_SLAB_ALLOC
/* But we know that one op is using this CV's slab. */
cv_forget_slab(PL_compcv);
#endif
LEAVE_SCOPE(floor);
pm->op_pmflags &= ~PMf_HAS_CV;
}
Expand Down Expand Up @@ -4634,9 +4630,7 @@ Perl_pmruntime(pTHX_ OP *o, OP *expr, bool isreg, I32 floor)
(void)pad_add_anon(cv, o->op_type);
SvREFCNT_inc_simple_void(cv);

#ifndef PL_OP_SLAB_ALLOC
cv_forget_slab(cv);
#endif
}
else {
pm->op_code_list = expr;
Expand Down Expand Up @@ -7103,9 +7097,7 @@ Perl_newATTRSUB_flags(pTHX_ I32 floor, OP *o, OP *proto, OP *attrs,
SvREFCNT_inc_simple_void_NN(const_sv);
if (cv) {
assert(!CvROOT(cv) && !CvCONST(cv));
#ifndef PL_OP_SLAB_ALLOC
cv_forget_slab(cv);
#endif
sv_setpvs(MUTABLE_SV(cv), ""); /* prototype is "" */
CvXSUBANY(cv).any_ptr = const_sv;
CvXSUB(cv) = const_sv_xsub;
Expand Down Expand Up @@ -7616,9 +7608,7 @@ Perl_newFORM(pTHX_ I32 floor, OP *o, OP *block)
CvROOT(cv)->op_next = 0;
CALL_PEEP(CvSTART(cv));
finalize_optree(CvROOT(cv));
#ifndef PL_OP_SLAB_ALLOC
cv_forget_slab(cv);
#endif
#ifdef PERL_MAD
op_getmad(o,pegop,'n');
op_getmad_weak(block, pegop, 'b');
Expand Down
4 changes: 0 additions & 4 deletions pp_ctl.c
Original file line number Diff line number Diff line change
Expand Up @@ -3444,9 +3444,7 @@ S_doeval(pTHX_ int gimme, CV* outside, U32 seq, HV *hh)
PL_op = saveop;
if (yystatus != 3) {
if (PL_eval_root) {
#ifndef PL_OP_SLAB_ALLOC
cv_forget_slab(evalcv);
#endif
op_free(PL_eval_root);
PL_eval_root = NULL;
}
Expand Down Expand Up @@ -3489,9 +3487,7 @@ S_doeval(pTHX_ int gimme, CV* outside, U32 seq, HV *hh)

CopLINE_set(&PL_compiling, 0);
SAVEFREEOP(PL_eval_root);
#ifndef PL_OP_SLAB_ALLOC
cv_forget_slab(evalcv);
#endif

DEBUG_x(dump_eval());

Expand Down

0 comments on commit be49fd9

Please sign in to comment.