Define cv_forget_slab under PL_OP_SLAB_ALLOC
authorFather Chrysostomos <sprout@cpan.org>
Tue, 26 Jun 2012 17:08:58 +0000 (10:08 -0700)
committerFather Chrysostomos <sprout@cpan.org>
Fri, 29 Jun 2012 07:20:59 +0000 (00:20 -0700)
Instead of using #ifndef every time we call cv_forget_slab, just
define it as a no-op under PL_OP_SLAB_ALLOC.

cv.h
op.c
pp_ctl.c

diff --git a/cv.h b/cv.h
index e2644e1..f7b1b66 100644 (file)
--- a/cv.h
+++ b/cv.h
@@ -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
 
diff --git a/op.c b/op.c
index 182a162..874df5f 100644 (file)
--- a/op.c
+++ b/op.c
@@ -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 */
@@ -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;
            }
@@ -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;
@@ -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;
@@ -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');
index c55afb1..f3c7692 100644 (file)
--- a/pp_ctl.c
+++ b/pp_ctl.c
@@ -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;
            }
@@ -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());