From 6c5e080d01cb781ede98cb40c5af749e9d939e17 Mon Sep 17 00:00:00 2001 From: Nicholas Clark Date: Thu, 28 Dec 2006 21:41:52 +0000 Subject: [PATCH] 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. p4raw-id: //depot/perl@29631 --- ext/B/B/Concise.pm | 8 +++++--- ext/B/defsubs_h.PL | 2 +- ext/B/t/concise-xs.t | 2 +- pad.c | 5 ----- pad.h | 5 +++++ 5 files changed, 12 insertions(+), 10 deletions(-) diff --git a/ext/B/B/Concise.pm b/ext/B/B/Concise.pm index 82a9ff4..8f99abc 100644 --- a/ext/B/B/Concise.pm +++ b/ext/B/B/Concise.pm @@ -28,7 +28,7 @@ our %EXPORT_TAGS = # 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" => @@ -731,8 +731,10 @@ sub concise_op { # These changes relate to the jumbo closure fix. # See changes 19939 and 20005 my $fake = ''; - $fake .= 'a' if $padname->PARENT_FAKELEX_FLAGS & 1; # PAD_FAKELEX_ANON - $fake .= 'm' if $padname->PARENT_FAKELEX_FLAGS & 2; # PAD_FAKELEX_MULTI + $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"; diff --git a/ext/B/defsubs_h.PL b/ext/B/defsubs_h.PL index 0a1f781..9291f34 100644 --- a/ext/B/defsubs_h.PL +++ b/ext/B/defsubs_h.PL @@ -51,7 +51,7 @@ foreach my $const (qw( { doconst($const); } -foreach my $file (qw(op.h cop.h)) +foreach my $file (qw(op.h cop.h pad.h)) { my $path = $^O eq 'MacOS' ? ":::$file" : "../../$file"; open(OPH,"$path") || die "Cannot open $path:$!"; diff --git a/ext/B/t/concise-xs.t b/ext/B/t/concise-xs.t index a83bc16..76f307b 100644 --- a/ext/B/t/concise-xs.t +++ b/ext/B/t/concise-xs.t @@ -117,7 +117,7 @@ use Getopt::Std; use Carp; use Test::More tests => ( # per-pkg tests (function ct + require_ok) 40 + 16 # Data::Dumper, Digest::MD5 - + 517 + 236 # B::Deparse, B + + 517 + 241 # B::Deparse, B + 595 + 190 # POSIX, IO::Socket + 3 * ($] > 5.009) + 16 * ($] >= 5.009003) diff --git a/pad.c b/pad.c index 2cfdc85..67913b0 100644 --- a/pad.c +++ b/pad.c @@ -669,11 +669,6 @@ the parent pad. =cut */ -/* 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 */ - /* the CV has finished being compiled. This is not a sufficient test for * all CVs (eg XSUBs), but suffices for the CVs found in a lexical chain */ #define CvCOMPILED(cv) CvROOT(cv) diff --git a/pad.h b/pad.h index bf91d0c..44e9385 100644 --- a/pad.h +++ b/pad.h @@ -89,6 +89,11 @@ typedef U64TYPE PADOFFSET; (0 + (((XPVNV*) SvANY(sv))->xnv_u.xpad_cop_seq.xhigh)) #endif +/* 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 */ #define padnew_CLONE 1 /* this pad is for a cloned CV */ -- 1.8.3.1