Eliminate PL_dirty
authorFlorian Ragwitz <rafl@debian.org>
Fri, 1 Oct 2010 21:28:36 +0000 (23:28 +0200)
committerFlorian Ragwitz <rafl@debian.org>
Sun, 14 Nov 2010 16:18:05 +0000 (17:18 +0100)
It now only exists as a compatibility macro for extensions that want to
introspect it.

cpan/Devel-PPPort/parts/inc/variables
embedvar.h
gv.c
hv.c
intrpvar.h
mg.c
pad.c
perl.c
perl.h
sv.c
util.c

index 515e620..77b088e 100644 (file)
@@ -383,7 +383,11 @@ other_variables()
                ppp_TESTVAR(PL_debstash);
                ppp_TESTVAR(PL_defgv);
                ppp_TESTVAR(PL_diehook);
+#if defined(PL_phase) || defined(PL_Iphase)
+               ppp_PARSERVAR_dummy;
+#else
                ppp_TESTVAR(PL_dirty);
+#endif
                ppp_TESTVAR(PL_dowarn);
                ppp_TESTVAR(PL_errgv);
                ppp_TESTVAR(PL_laststatval);
index ca316ef..290d402 100644 (file)
 #define PL_delaymagic          (vTHX->Idelaymagic)
 #define PL_destroyhook         (vTHX->Idestroyhook)
 #define PL_diehook             (vTHX->Idiehook)
-#define PL_dirty               (vTHX->Idirty)
 #define PL_doswitches          (vTHX->Idoswitches)
 #define PL_dowarn              (vTHX->Idowarn)
 #define PL_dumper_fd           (vTHX->Idumper_fd)
 #define PL_Idelaymagic         PL_delaymagic
 #define PL_Idestroyhook                PL_destroyhook
 #define PL_Idiehook            PL_diehook
-#define PL_Idirty              PL_dirty
 #define PL_Idoswitches         PL_doswitches
 #define PL_Idowarn             PL_dowarn
 #define PL_Idumper_fd          PL_dumper_fd
diff --git a/gv.c b/gv.c
index 691dbba..9f62066 100644 (file)
--- a/gv.c
+++ b/gv.c
@@ -2628,7 +2628,7 @@ Perl_gv_try_downgrade(pTHX_ GV *gv)
 
     /* XXX Why and where does this leave dangling pointers during global
        destruction? */
