Change 30095 by [EMAIL PROTECTED] on 2007/02/02 17:46:17

        Integrate:
        [ 29628]
        Change PAD_MAX to something a bit less FORTRAN-ish than 999999999.
        
        [ 29629]
        Abstract the pad code's overloaded use of SvNVX and SvIVX into
        4 macros COP_SEQ_RANGE_LOW, COP_SEQ_RANGE_HIGH, PARENT_PAD_INDEX
        and PARENT_FAKELEX_FLAGS
        
        [ 29631]
        Move PAD_FAKELEX_ANON and PAD_FAKELEX_MULTI to pad.h, export them via
        B.pm, so that B::Concise doesn't need to hard code magic numbers.
        
        [ 29663]
        Probably better to make PAD_FAKELEX_ANON and PAD_FAKELEX_MULTI special
        cases, instead of scanning pad.h to find them, and picking up 3 other
        superfluous definitions as a side effect.

Affected files ...

... //depot/maint-5.8/perl/ext/B/B.pm#21 integrate
... //depot/maint-5.8/perl/ext/B/B.xs#26 integrate
... //depot/maint-5.8/perl/ext/B/B/Concise.pm#35 integrate
... //depot/maint-5.8/perl/ext/B/B/Deparse.pm#29 integrate
... //depot/maint-5.8/perl/ext/B/defsubs_h.PL#8 integrate
... //depot/maint-5.8/perl/ext/B/t/concise-xs.t#10 integrate
... //depot/maint-5.8/perl/pad.c#64 edit
... //depot/maint-5.8/perl/pad.h#17 integrate

Differences ...

==== //depot/maint-5.8/perl/ext/B/B.pm#21 (text) ====
Index: perl/ext/B/B.pm
--- perl/ext/B/B.pm#20~26820~   2006-01-13 07:22:43.000000000 -0800
+++ perl/ext/B/B.pm     2007-02-02 09:46:17.000000000 -0800
@@ -7,7 +7,7 @@
 #
 package B;
 
-our $VERSION = '1.09_01';
+our $VERSION = '1.14';
 
 use XSLoader ();
 require Exporter;

==== //depot/maint-5.8/perl/ext/B/B.xs#26 (text) ====
Index: perl/ext/B/B.xs
--- perl/ext/B/B.xs#25~30053~   2007-01-28 15:11:59.000000000 -0800
+++ perl/ext/B/B.xs     2007-02-02 09:46:17.000000000 -0800
@@ -1184,6 +1184,22 @@
 SvNVX(sv)
        B::NV   sv
 
+U32
+COP_SEQ_RANGE_LOW(sv)
+       B::NV   sv
+
+U32
+COP_SEQ_RANGE_HIGH(sv)
+       B::NV   sv
+
+U32
+PARENT_PAD_INDEX(sv)
+       B::NV   sv
+
+U32
+PARENT_FAKELEX_FLAGS(sv)
+       B::NV   sv
+
 MODULE = B     PACKAGE = B::RV         PREFIX = Sv
 
 B::SV

==== //depot/maint-5.8/perl/ext/B/B/Concise.pm#35 (text) ====
Index: perl/ext/B/B/Concise.pm
--- perl/ext/B/B/Concise.pm#34~26610~   2006-01-03 08:56:22.000000000 -0800
+++ perl/ext/B/B/Concise.pm     2007-02-02 09:46:17.000000000 -0800
@@ -14,7 +14,7 @@
 
 use Exporter (); # use #5
 
-our $VERSION   = "0.66";
+our $VERSION   = "0.71";
 our @ISA       = qw(Exporter);
 our @EXPORT_OK = qw( set_style set_style_standard add_callback
                     concise_subref concise_cv concise_main
@@ -28,7 +28,7 @@
 # use #6
 use B qw(class ppname main_start main_root main_cv cstring svref_2object
         SVf_IOK SVf_NOK SVf_POK SVf_IVisUV SVf_FAKE OPf_KIDS OPf_SPECIAL
-        CVf_ANON);
+        CVf_ANON PAD_FAKELEX_ANON PAD_FAKELEX_MULTI);
 
 my %style =
   ("terse" =>
@@ -697,15 +697,18 @@
                    # These changes relate to the jumbo closure fix.
                    # See changes 19939 and 20005
                    my $fake = '';
-                   $fake .= 'a' if $padname->IVX & 1; # PAD_FAKELEX_ANON
-                   $fake .= 'm' if $padname->IVX & 2; # PAD_FAKELEX_MULTI
-                   $fake .= ':' . $padname->NVX if $curcv->CvFLAGS & CVf_ANON;
+                   $fake .= 'a'
+                       if $padname->PARENT_FAKELEX_FLAGS & PAD_FAKELEX_ANON;
+                   $fake .= 'm'
+                       if $padname->PARENT_FAKELEX_FLAGS & PAD_FAKELEX_MULTI;
+                   $fake .= ':' . $padname->PARENT_PAD_INDEX
+                       if $curcv->CvFLAGS & CVf_ANON;
                    $h{targarglife} = "$h{targarg}:FAKE:$fake";
                }
            }
            else {
-               my $intro = $padname->NVX - $cop_seq_base;
-               my $finish = int($padname->IVX) - $cop_seq_base;
+               my $intro = $padname->COP_SEQ_RANGE_LOW - $cop_seq_base;
+               my $finish = int($padname->COP_SEQ_RANGE_HIGH) - $cop_seq_base;
                $finish = "end" if $finish == 999999999 - $cop_seq_base;
                $h{targarglife} = "$h{targarg}:$intro,$finish";
            }

