Add a new CvISXSUB() macro, for abstracting the test as to whether a
authorNicholas Clark <nick@ccl4.org>
Mon, 20 Feb 2006 10:40:59 +0000 (10:40 +0000)
committerNicholas Clark <nick@ccl4.org>
Mon, 20 Feb 2006 10:40:59 +0000 (10:40 +0000)
PVCV is perl or XS.

p4raw-id: //depot/perl@27241

cv.h
dump.c
ext/Devel/Peek/Peek.xs
gv.c
op.c
pad.c
pp_ctl.c
pp_hot.c
pp_sort.c
sv.c

diff --git a/cv.h b/cv.h
index 9f2594a..7e60be7 100644 (file)
--- a/cv.h
+++ b/cv.h
@@ -153,7 +153,7 @@ Returns the stash of the CV.
 #define CvWEAKOUTSIDE_on(cv)   (CvFLAGS(cv) |= CVf_WEAKOUTSIDE)
 #define CvWEAKOUTSIDE_off(cv)  (CvFLAGS(cv) &= ~CVf_WEAKOUTSIDE)
 
-
+#define CvISXSUB(cv)           (CvXSUB(cv) ? TRUE : FALSE)
 /*
 =head1 CV reference counts and CvOUTSIDE
 
diff --git a/dump.c b/dump.c
index 6799c47..02b1c22 100644 (file)
--- a/dump.c
+++ b/dump.c
@@ -89,7 +89,7 @@ Perl_dump_sub(pTHX_ const GV *gv)
 
     gv_fullname3(sv, gv, NULL);
     Perl_dump_indent(aTHX_ 0, Perl_debug_log, "\nSUB %s = ", SvPVX_const(sv));
-    if (CvXSUB(GvCV(gv)))
+    if (CvISXSUB(GvCV(gv)))
        Perl_dump_indent(aTHX_ 0, Perl_debug_log, "(xsub 0x%"UVxf" %d)\n",
            PTR2UV(CvXSUB(GvCV(gv))),
            (int)CvXSUBANY(GvCV(gv)).any_i32);
index 5bec844..a88d231 100644 (file)
@@ -39,7 +39,7 @@ DeadCode(pTHX)
                int levels, tots = 0, levela, tota = 0, levelas, totas = 0;
                int dumpit = 0;
 
-               if (CvXSUB(sv)) {
+               if (CvISXSUB(sv)) {
                    continue;           /* XSUB */
                }
                if (!CvGV(sv)) {
diff --git a/gv.c b/gv.c
index 555260f..d866b66 100644 (file)
--- a/gv.c
+++ b/gv.c
@@ -600,7 +600,7 @@ Perl_gv_autoload4(pTHX_ HV *stash, const char *name, STRLEN len, I32 method)
          "Use of inherited AUTOLOAD for non-method %s::%.*s() is deprecated",
             packname, (int)len, name);
 