-    if (PL_dirty) return;
+    if (PL_phase == PERL_PHASE_DESTRUCT) return;
 
     if (!(SvREFCNT(gv) == 1 && SvTYPE(gv) == SVt_PVGV && !SvFAKE(gv) &&
            !SvOBJECT(gv) && !SvREADONLY(gv) &&
diff --git a/hv.c b/hv.c
index b435239..615cec2 100644 (file)
--- a/hv.c
+++ b/hv.c
@@ -1856,7 +1856,7 @@ Perl_hv_undef(pTHX_ HV *hv)
     DEBUG_A(Perl_hv_assert(aTHX_ hv));
     xhv = (XPVHV*)SvANY(hv);
 
-    if ((name = HvENAME_get(hv)) && !PL_dirty)
+    if ((name = HvENAME_get(hv)) && PL_phase != PERL_PHASE_DESTRUCT)
     {
         /* Delete the @ISA element before calling mro_package_moved, so it
            does not see it. */
index 52e9711..1ba3ab8 100644 (file)
@@ -248,8 +248,6 @@ PERLVAR(Iregmatch_state, regmatch_state *)
 PERLVAR(Idelaymagic,   U16)            /* ($<,$>) = ... */
 PERLVAR(Ilocalizing,   U8)             /* are we processing a local() list? */
 PERLVAR(Icolorset,     bool)           /* from regcomp.c */
-PERLVARI(Idirty,       bool, FALSE)    /* in the middle of tearing things
-                                          down? */
 PERLVAR(Iin_eval,      U8)             /* trap "fatal" errors? */
 PERLVAR(Itainted,      bool)           /* using variables controlled by $< */
 
diff --git a/mg.c b/mg.c
index 01240a7..4a342d4 100644 (file)
--- a/mg.c
+++ b/mg.c
@@ -1617,7 +1617,7 @@ Perl_magic_clearisa(pTHX_ SV *sv, MAGIC *mg)
     PERL_ARGS_ASSERT_MAGIC_CLEARISA;
 
     /* Bail out if destruction is going on */
-    if(PL_dirty) return 0;
+    if(PL_phase == PERL_PHASE_DESTRUCT) return 0;
 
     if (sv)
        av_clear(MUTABLE_AV(sv));
diff --git a/pad.c b/pad.c
index d395e71..1fcd375 100644 (file)
--- a/pad.c
+++ b/pad.c
@@ -277,7 +277,7 @@ Perl_pad_undef(pTHX_ CV* cv)
     /* XXX DAPM for efficiency, we should only do this if we know we have
      * children, or integrate this loop with general cleanup */
 
-    if (!PL_dirty) { /* don't bother during global destruction */
+    if (PL_phase != PERL_PHASE_DESTRUCT) { /* don't bother during global destruction */
        CV * const outercv = CvOUTSIDE(cv);
         const U32 seq = CvOUTSIDE_SEQ(cv);
        AV *  const comppad_name = MUTABLE_AV(AvARRAY(padlist)[0]);
diff --git a/perl.c b/perl.c
index 8ed0960..438106e 100644 (file)
--- a/perl.c
+++ b/perl.c
@@ -754,7 +754,6 @@ perl_destruct(pTHXx)
     SvREFCNT_dec(PL_main_cv);
     PL_main_cv = NULL;
     PL_phase = PERL_PHASE_DESTRUCT;
-    PL_dirty = TRUE;
 
     /* Tell PerlIO we are about to tear things apart in case
        we have layers which are using resources that should
diff --git a/perl.h b/perl.h
index fc7cf07..22bb6d8 100644 (file)
--- a/perl.h
+++ b/perl.h
@@ -4738,6 +4738,13 @@ EXTCONST char *const PL_phase_names[] = {
 EXTCONST char *const PL_phase_names[];
 #endif
 
+#ifndef PERL_CORE
+/* Do not use this macro. It only exists for extensions that rely on PL_dirty
+ * instead of using the newer PL_phase, which provides everything PL_dirty
+ * provided, and more. */
+#  define PL_dirty (PL_phase == PERL_PHASE_DESTRUCT)
+#endif /* !PERL_CORE */
+
 END_EXTERN_C
 
 /*****************************************************************************/
diff --git a/sv.c b/sv.c
index 484b402..f787b84 100644 (file)
--- a/sv.c
+++ b/sv.c
@@ -13123,7 +13123,6 @@ perl_clone_using(PerlInterpreter *proto_perl, UV flags,
     PL_restartop       = proto_perl->Irestartop;
     PL_in_eval         = proto_perl->Iin_eval;
     PL_delaymagic      = proto_perl->Idelaymagic;
-    PL_dirty           = proto_perl->Idirty;
     PL_phase           = proto_perl->Iphase;
     PL_localizing      = proto_perl->Ilocalizing;
 
diff --git a/util.c b/util.c
index f0b472a..a878f4b 100644 (file)
--- a/util.c
+++ b/util.c
@@ -1116,7 +1116,7 @@ S_mess_alloc(pTHX)
     SV *sv;
     XPVMG *any;
 
-    if (!PL_dirty)
+    if (PL_phase != PERL_PHASE_DESTRUCT)
        return newSVpvs_flags("", SVs_TEMP);
 
     if (PL_mess_sv)
@@ -1343,7 +1343,7 @@ Perl_mess_sv(pTHX_ SV *basemsg, bool consume)
                           line_mode ? "line" : "chunk",
                           (IV)IoLINES(GvIOp(PL_last_in_gv)));
        }
-       if (PL_dirty)
+       if (PL_phase == PERL_PHASE_DESTRUCT)
            sv_catpvs(sv, " during global destruction");
        sv_catpvs(sv, ".\n");
     }