==== //depot/maint-5.8/perl/ext/B/B/Deparse.pm#29 (text) ====
Index: perl/ext/B/B/Deparse.pm
--- perl/ext/B/B/Deparse.pm#28~28775~   2006-09-02 09:01:36.000000000 -0700
+++ perl/ext/B/B/Deparse.pm     2007-02-02 09:46:17.000000000 -0800
@@ -19,7 +19,7 @@
          CVf_METHOD CVf_LOCKED CVf_LVALUE CVf_ASSERTION
         PMf_KEEP PMf_GLOBAL PMf_CONTINUE PMf_EVAL PMf_ONCE PMf_SKIPWHITE
         PMf_MULTILINE PMf_SINGLELINE PMf_FOLD PMf_EXTENDED);
-$VERSION = 0.71_01;
+$VERSION = 0.80;
 use strict;
 use vars qw/$AUTOLOAD/;
 use warnings ();
@@ -1289,7 +1289,7 @@
            my ($seq_st, $seq_en) =
                ($ns[$i]->FLAGS & SVf_FAKE)
                    ? (0, 999999)
-                   : ($ns[$i]->NVX, $ns[$i]->IVX);
+                   : ($ns[$i]->COP_SEQ_RANGE_LOW, $ns[$i]->COP_SEQ_RANGE_HIGH);
 
            push @{$self->{'curcvlex'}{$name}}, [$seq_st, $seq_en];
        }
@@ -1307,8 +1307,8 @@
 
     for (my $o=$op->first; $$o; $o=$o->sibling) {
        if ($o->name =~ /^pad.v$/ && $o->private & OPpLVAL_INTRO) {
-           my $s = int($self->padname_sv($o->targ)->NVX);
-           my $e = $self->padname_sv($o->targ)->IVX;
+           my $s = int($self->padname_sv($o->targ)->COP_SEQ_RANGE_LOW);
+           my $e = $self->padname_sv($o->targ)->COP_SEQ_RANGE_HIGH;
            $scope_st = $s if !defined($scope_st) || $s < $scope_st;
            $scope_en = $e if !defined($scope_en) || $e > $scope_en;
        }

==== //depot/maint-5.8/perl/ext/B/defsubs_h.PL#8 (text) ====
Index: perl/ext/B/defsubs_h.PL
--- perl/ext/B/defsubs_h.PL#7~23291~    2004-09-09 02:22:38.000000000 -0700
+++ perl/ext/B/defsubs_h.PL     2007-02-02 09:46:17.000000000 -0800
@@ -47,6 +47,8 @@
                      SVs_SMG
                      SVt_PVGV
                      SVt_PVHV
+                     PAD_FAKELEX_ANON
+                     PAD_FAKELEX_MULTI
                      ))
  {
   doconst($const);

==== //depot/maint-5.8/perl/ext/B/t/concise-xs.t#10 (text) ====
Index: perl/ext/B/t/concise-xs.t
--- perl/ext/B/t/concise-xs.t#9~29924~  2007-01-22 12:22:04.000000000 -0800
+++ perl/ext/B/t/concise-xs.t   2007-02-02 09:46:17.000000000 -0800
@@ -94,7 +94,7 @@
 use Carp;
 use Test::More tests => ( 1 * !!$Config::Config{useithreads}
                          + 0 * ($] > 5.009)
-                         + 787);
+                         + 789);
 
 require_ok("B::Concise");
 

==== //depot/maint-5.8/perl/pad.c#64 (text) ====
Index: perl/pad.c
--- perl/pad.c#63~29964~        2007-01-24 15:53:28.000000000 -0800
+++ perl/pad.c  2007-02-02 09:46:17.000000000 -0800
@@ -103,8 +103,13 @@
 #define PERL_IN_PAD_C
 #include "perl.h"
 