-    if (CvXSUB(cv)) {
+    if (CvISXSUB(cv)) {
         /* rather than lookup/init $AUTOLOAD here
          * only to have the XSUB do another lookup for $AUTOLOAD
          * and split that value on the last '::',
diff --git a/op.c b/op.c
index 2830834..cb507ba 100644 (file)
--- a/op.c
+++ b/op.c
@@ -4261,14 +4261,14 @@ Perl_cv_undef(pTHX_ CV *cv)
 {
     dVAR;
 #ifdef USE_ITHREADS
-    if (CvFILE(cv) && !CvXSUB(cv)) {
+    if (CvFILE(cv) && !CvISXSUB(cv)) {
        /* for XSUBs CvFILE point directly to static memory; __FILE__ */
        Safefree(CvFILE(cv));
     }
     CvFILE(cv) = 0;
 #endif
 
-    if (!CvXSUB(cv) && CvROOT(cv)) {
+    if (!CvISXSUB(cv) && CvROOT(cv)) {
        if (CvDEPTH(cv))
            Perl_croak(aTHX_ "Can't undef active subroutine");
        ENTER;
diff --git a/pad.c b/pad.c
index aa806ea..75f0838 100644 (file)
--- a/pad.c
+++ b/pad.c
@@ -1445,8 +1445,8 @@ Perl_cv_clone(pTHX_ CV *proto)
     CvCLONED_on(cv);
 
 #ifdef USE_ITHREADS
-    CvFILE(cv)         = CvXSUB(proto) ? CvFILE(proto)
-                                       : savepv(CvFILE(proto));
+    CvFILE(cv)         = CvISXSUB(proto) ? CvFILE(proto)
+                                         : savepv(CvFILE(proto));
 #else
     CvFILE(cv)         = CvFILE(proto);
 #endif
index 725920f..80113a4 100644 (file)
--- a/pp_ctl.c
+++ b/pp_ctl.c
@@ -1763,7 +1763,7 @@ PP(pp_dbstate)
        hasargs = 0;
        SPAGAIN;
 
-       if (CvXSUB(cv)) {
+       if (CvISXSUB(cv)) {
            CvDEPTH(cv)++;
            PUSHMARK(SP);
            (void)(*CvXSUB(cv))(aTHX_ cv);
@@ -2352,7 +2352,7 @@ PP(pp_goto)
                    PAD_SVl(0) = (SV*)(cx->blk_sub.argarray = av);
                }
            }
-           else if (CvXSUB(cv)) {      /* put GvAV(defgv) back onto stack */
+           else if (CvISXSUB(cv)) {    /* put GvAV(defgv) back onto stack */
                AV* const av = GvAV(PL_defgv);
                items = AvFILLp(av) + 1;
                EXTEND(SP, items+1); /* @_ could have been extended. */
@@ -2369,7 +2369,7 @@ PP(pp_goto)
            /* Now do some callish stuff. */
            SAVETMPS;
            SAVEFREESV(cv); /* later, undo the 'avoid premature free' hack */
-           if (CvXSUB(cv)) {
+           if (CvISXSUB(cv)) {
                OP* retop = cx->blk_sub.retop;
                if (reified) {
                    I32 index;
index 677808f..242b03c 100644 (file)
--- a/pp_hot.c
+++ b/pp_hot.c
@@ -2667,7 +2667,7 @@ S_get_db_sub(pTHX_ SV **svp, CV *cv)
        SvIV_set(dbsv, PTR2IV(cv));     /* Do it the quickest way  */
     }
 
-    if (CvXSUB(cv))
+    if (CvISXSUB(cv))
        PL_curcopdb = PL_curcop;
     cv = GvCV(PL_DBsub);
     return cv;
@@ -2785,7 +2785,7 @@ try_autoload:
            DIE(aTHX_ "No DB::sub routine defined");
     }
 
-    if (!(CvXSUB(cv))) {
+    if (!(CvISXSUB(cv))) {
        /* This path taken at least 75% of the time   */
        dMARK;
        register I32 items = SP - MARK;
index 4859588..104e8ed 100644 (file)
--- a/pp_sort.c
+++ b/pp_sort.c
@@ -1515,7 +1515,7 @@ PP(pp_sort)
                }
            }
            if (!(cv && CvROOT(cv))) {
-               if (cv && CvXSUB(cv)) {
+               if (cv && CvISXSUB(cv)) {
                    is_xsub = 1;
                }
                else if (gv) {
diff --git a/sv.c b/sv.c
index 30b84f0..75ba895 100644 (file)
--- a/sv.c
+++ b/sv.c
@@ -9843,7 +9843,7 @@ Perl_sv_dup(pTHX_ const SV *sstr, CLONE_PARAMS* param)
                    CvWEAKOUTSIDE(sstr)
                    ? cv_dup(    CvOUTSIDE(dstr), param)
                    : cv_dup_inc(CvOUTSIDE(dstr), param);
-               if (!CvXSUB(dstr))
+               if (!CvISXSUB(dstr))
                    CvFILE(dstr) = SAVEPV(CvFILE(dstr));
                break;
            }