+#define COP_SEQ_RANGE_LOW_set(sv,val)          SvNV_set(sv, (NV)val)
+#define COP_SEQ_RANGE_HIGH_set(sv,val)         SvUV_set(sv, val)
 
-#define PAD_MAX 999999999
+#define PARENT_PAD_INDEX_set(sv,val)           SvNV_set(sv, (NV)val)
+#define PARENT_FAKELEX_FLAGS_set(sv,val)       SvUV_set(sv, val)
+
+#define PAD_MAX IV_MAX
 
 
 
@@ -362,8 +367,8 @@
        SvFAKE_on(namesv);
     else {
        /* not yet introduced */
-       SvNV_set(namesv, (NV)PAD_MAX);  /* min */
-       SvIV_set(namesv, 0);            /* max */
+       COP_SEQ_RANGE_LOW_set(namesv, PAD_MAX); /* min */
+       COP_SEQ_RANGE_HIGH_set(namesv, 0);              /* max */
 
        if (!PL_min_intro_pending)
            PL_min_intro_pending = offset;
@@ -467,8 +472,9 @@
     SV* const name = newSV(0);
     sv_upgrade(name, SVt_PVNV);
     sv_setpvn(name, "&", 1);
-    SvIV_set(name, -1);
-    SvNV_set(name, 1);
+    /* Are these two actually ever read? */
+    COP_SEQ_RANGE_HIGH_set(name, ~0);
+    COP_SEQ_RANGE_LOW_set(name, 1);
     ix = pad_alloc(op_type, SVs_PADMY);
     av_store(PL_comppad_name, ix, name);
     /* XXX DAPM use PL_curpad[] ? */
@@ -521,7 +527,7 @@
        if (sv
            && sv != &PL_sv_undef
            && !SvFAKE(sv)
-           && (SvIVX(sv) == PAD_MAX || SvIVX(sv) == 0)
+           && (COP_SEQ_RANGE_HIGH(sv) == PAD_MAX || COP_SEQ_RANGE_HIGH(sv) == 
0)
            && (!is_our
                || ((SvFLAGS(sv) & SVpad_OUR) && GvSTASH(sv) == ourstash))
            && strEQ(name, SvPVX_const(sv)))
@@ -530,7 +536,7 @@
                "\"%s\" variable %s masks earlier declaration in same %s",
                (is_our ? "our" : "my"),
                name,
-               (SvIVX(sv) == PAD_MAX ? "scope" : "statement"));
+               (COP_SEQ_RANGE_HIGH(sv) == PAD_MAX ? "scope" : "statement"));
            --off;
            break;
        }
@@ -542,7 +548,7 @@
            if (sv
                && sv != &PL_sv_undef
                && !SvFAKE(sv)
-               && (SvIVX(sv) == PAD_MAX || SvIVX(sv) == 0)
+               && (COP_SEQ_RANGE_HIGH(sv) == PAD_MAX || COP_SEQ_RANGE_HIGH(sv) 
== 0)
                && SvOURSTASH(sv) == ourstash
                && strEQ(name, SvPVX_const(sv)))
            {
@@ -607,11 +613,11 @@
            continue;
        }
        else {
-           if (   seq >  U_32(SvNVX(sv))       /* min */
-               && seq <= (U32)SvIVX(sv))       /* max */
+           if (   seq >  COP_SEQ_RANGE_LOW(sv)         /* min */
+               && seq <= COP_SEQ_RANGE_HIGH(sv))       /* max */
                return off;
            else if (SvPAD_OUR(sv)
-                   && U_32(SvNVX(sv)) == PAD_MAX) /* min */
+                   && COP_SEQ_RANGE_LOW(sv) == PAD_MAX) /* min */
            {
                /* look for an our that's being introduced; this allows
                 *    our $foo = 0 unless defined $foo;
@@ -699,8 +705,8 @@
                continue;
            }
            else {
-               if (   seq >  U_32(SvNVX(sv))   /* min */
-                   && seq <= (U32)SvIVX(sv)    /* max */
+               if (   seq >  COP_SEQ_RANGE_LOW(sv)     /* min */
+                   && seq <= COP_SEQ_RANGE_HIGH(sv)    /* max */
                    && !(newoff && !depth) /* ignore inactive when cloning */
                )
                    goto found;
@@ -740,8 +746,8 @@
                "             matched:   offset %ld"
                    " (%lu,%lu), sv=0x%"UVxf"\n",
                (long)off,
-               (unsigned long)U_32(SvNVX(sv)),
-               (unsigned long)SvIVX(sv),
+               (unsigned long)COP_SEQ_RANGE_LOW(sv),
+               (unsigned long)COP_SEQ_RANGE_HIGH(sv),
                PTR2UV(oldsv)
            )
        );
@@ -933,13 +939,14 @@
     for (i = PL_min_intro_pending; i <= PL_max_intro_pending; i++) {
        SV * const sv = svp[i];
 
-       if (sv && sv != &PL_sv_undef && !SvFAKE(sv) && !SvIVX(sv)) {
-           SvIV_set(sv, PAD_MAX);      /* Don't know scope end yet. */
-           SvNV_set(sv, (NV)PL_cop_seqmax);
+       if (sv && sv != &PL_sv_undef && !SvFAKE(sv) && !COP_SEQ_RANGE_HIGH(sv)) 
{
+           COP_SEQ_RANGE_HIGH_set(sv, PAD_MAX);        /* Don't know scope end 
yet. */
+           COP_SEQ_RANGE_LOW_set(sv, PL_cop_seqmax);
            DEBUG_Xv(PerlIO_printf(Perl_debug_log,
                "Pad intromy: %ld \"%s\", (%lu,%lu)\n",
                (long)i, SvPVX_const(sv),
-               (unsigned long)U_32(SvNVX(sv)), (unsigned long)SvIVX(sv))
+               (unsigned long)COP_SEQ_RANGE_LOW(sv),
+               (unsigned long)COP_SEQ_RANGE_HIGH(sv))
            );
        }
     }
@@ -982,12 +989,13 @@
     /* "Deintroduce" my variables that are leaving with this scope. */
     for (off = AvFILLp(PL_comppad_name); off > PL_comppad_name_fill; off--) {
        const SV * const sv = svp[off];
-       if (sv && sv != &PL_sv_undef && !SvFAKE(sv) && SvIVX(sv) == PAD_MAX) {
-           SvIV_set(sv, PL_cop_seqmax);
+       if (sv && sv != &PL_sv_undef && !SvFAKE(sv) && COP_SEQ_RANGE_HIGH(sv) 
== PAD_MAX) {
+           COP_SEQ_RANGE_HIGH_set(sv, PL_cop_seqmax);
            DEBUG_Xv(PerlIO_printf(Perl_debug_log,
                "Pad leavemy: %ld \"%s\", (%lu,%lu)\n",
                (long)off, SvPVX_const(sv),
-               (unsigned long)U_32(SvNVX(sv)), (unsigned long)SvIVX(sv))
+               (unsigned long)COP_SEQ_RANGE_LOW(sv),
+               (unsigned long)COP_SEQ_RANGE_HIGH(sv))
            );
        }
     }
@@ -1248,8 +1256,8 @@
                    (int) ix,
                    PTR2UV(ppad[ix]),
                    (unsigned long) (ppad[ix] ? SvREFCNT(ppad[ix]) : 0),
-                   (unsigned long)U_32(SvNVX(namesv)),
-                   (unsigned long)SvIVX(namesv),
+                   (unsigned long)COP_SEQ_RANGE_LOW(namesv),
+                   (unsigned long)COP_SEQ_RANGE_HIGH(namesv),
                    SvPVX_const(namesv)
                );
        }

==== //depot/maint-5.8/perl/pad.h#17 (text) ====
Index: perl/pad.h
--- perl/pad.h#16~29949~        2007-01-24 07:28:38.000000000 -0800
+++ perl/pad.h  2007-02-02 09:46:17.000000000 -0800
@@ -30,7 +30,20 @@
 #   endif
 #endif
 #define NOT_IN_PAD ((PADOFFSET) -1)
- 
+
+/* B.xs needs these for the benefit of B::Deparse */ 
+/* Low range end is exclusive (valid from the cop seq after this one) */
+#define COP_SEQ_RANGE_LOW(sv)                  U_32(SvNVX(sv))
+/* High range end is inclusive (valid up to this cop seq) */
+#define COP_SEQ_RANGE_HIGH(sv)                 U_32(SvUVX(sv))
+
+#define PARENT_PAD_INDEX(sv)                   U_32(SvNVX(sv))
+#define PARENT_FAKELEX_FLAGS(sv)               U_32(SvUVX(sv))
+
+/* Flags set in the SvIVX field of FAKE namesvs */
+    
+#define PAD_FAKELEX_ANON   1 /* the lex is declared in an ANON, or ... */
+#define PAD_FAKELEX_MULTI  2 /* the lex can be instantiated multiple times */
 
 /* flags for the pad_new() function */
 
End of Patch.

Reply via email to