blib/lib/B/C.pm

filter: Statementstmt 5.9% 278 / 4704 Branchbran 0.9% 35 / 3864 Conditioncond 0.6% 14 / 2100 MC/DCmcdc 0.0% 0 / 1192 Subroutinesub 21.4% 52 / 242 Podpod 0.0% 0 / 103 totaltotal 3.1% 379 / 12205 CC 2680 SCAR 94.3
CC
2680
Cov
3%
save
70118.2
save
46828.1
save
16256.0
CRAP 12456.7
↑ Summary blib/script/cc_harness »
1 # C.pm
2 #
3 # Copyright (c) 1996, 1997, 1998 Malcolm Beattie
4 # Copyright (c) 2008, 2009, 2010, 2011 Reini Urban
5 # Copyright (c) 2010 Nick Koston
6 # Copyright (c) 2011, 2012, 2013, 2014, 2015, 2016, 2017 cPanel Inc
7 # Copyright (c) 2017, 2018, 2019 Reini Urban
8 #
9 # You may distribute under the terms of either the GNU General Public
10 # License or the Artistic License, as specified in the README file.
11 #
12  
13 package B::C;
14 41 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
15  
16 41 our $VERSION = '1.57';
17 41 our (%debug, $check, %Config, %Cross, %OriConfig, $cross);
18 41 ▶BEGIN {
Subroutine BEGIN: called CC=3 SCAR=13.5
19 41 require B::C::Config;
20 41 *Config = \%B::C::Config::Config;
21 41 ▶ if (!keys %Config) { #or !exists $Config{usecperl}
Branch: 1 branch
BranchTrueFalseTotal
unless (keys %B::C::Config) 0 41 41
22 0 warn "Empty \%B::C::Config::Config";
23 0 require Config;
24 0 Config->import;
25 }
26 # make it a restricted hash
27 41 ▶ Internals::SvREADONLY(%Config, 1) if $] >= 5.008004;
Branch: 1 branch
BranchTrueFalseTotal
if $] >= "5.008004" 41 0 41
28 }
29  
30 # Thanks to Mattia Barbon for the C99 tip to init any union members
31 41 my $C99 = $Config{d_c99_variadic_macros}; # http://docs.sun.com/source/819-3688/c99.app.html#pgfId-1003962
32  
33 package B::C::Section;
34 41 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
35  
36 41 my %sections;
37  
38 0 ▶sub new {
Subroutine new: not called CC=3 SCAR=24.8
39 0 my ($class, $section, $symtable, $default) = @_;
40 0 my $o = bless [-1, $section, $symtable, $default], $class;
41 0 $sections{$section} = $o;
42  
43 0 push @$o, { values => [] };
44  
45 # if sv add a dummy sv_arenaroot to support global destruction
46 0 ▶ if ($section eq 'sv') {
Branch: 1 branch
BranchTrueFalseTotal
if ($section eq "sv") 0 0 0
47 # 0 refcnt placeholder for the static arenasize later adjusted
48 0 ▶ $o->add( "NULL, 0, SVTYPEMASK|0x01000000".($] >= 5.009005?", {0}":'')); # SVf_FAKE
Branch: 1 branch
BranchTrueFalseTotal
$] >= 5.009005 ? : 0 0 0
49 0 $o->[-1]{dbg}->[0] = "PL_sv_arenaroot";
50 }
51 0 return $o;
52 }
53  
54 0 ▶sub get {
Subroutine get: not called CC=1 SCAR=6.9
55 0 my ($class, $section) = @_;
56 0 return $sections{$section};
57 }
58  
59 0 ▶sub add {
Subroutine add: not called CC=1 SCAR=6.9
60 0 my $section = shift;
61 0 push( @{ $section->[-1]{values} }, @_ );
62 }
63  
64 0 ▶sub remove {
Subroutine remove: not called CC=1 SCAR=6.9
65 0 my $section = shift;
66 0 pop @{ $section->[-1]{values} };
67 }
68  
69 0 ▶sub index {
Subroutine index: not called CC=1 SCAR=6.9
70 0 my $section = shift;
71 0 return scalar( @{ $section->[-1]{values} } ) - 1;
72 }
73  
74 0 ▶sub name {
Subroutine name: not called CC=1 SCAR=6.9
75 0 my $section = shift;
76 0 return $section->[1];
77 }
78  
79 0 ▶sub symtable {
Subroutine symtable: not called CC=1 SCAR=6.9
80 0 my $section = shift;
81 0 return $section->[2];
82 }
83  
84 0 ▶sub default {
Subroutine default: not called CC=1 SCAR=6.9
85 0 my $section = shift;
86 0 return $section->[3];
87 }
88  
89 0 ▶sub typename {
Subroutine typename: not called CC=7 SCAR=40.3
90 0 my $section = shift;
91 0 my $name = $section->name;
92 0 my $typename = uc($name);
93 # -fcog hack to statically initialize PVs (SVPV for 5.10-5.11 only)
94 0 ▶ $typename = 'SVPV' if $typename eq 'SV' and $] > 5.009005 and $] < 5.012 and !$C99;
Branch: 1 branch
BranchTrueFalseTotal
if $typename eq "SV" and $] > "5.009005" and $] < "5.012" and not $C99 0 0 0
Condition0%0/9
$typename eq "SV" and $] > "5.009005" and $] < "5.012" and not $C99
!ll&&!rl&&r
000
$typename eq "SV" and $] > "5.009005" and $] < "5.012"
!ll&&!rl&&r
000
$typename eq "SV" and $] > "5.009005"
!ll&&!rl&&r
000
MC/DC0%0/4
$typename eq "SV" and $] > "5.009005" and $] < "5.012" and not $C99
$typename eq "SV" $] > "5.009005" $] < "5.012" not $C99
Truth table0%0/5
A and B and C and not(D)
A= $typename eq "SV"B= $] > "5.009005"C= $] < "5.012"D= not $C99
ABCDresult
0XXX0
10XX0
110X0
11100
11111
95 # $typename = 'const '.$typename if $name !~ /^(cop_|sv_)/;
96 0 ▶ $typename = 'UNOP_AUX' if $typename eq 'UNOPAUX';
Branch: 1 branch
BranchTrueFalseTotal
if $typename eq "UNOPAUX" 0 0 0
97 0 ▶ $typename = 'SV*' if $typename =~ /^AVCO[WG]_/;
Branch: 1 branch
BranchTrueFalseTotal
if $typename =~ /^AVCO[WG]_/ 0 0 0
98 #$typename = 'MyPADNAME' if $typename eq 'PADNAME' and $] >= 5.018;
99 0 return $typename;
100 }
101  
102 0 ▶sub comment {
Subroutine comment: not called CC=2 SCAR=17.9
103 0 my $section = shift;
104 0 ▶ $section->[-1]{comment} = join( "", @_ ) if @_;
Branch: 1 branch
BranchTrueFalseTotal
if @_ 0 0 0
105 0 $section->[-1]{comment};
106 }
107  
108 # add debugging info - stringified flags on -DF
109 0 ▶sub debug {
Subroutine debug: not called CC=2 SCAR=17.9
110 0 my $section = shift;
111 0 my $dbg = join( " ", @_ );
112 0 ▶ $section->[-1]{dbg}->[ $section->index ] = $dbg if $dbg;
Branch: 1 branch
BranchTrueFalseTotal
if $dbg 0 0 0
113 }
114  
115 0 ▶sub output {
Subroutine output: not called CC=16 SCAR=56.1
116 0 my ( $section, $fh, $format ) = @_;
117 0 ▶ my $sym = $section->symtable || {};
Condition0%0/2
$section->symtable || {}
l!l
00
MC/DC0%0/1
$section->symtable || {}
$section->symtable
Truth table0%0/2
A
A= $section->symtable
Aresult
11
00
118 0 my $default = $section->default;
119 0 ▶ return if $B::C::check;
Branch: 1 branch
BranchTrueFalseTotal
if $B::C::check 0 0 0
120 0 my $i = 0;
121 0 ▶ my $dodbg = 1 if $debug{flags} and $section->[-1]{dbg};
Branch: 1 branch
BranchTrueFalseTotal
if $B::C::debug{"flags"} and $section->[-1]{"dbg"} 0 0 0
Condition0%0/3
$B::C::debug{"flags"} and $section->[-1]{"dbg"}
!ll&&!rl&&r
000
MC/DC0%0/2
$B::C::debug{"flags"} and $section->[-1]{"dbg"}
$B::C::debug{"flags"} $section->[-1]{"dbg"}
Truth table0%0/3
A and B
A= $B::C::debug{"flags"}B= $section->[-1]{"dbg"}
ABresult
0X0
100
111
122 0 ▶ if ($section->name eq 'sv') { #fixup arenaroot refcnt
Branch: 1 branch
BranchTrueFalseTotal
if ($section->name eq "sv") 0 0 0
123 0 my $len = scalar @{ $section->[-1]{values} };
124 0 $section->[-1]{values}->[0] =~ s/^NULL, 0/NULL, $len/;
125 }
126 0 foreach ( @{ $section->[-1]{values} } ) {
127 0 my $dbg = "";
128 0 my $ref = "";
129 0 ▶ if (m/(s\\_[0-9a-f]+)/) {
Branch: 1 branch
BranchTrueFalseTotal
if (/(s\\_[0-9a-f]+)/) 0 0 0
130 0 ▶ if (!exists($sym->{$1}) and $1 ne 's\_0') {
Branch: 1 branch
BranchTrueFalseTotal
if (not exists $sym->{$1} and $1 ne "s\\_0") 0 0 0
Condition0%0/3
not exists $sym->{$1} and $1 ne "s\\_0"
!ll&&!rl&&r
000
MC/DC0%0/2
not exists $sym->{$1} and $1 ne "s\\_0"
not exists $sym->{$1} $1 ne "s\\_0"
Truth table0%0/3
not(A) and B
A= not exists $sym->{$1}B= $1 ne "s\\_0"
ABresult
0X0
100
111
131 0 $ref = $1;
132 0 $B::C::unresolved_count++;
133 0 ▶ if ($B::C::verbose) {
Branch: 1 branch
BranchTrueFalseTotal
if ($B::C::verbose) 0 0 0
134 0 my $caller = caller(1);
135 0 ▶ warn "Warning: unresolved ".$section->name." symbol $ref\n"
Branch: 1 branch
BranchTrueFalseTotal
if $caller eq "B::C" 0 0 0
136 if $caller eq 'B::C';
137 }
138 }
139 }
140 0 ▶ s{(s\\_[0-9a-f]+)}{ exists($sym->{$1}) ? $sym->{$1} : $default; }ge;
Branch: 1 branch
BranchTrueFalseTotal
exists $sym->{$1} ? : 0 0 0
141 0 ▶ if ($dodbg and $section->[-1]{dbg}->[$i]) {
Branch: 1 branch
BranchTrueFalseTotal
if ($dodbg and $section->[-1]{"dbg"}[$i]) 0 0 0
Condition0%0/3
$dodbg and $section->[-1]{"dbg"}[$i]
!ll&&!rl&&r
000
MC/DC0%0/2
$dodbg and $section->[-1]{"dbg"}[$i]
$dodbg $section->[-1]{"dbg"}[$i]
Truth table0%0/3
A and B
A= $dodbgB= $section->[-1]{"dbg"}[$i]
ABresult
0X0
100
111
142 0 $dbg = " /* ".$section->[-1]{dbg}->[$i]." ".$ref." */";
143 }
144 0 ▶ if ($format eq "\t{ %s }, /* %s_list[%d] %s */%s\n") {
Branch: 1 branch
BranchTrueFalseTotal
if ($format eq "\t{ %s }, /* %s_list[%d] %s */%s\n") { } 0 0 0
145 0 printf $fh $format, $_, $section->name, $i, $ref, $dbg;
146 } else {
147 0 printf $fh $format, $_;
148 }
149 0 ++$i;
150 }
151 }
152  
153 package B::C::InitSection;
154 41 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
155  
156 # avoid use vars
157 41 @B::C::InitSection::ISA = qw(B::C::Section);
158  
159 0 ▶sub new {
Subroutine new: not called CC=1 SCAR=6.9
160 0 my $class = shift;
161 0 my $max_lines = 10000; #pop;
162 0 my $section = $class->SUPER::new(@_);
163  
164 0 $section->[-1]{evals} = [];
165 0 $section->[-1]{initav} = [];
166 0 $section->[-1]{chunks} = [];
167 0 $section->[-1]{nosplit} = 0;
168 0 $section->[-1]{current} = [];
169 0 $section->[-1]{count} = 0;
170 0 $section->[-1]{size} = 0;
171 0 $section->[-1]{max_lines} = $max_lines;
172  
173 0 return $section;
174 }
175  
176 0 ▶sub split {
Subroutine split: not called CC=2 SCAR=17.9
177 0 my $section = shift;
178 $section->[-1]{nosplit}--
179 0 ▶ if $section->[-1]{nosplit} > 0;
Branch: 1 branch
BranchTrueFalseTotal
if $section->[-1]{"nosplit"} > 0 0 0 0
180 }
181  
182 0 ▶sub no_split {
Subroutine no_split: not called CC=1 SCAR=6.9
183 0 shift->[-1]{nosplit}++;
184 }
185  
186 0 ▶sub inc_count {
Subroutine inc_count: not called CC=1 SCAR=6.9
187 0 my $section = shift;
188  
189 0 $section->[-1]{count} += $_[0];
190  
191 # this is cheating
192 0 $section->add();
193 }
194  
195 0 ▶sub add {
Subroutine add: not called CC=3 SCAR=24.8
196 0 my $section = shift->[-1];
197 0 my $current = $section->{current};
198 0 my $nosplit = $section->{nosplit};
199  
200 0 push @$current, @_;
201 0 $section->{count} += scalar(@_);
202 0 ▶ if ( !$nosplit && $section->{count} >= $section->{max_lines} ) {
Branch: 1 branch
BranchTrueFalseTotal
if (not $nosplit and $section->{"count"} >= $section->{"max_lines"}) 0 0 0
Condition0%0/3
not $nosplit and $section->{"count"} >= $section->{"max_lines"}
!ll&&!rl&&r
000
MC/DC0%0/2
not $nosplit and $section->{"count"} >= $section->{"max_lines"}
not $nosplit $section->{"count"} >= $section->{"max_lines"}
Truth table0%0/3
not(A) and B
A= not $nosplitB= $section->{"count"} >= $section->{"max_lines"}
ABresult
0X0
100
111
203 0 push @{ $section->{chunks} }, $current;
204 0 $section->{current} = [];
205 0 $section->{count} = 0;
206 }
207 }
208  
209 0 ▶sub add_eval {
Subroutine add_eval: not called CC=2 SCAR=17.9
210 0 my $section = shift;
211 0 my @strings = @_;
212  
213 0 foreach my $i (@strings) {
214 0 $i =~ s/\"/\\\"/g;
215 }
216 0 push @{ $section->[-1]{evals} }, @strings;
217 }
218  
219 0 ▶sub pre_destruct {
Subroutine pre_destruct: not called CC=1 SCAR=6.9
220 0 my $section = shift;
221 0 push @{ $section->[-1]{pre_destruct} }, @_;
222 }
223  
224 0 ▶sub add_initav {
Subroutine add_initav: not called CC=1 SCAR=6.9
225 0 my $section = shift;
226 0 push @{ $section->[-1]{initav} }, @_;
227 }
228  
229 0 ▶sub output {
Subroutine output: not called CC=11 SCAR=48.8
230 0 my ( $section, $fh, $format, $init_name ) = @_;
231 0 ▶ my $sym = $section->symtable || {};
Condition0%0/2
$section->symtable || {}
l!l
00
MC/DC0%0/1
$section->symtable || {}
$section->symtable
Truth table0%0/2
A
A= $section->symtable
Aresult
11
00
232 0 my $default = $section->default;
233 0 ▶ return if $B::C::check;
Branch: 1 branch
BranchTrueFalseTotal
if $B::C::check 0 0 0
234 0 push @{ $section->[-1]{chunks} }, $section->[-1]{current};
235  
236 0 my $name = "aaaa";
237 0 foreach my $i ( @{ $section->[-1]{chunks} } ) {
238 # dTARG and dSP unused -nt
239 0 print $fh <<"EOT";
240 static void ${init_name}_${name}(pTHX)
241 {
242 dVAR;
243 EOT
244 0 foreach my $i ( @{ $section->[-1]{initav} } ) {
245 0 print $fh "\t",$i,"\n";
246 }
247 0 foreach my $j (@$i) {
248 0 $j =~ s{(s\\_[0-9a-f]+)}
249 0 ▶ { exists($sym->{$1}) ? $sym->{$1} : $default; }ge;
Branch: 1 branch
BranchTrueFalseTotal
exists $sym->{$1} ? : 0 0 0
250 0 print $fh "\t$j\n";
251 }
252 0 ▶ if (@{ $section->[-1]{evals} }) {
Branch: 1 branch
BranchTrueFalseTotal
if (@{$section->[-1]{"evals"};}) 0 0 0
253 # We need to output evals after dl_init, in init2
254 0 ▶ if ($section->name ne 'init2') {
Branch: 1 branch
BranchTrueFalseTotal
if ($section->name ne 'init2') { } 0 0 0
255 0 die "Invalid section ".$section->name."->add_eval, use init2";
256 } else {
257 0 foreach my $s ( @{ $section->[-1]{evals} } ) {
258 0 print $fh "\teval_pv(\"$s\",1);\n";
259 }
260 }
261 }
262 0 print $fh "}\n";
263  
264 0 $section->SUPER::add("${init_name}_${name}(aTHX);");
265 0 ++$name;
266 }
267  
268 0 print $fh <<"EOT";
269 PERL_STATIC_INLINE int ${init_name}(pTHX)
270 {
271 EOT
272 0 ▶ if ($section->name eq 'init') {
Branch: 1 branch
BranchTrueFalseTotal
if ($section->name eq "init") 0 0 0
273 0 print $fh "\tperl_init0(aTHX);\n";
274 }
275 0 $section->SUPER::output( $fh, $format );
276 0 print $fh "\treturn 0;\n}\n";
277 }
278  
279 package B::C;
280 41 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
281 41 ▶use Exporter ();
Subroutine BEGIN: called CC=1 SCAR=0.0
282 41 ▶use Errno (); #needed since 5.14
Subroutine BEGIN: called CC=1 SCAR=0.0
283 41 our %Regexp;
284  
285 { # block necessary for caller to work
286 41 my $caller = caller;
287 41 ▶ if ( $caller eq 'O' or $caller eq 'Od' ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($caller eq "O" or $caller eq "Od") 0 41 41
Condition33%1/3
$caller eq "O" or $caller eq "Od"
l!l&&r!l&&!r
0041
MC/DC0%0/2
$caller eq "O" or $caller eq "Od"
$caller eq "O" $caller eq "Od"
Truth table33%1/3
A or B
A= $caller eq "O"B= $caller eq "Od"
ABresult
1X1
011
000
288 0 require XSLoader;
289 0 XSLoader::load('B::C'); # for r-magic and for utf8-keyed B::HV->ARRAY
290 }
291 }
292  
293 41 our @ISA = qw(Exporter);
294 41 our @EXPORT_OK =
295 qw(output_all output_boilerplate output_main output_main_rest mark_unused mark_skip
296 init_sections set_callback save_unused_subs objsym save_context fixup_ppaddr
297 save_sig svop_or_padop_pv inc_cleanup ivx nvx curcv set_curcv cross_config);
298  
299 # for 5.6.[01] better use the native B::C
300 # but 5.6.2 works fine
301 use B
302 41 ▶ qw(minus_c sv_undef walkoptree walkoptree_slow main_root main_start peekop
Subroutine BEGIN: called CC=1 SCAR=0.0
303 cchar svref_2object compile_stats comppadlist hash
304 threadsv_names main_cv init_av end_av opnumber cstring
305 41 HEf_SVKEY SVf_POK SVp_POK SVf_ROK SVf_IOK SVf_NOK SVf_IVisUV SVf_READONLY);
306  
307 # usually 0x400000, but can be as low as 0x10000
308 # http://docs.embarcadero.com/products/rad_studio/delphiAndcpp2009/HelpUpdate2/EN/html/devcommon/compdirsimagebaseaddress_xml.html
309 # called mapped_base on linux (usually 0xa38000)
310 sub LOWEST_IMAGEBASE() {0x10000}
311  
312 0 ▶sub _load_mro {
Subroutine _load_mro: not called CC=3 SCAR=24.8
313 0 ▶ eval q/require mro; 1/ or die if $] >= 5.010;
Branch: 1 branch
BranchTrueFalseTotal
if $] >= "5.01" 0 0 0
Condition0%0/5
$] >= 5.01 && (eval 'require mro; 1' || die())
!ll&&!rl&&r
000
eval "require mro; 1" or die
l!l
00
MC/DC0%0/2
$] >= 5.01 && (eval 'require mro; 1' || die())
$] >= 5.01 eval "require mro; 1"
Truth table0%0/3
A && B
A= $] >= 5.01B= eval "require mro; 1"
ABresult
0X0
100
111
314 0 ▶ *_load_mro = sub {};
Subroutine __ANON__: not called CC=1 SCAR=6.9
315 }
316  
317 0 ▶sub is_using_mro {
Subroutine is_using_mro: not called CC=2 SCAR=17.9
Pod undocumented
318 0 ▶ return keys %{mro::} > 10 ? 1 : 0;
Branch: 1 branch
BranchTrueFalseTotal
keys %main::mro:: > 10 ? : 0 0 0
319 }
320  
321 41 ▶BEGIN {
Subroutine BEGIN: called CC=12 SCAR=33.1
322 41 ▶ if ($] >= 5.008) {
Branch: 1 branch
BranchTrueFalseTotal
if ($] >= 5.008) { } 41 0 41
323 41 @B::NV::ISA = 'B::IV'; # add IVX to nv. This fixes test 23 for Perl 5.8
324 41 B->import(qw(regex_padav SVp_NOK SVp_IOK CVf_CONST CVf_ANON
325 SVf_FAKE)); # both unsupported for 5.6
326 41 eval q[
327 sub SVs_OBJECT() {0x00100000}
328 sub SVf_AMAGIC() {0x10000000}
329 ];
330 } else {
331 0 eval q[
332 sub SVp_NOK() {0}; # unused
333 sub SVp_IOK() {0};
334 sub CVf_ANON() {4};
335 sub CVf_CONST() {0}; # unused
336 sub PMf_ONCE() {0xff}; # unused
337 sub SVf_FAKE() {0x00100000}; # unused
338 sub SVs_OBJECT() {0x00001000}
339 sub SVf_AMAGIC() {0x10000000}
340 ];
341 0 @B::PVMG::ISA = qw(B::PVNV B::RV);
342 }
343 # used since 5.27.3/5.27.2c only
344 sub SVt_PVLV() { 13 }
345 0 ▶ sub SVf_UTF8 { 0x20000000 }
Subroutine SVf_UTF8: not called CC=1 SCAR=6.9
Pod undocumented
346 41 ▶ if ($] >= 5.008001) {
Branch: 1 branch
BranchTrueFalseTotal
if ($] >= 5.008001) { } 41 0 41
347 41 B->import(qw(SVt_PVGV CVf_WEAKOUTSIDE)); # added with 5.8.1
348 } else {
349 0 eval q[sub SVt_PVGV() {13}];
350 0 eval q[sub CVf_WEAKOUTSIDE() { 0x0 }]; # unused
351 }
352 41 ▶ if ($] >= 5.010) {
Branch: 1 branch
BranchTrueFalseTotal
if ($] >= 5.01) { } 41 0 41
353 #require mro; # mro->import();
354 # not exported:
355 0 ▶ sub SVf_OOK { 0x02000000 }
Subroutine SVf_OOK: not called CC=1 SCAR=6.9
Pod undocumented
356 41 eval q[sub SVs_GMG() { 0x00200000 }
357 sub SVs_SMG() { 0x00400000 }];
358 41 ▶ if ($] >= 5.018) {
Branch: 3 branches
BranchTrueFalseTotal
if ($] >= 5.018) { } 41 0 41
elsif ($] >= 5.014) { } 0 0 0
elsif ($] >= 5.012) { } 0 0 0
359 41 B->import(qw(PMf_EVAL RXf_EVAL_SEEN));
360 41 eval q[sub PMf_ONCE(){ 0x10000 }]; # PMf_ONCE also not exported
361 } elsif ($] >= 5.014) {
362 0 eval q[sub PMf_ONCE(){ 0x8000 }];
363 } elsif ($] >= 5.012) {
364 0 eval q[sub PMf_ONCE(){ 0x0080 }];
365 } else { # 5.10. not used with <= 5.8
366 0 eval q[sub PMf_ONCE(){ 0x0002 }];
367 }
368 41 ▶ if ($] > 5.021006) {
Branch: 1 branch
BranchTrueFalseTotal
if ($] > 5.021006) { } 41 0 41
369 41 B->import(qw(SVf_PROTECT CVf_ANONCONST SVs_PADSTALE));
370 } else {
371 0 eval q[sub SVf_PROTECT() { 0x0 }
372 sub CVf_ANONCONST(){ 0x0 }
373 sub SVs_PADSTALE() { 0x0 }
374 ]; # unused
375 }
376 } else {
377 0 eval q[sub SVs_GMG() { 0x00002000 }
378 sub SVs_SMG() { 0x00004000 }
379 sub SVf_PROTECT(){ 0x0 }
380 sub CVf_ANONCONST(){ 0x0 }
381 sub SVs_PADSTALE() { 0x0 }
382 ]; # unused
383 }
384 41 ▶ if ($] < 5.018) {
Branch: 1 branch
BranchTrueFalseTotal
if ($] < 5.018) { } 0 41 41
385 0 eval q[sub RXf_EVAL_SEEN() { 0x0 }
386 sub PMf_EVAL() { 0x0 }
387 sub SVf_IsCOW() { 0x0 }
388 ]; # unused
389 } else {
390 # 5.18
391 41 B->import(qw(SVf_IsCOW));
392 #if (exists ${B::}{PADNAME::}) {
393 41 @B::PADNAME::ISA = qw(B::PV);
394 #}
395 #if (exists ${B::}{PADLIST::}) {
396 41 @B::PADLIST::ISA = qw(B::AV);
397 #}
398 #if (exists ${B::}{PADNAMELIST::}) {
399 41 ▶ if ($] > 5.021005) { # 5.22
Branch: 1 branch
BranchTrueFalseTotal
if ($] > "5.021005") 41 0 41
400 41 @B::PADNAME::ISA = ();
401 41 @B::PADNAMELIST::ISA = qw(B::AV);
402 }
403 41 ▶ if ($Config{usecperl} and $] >= 5.022002) {
Branch: 1 branch
BranchTrueFalseTotal
if ($B::C::Config{"usecperl"} and $] >= "5.022002") 0 41 41
Condition33%1/3
$B::C::Config{"usecperl"} and $] >= "5.022002"
!ll&&!rl&&r
4100
MC/DC0%0/2
$B::C::Config{"usecperl"} and $] >= "5.022002"
$B::C::Config{"usecperl"} $] >= "5.022002"
Truth table33%1/3
A and B
A= $B::C::Config{"usecperl"}B= $] >= "5.022002"
ABresult
0X0
100
111
404 0 eval q[sub SVpav_REAL () { 0x40000000 }
405 sub SVpav_REIFY (){ 0x80000000 }
406 ];
407 }
408 }
409 }
410 41 ▶use B::Asmdata qw(@specialsv_name);
Subroutine BEGIN: called CC=1 SCAR=0.0
411  
412 41 ▶use FileHandle;
Subroutine BEGIN: called CC=1 SCAR=0.0
413  
414 41 my $hv_index = 0;
415 41 my $gv_index = 0;
416 41 my $re_index = 0;
417 41 my $pv_index = 0;
418 41 my $cv_index = 0;
419 41 my $hek_index = 0;
420 41 my $anonsub_index = 0;
421 41 my $initsub_index = 0;
422 41 my $padlist_index = 0;
423 41 my $padname_index = 0;
424 41 my $padnl_index = 0;
425  
426 # exclude all not B::C:: prefixed subs
427 41 my %all_bc_subs = map {$_=>1}
428 qw(B::AV::save B::BINOP::save B::BM::save B::COP::save B::CV::save
429 B::FAKEOP::fake_ppaddr B::FAKEOP::flags B::FAKEOP::new B::FAKEOP::next
430 B::FAKEOP::ppaddr B::FAKEOP::private B::FAKEOP::save B::FAKEOP::sibling
431 B::FAKEOP::targ B::FAKEOP::type B::GV::save B::GV::savecv B::HV::save
432 B::IO::save B::IO::save_data B::IV::save B::LISTOP::save B::LOGOP::save
433 B::LOOP::save B::NULL::save B::NV::save B::OBJECT::save
434 B::OP::_save_common B::OP::fake_ppaddr B::OP::isa B::OP::save
435 B::PADOP::save B::PMOP::save B::PV::save
436 B::PVIV::save B::PVLV::save B::PVMG::save B::PVMG::save_magic B::PVNV::save
437 B::PVOP::save B::REGEXP::save B::RV::save B::SPECIAL::save B::SPECIAL::savecv
438 B::SV::save B::SVOP::save B::UNOP::save B::UV::save B::REGEXP::EXTFLAGS);
439  
440 # track all internally used packages. all other may not be deleted automatically
441 # - hidden methods
442 # uses now @B::C::Config::deps
443 41 ▶our %all_bc_deps = map {$_=>1}
Branch: 1 branch
BranchTrueFalseTotal
@B::C::Config::deps ? : 41 0 41
444 @B::C::Config::deps ? @B::C::Config::deps
445 : qw(AnyDBM_File AutoLoader B B::AV B::Asmdata B::BINOP B::BM B::C B::C::Config B::C::InitSection B::C::Section B::CC B::COP B::CV B::FAKEOP B::FM B::GV B::HE B::HV B::IO B::IV B::LEXWARN B::LISTOP B::LOGOP B::LOOP B::MAGIC B::NULL B::NV B::OBJECT B::OP B::PADLIST B::PADNAME B::PADNAMELIST B::PADOP B::PMOP B::PV B::PVIV B::PVLV B::PVMG B::PVNV B::PVOP B::REGEXP B::RHE B::RV B::SPECIAL B::STASHGV B::SV B::SVOP B::UNOP B::UV CORE CORE::GLOBAL Carp DB DynaLoader Errno Exporter Exporter::Heavy ExtUtils ExtUtils::Constant ExtUtils::Constant::ProxySubs Fcntl FileHandle IO IO::File IO::Handle IO::Poll IO::Seekable IO::Socket Internals O POSIX PerlIO PerlIO::Layer PerlIO::scalar Regexp SelectSaver Symbol UNIVERSAL XSLoader __ANON__ arybase arybase::mg base fields main maybe maybe::next mro next overload re strict threads utf8 vars version warnings warnings::register);
446 41 ▶$all_bc_deps{Socket} = 1 if !@B::C::Config::deps and $] > 5.021;
Branch: 1 branch
BranchTrueFalseTotal
if not @B::C::Config::deps and $] > "5.021" 0 41 41
Condition33%1/3
not @B::C::Config::deps and $] > "5.021"
!ll&&!rl&&r
4100
MC/DC0%0/2
not @B::C::Config::deps and $] > "5.021"
not @B::C::Config::deps $] > "5.021"
Truth table33%1/3
not(A) and B
A= not @B::C::Config::depsB= $] > "5.021"
ABresult
0X0
100
111
447 41 ▶$all_bc_deps{overloading} = 1 if !@B::C::Config::deps and $] >= 5.027003;
Branch: 1 branch
BranchTrueFalseTotal
if not @B::C::Config::deps and $] >= "5.027003" 0 41 41
Condition33%1/3
not @B::C::Config::deps and $] >= "5.027003"
!ll&&!rl&&r
4100
MC/DC0%0/2
not @B::C::Config::deps and $] >= "5.027003"
not @B::C::Config::deps $] >= "5.027003"
Truth table33%1/3
not(A) and B
A= not @B::C::Config::depsB= $] >= "5.027003"
ABresult
0X0
100
111
448  
449 # B::C stash footprint: mainly caused by blib, warnings, and Carp loaded with DynaLoader
450 # perl5.15.7d-nt -MO=C,-o/dev/null -MO=Stash -e0
451 # -umain,-ure,-umro,-ustrict,-uAnyDBM_File,-uFcntl,-uRegexp,-uoverload,-uErrno,-uExporter,-uExporter::Heavy,-uConfig,-uwarnings,-uwarnings::register,-uDB,-unext,-umaybe,-umaybe::next,-uFileHandle,-ufields,-uvars,-uAutoLoader,-uCarp,-uSymbol,-uPerlIO,-uPerlIO::scalar,-uSelectSaver,-uExtUtils,-uExtUtils::Constant,-uExtUtils::Constant::ProxySubs,-uthreads,-ubase
452 # perl5.15.7d-nt -MErrno -MO=Stash -e0
453 # -umain,-ure,-umro,-ustrict,-uRegexp,-uoverload,-uErrno,-uExporter,-uExporter::Heavy,-uwarnings,-uwarnings::register,-uConfig,-uDB,-uvars,-uCarp,-uPerlIO,-uthreads
454 # perl5.15.7d-nt -Mblib -MO=Stash -e0
455 # -umain,-ure,-umro,-ustrict,-uCwd,-uRegexp,-uoverload,-uFile,-uFile::Spec,-uFile::Spec::Unix,-uDos,-uExporter,-uExporter::Heavy,-uConfig,-uwarnings,-uwarnings::register,-uDB,-uEPOC,-ublib,-uScalar,-uScalar::Util,-uvars,-uCarp,-uVMS,-uVMS::Filespec,-uVMS::Feature,-uWin32,-uPerlIO,-uthreads
456 # perl -MO=Stash -e0
457 # -umain,-uTie,-uTie::Hash,-ure,-umro,-ustrict,-uRegexp,-uoverload,-uExporter,-uExporter::Heavy,-uwarnings,-uDB,-uCarp,-uPerlIO,-uthreads
458 # pb -MB::Stash -e0
459 # -umain,-ure,-umro,-uRegexp,-uPerlIO,-uExporter,-uDB
460  
461 41 my ($prev_op, $package_pv, @package_pv); # global stash for methods since 5.13
462 41 my (%symtable, %cvforward, %lexwarnsym);
463 41 my (%strtable, %stashtable, %hektable, %statichektable, %gptable, %cophhtable, %copgvtable);
464 41 my (%xsub, %init2_remap);
465 41 my ($warn_undefined_syms, $swash_init, $swash_ToCf);
466 41 my ($staticxs, $outfile);
467 41 my (%include_package, %dumped_package, %skip_package, %isa_cache, %static_ext);
468 41 my ($use_xsloader, $Devel_Peek_Dump_added);
469 41 my $nullop_count = 0;
470 41 my $unresolved_count = 0;
471 # options and optimizations shared with B::CC
472 41 our ($module, $init_name, %savINC, %curINC, $mainfile, @static_free);
473 41 our ($use_av_undef_speedup, $use_svpop_speedup) = (1, 1);
474 41 our ($optimize_ppaddr, $optimize_warn_sv, $use_perl_script_name,
475 $save_data_fh, $save_sig, $optimize_cop, $av_init, $av_init2, $ro_inc, $destruct,
476 $fold, $warnings, $const_strings, $stash, $can_delete_pkg, $pv_copy_on_grow, $dyn_padlist,
477 $walkall, $cow);
478 41 our $verbose = 0;
479 41 our %option_map = (
480 #ignored until IsCOW has a seperate COWREFCNT field (5.22 maybe)
481 'cog' => \$B::C::pv_copy_on_grow,
482 'const-strings' => \$B::C::const_strings,
483 'save-data' => \$B::C::save_data_fh,
484 'ppaddr' => \$B::C::optimize_ppaddr,
485 'walkall' => \$B::C::walkall,
486 'warn-sv' => \$B::C::optimize_warn_sv,
487 'av-init' => \$B::C::av_init,
488 'av-init2' => \$B::C::av_init2,
489 'delete-pkg' => \$B::C::can_delete_pkg,
490 'ro-inc' => \$B::C::ro_inc,
491 # if to disable the COW flag since 5.18
492 'cow' => \$B::C::cow, # enable with -O2
493 'stash' => \$B::C::stash, # enable with -fstash
494 'destruct' => \$B::C::destruct, # disable with -fno-destruct
495 'fold' => \$B::C::fold, # disable with -fno-fold
496 'warnings' => \$B::C::warnings, # disable with -fno-warnings
497 'use-script-name' => \$use_perl_script_name,
498 'save-sig-hash' => \$B::C::save_sig,
499 'dyn-padlist' => \$B::C::dyn_padlist, # with -O4, needed for cv cleanup with
500 # non-local exits since 5.18
501 'cop' => \$optimize_cop, # XXX very unsafe!
502 # Better do it in CC, but get rid of
503 # NULL cops also there.
504 );
505 41 our %optimization_map = (
506 0 => [qw()], # special case
507 1 => [qw(-fppaddr -fav-init2)], # falls back to -fav-init
508 2 => [qw(-fro-inc -fsave-data)],
509 3 => [qw(-fno-destruct -fconst-strings -fno-fold -fno-warnings)],
510 4 => [qw(-fcop -fno-dyn-padlist)],
511 );
512 41 ▶push @{$optimization_map{2}}, '-fcow' if $] >= 5.020;
Branch: 1 branch
BranchTrueFalseTotal
if $] >= "5.02" 41 0 41
513 # skipping here: oFr which need extra logic
514 41 our %debug_map = (
515 'O' => 'op',
516 'A' => 'av',
517 'H' => 'hv',
518 'C' => 'cv',
519 'M' => 'mg',
520 'R' => 'rx',
521 'G' => 'gv',
522 'S' => 'sv',
523 'P' => 'pv',
524 'W' => 'walk',
525 'c' => 'cops',
526 's' => 'sub',
527 'p' => 'pkg',
528 # 'm' => 'meth',
529 'u' => 'unused',
530 );
531  
532 41 my @xpvav_sizes;
533 41 my ($max_string_len, $in_endav);
534 41 my %static_core_pkg; # = map {$_ => 1} static_core_packages();
535  
536 41 ▶my $MULTI = $Config{usemultiplicity} || $Config{ccflags} =~ /-DPERL_GLOBAL_STRUCT/;
Condition33%1/3
$B::C::Config{'usemultiplicity'} || $B::C::Config{'ccflags'} =~ /-DPERL_GLOBAL_STRUCT/
l!l&&r!l&&!r
0041
MC/DC0%0/2
$B::C::Config{'usemultiplicity'} || $B::C::Config{'ccflags'} =~ /-DPERL_GLOBAL_STRUCT/
$B::C::Config{'usemultiplicity'} $B::C::Config{'ccflags'} =~ /-DPERL_GLOBAL_STRUCT/
Truth table33%1/3
A || B
A= $B::C::Config{'usemultiplicity'}B= $B::C::Config{'ccflags'} =~ /-DPERL_GLOBAL_STRUCT/
ABresult
1X1
011
000
537 41 my $ITHREADS = $Config{useithreads};
538 41 my $DEBUGGING = ($Config{ccflags} =~ m/-DDEBUGGING/);
539 41 my $DEBUG_LEAKING_SCALARS = $Config{ccflags} =~ m/-DDEBUG_LEAKING_SCALARS/;
540 41 my $GLOBAL_STRUCT = $Config{ccflags} =~ /-DPERL_GLOBAL_STRUCT/; # includes _PRIVATE
541 41 ▶my $CPERL56 = ( $Config{usecperl} and $] >= 5.025003 ); #sibparent, VALID
Condition33%1/3
$B::C::Config{'usecperl'} && $] >= 5.025003
!ll&&!rl&&r
4100
MC/DC0%0/2
$B::C::Config{'usecperl'} && $] >= 5.025003
$B::C::Config{'usecperl'} $] >= 5.025003
Truth table33%1/3
A && B
A= $B::C::Config{'usecperl'}B= $] >= 5.025003
ABresult
0X0
100
111
542 41 ▶my $CPERL55 = ( $Config{usecperl} and $] >= 5.025001 ); #HVMAX_T, RITER_T, ...
Condition33%1/3
$B::C::Config{'usecperl'} && $] >= 5.025001
!ll&&!rl&&r
4100
MC/DC0%0/2
$B::C::Config{'usecperl'} && $] >= 5.025001
$B::C::Config{'usecperl'} $] >= 5.025001
Truth table33%1/3
A && B
A= $B::C::Config{'usecperl'}B= $] >= 5.025001
ABresult
0X0
100
111
543 41 ▶my $CPERL52 = ( $Config{usecperl} and $] >= 5.022002 ); #sv_objcount, AvSTATIC, sigs
Condition33%1/3
$B::C::Config{'usecperl'} && $] >= 5.022002
!ll&&!rl&&r
4100
MC/DC0%0/2
$B::C::Config{'usecperl'} && $] >= 5.022002
$B::C::Config{'usecperl'} $] >= 5.022002
Truth table33%1/3
A && B
A= $B::C::Config{'usecperl'}B= $] >= 5.022002
ABresult
0X0
100
111
544 41 my $CPERL51 = ( $Config{usecperl} );
545 41 ▶my $PERL5257 = ( $CPERL56 or $] >= 5.025007 ); # VALID/TAIL, sibparent, ...
Condition33%1/3
$CPERL56 || $] >= 5.025007
l!l&&r!l&&!r
0410
MC/DC0%0/2
$CPERL56 || $] >= 5.025007
$CPERL56 $] >= 5.025007
Truth table33%1/3
A || B
A= $CPERL56B= $] >= 5.025007
ABresult
1X1
011
000
546 41 my $PERL524 = ( $] >= 5.023005 ); #xpviv sharing assertion
547 41 my $PERL522 = ( $] >= 5.021006 ); #PADNAMELIST, IsCOW, padname_with_str, compflags
548 41 my $PERL518 = ( $] >= 5.017010 );
549 41 my $PERL514 = ( $] >= 5.013002 );
550 41 my $PERL512 = ( $] >= 5.011 );
551 41 my $PERL510 = ( $] >= 5.009005 );
552 41 my $PERL56 = ( $] < 5.008001 ); # yes. 5.8.0 is a 5.6.x
553 #my $C99 = $Config{d_c99_variadic_macros}; # http://docs.sun.com/source/819-3688/c99.app.html#pgfId-1003962
554 41 my $MAD = $Config{mad};
555 41 my $MYMALLOC = $Config{usemymalloc} eq 'define';
556 41 ▶my $HAVE_DLFCN_DLOPEN = $Config{i_dlfcn} && $Config{d_dlopen};
Condition33%1/3
$B::C::Config{'i_dlfcn'} && $B::C::Config{'d_dlopen'}
!ll&&!rl&&r
0041
MC/DC0%0/2
$B::C::Config{'i_dlfcn'} && $B::C::Config{'d_dlopen'}
$B::C::Config{'i_dlfcn'} $B::C::Config{'d_dlopen'}
Truth table33%1/3
A && B
A= $B::C::Config{'i_dlfcn'}B= $B::C::Config{'d_dlopen'}
ABresult
0X0
100
111
557 # %Lu is not supported on older 32bit systems
558 41 ▶my $u32fmt = $Config{ivsize} == 4 ? "%lu" : "%u";
Branch: 1 branch
BranchTrueFalseTotal
$B::C::Config{'ivsize'} == 4 ? : 0 41 41
559 0 ▶sub IS_MSVC () { $^O eq 'MSWin32' and $Config{cc} eq 'cl' }
Subroutine IS_MSVC: not called CC=2 SCAR=17.9
Pod undocumented
Branch: 1 branch
BranchTrueFalseTotal
$^O eq "MSWin32" and $B::C::Config{"cc"} eq "cl" 0 0 0
560 41 ▶my $have_sibparent = ($PERL5257 or $Config{ccflags} =~ /-DPERL_OP_PARENT/) ? 1 : 0;
Branch: 1 branch
BranchTrueFalseTotal
$PERL5257 || $B::C::Config{'ccflags'} =~ /-DPERL_OP_PARENT/ ? : 41 0 41
Condition33%1/3
$PERL5257 or $B::C::Config{"ccflags"} =~ /-DPERL_OP_PARENT/
l!l&&r!l&&!r
4100
MC/DC0%0/2
$PERL5257 or $B::C::Config{"ccflags"} =~ /-DPERL_OP_PARENT/
$PERL5257 $B::C::Config{"ccflags"} =~ /-DPERL_OP_PARENT/
Truth table33%1/3
A or B
A= $PERL5257B= $B::C::Config{"ccflags"} =~ /-DPERL_OP_PARENT/
ABresult
1X1
011
000
561  
562 41 my @threadsv_names;
563  
564 41 ▶BEGIN {
Subroutine BEGIN: called CC=2 SCAR=8.1
565 41 @threadsv_names = threadsv_names();
566 # This the Carp free workaround for DynaLoader::bootstrap
567 0 ▶ eval 'sub DynaLoader::croak {die @_}' unless $CPERL51;
Subroutine croak: not called CC=1 SCAR=1.2
Pod undocumented
Branch: 1 branch
BranchTrueFalseTotal
unless $CPERL51 41 0 41
568 }
569  
570 0 ▶sub cross_config { # overrides %B::C::Config::Config
Subroutine cross_config: not called CC=13 SCAR=52.0
Pod undocumented
571 0 my ($file) = @_;
572 0 ▶ -e $file or die("-cross \"$file\" not found");
Branch: 1 branch
BranchTrueFalseTotal
-e $file or die qq[-cross "$file" not found] 0 0 0
573 0 ▶ open my $fh, "<", $file or
Branch: 1 branch
BranchTrueFalseTotal
open my $fh, "<", $file or die qq[Could not open -cross "$file": $!] 0 0 0
574 die("Could not open -cross \"$file\": $!");
575 0 ▶ while (<$fh>) {
Branch: 1 branch
BranchTrueFalseTotal
if (defined($_ = readline $fh)) 0 0 0
576 0 my ($k,$v) = /^(\w+)=(.+)$/; # startperl for $^X, osname for $^O
577 0 ▶ next unless $k;
Branch: 1 branch
BranchTrueFalseTotal
unless $k 0 0 0
578 0 ▶ $OriConfig{$k} = $Config{$k} if exists $Config{$k};
Branch: 1 branch
BranchTrueFalseTotal
if exists $B::C::Config{$k} 0 0 0
579 0 ▶ if (exists $Config{$k}) {
Branch: 1 branch
BranchTrueFalseTotal
if (exists $B::C::Config{$k}) 0 0 0
580 0 ▶ if ($v =~ /^'(.*)'$/) {
Branch: 2 branches
BranchTrueFalseTotal
if ($v =~ /^'(.*)'$/) { } 0 0 0
elsif ($v =~ /^"(.*)"$/) { } 0 0 0
581 0 $v = $1;
582 } elsif ($v =~ /^"(.*)"$/) {
583 0 $v = $1;
584 }
585 0 ▶ $v = '' if $v eq 'undef';
Branch: 1 branch
BranchTrueFalseTotal
if $v eq "undef" 0 0 0
586 0 ▶ if ($Config{$k} ne $v) {
Branch: 1 branch
BranchTrueFalseTotal
if ($B::C::Config{$k} ne $v) 0 0 0
587 0 ▶ if ($k =~ /^(version|usemultiplicity|useithreads)$/) {
Branch: 1 branch
BranchTrueFalseTotal
if ($k =~ /^(version|usemultiplicity|useithreads)$/) 0 0 0
588 0 die "Invalid cross $k $v. Require $Config{$k}";
589 }
590 0 ▶ warn "\$Config{$k}: $Config{$k} => $v\n" if $verbose;
Branch: 1 branch
BranchTrueFalseTotal
if $B::C::verbose 0 0 0
591 0 $Cross{$k} = $v;
592 0 $Config{$k} = $v;
593 }
594 }
595 }
596 0 close $fh;
597 }
598  
599 # needed for init2 remap and Dynamic annotation
600 0 ▶sub dl_module_to_sofile {
Subroutine dl_module_to_sofile: not called CC=5 SCAR=34.0
Pod undocumented
601 0 ▶ my $module = shift
Branch: 1 branch
BranchTrueFalseTotal
my $module = shift() or die "dl_module_to_sofile(\$module, \$path) missing module name" 0 0 0
602 or die 'dl_module_to_sofile($module, $path) missing module name';
603 0 ▶ my $modlibname = shift
Branch: 1 branch
BranchTrueFalseTotal
my $modlibname = shift() or die 'dl_module_to_sofile($module, $path): missing module path for ' . $module 0 0 0
604 or die 'dl_module_to_sofile($module, $path): missing module path for '.$module;
605 0 my @modparts = split(/::/,$module);
606 0 my $modfname = $modparts[-1];
607 0 my $modpname = join('/',@modparts);
608 0 my $c = @modparts;
609 0 ▶ $modlibname =~ s,[\\/][^\\/]+$,, while $c--; # Q&D basename
Branch: 1 branch
BranchTrueFalseTotal
$c-- and do { $modlibname =~ s[[\\/][^\\/]+$][] } 0 0 0
610 0 ▶ die "dl_module_to_sofile: empty modlibname" unless $modlibname;
Branch: 1 branch
BranchTrueFalseTotal
unless $modlibname 0 0 0
611 0 my $sofile = "$modlibname/auto/$modpname/$modfname.".$Config{dlext};
612 0 return $sofile;
613 }
614  
615 # 5.15.3 workaround [perl #101336], without .bs support
616 # XSLoader::load_file($module, $modlibname, ...)
617 41 my $dlext = $Config{dlext};
618 0 ▶eval q|
Subroutine load_file: not called CC=17 SCAR=56.1
Pod undocumented
Branch: 16 branches
BranchTrueFalseTotal
my $module = shift() or die "missing module name" 0 0 0
my $modlibname = shift() or die "missing module filepath" 0 0 0
if $DynaLoader::dl_debug 0 0 0
if defined &$boots 0 0 0
$c-- and do { $modlibname =~ s[[\/][^\/]+$][] } 0 0 0
unless $modlibname 0 0 0
if $DynaLoader::dl_debug and not -f $file 0 0 0
unless -f $file 0 0 0
if ($boot_symbol_ref = DynaLoader::dl_find_symbol(0, $bootname)) 0 0 0
if $DynaLoader::dl_debug 0 0 0
my $libref = DynaLoader::dl_load_file($file, 0) or do { die "Can't load '${file}' for module ${module}: " . DynaLoader::dl_error() } 0 0 0
if (@unresolved) 0 0 0
$boot_symbol_ref = DynaLoader::dl_find_symbol($libref, $bootname) or do { die "Can't find '${bootname}' symbol in $file\n" } 0 0 0
if $DynaLoader::dl_debug 0 0 0
if $DynaLoader::dl_debug 0 0 0
if $] >= "5.015003" and not $CPERL51 41 0 41
Condition16%1/6
$DynaLoader::dl_debug and not -f $file
!ll&&!rl&&r
000
$] >= "5.015003" and not $CPERL51
!ll&&!rl&&r
0041
MC/DC0%0/2
$DynaLoader::dl_debug and not -f $file
$DynaLoader::dl_debug not -f $file
MC/DC0%0/2
$] >= "5.015003" and not $CPERL51
$] >= "5.015003" not $CPERL51
Truth table0%0/3
A and not(B)
A= $DynaLoader::dl_debugB= not -f $file
ABresult
0X0
100
111
Truth table33%1/3
A and not(B)
A= $] >= "5.015003"B= not $CPERL51
ABresult
0X0
100
111
619 sub XSLoader::load_file {
620 #package DynaLoader;
621 my $module = shift or die "missing module name";
622 my $modlibname = shift or die "missing module filepath";
623 print STDOUT "XSLoader::load_file(\"$module\", \"$modlibname\" @_)\n"
624 if ${DynaLoader::dl_debug};
625  
626 push @_, $module;
627 # works with static linking too
628 my $boots = "$module\::bootstrap";
629 goto &$boots if defined &$boots;
630  
631 my @modparts = split(/::/,$module); # crashes threaded, issue 100
632 my $modfname = $modparts[-1];
633 my $modpname = join('/',@modparts);
634 my $c = @modparts;
635 $modlibname =~ s,[\\/][^\\/]+$,, while $c--; # Q&D basename
636 die "missing module filepath" unless $modlibname;
637 my $file = "$modlibname/auto/$modpname/$modfname."|.qq(."$dlext").q|;
638  
639 # skip the .bs "bullshit" part, needed for some old solaris ages ago
640  
641 print STDOUT "goto DynaLoader::bootstrap_inherit\n"
642 if ${DynaLoader::dl_debug} and not -f $file;
643 goto \&DynaLoader::bootstrap_inherit if not -f $file;
644 my $modxsname = $module;
645 $modxsname =~ s/\W/_/g;
646 my $bootname = "boot_".$modxsname;
647 @DynaLoader::dl_require_symbols = ($bootname);
648  
649 my $boot_symbol_ref;
650 if ($boot_symbol_ref = DynaLoader::dl_find_symbol(0, $bootname)) {
651 print STDOUT "dl_find_symbol($bootname) ok => goto boot\n"
652 if ${DynaLoader::dl_debug};
653 goto boot; #extension library has already been loaded, e.g. darwin
654 }
655 # Many dynamic extension loading problems will appear to come from
656 # this section of code: XYZ failed at line 123 of DynaLoader.pm.
657 # Often these errors are actually occurring in the initialisation
658 # C code of the extension XS file. Perl reports the error as being
659 # in this perl code simply because this was the last perl code
660 # it executed.
661  
662 my $libref = DynaLoader::dl_load_file($file, 0) or do {
663 die("Can't load '$file' for module $module: " . DynaLoader::dl_error());
664 };
665 push(@DynaLoader::dl_librefs,$libref); # record loaded object
666  
667 my @unresolved = DynaLoader::dl_undef_symbols();
668 if (@unresolved) {
669 die("Undefined symbols present after loading $file: @unresolved\n");
670 }
671  
672 $boot_symbol_ref = DynaLoader::dl_find_symbol($libref, $bootname) or do {
673 die("Can't find '$bootname' symbol in $file\n");
674 };
675 print STDOUT "dl_find_symbol($libref, $bootname) ok => goto boot\n"
676 if ${DynaLoader::dl_debug};
677 push(@DynaLoader::dl_modules, $module); # record loaded module
678  
679 boot:
680 my $xs = DynaLoader::dl_install_xsub($boots, $boot_symbol_ref, $file);
681 print STDOUT "dl_install_xsub($boots, $boot_symbol_ref, $file)\n"
682 if ${DynaLoader::dl_debug};
683 # See comment block above
684 push(@DynaLoader::dl_shared_objects, $file); # record files loaded
685 return &$xs(@_);
686 }
687 | if $] >= 5.015003 and !$CPERL51;
688 # Note: cperl uses a different API: the 2nd arg is the sofile directly
689  
690 # Code sections
691 my (
692 41 $init, $decl, $symsect, $binopsect, $condopsect,
693 $copsect, $padopsect, $listopsect, $logopsect, $loopsect,
694 $opsect, $pmopsect, $pvopsect, $svopsect, $unopsect,
695 $methopsect, $unopauxsect,
696 $svsect, $xpvsect, $xpvavsect, $xpvhvsect, $xpvcvsect,
697 $xpvivsect, $xpvuvsect, $xpvnvsect, $xpvmgsect, $xpvlvsect,
698 $xrvsect, $xpvbmsect, $xpviosect, $heksect, $free,
699 $padlistsect, $padnamesect, $padnlsect, $init0, $init1, $init2
700 );
701 41 my (%padnamesect, %avcowsect, %avcogsect);
702 41 my @padnamesect_sizes = (8, 16, 24, 32, 40, 48, 56, 64);
703  
704 41 my @op_sections =
705 \(
706 $binopsect, $condopsect, $copsect, $padopsect,
707 $listopsect, $logopsect, $loopsect, $opsect,
708 $pmopsect, $pvopsect, $svopsect, $unopsect,
709 $methopsect, $unopauxsect
710 );
711 # push @op_sections, ($resect) if $PERL512;
712 sub walk_and_save_optree;
713 41 my $saveoptree_callback = \&walk_and_save_optree;
714 0 ▶sub set_callback { $saveoptree_callback = shift }
Subroutine set_callback: not called CC=1 SCAR=6.9
Pod undocumented
715 0 ▶sub saveoptree { &$saveoptree_callback(@_) }
Subroutine saveoptree: not called CC=1 SCAR=6.9
Pod undocumented
716 sub save_main_rest;
717 0 ▶sub verbose { if (@_) { $verbose = shift; } else { $verbose; } }
Subroutine verbose: not called CC=2 SCAR=17.9
Pod undocumented
Branch: 1 branch
BranchTrueFalseTotal
if (@_) { } 0 0 0
718 0 ▶sub module { if (@_) { $module = shift; } else { $module; } }
Subroutine module: not called CC=2 SCAR=17.9
Pod undocumented
Branch: 1 branch
BranchTrueFalseTotal
if (@_) { } 0 0 0
719  
720 0 ▶sub walk_and_save_optree {
Subroutine walk_and_save_optree: not called CC=3 SCAR=24.8
Pod undocumented
721 0 my ( $name, $root, $start ) = @_;
722 0 ▶ if ($root) {
Branch: 1 branch
BranchTrueFalseTotal
if ($root) 0 0 0
723 # B.xs: walkoptree does more, reifying refs. rebless or recreating it.
724 # TODO: add walkoptree_debug support.
725 0 ▶ $verbose ? walkoptree_slow( $root, "save" ) : walkoptree( $root, "save" );
Branch: 1 branch
BranchTrueFalseTotal
$B::C::verbose ? : 0 0 0
726 }
727 0 return objsym($start);
728 }
729  
730 # Look this up here so we can do just a number compare
731 # rather than looking up the name of every BASEOP in B::OP
732 41 my $OP_THREADSV = opnumber('threadsv');
733 41 my $OP_DBMOPEN = opnumber('dbmopen');
734 41 my $OP_FORMLINE = opnumber('formline');
735 41 my $OP_UCFIRST = opnumber('ucfirst');
736 41 my $OP_CUSTOM = opnumber('custom');
737  
738 # special handling for nullified COP's.
739 41 my %OP_COP = ( opnumber('nextstate') => 1 );
740 41 ▶$OP_COP{ opnumber('setstate') } = 1 if $] > 5.005003 and $] < 5.005062;
Branch: 1 branch
BranchTrueFalseTotal
if $] > "5.005003" and $] < "5.005062" 0 41 41
Condition33%1/3
$] > "5.005003" and $] < "5.005062"
!ll&&!rl&&r
0410
MC/DC0%0/2
$] > "5.005003" and $] < "5.005062"
$] > "5.005003" $] < "5.005062"
Truth table33%1/3
A and B
A= $] > "5.005003"B= $] < "5.005062"
ABresult
0X0
100
111
741 41 ▶$OP_COP{ opnumber('dbstate') } = 1 unless $PERL512;
Branch: 1 branch
BranchTrueFalseTotal
unless $PERL512 0 41 41
742 41 ▶warn %OP_COP if $debug{cops};
Branch: 1 branch
BranchTrueFalseTotal
if $B::C::debug{"cops"} 0 41 41
743  
744 # 1. called from method_named, so hashp should be defined
745 # 2. called from svop before method_named to cache the $package_pv
746 0 ▶sub svop_or_padop_pv {
Subroutine svop_or_padop_pv: not called CC=26 SCAR=65.5
Pod undocumented
747 0 my $op = shift;
748 0 my $sv;
749 0 ▶ if (!$op->can("sv")) {
Branch: 1 branch
BranchTrueFalseTotal
if (not $op->can('sv')) { } 0 0 0
750 0 ▶ if ($op->can('name') and $op->name eq 'padsv') {
Branch: 1 branch
BranchTrueFalseTotal
if ($op->can("name") and $op->name eq "padsv") 0 0 0
Condition0%0/3
$op->can("name") and $op->name eq "padsv"
!ll&&!rl&&r
000
MC/DC0%0/2
$op->can("name") and $op->name eq "padsv"
$op->can("name") $op->name eq "padsv"
Truth table0%0/3
A and B
A= $op->can("name")B= $op->name eq "padsv"
ABresult
0X0
100
111
751 0 my @c = comppadlist->ARRAY;
752 0 my @pad = $c[1]->ARRAY;
753 0 ▶ return $pad[$op->targ]->PV if $pad[$op->targ] and $pad[$op->targ]->can("PV");
Branch: 1 branch
BranchTrueFalseTotal
if $pad[$op->targ] and $pad[$op->targ]->can("PV") 0 0 0
Condition0%0/3
$pad[$op->targ] and $pad[$op->targ]->can("PV")
!ll&&!rl&&r
000
MC/DC0%0/2
$pad[$op->targ] and $pad[$op->targ]->can("PV")
$pad[$op->targ] $pad[$op->targ]->can("PV")
Truth table0%0/3
A and B
A= $pad[$op->targ]B= $pad[$op->targ]->can("PV")
ABresult
0X0
100
111
754 # This might fail with B::NULL (optimized ex-const pv) entries in the pad.
755 }
756 # $op->can('pmreplroot') fails for 5.14
757 0 ▶ if (ref($op) eq 'B::PMOP' and $op->pmreplroot->can("sv")) {
Branch: 1 branch
BranchTrueFalseTotal
if (ref $op eq 'B::PMOP' and $op->pmreplroot->can('sv')) { } 0 0 0
Condition0%0/3
ref $op eq "B::PMOP" and $op->pmreplroot->can("sv")
!ll&&!rl&&r
000
MC/DC0%0/2
ref $op eq "B::PMOP" and $op->pmreplroot->can("sv")
ref $op eq "B::PMOP" $op->pmreplroot->can("sv")
Truth table0%0/3
A and B
A= ref $op eq "B::PMOP"B= $op->pmreplroot->can("sv")
ABresult
0X0
100
111
758 0 $sv = $op->pmreplroot->sv;
759 } else {
760 0 ▶ return $package_pv unless $op->flags & 4;
Branch: 1 branch
BranchTrueFalseTotal
unless $op->flags & 4 0 0 0
761 # op->first is disallowed for !KIDS and OPpCONST_BARE
762 0 ▶ return $package_pv if $op->name eq 'const' and $op->flags & 64;
Branch: 1 branch
BranchTrueFalseTotal
if $op->name eq "const" and $op->flags & 64 0 0 0
Condition0%0/3
$op->name eq "const" and $op->flags & 64
!ll&&!rl&&r
000
MC/DC0%0/2
$op->name eq "const" and $op->flags & 64
$op->name eq "const" $op->flags & 64
Truth table0%0/3
A and B
A= $op->name eq "const"B= $op->flags & 64
ABresult
0X0
100
111
763 0 ▶ return $package_pv unless $op->first->can("sv");
Branch: 1 branch
BranchTrueFalseTotal
unless $op->first->can("sv") 0 0 0
764 0 $sv = $op->first->sv;
765 }
766 } else {
767 0 $sv = $op->sv;
768 }
769 # XXX see SvSHARED_HEK_FROM_PV for the stash in S_method_common pp_hot.c
770 # In this hash the CV is stored directly
771 0 ▶ if ($sv and $$sv) {
Branch: 1 branch
BranchTrueFalseTotal
if ($sv and $$sv) { } 0 0 0
Condition0%0/3
$sv and $$sv
!ll&&!rl&&r
000
MC/DC0%0/2
$sv and $$sv
$sv $$sv
Truth table0%0/3
A and B
A= $svB= $$sv
ABresult
0X0
100
111
772 #if ($PERL510) { # PVX->hek_hash - STRUCT_OFFSET(struct hek, hek_key)
773 #} else { # UVX
774 #}
775 0 ▶ return $sv->PV if $sv->can("PV");
Branch: 1 branch
BranchTrueFalseTotal
if $sv->can("PV") 0 0 0
776 0 ▶ if (ref($sv) eq "B::SPECIAL") { # DateTime::TimeZone
Branch: 1 branch
BranchTrueFalseTotal
if (ref $sv eq "B::SPECIAL") 0 0 0
777 # XXX null -> method_named
778 0 ▶ warn "NYI S_method_common op->sv==B::SPECIAL, keep $package_pv\n" if $debug{gv};
Branch: 1 branch
BranchTrueFalseTotal
if $B::C::debug{"gv"} 0 0 0
779 0 return $package_pv;
780 }
781 0 ▶ if ($sv->FLAGS & SVf_ROK) {
Branch: 1 branch
BranchTrueFalseTotal
if ($sv->FLAGS & 2048) { } 0 0 0
782 0 ▶ goto missing if $sv->isa("B::NULL");
Branch: 1 branch
BranchTrueFalseTotal
if $sv->isa("B::NULL") 0 0 0
783 0 my $rv = $sv->RV;
784 0 ▶ if ($rv->isa("B::PVGV")) {
Branch: 1 branch
BranchTrueFalseTotal
if ($rv->isa("B::PVGV")) 0 0 0
785 0 my $o = $rv->IO;
786 0 ▶ return $o->STASH->NAME if $$o;
Branch: 1 branch
BranchTrueFalseTotal
if $$o 0 0 0
787 }
788 0 ▶ goto missing if $rv->isa("B::PVMG");
Branch: 1 branch
BranchTrueFalseTotal
if $rv->isa("B::PVMG") 0 0 0
789 0 return $rv->STASH->NAME;
790 } else {
791 missing:
792 0 ▶ if ($op->name ne 'method_named') {
Branch: 2 branches
BranchTrueFalseTotal
if ($op->name ne 'method_named') { } 0 0 0
elsif ($sv->isa('B::IV')) { } 0 0 0
793 # Called from first const/padsv before method_named. no magic pv string, so a method arg.
794 # The first const pv as method_named arg is always the $package_pv.
795 0 return $package_pv;
796 } elsif ($sv->isa("B::IV")) {
797 0 warn sprintf("Experimentally try method_cv(sv=$sv,$package_pv) flags=0x%x",
798 $sv->FLAGS);
799 # XXX untested!
800 0 return svref_2object(method_cv($$sv, $package_pv));
801 }
802 }
803 } else {
804 0 my @c = comppadlist->ARRAY;
805 0 my @pad = $c[1]->ARRAY;
806 0 ▶ return $pad[$op->targ]->PV if $pad[$op->targ] and $pad[$op->targ]->can("PV");
Branch: 1 branch
BranchTrueFalseTotal
if $pad[$op->targ] and $pad[$op->targ]->can("PV") 0 0 0
Condition0%0/3
$pad[$op->targ] and $pad[$op->targ]->can("PV")
!ll&&!rl&&r
000
MC/DC0%0/2
$pad[$op->targ] and $pad[$op->targ]->can("PV")
$pad[$op->targ] $pad[$op->targ]->can("PV")
Truth table0%0/3
A and B
A= $pad[$op->targ]B= $pad[$op->targ]->can("PV")
ABresult
0X0
100
111
807 }
808 }
809  
810 0 ▶sub IsCOW {
Subroutine IsCOW: not called CC=3 SCAR=24.8
Pod undocumented
811 0 ▶ if ($PERL522) {
Branch: 1 branch
BranchTrueFalseTotal
if ($PERL522) 0 0 0
812 0 return $_[0]->FLAGS & SVf_IsCOW;
813 }
814 0 ▶ return ($] >= 5.017008 and $_[0]->FLAGS & SVf_IsCOW); # since 5.17.8
Condition0%0/3
$] >= 5.017008 && $_[0]->FLAGS & 268435456
!ll&&!rl&&r
000
MC/DC0%0/2
$] >= 5.017008 && $_[0]->FLAGS & 268435456
$] >= 5.017008 $_[0]->FLAGS & 268435456
Truth table0%0/3
A && B
A= $] >= 5.017008B= $_[0]->FLAGS & 268435456
ABresult
0X0
100
111
815 }
816 0 ▶sub IsCOW_hek {
Subroutine IsCOW_hek: not called CC=2 SCAR=17.9
Pod undocumented
817 0 ▶ return IsCOW($_[0]) && !$_[0]->LEN;
Condition0%0/3
IsCOW($_[0]) && !$_[0]->LEN
!ll&&!rl&&r
000
MC/DC0%0/2
IsCOW($_[0]) && !$_[0]->LEN
IsCOW($_[0]) !$_[0]->LEN
Truth table0%0/3
A && not(B)
A= IsCOW($_[0])B= !$_[0]->LEN
ABresult
0X0
100
111
818 }
819  
820 41 ▶if ($Config{usecperl} and $] >= 5.022002) {
Branch: 1 branch
BranchTrueFalseTotal
if ($B::C::Config{'usecperl'} and $] >= 5.022002) { } 0 41 41
Condition33%1/3
$B::C::Config{"usecperl"} and $] >= "5.022002"
!ll&&!rl&&r
4100
MC/DC0%0/2
$B::C::Config{"usecperl"} and $] >= "5.022002"
$B::C::Config{"usecperl"} $] >= "5.022002"
Truth table33%1/3
A and B
A= $B::C::Config{"usecperl"}B= $] >= "5.022002"
ABresult
0X0
100
111
821 0 eval q[sub isAvSTATIC {
822 my $flags = shift->FLAGS;
823 return !($flags & SVpav_REAL) && !($flags & SVpav_REIFY)
824 }];
825 } else {
826 41 eval q[sub isAvSTATIC () { 0 }];
827 }
828  
829 0 ▶sub canAvSTATIC {
Subroutine canAvSTATIC: not called CC=1 SCAR=6.9
Pod undocumented
830 0 my ($av, $fullname) = @_;
831 0 my $flags = $av->FLAGS;
832 0 return 1;
833 }
834  
835 0 ▶sub savesym {
Subroutine savesym: not called CC=1 SCAR=1.7
Pod undocumented
836 0 my ( $obj, $value ) = @_;
837 41 ▶ no strict 'refs';
Subroutine BEGIN: called CC=1 SCAR=0.0
838 0 my $sym = sprintf( "s\\_%x", $$obj );
839 0 $symtable{$sym} = $value;
840 0 return $value;
841 }
842  
843 0 ▶sub objsym {
Subroutine objsym: not called CC=1 SCAR=0.6
Pod undocumented
844 0 my $obj = shift;
845 41 ▶ no strict 'refs';
Subroutine BEGIN: called CC=1 SCAR=0.0
846 0 return $symtable{ sprintf( "s\\_%x", $$obj ) };
847 }
848  
849 0 ▶sub getsym {
Subroutine getsym: not called CC=4 SCAR=30.0
Pod undocumented
850 0 my $sym = shift;
851 0 my $value;
852  
853 0 ▶ return 0 if $sym eq "sym_0"; # special case
Branch: 1 branch
BranchTrueFalseTotal
if $sym eq "sym_0" 0 0 0
854 0 $value = $symtable{$sym};
855 0 ▶ if ( defined($value) ) {
Branch: 1 branch
BranchTrueFalseTotal
if (defined $value) { } 0 0 0
856 0 return $value;
857 }
858 else {
859 0 ▶ warn "warning: undefined symbol $sym\n" if $warn_undefined_syms;
Branch: 1 branch
BranchTrueFalseTotal
if $warn_undefined_syms 0 0 0
860 0 return "UNUSED";
861 }
862 }
863  
864 0 ▶sub delsym {
Subroutine delsym: not called CC=1 SCAR=6.9
Pod undocumented
865 0 my ( $obj ) = @_;
866 0 my $sym = sprintf( "s\\_%x", $$obj );
867 0 delete $symtable{$sym};
868 }
869  
870 0 ▶sub curcv { $B::C::curcv }
Subroutine curcv: not called CC=1 SCAR=6.9
Pod undocumented
871 0 ▶sub set_curcv($) { $B::C::curcv = shift; }
Subroutine set_curcv: not called CC=1 SCAR=6.9
Pod undocumented
872  
873 # returns cstring, len, utf8 flags of a string
874 0 ▶sub strlen_flags {
Subroutine strlen_flags: not called CC=3 SCAR=24.8
Pod undocumented
875 0 my $s = shift;
876 0 my ($len, $flags) = (0,"0");
877 0 ▶ if (!$PERL56 and utf8::is_utf8($s)) {
Branch: 1 branch
BranchTrueFalseTotal
if (not $PERL56 and utf8::is_utf8($s)) { } 0 0 0
Condition0%0/3
not $PERL56 and utf8::is_utf8($s)
!ll&&!rl&&r
000
MC/DC0%0/2
not $PERL56 and utf8::is_utf8($s)
not $PERL56 utf8::is_utf8($s)
Truth table0%0/3
not(A) and B
A= not $PERL56B= utf8::is_utf8($s)
ABresult
0X0
100
111
878 0 my $us = $s;
879 0 $flags = 'SVf_UTF8';
880 0 $len = utf8::upgrade($us);
881 } else {
882 0 $len = length $s;
883 }
884 0 return (cstring($s), $len, $flags);
885 }
886  
887 0 ▶sub savestash_flags {
Subroutine savestash_flags: not called CC=8 SCAR=40.4
Pod undocumented
888 0 my ($name, $cstring, $len, $flags) = @_;
889 0 ▶ return $stashtable{$name} if exists $stashtable{$name};
Branch: 1 branch
BranchTrueFalseTotal
if exists $stashtable{$name} 0 0 0
890 #return '(HV*)&PL_sv_undef' if $name =~ /^(|B::CC?)$/; # protect against empty stashes
891 0 ▶ $flags = $flags ? "$flags|GV_ADD" : "GV_ADD";
Branch: 1 branch
BranchTrueFalseTotal
$flags ? : 0 0 0
892 0 my $sym = "hv$hv_index";
893 0 $decl->add("Static HV *$sym;");
894 0 $hv_index++;
895 0 ▶ if ($PERL518 and $name) { # since 5.18 save @ISA before calling stashpv
Branch: 1 branch
BranchTrueFalseTotal
if ($PERL518 and $name) 0 0 0
Condition0%0/3
$PERL518 and $name
!ll&&!rl&&r
000
MC/DC0%0/2
$PERL518 and $name
$PERL518 $name
Truth table0%0/3
A and B
A= $PERL518B= $name
ABresult
0X0
100
111
896 0 my @isa = get_isa($name);
897 41 ▶ no strict 'refs';
Subroutine BEGIN: called CC=1 SCAR=0.0
898 0 ▶ if (@isa and exists ${$name.'::'}{ISA} ) {
Branch: 1 branch
BranchTrueFalseTotal
if (@isa and exists do { $name . '::' }->{"ISA"}) 0 0 0
Condition0%0/3
@isa and exists do { $name . '::' }->{"ISA"}
!ll&&!rl&&r
000
MC/DC0%0/2
@isa and exists do { $name . '::' }->{"ISA"}
@isa exists do { $name . '::' }->{"ISA"}
Truth table0%0/3
A and B
A= @isaB= exists do { $name . '::' }->{"ISA"}
ABresult
0X0
100
111
899 0 svref_2object( \@{"$name\::ISA"} )->save("$name\::ISA");
900 }
901 }
902 0 ▶ my $pvsym = $len ? constpv($name) : '""';
Branch: 1 branch
BranchTrueFalseTotal
$len ? : 0 0 0
903 0 $stashtable{$name} = $sym;
904 0 $init->add( sprintf( "%s = gv_stashpvn(%s, %u, %s); /* $name */",
905 $sym, $pvsym, $len, $flags));
906 0 return $sym;
907 }
908  
909 0 ▶sub savestashpv {
Subroutine savestashpv: not called CC=1 SCAR=6.9
Pod undocumented
910 0 my $name = shift;
911 0 return savestash_flags($name, strlen_flags($name));
912 }
913  
914 0 ▶sub savere {
Subroutine savere: not called CC=8 SCAR=42.8
Pod undocumented
915 0 my $re = shift;
916 0 ▶ my $flags = shift || 0;
Condition0%0/2
shift() || 0
l!l
00
MC/DC0%0/1
shift() || 0
shift()
Truth table0%0/2
A
A= shift()
Aresult
11
00
917 0 my $sym;
918 0 my $pv = $re;
919 0 my ($cstring, $cur, $utf8) = strlen_flags($pv);
920 0 my $len = 0; # static buffer
921 0 ▶ if ($PERL514) {
Branch: 2 branches
BranchTrueFalseTotal
if ($PERL514) { } 0 0 0
elsif ($PERL510) { } 0 0 0
922 0 $xpvsect->add( sprintf( "Nullhv, {0}, %u, %u", $cur, $len ) );
923 0 ▶ $svsect->add( sprintf( "&xpv_list[%d], 1, %x, {%s}", $xpvsect->index,
Branch: 1 branch
BranchTrueFalseTotal
$C99 ? : 0 0 0
924 0x4405, ($C99?".svu_pv=":"").'(char*)'.savepv($pv) ) );
925 0 $sym = sprintf( "&sv_list[%d]", $svsect->index );
926 }
927 elsif ($PERL510) {
928 # BUG! Should be the same as newSVpvn($resym, $relen) but is not
929 #$sym = sprintf("re_list[%d]", $re_index++);
930 #$resect->add(sprintf("0,0,0,%s", $cstring));
931 0 ▶ my $s1 = ($PERL514 ? "NULL," : "") . "{0}, %u, %u";
Branch: 1 branch
BranchTrueFalseTotal
$PERL514 ? : 0 0 0
932 0 $xpvsect->add( sprintf( $s1, $cur, $len ) );
933 0 ▶ $svsect->add( sprintf( "&xpv_list[%d], 1, %x, {%s}", $xpvsect->index,
Branch: 1 branch
BranchTrueFalseTotal
$C99 ? : 0 0 0
934 0x4405, ($C99?".svu_pv=":"").'(char*)'.savepv($pv) ) );
935 0 my $s = "sv_list[".$svsect->index."]";
936 0 $sym = "&$s";
937 0 ▶ push @B::C::static_free, $s if $len; # and $B::C::pv_copy_on_grow;
Branch: 1 branch
BranchTrueFalseTotal
if $len 0 0 0
938 # $resect->add(sprintf("&xpv_list[%d], $u32fmt, 0x%x", $xpvsect->index, 1, 0x4405));
939 }
940 else {
941 0 $sym = sprintf( "re%d", $re_index++ );
942 0 $decl->add( sprintf( "Static const char *%s = %s;", $sym, $cstring ) );
943 }
944 0 return ( $sym, $cur );
945 }
946  
947 0 ▶sub constpv {
Subroutine constpv: not called CC=1 SCAR=6.9
Pod undocumented
948 0 return savepv(shift, 1);
949 }
950  
951 0 ▶sub savepv {
Subroutine savepv: not called CC=6 SCAR=37.4
Pod undocumented
952 0 my $pv = shift;
953 0 my $const = shift;
954 0 my ($cstring, $cur, $utf8) = strlen_flags($pv);
955 # $decl->add( sprintf( "/* %s */", $cstring) ) if $debug{pv};
956 0 ▶ return $strtable{$cstring} if defined $strtable{$cstring};
Branch: 1 branch
BranchTrueFalseTotal
if defined $strtable{$cstring} 0 0 0
957 0 my $pvsym = sprintf( "pv%d", $pv_index++ );
958 0 ▶ $const = $const ? " const" : "";
Branch: 1 branch
BranchTrueFalseTotal
$const ? : 0 0 0
959 0 ▶ if ( defined $max_string_len && $cur > $max_string_len ) {
Branch: 1 branch
BranchTrueFalseTotal
if (defined $max_string_len and $cur > $max_string_len) { } 0 0 0
Condition0%0/3
defined $max_string_len and $cur > $max_string_len
!ll&&!rl&&r
000
MC/DC0%0/2
defined $max_string_len and $cur > $max_string_len
defined $max_string_len $cur > $max_string_len
Truth table0%0/3
A and B
A= defined $max_string_lenB= $cur > $max_string_len
ABresult
0X0
100
111
960 0 my $chars = join ', ', map { cchar $_ } split //, pack("a*", $pv);
961 0 $decl->add( sprintf( "Static%s char %s[] = { %s };", $const, $pvsym, $chars ) );
962 0 $strtable{$cstring} = $pvsym;
963 } else {
964 0 ▶ if ( $cstring ne "0" ) { # sic
Branch: 1 branch
BranchTrueFalseTotal
if ($cstring ne 0) 0 0 0
965 0 $decl->add( sprintf( "Static%s char %s[] = %s;", $const, $pvsym, $cstring ) );
966 0 $strtable{$cstring} = $pvsym;
967 }
968 }
969 0 return $pvsym;
970 }
971  
972 0 ▶sub save_rv {
Subroutine save_rv: not called CC=2 SCAR=17.9
Pod undocumented
973 0 my ($sv, $fullname) = @_;
974 0 ▶ if (!$fullname) {
Branch: 1 branch
BranchTrueFalseTotal
unless ($fullname) 0 0 0
975 0 $fullname = '(unknown)';
976 }
977 # confess "Can't save RV: not ROK" unless $sv->FLAGS & SVf_ROK;
978 # 5.6: Can't locate object method "RV" via package "B::PVMG"
979 # since 5.11 it must be a PV, the RV was removed from the IV
980 0 my $rv;
981 #if ($] >= 5.011 and ref($sv) =~ /^B::[IP]V$/) {
982 # warn "$sv is no IV nor PV\n" if $debug{sv};
983 # $sv = bless $sv, 'B::PV'; # only observed with DB::args[0]
984 #}
985 #elsif ($] < 5.011 and ref($sv) =~ /^B::[RP]V$/) {
986 # warn "$sv is no RV nor PV\n" if $debug{sv};
987 # $sv = bless $sv, 'B::RV';
988 #}
989 0 $rv = $sv->RV->save($fullname);
990 0 $rv =~ s/^\(([AGHS]V|IO)\s*\*\)\s*(\&sv_list.*)$/$2/;
991  
992 0 return $rv;
993 }
994  
995 # => savesym, cur, len, pv, static, flags
996 0 ▶sub save_pv_or_rv {
Subroutine save_pv_or_rv: not called CC=82 SCAR=87.9
Pod undocumented
997 0 my ($sv, $fullname) = @_;
998  
999 0 my $flags = $sv->FLAGS;
1000 0 my $rok = $flags & SVf_ROK;
1001 0 my $pok = $flags & SVf_POK;
1002 0 my $gmg = $flags & SVs_GMG;
1003 0 ▶ my $iscow = (IsCOW($sv) or ($B::C::cow and $PERL518)) ? 1 : 0;
Branch: 1 branch
BranchTrueFalseTotal
IsCOW($sv) || $B::C::cow && $PERL518 ? : 0 0 0
Condition0%0/6
IsCOW($sv) or $B::C::cow and $PERL518
l!l&&r!l&&!r
000
$B::C::cow and $PERL518
!ll&&!rl&&r
000
MC/DC0%0/3
IsCOW($sv) or $B::C::cow and $PERL518
IsCOW($sv) $B::C::cow $PERL518
Truth table0%0/4
A or B and C
A= IsCOW($sv)B= $B::C::cowC= $PERL518
ABCresult
1XX1
0111
00X0
0100
1004 #my $wascow = IsCOW($sv) ? 1 : 0;
1005 0 my ( $cur, $len, $savesym, $pv ) = ( 0, 1, 'NULL', "" );
1006 0 my ($static, $shared_hek);
1007 # overloaded VERSION symbols fail to xs boot: ExtUtils::CBuilder with Fcntl::VERSION (i91)
1008 # 5.6: Can't locate object method "RV" via package "B::PV" Carp::Clan
1009 0 ▶ if ($rok and !$PERL56) {
Branch: 1 branch
BranchTrueFalseTotal
if ($rok and not $PERL56) { } 0 0 0
Condition0%0/3
$rok and not $PERL56
!ll&&!rl&&r
000
MC/DC0%0/2
$rok and not $PERL56
$rok not $PERL56
Truth table0%0/3
A and not(B)
A= $rokB= not $PERL56
ABresult
0X0
100
111
1010 # this returns us a SV*. 5.8 expects a char* in xpvmg.xpv_pv
1011 0 ▶ warn "save_pv_or_rv: save_rv(",$sv,")\n" if $debug{sv};
Branch: 1 branch
BranchTrueFalseTotal
if $B::C::debug{"sv"} 0 0 0
1012 0 ▶ $savesym = ($PERL510 ? "" : "(char*)") . save_rv($sv, $fullname);
Branch: 1 branch
BranchTrueFalseTotal
$PERL510 ? : 0 0 0
1013 0 $static = 1; # avoid run-time overwrite of the PV/RV slot (#273)
1014 0 ▶ if ($savesym =~ /get_cv/) { # Moose::Util::TypeConstraints::Builtins::_RegexpRef
Branch: 1 branch
BranchTrueFalseTotal
if ($savesym =~ /get_cv/) 0 0 0
1015 0 $static = 0;
1016 0 $pv = $savesym;
1017 0 $savesym = 'NULL';
1018 }
1019 }
1020 else {
1021 0 ▶ if ($pok) {
Branch: 1 branch
BranchTrueFalseTotal
if ($pok) { } 0 0 0
1022 0 $pv = pack "a*", $sv->PV; # XXX!
1023 0 ▶ $cur = ($sv and $sv->can('CUR') and ref($sv) ne 'B::GV') ? $sv->CUR : length($pv);
Branch: 1 branch
BranchTrueFalseTotal
$sv && $sv->can('CUR') && ref $sv ne 'B::GV' ? : 0 0 0
Condition0%0/6
$sv and $sv->can("CUR") and ref $sv ne "B::GV"
!ll&&!rl&&r
000
$sv and $sv->can("CUR")
!ll&&!rl&&r
000
MC/DC0%0/3
$sv and $sv->can("CUR") and ref $sv ne "B::GV"
$sv $sv->can("CUR") ref $sv ne "B::GV"
Truth table0%0/4
A and B and C
A= $svB= $sv->can("CUR")C= ref $sv ne "B::GV"
ABCresult
0XX0
10X0
1100
1111
1024 # comppadname bug with overlong strings
1025 0 ▶ if ($] < 5.008008 and $cur > 100 and $fullname =~ m/ :pad\[0\]/ and $pv =~ m/\0\0/) {
Branch: 1 branch
BranchTrueFalseTotal
if ($] < "5.008008" and $cur > 100 and $fullname =~ / :pad\[0\]/ and $pv =~ /\0\0/) 0 0 0
Condition0%0/9
$] < "5.008008" and $cur > 100 and $fullname =~ / :pad\[0\]/ and $pv =~ /\0\0/
!ll&&!rl&&r
000
$] < "5.008008" and $cur > 100 and $fullname =~ / :pad\[0\]/
!ll&&!rl&&r
000
$] < "5.008008" and $cur > 100
!ll&&!rl&&r
000
MC/DC0%0/4
$] < "5.008008" and $cur > 100 and $fullname =~ / :pad\[0\]/ and $pv =~ /\0\0/
$] < "5.008008" $cur > 100 $fullname =~ / :pad\[0\]/ $pv =~ /\0\0/
Truth table0%0/5
A and B and C and D
A= $] < "5.008008"B= $cur > 100C= $fullname =~ / :pad\[0\]/D= $pv =~ /\0\0/
ABCDresult
0XXX0
10XX0
110X0
11100
11111
1026 0 my $i = index($pv,"\0");
1027 0 ▶ if ($i > -1) {
Branch: 1 branch
BranchTrueFalseTotal
if ($i > -1) 0 0 0
1028 0 $pv = substr($pv,0,$i);
1029 0 $cur = $i;
1030 0 ▶ warn "Warning: stripped wrong comppad name for $fullname to ".cstring($pv)."\n"
Branch: 1 branch
BranchTrueFalseTotal
if $B::C::verbose 0 0 0
1031 if $verbose;
1032 }
1033 }
1034 } else {
1035 0 ▶ if ($gmg && $fullname) {
Branch: 1 branch
BranchTrueFalseTotal
if ($gmg and $fullname) { } 0 0 0
Condition0%0/3
$gmg and $fullname
!ll&&!rl&&r
000
MC/DC0%0/2
$gmg and $fullname
$gmg $fullname
Truth table0%0/3
A and B
A= $gmgB= $fullname
ABresult
0X0
100
111
1036 41 ▶ no strict 'refs';
Subroutine BEGIN: called CC=1 SCAR=0.0
1037 0 ▶ $pv = ($fullname and ref($fullname)) ? "${$fullname}" : '';
Branch: 1 branch
BranchTrueFalseTotal
$fullname && ref $fullname ? : 0 0 0
Condition0%0/3
$fullname and ref $fullname
!ll&&!rl&&r
000
MC/DC0%0/2
$fullname and ref $fullname
$fullname ref $fullname
Truth table0%0/3
A and B
A= $fullnameB= ref $fullname
ABresult
0X0
100
111
1038 0 $cur = length (pack "a*", $pv);
1039 0 $pok = 1;
1040 } else {
1041 0 ($pv,$cur) = ("",0);
1042 }
1043 }
1044 0 ▶ $shared_hek = $PERL510 ? (($flags & 0x09000000) == 0x09000000) : undef;
Branch: 1 branch
BranchTrueFalseTotal
$PERL510 ? : 0 0 0
1045 0 ▶ $shared_hek = $shared_hek ? 1 : IsCOW_hek($sv);
Branch: 1 branch
BranchTrueFalseTotal
$shared_hek ? : 0 0 0
1046 0 ▶ $static = ($B::C::const_strings or $iscow or ($flags & SVf_READONLY))
Branch: 1 branch
BranchTrueFalseTotal
$B::C::const_strings || $iscow || $flags & 134217728 ? : 0 0 0
Condition0%0/6
$B::C::const_strings or $iscow or $flags & 134217728
l!l&&r!l&&!r
000
$B::C::const_strings or $iscow
l!l&&r!l&&!r
000
MC/DC0%0/3
$B::C::const_strings or $iscow or $flags & 134217728
$B::C::const_strings $iscow $flags & 134217728
Truth table0%0/4
A or B or C
A= $B::C::const_stringsB= $iscowC= $flags & 134217728
ABCresult
1XX1
01X1
0011
0000
1047 ? 1 : 0;
1048 0 ▶ $static = 0 if $shared_hek
Branch: 1 branch
BranchTrueFalseTotal
if $shared_hek or $fullname and $fullname =~ / :pad/ || $fullname =~ /^DynaLoader/ && $pv =~ /^boot_/ 0 0 0
Condition0%0/12
$shared_hek or $fullname and $fullname =~ / :pad/ || $fullname =~ /^DynaLoader/ && $pv =~ /^boot_/
l!l&&r!l&&!r
000
$fullname and $fullname =~ / :pad/ || $fullname =~ /^DynaLoader/ && $pv =~ /^boot_/
!ll&&!rl&&r
000
$fullname =~ / :pad/ or $fullname =~ /^DynaLoader/ and $pv =~ /^boot_/
l!l&&r!l&&!r
000
$fullname =~ /^DynaLoader/ and $pv =~ /^boot_/
!ll&&!rl&&r
000
MC/DC0%0/5
$shared_hek or $fullname and $fullname =~ / :pad/ || $fullname =~ /^DynaLoader/ && $pv =~ /^boot_/
$shared_hek $fullname $fullname =~ / :pad/ $fullname =~ /^DynaLoader/ $pv =~ /^boot_/
Truth table0%0/6
A or B and C or D and E
A= $shared_hekB= $fullnameC= $fullname =~ / :pad/D= $fullname =~ /^DynaLoader/E= $pv =~ /^boot_/
ABCDEresult
1XXXX1
011XX1
010111
00XXX0
0100X0
010100
1049 or ($fullname and ($fullname =~ m/ :pad/
1050 or ($fullname =~ m/^DynaLoader/ and $pv =~ m/^boot_/)));
1051 0 ▶ $static = 0 if $static and $pv =~ /::bootstrap$/;
Branch: 1 branch
BranchTrueFalseTotal
if $static and $pv =~ /::bootstrap$/ 0 0 0
Condition0%0/3
$static and $pv =~ /::bootstrap$/
!ll&&!rl&&r
000
MC/DC0%0/2
$static and $pv =~ /::bootstrap$/
$static $pv =~ /::bootstrap$/
Truth table0%0/3
A and B
A= $staticB= $pv =~ /::bootstrap$/
ABresult
0X0
100
111
1052 0 ▶ $static = 0 if $static and $] > 5.017 and ref($sv) eq 'B::PVMG'; # 242: e.g. $1
Branch: 1 branch
BranchTrueFalseTotal
if $static and $] > "5.017" and ref $sv eq "B::PVMG" 0 0 0
Condition0%0/6
$static and $] > "5.017" and ref $sv eq "B::PVMG"
!ll&&!rl&&r
000
$static and $] > "5.017"
!ll&&!rl&&r
000
MC/DC0%0/3
$static and $] > "5.017" and ref $sv eq "B::PVMG"
$static $] > "5.017" ref $sv eq "B::PVMG"
Truth table0%0/4
A and B and C
A= $staticB= $] > "5.017"C= ref $sv eq "B::PVMG"
ABCresult
0XX0
10X0
1100
1111
1053 0 ▶ $static = 0 if $static and $B::C::const_strings and $fullname and
Branch: 1 branch
BranchTrueFalseTotal
if $static and $B::C::const_strings and $fullname and $fullname =~ /^warnings::(Dead)?Bits/ || $fullname =~ /::AUTOLOAD$/ 0 0 0
Condition0%0/12
$static and $B::C::const_strings and $fullname and $fullname =~ /^warnings::(Dead)?Bits/ || $fullname =~ /::AUTOLOAD$/
!ll&&!rl&&r
000
$static and $B::C::const_strings and $fullname
!ll&&!rl&&r
000
$static and $B::C::const_strings
!ll&&!rl&&r
000
$fullname =~ /^warnings::(Dead)?Bits/ or $fullname =~ /::AUTOLOAD$/
l!l&&r!l&&!r
000
MC/DC0%0/5
$static and $B::C::const_strings and $fullname and $fullname =~ /^warnings::(Dead)?Bits/ || $fullname =~ /::AUTOLOAD$/
$static $B::C::const_strings $fullname $fullname =~ /^warnings::(Dead)?Bits/ $fullname =~ /::AUTOLOAD$/
Truth table0%0/6
A and B and C and D or E
A= $staticB= $B::C::const_stringsC= $fullnameD= $fullname =~ /^warnings::(Dead)?Bits/E= $fullname =~ /::AUTOLOAD$/
ABCDEresult
0XXXX0
10XXX0
110XX0
111000
1111X1
111011
1054 ($fullname =~ /^warnings::(Dead)?Bits/ or $fullname =~ /::AUTOLOAD$/);
1055 0 ▶ if ($shared_hek and $pok and !$cur) { #272 empty key
Branch: 1 branch
BranchTrueFalseTotal
if ($shared_hek and $pok and not $cur) 0 0 0
Condition0%0/6
$shared_hek and $pok and not $cur
!ll&&!rl&&r
000
$shared_hek and $pok
!ll&&!rl&&r
000
MC/DC0%0/3
$shared_hek and $pok and not $cur
$shared_hek $pok not $cur
Truth table0%0/4
A and B and not(C)
A= $shared_hekB= $pokC= not $cur
ABCresult
0XX0
10X0
1100
1111
1056 0 ▶ warn "use emptystring for empty shared key $fullname\n" if $debug{pv} or $debug{hv};
Branch: 1 branch
BranchTrueFalseTotal
if $B::C::debug{"pv"} or $B::C::debug{"hv"} 0 0 0
Condition0%0/3
$B::C::debug{"pv"} or $B::C::debug{"hv"}
l!l&&r!l&&!r
000
MC/DC0%0/2
$B::C::debug{"pv"} or $B::C::debug{"hv"}
$B::C::debug{"pv"} $B::C::debug{"hv"}
Truth table0%0/3
A or B
A= $B::C::debug{"pv"}B= $B::C::debug{"hv"}
ABresult
1X1
011
000
1057 0 ▶ $savesym = "emptystring" unless $fullname =~ /unopaux_item.* const/;
Branch: 1 branch
BranchTrueFalseTotal
unless $fullname =~ /unopaux_item.* const/ 0 0 0
1058 0 $static = 0;
1059 }
1060 0 ▶ if ($static and $PERL510) { # force dynamic PADNAME strings
Branch: 1 branch
BranchTrueFalseTotal
if ($static and $PERL510) 0 0 0
Condition0%0/3
$static and $PERL510
!ll&&!rl&&r
000
MC/DC0%0/2
$static and $PERL510
$static $PERL510
Truth table0%0/3
A and B
A= $staticB= $PERL510
ABresult
0X0
100
111
1061 0 ▶ if ($] < 5.016) { $static = 0 if $flags & 0x40000000; } # SVpad_NAME
Branch: 4 branches
BranchTrueFalseTotal
if ($] < 5.016) { } 0 0 0
elsif ($] < 5.02 and $fullname =~ /(^svop const|::VERSION)$/) { } 0 0 0
elsif ($] < 5.022 and $flags & !0) { } 0 0 0
if $flags & 1073741824 0 0 0
1062 # w. 5.18 even const and VERSION
1063 ▶ elsif ($] < 5.020 and $fullname =~ /(^svop const|::VERSION)$/) {
Condition0%0/3
$] < "5.02" and $fullname =~ /(^svop const|::VERSION)$/
!ll&&!rl&&r
000
MC/DC0%0/2
$] < "5.02" and $fullname =~ /(^svop const|::VERSION)$/
$] < "5.02" $fullname =~ /(^svop const|::VERSION)$/
Truth table0%0/3
A and B
A= $] < "5.02"B= $fullname =~ /(^svop const|::VERSION)$/
ABresult
0X0
100
111
1064 0 ▶ warn "static=0 for $fullname\n" if $debug{pv};
Branch: 1 branch
BranchTrueFalseTotal
if $B::C::debug{"pv"} 0 0 0
1065 0 $static = 0;
1066 }
1067 ▶ elsif ($] < 5.022 and ($flags & 0x40008000 == 0x40008000)) { # SVpad_NAME
Condition0%0/3
$] < "5.022" and
!ll&&!rl&&r
000
MC/DC0%0/2
$] < "5.022" and
$] < "5.022"
Truth table0%0/3
A and B
A= $] < "5.022"B=
ABresult
0X0
100
111
1068 0 ▶ warn "static=0 for SVpad_NAME $fullname\n" if $debug{pv};
Branch: 1 branch
BranchTrueFalseTotal
if $B::C::debug{"pv"} 0 0 0
1069 0 $static = 0;
1070 }
1071 }
1072 0 ▶ if ($pok) {
Branch: 1 branch
BranchTrueFalseTotal
if ($pok) { } 0 0 0
1073 0 my $s = "sv_list[" . ($svsect->index + 1) . "]";
1074 # static pv (!SvLEN) only valid since cd84013aab030da47b76a44fb3 (sv.c: !SvLEN does not mean undefined)
1075 # i.e. since v5.17.6. because conversion to IV would fail.
1076 # But a "" or "0" or "[a-z]+" string can have SvLEN=0
1077 # since its is converted to 0.
1078 # Only a readonly "" or "0" string can have SvLEN=0 since it's
1079 # converted to 0, which leads to the same result.
1080 # perlcc -O3 -r -e'print "ok" if 1 == "1"'
1081 # vs
1082 # perlcc -O2 -r -e'print "ok" if 1 == "1"'
1083 # ok
1084 0 ▶ if ($static and $] < 5.017006 and $pv !~ /^0?$/) {
Branch: 1 branch
BranchTrueFalseTotal
if ($static and $] < "5.017006" and not $pv =~ /^0?$/) 0 0 0
Condition0%0/6
$static and $] < "5.017006" and not $pv =~ /^0?$/
!ll&&!rl&&r
000
$static and $] < "5.017006"
!ll&&!rl&&r
000
MC/DC0%0/3
$static and $] < "5.017006" and not $pv =~ /^0?$/
$static $] < "5.017006" not $pv =~ /^0?$/
Truth table0%0/4
A and B and not(C)
A= $staticB= $] < "5.017006"C= not $pv =~ /^0?$/
ABCresult
0XX0
10X0
1100
1111
1085 0 $static = 0;
1086 }
1087 # but we can optimize static set-magic ISA entries. #263, #91
1088 0 ▶ if ($B::C::const_strings and ref($sv) eq 'B::PVMG'
Branch: 1 branch
BranchTrueFalseTotal
if ($B::C::const_strings and ref $sv eq "B::PVMG" and $flags & 4194304 and $fullname =~ /ISA/) 0 0 0
Condition0%0/9
$B::C::const_strings and ref $sv eq "B::PVMG" and $flags & 4194304 and $fullname =~ /ISA/
!ll&&!rl&&r
000
$B::C::const_strings and ref $sv eq "B::PVMG" and $flags & 4194304
!ll&&!rl&&r
000
$B::C::const_strings and ref $sv eq "B::PVMG"
!ll&&!rl&&r
000
MC/DC0%0/4
$B::C::const_strings and ref $sv eq "B::PVMG" and $flags & 4194304 and $fullname =~ /ISA/
$B::C::const_strings ref $sv eq "B::PVMG" $flags & 4194304 $fullname =~ /ISA/
Truth table0%0/5
A and B and C and D
A= $B::C::const_stringsB= ref $sv eq "B::PVMG"C= $flags & 4194304D= $fullname =~ /ISA/
ABCDresult
0XXX0
10XX0
110X0
11100
11111
1089 and $flags & SVs_SMG and $fullname =~ /ISA/) {
1090 0 $static = 1; # warn "static $fullname";
1091 }
1092 0 ▶ if ($static) {
Branch: 1 branch
BranchTrueFalseTotal
if ($static) { } 0 0 0
1093 0 $len = 0;
1094 #warn cstring($sv->PV)." $iscow $wascow";
1095 0 ▶ if ($iscow and $PERL518) { # 5.18 COW logic
Branch: 1 branch
BranchTrueFalseTotal
if ($iscow and $PERL518) { } 0 0 0
Condition0%0/3
$iscow and $PERL518
!ll&&!rl&&r
000
MC/DC0%0/2
$iscow and $PERL518
$iscow $PERL518
Truth table0%0/3
A and B
A= $iscowB= $PERL518
ABresult
0X0
100
111
1096 0 ▶ if ($B::C::Config::have_HEK_STATIC) {
Branch: 2 branches
BranchTrueFalseTotal
if ($B::C::Config::have_HEK_STATIC) { } 0 0 0
elsif ($B::C::cow) { } 0 0 0
1097 0 $iscow = 1;
1098 0 $shared_hek = 1;
1099 # $pv .= "\000\001";
1100 0 $savesym = save_hek($pv,$fullname,0);
1101 # warn "static shared hek: $savesym";
1102 # $savesym =~ s/&\(HEK\)(hek\d+)/&($1.hek_key)/;
1103 } elsif ($B::C::cow) {
1104 # wrong in many cases but saves a lot of memory, only do this with -O2
1105 0 $len = $cur+2;
1106 0 $pv .= "\000\001";
1107 0 $savesym = savepv($pv);
1108 } else {
1109 0 $iscow = 0;
1110 0 $savesym = constpv($pv);
1111 }
1112 } else {
1113 0 $savesym = constpv($pv);
1114 }
1115 0 ▶ if ($savesym =~ /\)?get_cv/) { # Moose::Util::TypeConstraints::Builtins::_RegexpRef
Branch: 1 branch
BranchTrueFalseTotal
if ($savesym =~ /\)?get_cv/) 0 0 0
1116 0 $static = 0;
1117 0 $len = $cur +1;
1118 0 $pv = $savesym;
1119 0 $savesym = 'NULL';
1120 }
1121 0 ▶ if ($iscow) {
Branch: 1 branch
BranchTrueFalseTotal
if ($iscow) { } 0 0 0
1122 0 $flags |= SVf_IsCOW;
1123 } else {
1124 0 $flags &= ~SVf_IsCOW;
1125 }
1126 #push @B::C::static_free, $savesym if $len and $savesym =~ /^pv/ and !$B::C::in_endav;
1127 } else {
1128 0 $len = $cur+1;
1129 0 ▶ if ($shared_hek) {
Branch: 1 branch
BranchTrueFalseTotal
if ($shared_hek) { } 0 0 0
1130 0 ▶ if ($savesym eq "emptystring") {
Branch: 1 branch
BranchTrueFalseTotal
if ($savesym eq 'emptystring') { } 0 0 0
1131 0 $free->add(" SvLEN(&$s) = 0;");
1132 0 ▶ $len = 0 if $PERL518;
Branch: 1 branch
BranchTrueFalseTotal
if $PERL518 0 0 0
1133 } else {
1134 0 $len = 0;
1135 }
1136 0 $free->add(" SvFAKE_off(&$s);");
1137 } else {
1138 0 ▶ if ($iscow and $cur and $PERL518) {
Branch: 1 branch
BranchTrueFalseTotal
if ($iscow and $cur and $PERL518) 0 0 0
Condition0%0/6
$iscow and $cur and $PERL518
!ll&&!rl&&r
000
$iscow and $cur
!ll&&!rl&&r
000
MC/DC0%0/3
$iscow and $cur and $PERL518
$iscow $cur $PERL518
Truth table0%0/4
A and B and C
A= $iscowB= $curC= $PERL518
ABCresult
0XX0
10X0
1100
1111
1139 0 $len++;
1140 0 $pv .= "\000\001";
1141 0 $flags |= SVf_IsCOW;
1142 }
1143 }
1144 }
1145 } else {
1146 0 $len = 0;
1147 }
1148 }
1149 #if ($iscow and $len and $PERL518) { # 5.18 COW logic
1150 # my $offset = $len % $Config{ptrsize};
1151 # $len += $Config{ptrsize} - $offset if $offset;
1152 #}
1153 warn sprintf("Saving pv as %s %s cur=%d, len=%d, static=%d cow=%d %s flags=0x%x\n",
1154 $savesym, cstring($pv), $cur, $len,
1155 $static, $iscow, $shared_hek ? "shared, $fullname" : $fullname, $flags)
1156 0 ▶ if $debug{pv};
Branch: 2 branches
BranchTrueFalseTotal
if $B::C::debug{"pv"} 0 0 0
$shared_hek ? : 0 0 0
1157 0 return ( $savesym, $cur, $len, $pv, $static, $flags );
1158 }
1159  
1160 # Shared global string in PL_strtab.
1161 # Mostly GvNAME and GvFILE, but also CV prototypes or bareword hash keys.
1162 # Note: currently not used in list context
1163 0 ▶sub save_hek {
Subroutine save_hek: not called CC=16 SCAR=56.1
Pod undocumented
1164 0 my ($str, $fullname, $dynamic) = @_; # not cstring'ed
1165 # $dynamic: see lexsub CvNAME in CV::save
1166 # force empty string for CV prototypes
1167 0 ▶ return "NULL" unless defined $str;
Branch: 1 branch
BranchTrueFalseTotal
unless defined $str 0 0 0
1168 0 ▶ return "NULL" if $dynamic and !length $str and !@_
Branch: 1 branch
BranchTrueFalseTotal
if $dynamic and not length $str and not @_ and not $fullname =~ /unopaux_item.* const/ 0 0 0
Condition0%0/9
$dynamic and not length $str and not @_ and not $fullname =~ /unopaux_item.* const/
!ll&&!rl&&r
000
$dynamic and not length $str and not @_
!ll&&!rl&&r
000
$dynamic and not length $str
!ll&&!rl&&r
000
MC/DC0%0/4
$dynamic and not length $str and not @_ and not $fullname =~ /unopaux_item.* const/
$dynamic not length $str not @_ not $fullname =~ /unopaux_item.* const/
Truth table0%0/5
A and not(B) and not(C) and not(D)
A= $dynamicB= not length $strC= not @_D= not $fullname =~ /unopaux_item.* const/
ABCDresult
0XXX0
10XX0
110X0
11100
11111
1169 and $fullname !~ /unopaux_item.* const/;
1170 # The first assigment is already refcount bumped, we have to manually
1171 # do it for all others
1172 0 my ($cstr, $cur, $utf8) = strlen_flags($str);
1173 0 my $hek_key = $str.":".$utf8;
1174 0 ▶ if ($dynamic and defined $hektable{$hek_key}) {
Branch: 1 branch
BranchTrueFalseTotal
if ($dynamic and defined $hektable{$hek_key}) 0 0 0
Condition0%0/3
$dynamic and defined $hektable{$hek_key}
!ll&&!rl&&r
000
MC/DC0%0/2
$dynamic and defined $hektable{$hek_key}
$dynamic defined $hektable{$hek_key}
Truth table0%0/3
A and B
A= $dynamicB= defined $hektable{$hek_key}
ABresult
0X0
100
111
1175 0 return sprintf("share_hek_hek(%s)", $hektable{$hek_key});
1176 }
1177 0 ▶ if (!$dynamic and defined $statichektable{$hek_key}) {
Branch: 1 branch
BranchTrueFalseTotal
if (not $dynamic and defined $statichektable{$hek_key}) 0 0 0
Condition0%0/3
not $dynamic and defined $statichektable{$hek_key}
!ll&&!rl&&r
000
MC/DC0%0/2
not $dynamic and defined $statichektable{$hek_key}
not $dynamic defined $statichektable{$hek_key}
Truth table0%0/3
not(A) and B
A= not $dynamicB= defined $statichektable{$hek_key}
ABresult
0X0
100
111
1178 0 return $statichektable{$hek_key};
1179 }
1180 0 ▶ $cur = - $cur if $utf8;
Branch: 1 branch
BranchTrueFalseTotal
if $utf8 0 0 0
1181 0 ▶ $cstr = '""' if $cstr eq "0";
Branch: 1 branch
BranchTrueFalseTotal
if $cstr eq 0 0 0 0
1182 0 my $sym = sprintf( "hek%d", $hek_index++ );
1183 0 ▶ if (!$dynamic) {
Branch: 1 branch
BranchTrueFalseTotal
if (not $dynamic) { } 0 0 0
1184 0 $statichektable{$hek_key} = $sym;
1185 0 my $key = $cstr;
1186 0 my $len = abs($cur);
1187 # strip CowREFCNT
1188 0 ▶ if ($key =~ /\\000\\001"$/) {
Branch: 1 branch
BranchTrueFalseTotal
if ($key =~ /\\000\\001"$/) 0 0 0
1189 0 $key =~ s/\\000\\001"$/"/;
1190 0 $len -= 2;
1191 }
1192 # add the flags. a static hek is unshared
1193 0 ▶ if (!$utf8) { # 0x88: HVhek_STATIC + HVhek_UNSHARED
Branch: 1 branch
BranchTrueFalseTotal
if (not $utf8) { } 0 0 0
1194 0 $key =~ s/"$/\\000\\210"/;
1195 } else { # 0x89: + HVhek_UTF8
1196 0 $key =~ s/"$/\\000\\211"/;
1197 }
1198 #warn sprintf("Saving static hek %s %s cur=%d\n", $sym, $cstr, $cur)
1199 # if $debug{pv};
1200 # not const because we need to set the HASH at init
1201 0 $decl->add(sprintf("Static struct hek_ptr %s = { %u, %d, %s};",
1202 $sym, 0, $len, $key));
1203 0 $init->add(sprintf("PERL_HASH(%s.hek_hash, %s.hek_key, %u);", $sym, $sym, $len));
1204 } else {
1205 0 $hektable{$hek_key} = $sym;
1206 0 $decl->add(sprintf("Static HEK *%s;", $sym));
1207 warn sprintf("Saving hek %s %s cur=%d\n", $sym, $cstr, $cur)
1208 0 ▶ if $debug{pv};
Branch: 1 branch
BranchTrueFalseTotal
if $B::C::debug{"pv"} 0 0 0
1209 # randomized global shared hash keys:
1210 # share_hek needs a non-zero hash parameter, unlike hv_store.
1211 # Vulnerable to oCERT-2011-003 style DOS attacks?
1212 # user-input (object fields) do not affect strtab, it is pretty safe.
1213 # But we need to randomize them to avoid run-time conflicts
1214 # e.g. "Prototype mismatch: sub bytes::length (_) vs (_)"
1215 #if (0 and $PERL510) { # no refcount
1216 # $init->add(sprintf("%s = my_share_hek_0(%s, %d);", $sym, $cstr, $cur));
1217 #} else { # vs. bump the refcount
1218 0 $init->add(sprintf("%s = share_hek(%s, %d);", $sym, $cstr, $cur));
1219 #}
1220 # protect against Unbalanced string table refcount warning with PERL_DESTRUCT_LEVEL=2
1221 # $free->add(" $sym = NULL;");
1222 }
1223 0 return $sym;
1224 }
1225  
1226 0 ▶sub gv_fetchpvn {
Subroutine gv_fetchpvn: not called CC=6 SCAR=37.4
Pod undocumented
1227 0 my ($name, $flags, $type) = @_;
1228 0 ▶ warn 'undefined flags' unless defined $flags;
Branch: 1 branch
BranchTrueFalseTotal
unless defined $flags 0 0 0
1229 0 ▶ warn 'undefined type' unless defined $type;
Branch: 1 branch
BranchTrueFalseTotal
unless defined $type 0 0 0
1230 0 my ($cname, $cur, $utf8) = strlen_flags($name);
1231 0 ▶ if ($] >= 5.009002) {
Branch: 1 branch
BranchTrueFalseTotal
if ($] >= 5.009002) { } 0 0 0
1232 0 ▶ $flags .= length($flags) ? "|$utf8" : $utf8 if $utf8;
Branch: 2 branches
BranchTrueFalseTotal
if $utf8 0 0 0
length $flags ? : 0 0 0
1233 0 return "gv_fetchpvn_flags($cname, $cur, $flags, $type)";
1234 } else {
1235 0 return "gv_fetchpv($cname, $flags, $type)";
1236 }
1237 }
1238  
1239 # get_cv() returns a CV*
1240 0 ▶sub get_cv {
Subroutine get_cv: not called CC=6 SCAR=37.4
Pod undocumented
1241 0 my ($name, $flags) = @_;
1242 0 ▶ $name = "" if $name eq "__ANON__";
Branch: 1 branch
BranchTrueFalseTotal
if $name eq "__ANON__" 0 0 0
1243 0 my ($cname, $cur, $utf8) = strlen_flags($name);
1244 0 ▶ warn 'undefined flags' unless defined $flags;
Branch: 1 branch
BranchTrueFalseTotal
unless defined $flags 0 0 0
1245 0 ▶ if ($] >= 5.009002) {
Branch: 1 branch
BranchTrueFalseTotal
if ($] >= 5.009002) { } 0 0 0
1246 0 ▶ $flags .= length($flags) ? "|$utf8" : $utf8 if $utf8;
Branch: 2 branches
BranchTrueFalseTotal
if $utf8 0 0 0
length $flags ? : 0 0 0
1247 0 return qq[get_cvn_flags($cname, $cur, $flags)];
1248 } else {
1249 0 return qq[get_cv($cname, $flags)];
1250 }
1251 }
1252  
1253 0 ▶sub ivx ($) {
Subroutine ivx: not called CC=10 SCAR=47.0
Pod undocumented
1254 0 my $ivx = shift;
1255 0 my $ivdformat = $Config{ivdformat};
1256 0 $ivdformat =~ s/["\0]//g; #" poor editor
1257 0 $ivdformat =~ s/".$/"/; # cperl bug 5.22.2 #61 (never released)
1258 0 ▶ unless ($ivdformat) {
Branch: 1 branch
BranchTrueFalseTotal
unless ($ivdformat) 0 0 0
1259 0 ▶ $ivdformat = $Config{ivsize} == 4 ? 'd' : 'ld';
Branch: 1 branch
BranchTrueFalseTotal
$B::C::Config{'ivsize'} == 4 ? : 0 0 0
1260 }
1261 0 my $POW = ( $Config{ivsize} * 4 - 1 ); # poor editor
1262 0 my $intmax = (1 << $POW) - 1;
1263 0 my $L = 'L';
1264 # LL for 32bit -2147483648L or 64bit -9223372036854775808L
1265 0 ▶ $L = 'LL' if $Config{ivsize} == 2*$Config{ptrsize};
Branch: 1 branch
BranchTrueFalseTotal
if $B::C::Config{"ivsize"} == 2 * $B::C::Config{"ptrsize"} 0 0 0
1266 # UL if > INT32_MAX = 2147483647
1267 0 ▶ my $sval = sprintf("%${ivdformat}%s", $ivx, $ivx > $intmax ? "U$L" : "");
Branch: 1 branch
BranchTrueFalseTotal
$ivx > $intmax ? : 0 0 0
1268 0 ▶ if ($ivx < -$intmax) {
Branch: 1 branch
BranchTrueFalseTotal
if ($ivx < -$intmax) 0 0 0
1269 0 $sval = sprintf("%${ivdformat}%s", $ivx, 'LL'); # DateTime
1270 }
1271 0 ▶ if ($INC{'POSIX.pm'}) {
Branch: 1 branch
BranchTrueFalseTotal
if ($INC{"POSIX.pm"}) 0 0 0
1272 # i262: LONG_MIN -9223372036854775808L integer constant is so large that it is unsigned
1273 0 ▶ if ($ivx == POSIX::LONG_MIN()) {
Branch: 2 branches
BranchTrueFalseTotal
if ($ivx == POSIX::LONG_MIN()) { } 0 0 0
elsif ($ivx == POSIX::LONG_MAX()) { } 0 0 0
1274 0 $sval = "PERL_LONG_MIN";
1275 }
1276 elsif ($ivx == POSIX::LONG_MAX()) {
1277 0 $sval = "PERL_LONG_MAX";
1278 }
1279 #elsif ($ivx == POSIX::HUGE_VAL()) {
1280 # $sval = "HUGE_VAL";
1281 #}
1282 }
1283 0 ▶ $sval = '0' if $sval =~ /(NAN|inf)$/i;
Branch: 1 branch
BranchTrueFalseTotal
if $sval =~ /(NAN|inf)$/i 0 0 0
1284 0 return $sval;
1285 #return $C99 ? ".xivu_uv = $sval" : $sval; # this is version dependent
1286 }
1287  
1288 # protect from warning: floating constant exceeds range of ‘double’ [-Woverflow]
1289 0 ▶sub nvx ($) {
Subroutine nvx: not called CC=27 SCAR=66.3
Pod undocumented
1290 0 my $nvx = shift;
1291  
1292 # Handle infinite and NaN values
1293 0 ▶ if ( defined $nvx ) {
Branch: 1 branch
BranchTrueFalseTotal
if (defined $nvx) 0 0 0
1294 0 ▶ if ( $Config{d_isinf} or $] < 5.012 ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($B::C::Config{"d_isinf"} or $] < "5.012") 0 0 0
Condition0%0/3
$B::C::Config{"d_isinf"} or $] < "5.012"
l!l&&r!l&&!r
000
MC/DC0%0/2
$B::C::Config{"d_isinf"} or $] < "5.012"
$B::C::Config{"d_isinf"} $] < "5.012"
Truth table0%0/3
A or B
A= $B::C::Config{"d_isinf"}B= $] < "5.012"
ABresult
1X1
011
000
1295 0 ▶ return 'INFINITY' if $nvx =~ /^Inf/i;
Branch: 1 branch
BranchTrueFalseTotal
if $nvx =~ /^Inf/i 0 0 0
1296 0 ▶ return '-INFINITY' if $nvx =~ /^-Inf/i;
Branch: 1 branch
BranchTrueFalseTotal
if $nvx =~ /^-Inf/i 0 0 0
1297 }
1298 0 ▶ return 'NAN' if $nvx =~ /^NaN/i and ($Config{d_isnan} or $] < 5.012);
Branch: 1 branch
BranchTrueFalseTotal
if $nvx =~ /^NaN/i and $B::C::Config{"d_isnan"} || $] < "5.012" 0 0 0
Condition0%0/6
$nvx =~ /^NaN/i and $B::C::Config{"d_isnan"} || $] < "5.012"
!ll&&!rl&&r
000
$B::C::Config{"d_isnan"} or $] < "5.012"
l!l&&r!l&&!r
000
MC/DC0%0/3
$nvx =~ /^NaN/i and $B::C::Config{"d_isnan"} || $] < "5.012"
$nvx =~ /^NaN/i $B::C::Config{"d_isnan"} $] < "5.012"
Truth table0%0/4
A and B or C
A= $nvx =~ /^NaN/iB= $B::C::Config{"d_isnan"}C= $] < "5.012"
ABCresult
0XX0
1000
11X1
1011
1299 # TODO NANL for long double
1300 }
1301  
1302 0 my $nvgformat = $Config{nvgformat};
1303 0 $nvgformat =~ s/["\0]//g; #" poor editor
1304 0 $nvgformat =~ s/".$/"/; # cperl bug 5.22.2 #61
1305 0 ▶ unless ($nvgformat) {
Branch: 1 branch
BranchTrueFalseTotal
unless ($nvgformat) 0 0 0
1306 0 $nvgformat = 'g';
1307 }
1308 0 my $dblmax = "1.79769313486232e+308";
1309 0 ▶ my $ll = $Config{d_longdbl} ? "LL" : "L";
Branch: 1 branch
BranchTrueFalseTotal
$B::C::Config{'d_longdbl'} ? : 0 0 0
1310 0 my $ldblmax = "1.18973149535723176502e+4932";
1311 0 ▶ if ($nvgformat eq 'g') { # a very poor choice to keep precision
Branch: 1 branch
BranchTrueFalseTotal
if ($nvgformat eq "g") 0 0 0
1312 # on intel 17-18, on ppc 31, on sparc64/s390 34
1313 # TODO: rather use the binary representation of our union
1314 0 ▶ $nvgformat = $Config{uselongdouble} ? '.18Lg' : '.17g';
Branch: 1 branch
BranchTrueFalseTotal
$B::C::Config{'uselongdouble'} ? : 0 0 0
1315 }
1316 0 ▶ my $sval = sprintf("%${nvgformat}%s", $nvx, $nvx > $dblmax ? $ll : "");
Branch: 1 branch
BranchTrueFalseTotal
$nvx > $dblmax ? : 0 0 0
1317 0 ▶ if ($nvx < -$dblmax) {
Branch: 1 branch
BranchTrueFalseTotal
if ($nvx < -$dblmax) 0 0 0
1318 0 $sval = sprintf("%${nvgformat}%s", $nvx, $ll);
1319 }
1320 0 ▶ if ($INC{'POSIX.pm'}) {
Branch: 1 branch
BranchTrueFalseTotal
if ($INC{'POSIX.pm'}) { } 0 0 0
1321 0 ▶ if ($nvx == POSIX::DBL_MIN()) {
Branch: 2 branches
BranchTrueFalseTotal
if ($nvx == POSIX::DBL_MIN()) { } 0 0 0
elsif ($nvx == POSIX::DBL_MAX()) { } 0 0 0
1322 0 $sval = "DBL_MIN";
1323 }
1324 elsif ($nvx == POSIX::DBL_MAX()) { #1.797693134862316e+308
1325 0 $sval = "DBL_MAX";
1326 }
1327 }
1328 else {
1329 0 ▶ if ($nvx == $dblmax) {
Branch: 1 branch
BranchTrueFalseTotal
if ($nvx == $dblmax) 0 0 0
1330 0 $sval = "DBL_MAX";
1331 }
1332 }
1333  
1334 0 ▶ if ($Config{d_longdbl}) {
Branch: 1 branch
BranchTrueFalseTotal
if ($B::C::Config{"d_longdbl"}) 0 0 0
1335 0 my $posix;
1336 0 ▶ if ($INC{'POSIX.pm'}) {
Branch: 1 branch
BranchTrueFalseTotal
if ($INC{"POSIX.pm"}) 0 0 0
1337 0 eval { $posix = POSIX::LDBL_MIN(); };
1338 }
1339 0 ▶ if ($posix) { # linux does not have these, darwin does
Branch: 2 branches
BranchTrueFalseTotal
if ($posix) { } 0 0 0
elsif ($nvx == $ldblmax) { } 0 0 0
1340 0 ▶ if ($nvx == $posix) {
Branch: 2 branches
BranchTrueFalseTotal
if ($nvx == $posix) { } 0 0 0
elsif ($nvx == POSIX::LDBL_MAX()) { } 0 0 0
1341 0 $sval = "NV_MIN";
1342 }
1343 elsif ($nvx == POSIX::LDBL_MAX()) {
1344 0 $sval = "NV_MAX";
1345 }
1346 } elsif ($nvx == $ldblmax) {
1347 0 $sval = "NV_MAX";
1348 }
1349 }
1350 0 ▶ $sval = '0' if $sval =~ /(NAN|inf)$/i;
Branch: 1 branch
BranchTrueFalseTotal
if $sval =~ /(NAN|inf)$/i 0 0 0
1351 0 ▶ $sval .= '.00' if $sval =~ /^-?\d+$/;
Branch: 1 branch
BranchTrueFalseTotal
if $sval =~ /^-?\d+$/ 0 0 0
1352 0 return $sval;
1353 }
1354  
1355 0 ▶sub mg_RC_off {
Subroutine mg_RC_off: not called CC=3 SCAR=24.8
Pod undocumented
1356 0 my ($mg, $sym, $type) = @_;
1357 0 ▶ warn "MG->FLAGS ",$mg->FLAGS," turn off MGf_REFCOUNTED\n" if $debug{mg};
Branch: 1 branch
BranchTrueFalseTotal
if $B::C::debug{"mg"} 0 0 0
1358 0 ▶ if (!ref $sym) {
Branch: 1 branch
BranchTrueFalseTotal
if (not ref $sym) { } 0 0 0
1359 0 $init->add(sprintf("my_mg_RC_off(aTHX_ (SV*)$sym, %s);", cchar($type)));
1360 } else {
1361 0 $init->add(sprintf("my_mg_RC_off(aTHX_ (SV*)s\\_%x, %s);", $$sym, cchar($type)));
1362 }
1363 }
1364  
1365 # for bytes and utf8 only
1366 # TODO: Carp::Heavy, Exporter::Heavy
1367 # special case: warnings::register via -fno-warnings
1368 0 ▶sub force_heavy {
Subroutine force_heavy: not called CC=4 SCAR=25.8
Pod undocumented
1369 0 my $pkg = shift;
1370 0 my $pkg_heavy = $pkg."_heavy.pl";
1371 41 ▶ no strict 'refs';
Subroutine BEGIN: called CC=1 SCAR=0.0
1372 0 ▶ if (!$include_package{$pkg_heavy} and !exists $savINC{$pkg_heavy}) {
Branch: 1 branch
BranchTrueFalseTotal
unless ($include_package{$pkg_heavy} or exists $B::C::savINC{$pkg_heavy}) 0 0 0
Condition0%0/3
$include_package{$pkg_heavy} or exists $B::C::savINC{$pkg_heavy}
l!l&&r!l&&!r
000
MC/DC0%0/2
$include_package{$pkg_heavy} or exists $B::C::savINC{$pkg_heavy}
$include_package{$pkg_heavy} exists $B::C::savINC{$pkg_heavy}
Truth table0%0/3
A or B
A= $include_package{$pkg_heavy}B= exists $B::C::savINC{$pkg_heavy}
ABresult
1X1
011
000
1373 #eval qq[sub $pkg\::AUTOLOAD {
1374 # require '$pkg_heavy';
1375 # goto &\$AUTOLOAD if defined &\$AUTOLOAD;
1376 # warn("Undefined subroutine \$AUTOLOAD called");
1377 # }];
1378 #warn "Redefined $pkg\::AUTOLOAD to omit Carp\n" if $debug{gv};
1379 0 ▶ warn "Forcing early $pkg_heavy\n" if $debug{pkg};
Branch: 1 branch
BranchTrueFalseTotal
if $B::C::debug{"pkg"} 0 0 0
1380 0 require $pkg_heavy;
1381 0 mark_package($pkg_heavy, 1);
1382 #walk_syms($pkg); #before we stub unloaded CVs
1383 }
1384 0 return svref_2object( \*{$pkg."::AUTOLOAD"} );
1385 }
1386  
1387 # See also init_op_ppaddr below; initializes the ppaddr to the
1388 # OpTYPE; init_op_ppaddr iterates over the ops and sets
1389 # op_ppaddr to PL_ppaddr[op_ppaddr]; this avoids an explicit assignment
1390 # in perl_init ( ~10 bytes/op with GCC/i386 )
1391 0 ▶sub B::OP::fake_ppaddr {
Subroutine fake_ppaddr: not called CC=6 SCAR=37.4
1392 0 my $op = shift;
1393 0 ▶ return "NULL" unless $op->can('name');
Branch: 1 branch
BranchTrueFalseTotal
unless $op->can("name") 0 0 0
1394 0 ▶ if ($op->type == $OP_CUSTOM) {
Branch: 1 branch
BranchTrueFalseTotal
if ($op->type == $OP_CUSTOM) 0 0 0
1395 0 ▶ return ( $verbose ? sprintf( "/*XOP %s*/NULL", $op->name) : "NULL" );
Branch: 1 branch
BranchTrueFalseTotal
$B::C::verbose ? : 0 0 0
1396 }
1397 0 ▶ return $B::C::optimize_ppaddr
Branch: 2 branches
BranchTrueFalseTotal
$B::C::optimize_ppaddr ? : 0 0 0
$B::C::verbose ? : 0 0 0
1398 ? sprintf( "INT2PTR(void*,OP_%s)", uc( $op->name ) )
1399 : ( $verbose ? sprintf( "/*OP_%s*/NULL", uc( $op->name ) ) : "NULL" );
1400 }
1401 0 ▶sub B::FAKEOP::fake_ppaddr { "NULL" }
Subroutine fake_ppaddr: not called CC=1 SCAR=6.9
1402 # XXX HACK! duct-taping around compiler problems
1403 0 ▶sub B::OP::isa { UNIVERSAL::isa(@_) } # walkoptree_slow misses that
Subroutine isa: not called CC=1 SCAR=6.9
1404 127828 ▶sub B::OP::can { UNIVERSAL::can(@_) }
Subroutine can: called CC=1 SCAR=0.0
1405 74320 ▶sub B::OBJECT::name { "" } # B misses that
Subroutine name: called CC=1 SCAR=0.0
1406 41 $isa_cache{'B::OBJECT::can'} = 'UNIVERSAL';
1407  
1408 # This pair is needed because B::FAKEOP::save doesn't scalar dereference
1409 # $op->next and $op->sibling
1410 41 ▶my $opsect_common =
Branch: 1 branch
BranchTrueFalseTotal
$MAD ? : 0 41 41
1411 "next, sibling, ppaddr, " . ( $MAD ? "madprop, " : "" ) . "targ, type, ";
1412 #$opsect_common =~ s/, sibling/, _OP_SIBPARENT_FIELDNAME/ if $] > 5.021007;
1413 41 ▶$opsect_common =~ s/, sibling/, sibparent/ if $have_sibparent;
Branch: 1 branch
BranchTrueFalseTotal
if $have_sibparent 41 0 41
1414 {
1415  
1416 # For 5.8:
1417 # Current workaround/fix for op_free() trying to free statically
1418 # defined OPs is to set op_seq = -1 and check for that in op_free().
1419 # Instead of hardwiring -1 in place of $op->seq, we use $op_seq
1420 # so that it can be changed back easily if necessary. In fact, to
1421 # stop compilers from moaning about a U16 being initialised with an
1422 # uncast -1 (the printf format is %d so we can't tweak it), we have
1423 # to "know" that op_seq is a U16 and use 65535. Ugh.
1424  
1425 # For 5.9 the hard coded text is the values for op_opt and op_static in each
1426 # op. The value of op_opt is irrelevant, and the value of op_static needs to
1427 # be 1 to tell op_free that this is a statically defined op and that is
1428 # shouldn't be freed.
1429  
1430 # For 5.10 op_seq = -1 is gone, the temp. op_static also, but we
1431 # have something better, we can set op_latefree to 1, which frees the children
1432 # (e.g. savepvn), but not the static op.
1433  
1434 # 5.8: U16 op_seq;
1435 # 5.9.4: unsigned op_opt:1; unsigned op_static:1; unsigned op_spare:5;
1436 # 5.10: unsigned op_opt:1; unsigned op_latefree:1; unsigned op_latefreed:1; unsigned op_attached:1; unsigned op_spare:3;
1437 # 5.18: unsigned op_opt:1; unsigned op_slabbed:1; unsigned op_savefree:1; unsigned op_static:1; unsigned op_spare:3;
1438 # 5.19: unsigned op_opt:1; unsigned op_slabbed:1; unsigned op_savefree:1; unsigned op_static:1; unsigned op_folded:1; unsigned op_spare:2;
1439 # 5.21.2: unsigned op_opt:1; unsigned op_slabbed:1; unsigned op_savefree:1; unsigned op_static:1; unsigned op_folded:1; unsigned op_lastesib:1; unsigned op_spare:1;
1440 # 5.21.11: unsigned op_opt:1; unsigned op_slabbed:1; unsigned op_savefree:1; unsigned op_static:1; unsigned op_folded:1; unsigned op_moresib:1; unsigned op_spare:1;
1441 41 my $static;
1442 41 ▶ if ( $] < 5.009004 ) {
Branch: 8 branches
BranchTrueFalseTotal
if ($] < 5.009004) { } 0 41 41
elsif ($] < 5.01) { } 0 41 41
elsif ($] < 5.017002) { } 0 41 41
elsif ($] < 5.017004) { } 0 41 41
elsif ($] < 5.017006) { } 0 41 41
elsif ($] < 5.019002) { } 0 41 41
elsif ($] < 5.021002) { } 0 41 41
elsif ($] < 5.0210011) { } 0 41 41
1443 0 $static = sprintf "%u", 65535;
1444 0 $opsect_common .= "seq";
1445 }
1446 elsif ( $] < 5.010 ) {
1447 0 $static = '0, 1, 0';
1448 0 $opsect_common .= "opt, static, spare";
1449 }
1450 elsif ($] < 5.017002) {
1451 0 $static = '0, 1, 0, 0, 0';
1452 0 $opsect_common .= "opt, latefree, latefreed, attached, spare";
1453 }
1454 elsif ($] < 5.017004) {
1455 0 $static = '0, 1, 0, 0, 0, 0, 0';
1456 0 $opsect_common .= "opt, latefree, latefreed, attached, slabbed, savefree, spare";
1457 }
1458 elsif ($] < 5.017006) {
1459 0 $static = '0, 1, 0, 0, 0, 0, 0';
1460 0 $opsect_common .= "opt, latefree, latefreed, attached, slabbed, savefree, spare";
1461 }
1462 elsif ($] < 5.019002) { # 90840c5d1d 5.17.6
1463 0 $static = '0, 0, 0, 1, 0';
1464 0 $opsect_common .= "opt, slabbed, savefree, static, spare";
1465 }
1466 elsif ($] < 5.021002) {
1467 0 $static = '0, 0, 0, 1, 0, 0';
1468 0 $opsect_common .= "opt, slabbed, savefree, static, folded, spare";
1469 }
1470 elsif ($] < 5.0210011) {
1471 0 $static = '0, 0, 0, 1, 0, %d, 0';
1472 0 $opsect_common .= "opt, slabbed, savefree, static, folded, lastsib, spare";
1473 }
1474 else {
1475 41 $static = '0, 0, 0, 1, 0, %d, 0';
1476 41 $opsect_common .= "opt, slabbed, savefree, static, folded, moresib, spare";
1477 }
1478  
1479 0 ▶ sub B::OP::_save_common_middle {
Subroutine _save_common_middle: not called CC=6 SCAR=37.4
1480 0 my $op = shift;
1481 0 ▶ my $madprop = $MAD ? "0," : "";
Branch: 1 branch
BranchTrueFalseTotal
$MAD ? : 0 0 0
1482 0 my $ret;
1483 0 ▶ if ($static =~ / %d,/) {
Branch: 1 branch
BranchTrueFalseTotal
if ($static =~ / %d,/) { } 0 0 0
1484 0 my $has_sib;
1485 0 ▶ if (ref($op) eq 'B::FAKEOP') {
Branch: 2 branches
BranchTrueFalseTotal
if (ref $op eq 'B::FAKEOP') { } 0 0 0
elsif ($] < 5.0210011) { } 0 0 0
1486 0 $has_sib = 0;
1487 } elsif ($] < 5.0210011) {
1488 0 $has_sib = $op->lastsib;
1489 } else {
1490 0 $has_sib = $op->moresib;
1491 }
1492 0 $ret = sprintf( "%s, %s %u, %u, $static, 0x%x, 0x%x",
1493 $op->fake_ppaddr, $madprop, $op->targ, $op->type,
1494 $has_sib,
1495 $op->flags, $op->private );
1496 } else {
1497 0 $ret = sprintf( "%s, %s %u, %u, $static, 0x%x, 0x%x",
1498 $op->fake_ppaddr, $madprop, $op->targ, $op->type,
1499 $op->flags, $op->private );
1500 }
1501 # XXX maybe add a ix=opindex string for debugging if $debug{flags}
1502 0 ▶ if ($B::C::Config::have_op_rettype) {
Branch: 1 branch
BranchTrueFalseTotal
if ($B::C::Config::have_op_rettype) 0 0 0
1503 0 $ret .= sprintf(", 0x%x", $op->rettype);
1504 }
1505 0 $ret;
1506 }
1507 41 $opsect_common .= ", flags, private";
1508 41 ▶ if ($B::C::Config::have_op_rettype) {
Branch: 1 branch
BranchTrueFalseTotal
if ($B::C::Config::have_op_rettype) 0 41 41
1509 0 $opsect_common .= ", rettype";
1510 }
1511 }
1512  
1513 0 ▶sub B::OP::_save_common {
Subroutine _save_common: not called CC=26 SCAR=65.5
1514 0 my $op = shift;
1515 # compile-time method_named packages are always const PV sM/BARE, they should be optimized.
1516 # run-time packages are in gvsv/padsv. This is difficult to optimize.
1517 # my Foo $obj = shift; $obj->bar(); # TODO typed $obj
1518 # entersub -> pushmark -> package -> args...
1519 # See perl -MO=Terse -e '$foo->bar("var")'
1520 # See also http://www.perl.com/pub/2000/06/dougpatch.html
1521 # XXX TODO 5.8 ex-gvsv
1522 # XXX TODO Check for method_named as last argument
1523 0 ▶ if ($op->type > 0 and
Branch: 1 branch
BranchTrueFalseTotal
if ($op->type > 0 and $op->name eq "entersub" and $op->first and $op->first->can("name") and $op->first->name eq "pushmark" and $op->first->next->name eq "const" && $op->first->next->flags == 34 || $op->first->next->name eq "padsv" || $] < "5.01" && $op->first->next->name eq "gvsv" && !$op->first->next->type && $op->first->next->next->name eq "const" && $op->first->next->next->flags == 34) 0 0 0
Condition0%0/36
$op->type > 0 and $op->name eq "entersub" and $op->first and $op->first->can("name") and $op->first->name eq "pushmark" and $op->first->next->name eq "const" && $op->first->next->flags == 34 || $op->first->next->name eq "padsv" || $] < "5.01" && $op->first->next->name eq "gvsv" && !$op->first->next->type && $op->first->next->next->name eq "const" && $op->first->next->next->flags == 34
!ll&&!rl&&r
000
$op->type > 0 and $op->name eq "entersub" and $op->first and $op->first->can("name") and $op->first->name eq "pushmark"
!ll&&!rl&&r
000
$op->type > 0 and $op->name eq "entersub" and $op->first and $op->first->can("name")
!ll&&!rl&&r
000
$op->type > 0 and $op->name eq "entersub" and $op->first
!ll&&!rl&&r
000
$op->type > 0 and $op->name eq "entersub"
!ll&&!rl&&r
000
$op->first->next->name eq "const" and $op->first->next->flags == 34 or $op->first->next->name eq "padsv" or $] < "5.01" and $op->first->next->name eq "gvsv" and not $op->first->next->type and $op->first->next->next->name eq "const" and $op->first->next->next->flags == 34
l!l&&r!l&&!r
000
$op->first->next->name eq "const" and $op->first->next->flags == 34 or $op->first->next->name eq "padsv"
l!l&&r!l&&!r
000
$op->first->next->name eq "const" and $op->first->next->flags == 34
!ll&&!rl&&r
000
$] < "5.01" and $op->first->next->name eq "gvsv" and not $op->first->next->type and $op->first->next->next->name eq "const" and $op->first->next->next->flags == 34
!ll&&!rl&&r
000
$] < "5.01" and $op->first->next->name eq "gvsv" and not $op->first->next->type and $op->first->next->next->name eq "const"
!ll&&!rl&&r
000
$] < "5.01" and $op->first->next->name eq "gvsv" and not $op->first->next->type
!ll&&!rl&&r
000
$] < "5.01" and $op->first->next->name eq "gvsv"
!ll&&!rl&&r
000
MC/DC0%0/13
$op->type > 0 and $op->name eq "entersub" and $op->first and $op->first->can("name") and $op->first->name eq "pushmark" and $op->first->next->name eq "const" && $op->first->next->flags == 34 || $op->first->next->name eq "padsv" || $] < "5.01" && $op->first->next->name eq "gvsv" && !$op->first->next->type && $op->first->next->next->name eq "const" && $op->first->next->next->flags == 34
$op->type > 0 $op->name eq "entersub" $op->first $op->first->can("name") $op->first->name eq "pushmark" $op->first->next->name eq "const" $op->first->next->flags == 34 $op->first->next->name eq "padsv" $] < "5.01" $op->first->next->name eq "gvsv" not $op->first->next->type $op->first->next->next->name eq "const" $op->first->next->next->flags == 34
Truth table0%0/20
A and B and C and D and E and F and G or H or I and J and not(K) and L and M
A= $op->type > 0B= $op->name eq "entersub"C= $op->firstD= $op->first->can("name")E= $op->first->name eq "pushmark"F= $op->first->next->name eq "const"G= $op->first->next->flags == 34H= $op->first->next->name eq "padsv"I= $] < "5.01"J= $op->first->next->name eq "gvsv"K= not $op->first->next->typeL= $op->first->next->next->name eq "const"M= $op->first->next->next->flags == 34
ABCDEFGHIJKLMresult
0XXXXXXXXXXXX0
10XXXXXXXXXXX0
110XXXXXXXXXX0
1110XXXXXXXXX0
11110XXXXXXXX0
111110X00XXXX0
111110X010XXX0
111110X0110XX0
111110X01110X0
111110X0111100
111111000XXXX0
1111110010XXX0
11111100110XX0
111111001110X0
11111100111100
1111111XXXXXX1
111110X1XXXXX1
11111101XXXXX1
111110X0111111
11111100111111
1524 $op->name eq 'entersub' and $op->first and $op->first->can('name') and
1525 $op->first->name eq 'pushmark' and
1526 # Foo->bar() compile-time lookup, 34 = BARE in all versions
1527 (($op->first->next->name eq 'const' and $op->first->next->flags == 34)
1528 or $op->first->next->name eq 'padsv' # or $foo->bar() run-time lookup
1529 or ($] < 5.010 and $op->first->next->name eq 'gvsv' and !$op->first->next->type # 5.8 ex-gvsv
1530 and $op->first->next->next->name eq 'const' and $op->first->next->next->flags == 34))
1531 ) {
1532 0 my $pkgop = $op->first->next;
1533 0 ▶ if ($] < 5.010 and !$op->first->next->type) { # 5.8 ex-gvsv
Branch: 1 branch
BranchTrueFalseTotal
if ($] < "5.01" and not $op->first->next->type) 0 0 0
Condition0%0/3
$] < "5.01" and not $op->first->next->type
!ll&&!rl&&r
000
MC/DC0%0/2
$] < "5.01" and not $op->first->next->type
$] < "5.01" not $op->first->next->type
Truth table0%0/3
A and not(B)
A= $] < "5.01"B= not $op->first->next->type
ABresult
0X0
100
111
1534 0 $pkgop = $op->first->next->next;
1535 }
1536 0 ▶ warn "check package_pv ".$pkgop->name." for method_name\n" if $debug{cv};
Branch: 1 branch
BranchTrueFalseTotal
if $B::C::debug{"cv"} 0 0 0
1537 0 my $pv = svop_or_padop_pv($pkgop); # 5.13: need to store away the pkg pv
1538 0 ▶ if ($pv and $pv !~ /[! \(]/) {
Branch: 1 branch
BranchTrueFalseTotal
if ($pv and not $pv =~ /[! \(]/) { } 0 0 0
Condition0%0/3
$pv and not $pv =~ /[! \(]/
!ll&&!rl&&r
000
MC/DC0%0/2
$pv and not $pv =~ /[! \(]/
$pv not $pv =~ /[! \(]/
Truth table0%0/3
A and not(B)
A= $pvB= not $pv =~ /[! \(]/
ABresult
0X0
100
111
1539 0 $package_pv = $pv;
1540 0 push_package($package_pv);
1541 } else {
1542 # mostly optimized-away padsv NULL pads with 5.8
1543 0 ▶ warn "package_pv for method_name not found\n" if $debug{cv};
Branch: 1 branch
BranchTrueFalseTotal
if $B::C::debug{"cv"} 0 0 0
1544 }
1545 }
1546 0 ▶ if ($op->type == $OP_CUSTOM) {
Branch: 1 branch
BranchTrueFalseTotal
if ($op->type == $OP_CUSTOM) 0 0 0
1547 0 ▶ warn sprintf("CUSTOM OP %s $op\n", $op->name) if $verbose;
Branch: 1 branch
BranchTrueFalseTotal
if $B::C::verbose 0 0 0
1548 }
1549 0 $prev_op = $op;
1550 0 my $sibling;
1551 0 ▶ if ($have_sibparent and !$op->moresib) { # HAS_SIBLING
Branch: 1 branch
BranchTrueFalseTotal
if ($have_sibparent and not $op->moresib) { } 0 0 0
Condition0%0/3
$have_sibparent and not $op->moresib
!ll&&!rl&&r
000
MC/DC0%0/2
$have_sibparent and not $op->moresib
$have_sibparent not $op->moresib
Truth table0%0/3
A and not(B)
A= $have_sibparentB= not $op->moresib
ABresult
0X0
100
111
1552 0 $sibling = $op->parent;
1553 0 ▶ warn "sibparent ",$op->name," $sibling\n" if $verbose and $debug{op};
Branch: 1 branch
BranchTrueFalseTotal
if $B::C::verbose and $B::C::debug{"op"} 0 0 0
Condition0%0/3
$B::C::verbose and $B::C::debug{"op"}
!ll&&!rl&&r
000
MC/DC0%0/2
$B::C::verbose and $B::C::debug{"op"}
$B::C::verbose $B::C::debug{"op"}
Truth table0%0/3
A and B
A= $B::C::verboseB= $B::C::debug{"op"}
ABresult
0X0
100
111
1554 } else {
1555 0 $sibling = $op->sibling;
1556 }
1557 return sprintf( "s\\_%x, s\\_%x, %s",
1558 0 ${ $op->next },
1559 $$sibling,
1560 $op->_save_common_middle
1561 );
1562 }
1563  
1564 0 ▶sub B::OP::save {
Subroutine save: not called CC=29 SCAR=67.7
1565 0 my ( $op, $level ) = @_;
1566 0 my $sym = objsym($op);
1567 0 ▶ return $sym if defined $sym;
Branch: 1 branch
BranchTrueFalseTotal
if defined $sym 0 0 0
1568 0 ▶ $level = 0 unless $level;
Branch: 1 branch
BranchTrueFalseTotal
unless $level 0 0 0
1569 0 my $type = $op->type;
1570 0 ▶ $nullop_count++ unless $type;
Branch: 1 branch
BranchTrueFalseTotal
unless $type 0 0 0
1571 0 ▶ if ( $type == $OP_THREADSV ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($type == $OP_THREADSV) 0 0 0
1572 # saves looking up ppaddr but it's a bit naughty to hard code this
1573 0 $init->add(sprintf( "(void)find_threadsv(%s);", cstring( $threadsv_names[ $op->targ ])));
1574 }
1575 0 ▶ if ( $type == $OP_UCFIRST ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($type == $OP_UCFIRST) 0 0 0
1576 0 $B::C::fold = 1;
1577 0 ▶ if ($] >= 5.013009) {
Branch: 1 branch
BranchTrueFalseTotal
if ($] >= "5.013009") 0 0 0
1578 0 ▶ warn "enabling -ffold with ucfirst\n" if $verbose;
Branch: 1 branch
BranchTrueFalseTotal
if $B::C::verbose 0 0 0
1579 0 ▶ require "utf8.pm" unless $savINC{"utf8.pm"};
Branch: 1 branch
BranchTrueFalseTotal
unless $B::C::savINC{"utf8.pm"} 0 0 0
1580 0 mark_package("utf8");
1581 0 load_utf8_heavy();
1582 }
1583 }
1584 0 ▶ if (ref($op) eq 'B::OP') { # check wrong BASEOPs
Branch: 1 branch
BranchTrueFalseTotal
if (ref $op eq "B::OP") 0 0 0
1585 # [perl #80622] Introducing the entrytry hack, needed since 5.12, fixed with 5.13.8 a425677
1586 # ck_eval upgrades the UNOP entertry to a LOGOP, but B gets us just a B::OP (BASEOP).
1587 # op->other points to the leavetry op, which is needed for the eval scope.
1588 0 ▶ if ($op->name eq 'entertry') {
Branch: 1 branch
BranchTrueFalseTotal
if ($op->name eq "entertry") 0 0 0
1589 0 ▶ warn "[perl #80622] Upgrading entertry from BASEOP to LOGOP...\n" if $verbose;
Branch: 1 branch
BranchTrueFalseTotal
if $B::C::verbose 0 0 0
1590 0 bless $op, 'B::LOGOP';
1591 0 return $op->save($level);
1592 }
1593 }
1594  
1595 # since 5.10 nullified cops free their additional fields
1596 0 ▶ if ( $PERL510 and !$type and $OP_COP{ $op->targ } ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($PERL510 and not $type and $OP_COP{$op->targ}) { } 0 0 0
Condition0%0/6
$PERL510 and not $type and $OP_COP{$op->targ}
!ll&&!rl&&r
000
$PERL510 and not $type
!ll&&!rl&&r
000
MC/DC0%0/3
$PERL510 and not $type and $OP_COP{$op->targ}
$PERL510 not $type $OP_COP{$op->targ}
Truth table0%0/4
A and not(B) and C
A= $PERL510B= not $typeC= $OP_COP{$op->targ}
ABCresult
0XX0
10X0
1100
1111
1597 0 ▶ warn sprintf( "Null COP: %d\n", $op->targ ) if $debug{cops};
Branch: 1 branch
BranchTrueFalseTotal
if $B::C::debug{"cops"} 0 0 0
1598 0 if (0 and $optimize_cop) {
1599 # XXX when is the NULL COP save to skip?
1600 # unsafe after entersub, entereval, anoncode, sort block (pushmark pushmark)
1601 # Rather skip this with CC not with C because we need the context.
1602 # XXX we dont have the prevop, it can be any op type.
1603 if ($verbose or $debug{cops}) {
1604 my $prevop = getsym(sprintf("&op_list[%d]", $opsect->index));
1605 warn sprintf( "Skip Null COP: %d, prev=\\s%x\n", $op->targ, $prevop);
1606 }
1607 return savesym( $op, $op->next->save );
1608 }
1609 0 ▶ if ($ITHREADS and $] >= 5.017) {
Branch: 5 branches
BranchTrueFalseTotal
if ($ITHREADS and $] >= 5.017) { } 0 0 0
elsif ($ITHREADS and $] >= 5.016) { } 0 0 0
elsif ($ITHREADS and $] >= 5.015004) { } 0 0 0
elsif ($PERL512) { } 0 0 0
elsif ($PERL510) { } 0 0 0
Condition0%0/3
$ITHREADS and $] >= "5.017"
!ll&&!rl&&r
000
MC/DC0%0/2
$ITHREADS and $] >= "5.017"
$ITHREADS $] >= "5.017"
Truth table0%0/3
A and B
A= $ITHREADSB= $] >= "5.017"
ABresult
0X0
100
111
1610 0 $copsect->comment(
1611 "$opsect_common, line, stashoff, file, hints, seq, warnings, hints_hash");
1612 0 $copsect->add(sprintf("%s, 0, 0, (char *)NULL, 0, 0, NULL, NULL",
1613 $op->_save_common));
1614 }
1615 ▶ elsif ($ITHREADS and $] >= 5.016) {
Condition0%0/3
$ITHREADS and $] >= "5.016"
!ll&&!rl&&r
000
MC/DC0%0/2
$ITHREADS and $] >= "5.016"
$ITHREADS $] >= "5.016"
Truth table0%0/3
A and B
A= $ITHREADSB= $] >= "5.016"
ABresult
0X0
100
111
1616 0 $copsect->comment(
1617 "$opsect_common, line, stashpv, file, stashlen, hints, seq, warnings, hints_hash");
1618 0 $copsect->add(sprintf("%s, 0, (char *)NULL, NULL, 0, 0, 0, NULL, NULL",
1619 $op->_save_common));
1620 }
1621 ▶ elsif ($ITHREADS and $] >= 5.015004) {
Condition0%0/3
$ITHREADS and $] >= "5.015004"
!ll&&!rl&&r
000
MC/DC0%0/2
$ITHREADS and $] >= "5.015004"
$ITHREADS $] >= "5.015004"
Truth table0%0/3
A and B
A= $ITHREADSB= $] >= "5.015004"
ABresult
0X0
100
111
1622 0 $copsect->comment(
1623 "$opsect_common, line, stash, file, hints, seq, warnings, hints_hash");
1624 0 $copsect->add(sprintf("%s, 0, (char *)NULL, NULL, 0, 0, NULL, NULL",
1625 $op->_save_common));
1626 }
1627 elsif ($PERL512) {
1628 0 $copsect->comment(
1629 "$opsect_common, line, stash, file, hints, seq, warnings, hints_hash");
1630 0 ▶ $copsect->add(sprintf("%s, 0, %s, NULL, 0, 0, NULL, NULL",
Branch: 1 branch
BranchTrueFalseTotal
$ITHREADS ? : 0 0 0
1631 $op->_save_common, $ITHREADS ? "(char *)NULL" : "Nullhv"));
1632 }
1633 elsif ($PERL510) {
1634 0 $copsect->comment("$opsect_common, line, label, seq, warn_int, hints_hash");
1635 0 $copsect->add(sprintf("%s, %u, NULL, " . "NULL, NULL, 0, " . "%u, %d, NULL",
1636 $op->_save_common, 0, 0, 0));
1637 }
1638 else {
1639 0 $copsect->comment(
1640 "$opsect_common, label, seq, arybase, line, warnings, hints_hash");
1641 0 $copsect->add(
1642 sprintf( "%s, NULL, NULL, NULL, 0, 0, 0, NULL", $op->_save_common ) );
1643 }
1644 0 my $ix = $copsect->index;
1645 0 ▶ $init->add( sprintf( "cop_list[%d].op_ppaddr = %s;", $ix, $op->ppaddr ) )
Branch: 1 branch
BranchTrueFalseTotal
unless $B::C::optimize_ppaddr 0 0 0
1646 unless $B::C::optimize_ppaddr;
1647 0 savesym( $op, "(OP*)&cop_list[$ix]" );
1648 }
1649 else {
1650 0 $opsect->comment($opsect_common);
1651 0 $opsect->add( $op->_save_common );
1652  
1653 0 ▶ $opsect->debug( $op->name, $op->flagspv ) if $debug{flags};
Branch: 1 branch
BranchTrueFalseTotal
if $B::C::debug{"flags"} 0 0 0
1654 0 my $ix = $opsect->index;
1655 0 ▶ $init->add( sprintf( "op_list[%d].op_ppaddr = %s;", $ix, $op->ppaddr ) )
Branch: 1 branch
BranchTrueFalseTotal
unless $B::C::optimize_ppaddr 0 0 0
1656 unless $B::C::optimize_ppaddr;
1657 warn( sprintf( " OP=%s targ=%d flags=0x%x private=0x%x\n",
1658 0 ▶ peekop($op), $op->targ, $op->flags, $op->private ) ) if $debug{op};
Branch: 1 branch
BranchTrueFalseTotal
if $B::C::debug{"op"} 0 0 0
1659 0 savesym( $op, "&op_list[$ix]" );
1660 }
1661 }
1662  
1663 # needed for special GV logic: save only stashes for stashes
1664 package B::STASHGV;
1665 41 our @ISA = ('B::GV');
1666  
1667 package B::FAKEOP;
1668  
1669 41 our @ISA = qw(B::OP);
1670  
1671 0 ▶sub new {
Subroutine new: not called CC=1 SCAR=6.9
1672 0 my ( $class, %objdata ) = @_;
1673 0 bless \%objdata, $class;
1674 }
1675  
1676 0 ▶sub save {
Subroutine save: not called CC=2 SCAR=17.9
1677 0 my ( $op, $level ) = @_;
1678 0 $opsect->add(
1679 sprintf( "%s, %s, %s", $op->next, $op->sibling, $op->_save_common_middle )
1680 );
1681 0 my $ix = $opsect->index;
1682 0 ▶ $init->add( sprintf( "op_list[%d].op_ppaddr = %s;", $ix, $op->ppaddr ) )
Branch: 1 branch
BranchTrueFalseTotal
unless $B::C::optimize_ppaddr 0 0 0
1683 unless $B::C::optimize_ppaddr;
1684 0 return "&op_list[$ix]";
1685 }
1686  
1687 41 *_save_common_middle = \&B::OP::_save_common_middle;
1688 0 ▶sub next { $_[0]->{"next"} || 0 }
Subroutine next: not called CC=2 SCAR=17.9
Branch: 1 branch
BranchTrueFalseTotal
$_[0]{"next"} or 0 0 0 0
1689 0 ▶sub type { $_[0]->{type} || 0 }
Subroutine type: not called CC=2 SCAR=17.9
Branch: 1 branch
BranchTrueFalseTotal
$_[0]{"type"} or 0 0 0 0
1690 0 ▶sub sibling { $_[0]->{sibling} || 0 }
Subroutine sibling: not called CC=2 SCAR=17.9
Branch: 1 branch
BranchTrueFalseTotal
$_[0]{"sibling"} or 0 0 0 0
1691 0 ▶sub moresib { $_[0]->{moresib} || 0 }
Subroutine moresib: not called CC=2 SCAR=17.9
Branch: 1 branch
BranchTrueFalseTotal
$_[0]{"moresib"} or 0 0 0 0
1692 0 ▶sub parent { $_[0]->{parent} || 0 }
Subroutine parent: not called CC=2 SCAR=17.9
Branch: 1 branch
BranchTrueFalseTotal
$_[0]{"parent"} or 0 0 0 0
1693 0 ▶sub ppaddr { $_[0]->{ppaddr} || 0 }
Subroutine ppaddr: not called CC=2 SCAR=17.9
Branch: 1 branch
BranchTrueFalseTotal
$_[0]{"ppaddr"} or 0 0 0 0
1694 0 ▶sub targ { $_[0]->{targ} || 0 }
Subroutine targ: not called CC=2 SCAR=17.9
Branch: 1 branch
BranchTrueFalseTotal
$_[0]{"targ"} or 0 0 0 0
1695 0 ▶sub flags { $_[0]->{flags} || 0 }
Subroutine flags: not called CC=2 SCAR=17.9
Branch: 1 branch
BranchTrueFalseTotal
$_[0]{"flags"} or 0 0 0 0
1696 0 ▶sub private { $_[0]->{private} || 0 }
Subroutine private: not called CC=2 SCAR=17.9
Branch: 1 branch
BranchTrueFalseTotal
$_[0]{"private"} or 0 0 0 0
1697 0 ▶sub rettype { $_[0]->{rettype} || 0 }
Subroutine rettype: not called CC=2 SCAR=17.9
Branch: 1 branch
BranchTrueFalseTotal
$_[0]{"rettype"} or 0 0 0 0
1698  
1699 package B::C;
1700  
1701 # dummy for B::C, only needed for B::CC
1702 0 ▶sub label {}
Subroutine label: not called CC=1 SCAR=0.0
Pod undocumented
1703  
1704 # save alternate ops if defined, and also add labels (needed for B::CC)
1705 0 ▶sub do_labels ($$@) {
Subroutine do_labels: not called CC=9 SCAR=42.0
Pod undocumented
1706 0 my $op = shift;
1707 0 my $level = shift;
1708 0 for my $m (@_) {
1709 41 ▶ no strict 'refs';
Subroutine BEGIN: called CC=1 SCAR=0.0
1710 0 ▶ my $mo = $op->$m if $m;
Branch: 1 branch
BranchTrueFalseTotal
if $m 0 0 0
1711 0 ▶ if ( $mo and $$mo ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($mo and $$mo) 0 0 0
Condition0%0/3
$mo and $$mo
!ll&&!rl&&r
000
MC/DC0%0/2
$mo and $$mo
$mo $$mo
Truth table0%0/3
A and B
A= $moB= $$mo
ABresult
0X0
100
111
1712 0 label($mo);
1713 0 ▶ $mo->save($level) if $m ne 'first'
Branch: 1 branch
BranchTrueFalseTotal
if $m ne "first" or $op->flags & 4 and not $op->name eq "const" && $op->flags & 64 0 0 0
Condition0%0/9
$m ne "first" or $op->flags & 4 and not $op->name eq "const" && $op->flags & 64
l!l&&r!l&&!r
000
$op->flags & 4 and not $op->name eq "const" && $op->flags & 64
!ll&&!rl&&r
000
$op->name eq 'const' && $op->flags & 64
!ll&&!rl&&r
000
MC/DC0%0/4
$m ne "first" or $op->flags & 4 and not $op->name eq "const" && $op->flags & 64
$m ne "first" $op->flags & 4 $op->name eq 'const' $op->flags & 64
Truth table0%0/5
A or B and not(C && D)
A= $m ne "first"B= $op->flags & 4C= $op->name eq 'const'D= $op->flags & 64
ABCDresult
1XXX1
010X1
01101
00XX0
01110
1714 or ($op->flags & 4
1715 and !($op->name eq 'const' and $op->flags & 64)); #OPpCONST_BARE has no first
1716 }
1717 }
1718 }
1719  
1720 0 ▶sub B::UNOP::save {
Subroutine save: not called CC=17 SCAR=57.2
1721 0 my ( $op, $level ) = @_;
1722 0 my $sym = objsym($op);
1723 0 ▶ return $sym if defined $sym;
Branch: 1 branch
BranchTrueFalseTotal
if defined $sym 0 0 0
1724 0 ▶ $level = 0 unless $level;
Branch: 1 branch
BranchTrueFalseTotal
unless $level 0 0 0
1725 0 $unopsect->comment("$opsect_common, first");
1726 0 $unopsect->add( sprintf( "%s, s\\_%x", $op->_save_common, ${ $op->first } ) );
1727 0 ▶ $unopsect->debug( $op->name, $op->flagspv ) if $debug{flags};
Branch: 1 branch
BranchTrueFalseTotal
if $B::C::debug{"flags"} 0 0 0
1728 0 my $ix = $unopsect->index;
1729 0 ▶ $init->add( sprintf( "unop_list[%d].op_ppaddr = %s;", $ix, $op->ppaddr ) )
Branch: 1 branch
BranchTrueFalseTotal
unless $B::C::optimize_ppaddr 0 0 0
1730 unless $B::C::optimize_ppaddr;
1731 0 $sym = savesym( $op, "(OP*)&unop_list[$ix]" );
1732 0 ▶ if ($op->name eq 'method' and $op->first and $op->first->name eq 'const') {
Branch: 1 branch
BranchTrueFalseTotal
if ($op->name eq "method" and $op->first and $op->first->name eq "const") 0 0 0
Condition0%0/6
$op->name eq "method" and $op->first and $op->first->name eq "const"
!ll&&!rl&&r
000
$op->name eq "method" and $op->first
!ll&&!rl&&r
000
MC/DC0%0/3
$op->name eq "method" and $op->first and $op->first->name eq "const"
$op->name eq "method" $op->first $op->first->name eq "const"
Truth table0%0/4
A and B and C
A= $op->name eq "method"B= $op->firstC= $op->first->name eq "const"
ABCresult
0XX0
10X0
1100
1111
1733 0 my $method = svop_name($op->first);
1734 0 ▶ if (!$method and $ITHREADS) {
Branch: 1 branch
BranchTrueFalseTotal
if (not $method and $ITHREADS) 0 0 0
Condition0%0/3
not $method and $ITHREADS
!ll&&!rl&&r
000
MC/DC0%0/2
not $method and $ITHREADS
not $method $ITHREADS
Truth table0%0/3
not(A) and B
A= not $methodB= $ITHREADS
ABresult
0X0
100
111
1735 0 $method = padop_name($op->first, curcv); # XXX (curpad[targ])
1736 }
1737 0 ▶ warn "method -> const $method\n" if $debug{pkg} and $ITHREADS;
Branch: 1 branch
BranchTrueFalseTotal
if $B::C::debug{"pkg"} and $ITHREADS 0 0 0
Condition0%0/3
$B::C::debug{"pkg"} and $ITHREADS
!ll&&!rl&&r
000
MC/DC0%0/2
$B::C::debug{"pkg"} and $ITHREADS
$B::C::debug{"pkg"} $ITHREADS
Truth table0%0/3
A and B
A= $B::C::debug{"pkg"}B= $ITHREADS
ABresult
0X0
100
111
1738 #324,#326 need to detect ->(maybe::next|maybe|next)::(method|can)
1739 0 ▶ if ($method =~ /^(maybe::next|maybe|next)::(method|can)$/) {
Branch: 2 branches
BranchTrueFalseTotal
if ($method =~ /^(maybe::next|maybe|next)::(method|can)$/) { } 0 0 0
elsif ($method =~ /^(NEXT|EVERY)::/) { } 0 0 0
1740 0 ▶ warn "mark \"$1\" for method $method\n" if $debug{pkg};
Branch: 1 branch
BranchTrueFalseTotal
if $B::C::debug{"pkg"} 0 0 0
1741 0 mark_package($1, 1);
1742 0 mark_package("mro", 1);
1743 } # and also the old 5.8 NEXT|EVERY with non-fixed method names und subpackages
1744 elsif ($method =~ /^(NEXT|EVERY)::/) {
1745 0 ▶ warn "mark \"$1\" for method $method\n" if $debug{pkg};
Branch: 1 branch
BranchTrueFalseTotal
if $B::C::debug{"pkg"} 0 0 0
1746 0 mark_package($1, 1);
1747 0 ▶ mark_package("NEXT", 1) if $1 ne "NEXT";
Branch: 1 branch
BranchTrueFalseTotal
if $1 ne "NEXT" 0 0 0
1748 }
1749 }
1750 0 do_labels ($op, $level+1, 'first');
1751 0 $sym;
1752 }
1753  
1754 0 ▶sub is_constant {
Subroutine is_constant: not called CC=2 SCAR=17.9
Pod undocumented
1755 0 my $s = shift;
1756 0 ▶ return 1 if $s =~ /^(&sv_list|\-?\d+|Nullsv)/; # not gv_list, hek
Branch: 1 branch
BranchTrueFalseTotal
if $s =~ /^(&sv_list|\-?\d+|Nullsv)/ 0 0 0
1757 0 return 0;
1758 }
1759  
1760 0 ▶sub B::UNOP_AUX::save {
Subroutine save: not called CC=74 SCAR=86.2
1761 0 my ( $op, $level ) = @_;
1762 0 my $sym = objsym($op);
1763 0 ▶ return $sym if defined $sym;
Branch: 1 branch
BranchTrueFalseTotal
if defined $sym 0 0 0
1764 0 ▶ $level = 0 unless $level;
Branch: 1 branch
BranchTrueFalseTotal
unless $level 0 0 0
1765 0 my $cvref = B::main_cv;
1766 0 ▶ my @aux_list = $op->name eq 'multideref'
Branch: 1 branch
BranchTrueFalseTotal
$op->name eq 'multideref' ? : 0 0 0
1767 ? $op->aux_list_thr # our own version. GH#283, GH#341
1768 : $op->aux_list($cvref);
1769 0 my $auxlen = scalar @aux_list;
1770 0 ▶ $auxlen = $aux_list[0] + 6 if $op->name eq 'multiconcat';
Branch: 1 branch
BranchTrueFalseTotal
if $op->name eq "multiconcat" 0 0 0
1771 0 $unopauxsect->comment("$opsect_common, first, aux");
1772 0 my $ix = $unopauxsect->index + 1;
1773 $unopauxsect->add(
1774 sprintf("%s, s\\_%x, %s+1",
1775 0 $op->_save_common, ${ $op->first }, "unopaux_item${ix}"));
1776 0 ▶ $unopauxsect->debug( $op->name, $op->flagspv ) if $debug{flags};
Branch: 1 branch
BranchTrueFalseTotal
if $B::C::debug{"flags"} 0 0 0
1777 # This cannot be a section, as the number of elements is variable
1778 0 my $i = 1;
1779 0 ▶ my $s = "Static UNOP_AUX_item unopaux_item".$ix."[] = { /* ".$op->name." */\n\t"
Branch: 1 branch
BranchTrueFalseTotal
$C99 ? : 0 0 0
1780 .($C99?"{.uv=$auxlen}":$auxlen). " \t/* length prefix */\n";
1781 0 my $action = 0;
1782 0 my ($nargs);
1783 0 for my $item (@aux_list) {
1784 0 ▶ unless (ref $item) {
Branch: 1 branch
BranchTrueFalseTotal
if (ref $item) { } 0 0 0
1785 # symbolize MDEREF, SIGNATURE, MCONCAT actions and flags, just for the comments
1786 0 my $cmt = 'action';
1787 0 ▶ if ($op->name eq 'multiconcat') {
Branch: 1 branch
BranchTrueFalseTotal
if ($op->name eq "multiconcat") 0 0 0
1788 # TODO: test 27
1789 # nargs, consts, len 0, 1, ...
1790 0 ▶ if ($i == 1) {
Branch: 3 branches
BranchTrueFalseTotal
if ($i == 1) { } 0 0 0
elsif ($i == 2) { } 0 0 0
elsif ($i > 2) { } 0 0 0
1791 0 $nargs = $item;
1792 }
1793 elsif ($i == 2) {
1794 0 my ($pv,$len,$utf8) = strlen_flags($item);
1795 0 ▶ if ($utf8) {
Branch: 1 branch
BranchTrueFalseTotal
if ($utf8) { } 0 0 0
1796 0 ▶ $s .= ($C99 ? sprintf("\t,{.pv=NULL} \t/* plain_pv */\n")
Branch: 1 branch
BranchTrueFalseTotal
$C99 ? : 0 0 0
1797 : sprintf("\t,NULL \t/* plain_pv */\n"));
1798 0 ▶ $s .= ($C99 ? sprintf("\t,{.uv=0} \t/* plain_len */\n")
Branch: 1 branch
BranchTrueFalseTotal
$C99 ? : 0 0 0
1799 : sprintf("\t,0 \t/* plain_len */\n"));
1800 0 ▶ $s .= ($C99 ? sprintf("\t,{.pv=%s} \t/* utf8_pv */\n", $pv)
Branch: 1 branch
BranchTrueFalseTotal
$C99 ? : 0 0 0
1801 : sprintf("\t,%s \t/* utf8_pv */\n", $pv));
1802 0 ▶ $s .= ($C99 ? sprintf("\t,{.uv=%u} \t/* utf8_len */\n", $len)
Branch: 1 branch
BranchTrueFalseTotal
$C99 ? : 0 0 0
1803 : sprintf("\t,%u \t/* utf8_len */\n", $len));
1804 } else {
1805 0 ▶ $s .= ($C99 ? sprintf("\t,{.pv=%s} \t/* plain_pv */\n", $pv)
Branch: 1 branch
BranchTrueFalseTotal
$C99 ? : 0 0 0
1806 : sprintf("\t,%s \t/* plain_pv */\n", $pv));
1807 0 ▶ $s .= ($C99 ? sprintf("\t,{.uv=%u} \t/* plain_len */\n", $len)
Branch: 1 branch
BranchTrueFalseTotal
$C99 ? : 0 0 0
1808 : sprintf("\t,%u \t/* plain_len */\n", $len));
1809 0 ▶ $s .= ($C99 ? sprintf("\t,{.pv=NULL} \t/* utf8_pv */\n")
Branch: 1 branch
BranchTrueFalseTotal
$C99 ? : 0 0 0
1810 : sprintf("\t,NULL \t/* utf8_pv */\n"));
1811 0 ▶ $s .= ($C99 ? sprintf("\t,{.uv=0} \t/* utf8_len */\n")
Branch: 1 branch
BranchTrueFalseTotal
$C99 ? : 0 0 0
1812 : sprintf("\t,0 \t/* utf8_len */\n"));
1813 }
1814 0 $i++;
1815 0 next;
1816 }
1817 elsif ($i > 2) {
1818 0 ▶ die "Overflow multiconcat nargs $nargs" if $i-3 > $nargs;
Branch: 1 branch
BranchTrueFalseTotal
if $i - 3 > $nargs 0 0 0
1819 }
1820 }
1821 0 ▶ if ($verbose) {
Branch: 1 branch
BranchTrueFalseTotal
if ($B::C::verbose) 0 0 0
1822 0 ▶ if ($op->name eq 'multideref') {
Branch: 3 branches
BranchTrueFalseTotal
if ($op->name eq 'multideref') { } 0 0 0
elsif ($op->name eq 'signature') { } 0 0 0
elsif ($op->name eq 'multiconcat') { } 0 0 0
1823 0 my $act = $item & 0xf; # MDEREF_ACTION_MASK
1824 0 ▶ $cmt = 'AV_pop_rv2av_aelem' if $act == 1;
Branch: 1 branch
BranchTrueFalseTotal
if $act == 1 0 0 0
1825 0 ▶ $cmt = 'AV_gvsv_vivify_rv2av_aelem' if $act == 2;
Branch: 1 branch
BranchTrueFalseTotal
if $act == 2 0 0 0
1826 0 ▶ $cmt = 'AV_padsv_vivify_rv2av_aelem' if $act == 3;
Branch: 1 branch
BranchTrueFalseTotal
if $act == 3 0 0 0
1827 0 ▶ $cmt = 'AV_vivify_rv2av_aelem' if $act == 4;
Branch: 1 branch
BranchTrueFalseTotal
if $act == 4 0 0 0
1828 0 ▶ $cmt = 'AV_padav_aelem' if $act == 5;
Branch: 1 branch
BranchTrueFalseTotal
if $act == 5 0 0 0
1829 0 ▶ $cmt = 'AV_gvav_aelem' if $act == 6;
Branch: 1 branch
BranchTrueFalseTotal
if $act == 6 0 0 0
1830 0 ▶ $cmt = 'HV_pop_rv2hv_helem' if $act == 8;
Branch: 1 branch
BranchTrueFalseTotal
if $act == 8 0 0 0
1831 0 ▶ $cmt = 'HV_gvsv_vivify_rv2hv_helem' if $act == 9;
Branch: 1 branch
BranchTrueFalseTotal
if $act == 9 0 0 0
1832 0 ▶ $cmt = 'HV_padsv_vivify_rv2hv_helem' if $act == 10;
Branch: 1 branch
BranchTrueFalseTotal
if $act == 10 0 0 0
1833 0 ▶ $cmt = 'HV_vivify_rv2hv_helem' if $act == 11;
Branch: 1 branch
BranchTrueFalseTotal
if $act == 11 0 0 0
1834 0 ▶ $cmt = 'HV_padhv_helem' if $act == 12;
Branch: 1 branch
BranchTrueFalseTotal
if $act == 12 0 0 0
1835 0 ▶ $cmt = 'HV_gvhv_helem' if $act == 13;
Branch: 1 branch
BranchTrueFalseTotal
if $act == 13 0 0 0
1836 0 my $idx = $item & 0x30; # MDEREF_INDEX_MASK
1837 #$cmt .= '' if $idx == 0x0;
1838 0 ▶ $cmt .= ' INDEX_const' if $idx == 0x10;
Branch: 1 branch
BranchTrueFalseTotal
if $idx == 16 0 0 0
1839 0 ▶ $cmt .= ' INDEX_padsv' if $idx == 0x20;
Branch: 1 branch
BranchTrueFalseTotal
if $idx == 32 0 0 0
1840 0 ▶ $cmt .= ' INDEX_gvsv' if $idx == 0x30;
Branch: 1 branch
BranchTrueFalseTotal
if $idx == 48 0 0 0
1841 }
1842 elsif ($op->name eq 'signature') {
1843 0 my $act = $item & 0xf; # SIGNATURE_ACTION_MASK
1844 0 ▶ $cmt = 'reload' if $act == 0;
Branch: 1 branch
BranchTrueFalseTotal
if $act == 0 0 0 0
1845 0 ▶ $cmt = 'end' if $act == 1;
Branch: 1 branch
BranchTrueFalseTotal
if $act == 1 0 0 0
1846 0 ▶ $cmt = 'padintro' if $act == 2;
Branch: 1 branch
BranchTrueFalseTotal
if $act == 2 0 0 0
1847 0 ▶ $cmt = 'arg' if $act == 3;
Branch: 1 branch
BranchTrueFalseTotal
if $act == 3 0 0 0
1848 0 ▶ $cmt = 'arg_default_none' if $act == 4;
Branch: 1 branch
BranchTrueFalseTotal
if $act == 4 0 0 0
1849 0 ▶ $cmt = 'arg_default_undef' if $act == 5;
Branch: 1 branch
BranchTrueFalseTotal
if $act == 5 0 0 0
1850 0 ▶ $cmt = 'arg_default_0' if $act == 6;
Branch: 1 branch
BranchTrueFalseTotal
if $act == 6 0 0 0
1851 0 ▶ $cmt = 'arg_default_1' if $act == 7;
Branch: 1 branch
BranchTrueFalseTotal
if $act == 7 0 0 0
1852 0 ▶ $cmt = 'arg_default_iv' if $act == 8;
Branch: 1 branch
BranchTrueFalseTotal
if $act == 8 0 0 0
1853 0 ▶ $cmt = 'arg_default_const' if $act == 9;
Branch: 1 branch
BranchTrueFalseTotal
if $act == 9 0 0 0
1854 0 ▶ $cmt = 'arg_default_padsv' if $act == 10;
Branch: 1 branch
BranchTrueFalseTotal
if $act == 10 0 0 0
1855 0 ▶ $cmt = 'arg_default_gvsv' if $act == 11;
Branch: 1 branch
BranchTrueFalseTotal
if $act == 11 0 0 0
1856 0 ▶ $cmt = 'arg_default_op' if $act == 12;
Branch: 1 branch
BranchTrueFalseTotal
if $act == 12 0 0 0
1857 0 ▶ $cmt = 'array' if $act == 13;
Branch: 1 branch
BranchTrueFalseTotal
if $act == 13 0 0 0
1858 0 ▶ $cmt = 'hash' if $act == 14;
Branch: 1 branch
BranchTrueFalseTotal
if $act == 14 0 0 0
1859 0 my $idx = $item & 0x3F; # SIGNATURE_MASK
1860 0 ▶ $cmt .= '' if $idx == 0x0;
Branch: 1 branch
BranchTrueFalseTotal
if $idx == 0 0 0 0
1861 0 ▶ $cmt .= ' flag skip' if $idx == 0x10;
Branch: 1 branch
BranchTrueFalseTotal
if $idx == 16 0 0 0
1862 0 ▶ $cmt .= ' flag ref' if $idx == 0x20;
Branch: 1 branch
BranchTrueFalseTotal
if $idx == 32 0 0 0
1863 }
1864 elsif ($op->name eq 'multiconcat') {
1865 # nargs, consts, len 0, 1, ...
1866 0 ▶ if ($i == 1) {
Branch: 2 branches
BranchTrueFalseTotal
if ($i == 1) { } 0 0 0
elsif ($i > 2) { } 0 0 0
1867 0 $cmt = 'nargs';
1868 }
1869 elsif ($i > 2) {
1870 0 $cmt = sprintf "lengths[%d]", $i-3;
1871 }
1872 } else {
1873 0 die "Unknown UNOP_AUX op ".$op->name;
1874 }
1875 }
1876 0 $action = $item;
1877 0 ▶ warn "{$op->name} action $action $cmt\n" if $debug{hv};
Branch: 1 branch
BranchTrueFalseTotal
if $B::C::debug{"hv"} 0 0 0
1878 0 ▶ $s .= ($C99 ? sprintf("\t,{.uv=0x%x} \t/* %s: %d */\n", $item, $cmt, $item)
Branch: 1 branch
BranchTrueFalseTotal
$C99 ? : 0 0 0
1879 : sprintf("\t,0x%x \t/* %s: %d */\n", $item, $cmt, $item));
1880 } else {
1881 # const and sv already at compile-time, gv deferred to init-time.
1882 # testcase: $a[-1] -1 as B::IV not as -1
1883 # hmm, if const ensure that candidate CONSTs have been HEKified. (pp_multideref assertion)
1884 # || SvTYPE(keysv) >= SVt_PVMG
1885 # || !SvOK(keysv)
1886 # || SvROK(keysv)
1887 # || SvIsCOW_shared_hash(keysv));
1888 0 ▶ my $constkey = ($action & 0x30) == 0x10 ? 1 : 0;
Branch: 1 branch
BranchTrueFalseTotal
($action & 48) == 16 ? : 0 0 0
1889 0 ▶ my $itemsym = $item->save("unopaux_item".$ix."[".$i."]" . ($constkey ? " const" : ""));
Branch: 1 branch
BranchTrueFalseTotal
$constkey ? : 0 0 0
1890 0 ▶ if (is_constant($itemsym)) {
Branch: 1 branch
BranchTrueFalseTotal
if (is_constant($itemsym)) { } 0 0 0
1891 0 ▶ if (ref $item eq 'B::IV') {
Branch: 2 branches
BranchTrueFalseTotal
if (ref $item eq 'B::IV') { } 0 0 0
elsif (ref $item eq 'B::UV') { } 0 0 0
1892 0 my $iv = $item->IVX;
1893 0 ▶ $s .= ($C99 ? "\t,{.iv=$iv}\n"
Branch: 1 branch
BranchTrueFalseTotal
$C99 ? : 0 0 0
1894 : "\t,PTR2IV($iv)\n");
1895 } elsif (ref $item eq 'B::UV') { # also for PAD_OFFSET
1896 0 my $uv = $item->UVX;
1897 0 ▶ $s .= ($C99 ? "\t,{.uv=$uv}\n"
Branch: 1 branch
BranchTrueFalseTotal
$C99 ? : 0 0 0
1898 : "\t,PTR2IV($uv)\n");
1899 } else { # SV
1900 0 ▶ $s .= ($C99 ? "\t,{.sv=$itemsym}\n"
Branch: 1 branch
BranchTrueFalseTotal
$C99 ? : 0 0 0
1901 : "\t,PTR2UV($itemsym)\n");
1902 }
1903 } else {
1904 # gv or other late inits
1905 0 ▶ $s .= ($C99 ? "\t,{.sv=Nullsv} \t/* $itemsym */\n"
Branch: 1 branch
BranchTrueFalseTotal
$C99 ? : 0 0 0
1906 : "\t,0 \t/* $itemsym */\n");
1907 0 $init->add("unopaux_item".$ix."[".$i."].sv = (SV*)$itemsym;");
1908 }
1909 }
1910 0 $i++;
1911 }
1912 0 $decl->add($s."};");
1913 0 ▶ $init->add( sprintf( "unopaux_list[%d].op_ppaddr = %s;", $ix, $op->ppaddr ) )
Branch: 1 branch
BranchTrueFalseTotal
unless $B::C::optimize_ppaddr 0 0 0
1914 unless $B::C::optimize_ppaddr;
1915 0 $sym = savesym( $op, "(OP*)&unopaux_list[$ix]" );
1916 0 push @B::C::static_free, $sym;
1917 # $free->add(" ($sym)->op_type = OP_NULL;");
1918 0 do_labels ($op, $level+1, 'first');
1919 0 $sym;
1920 }
1921  
1922 # cannot save it statically in a sect. need the class (ref) and the ppaddr
1923 #sub B::XOP::save {
1924 # my ( $op, $level ) = @_;
1925 # my $sym = objsym($op);
1926 # return $sym if defined $sym;
1927 # # which class
1928 # $binopsect->comment("$opsect_common, first, last");
1929 # $binopsect->add(
1930 # sprintf( "%s, s\\_%x, s\\_%x",
1931 # $op->_save_common,
1932 # ${ $op->first },
1933 # ${ $op->last } ));
1934 # $binopsect->debug( $op->name, $op->flagspv ) if $debug{flags};
1935 # my $ix = $binopsect->index;
1936 # $init->add( sprintf( "binop_list[%d].op_ppaddr = %s;", $ix, $op->ppaddr ) )
1937 # unless $B::C::optimize_ppaddr;
1938 # $sym = savesym( $op, "(OP*)&binop_list[$ix]" );
1939 # do_labels ($op, $level+1, 'first', 'last');
1940 # $sym;
1941 #}
1942  
1943 0 ▶sub B::BINOP::save {
Subroutine save: not called CC=12 SCAR=50.5
1944 0 my ( $op, $level ) = @_;
1945 0 my $sym = objsym($op);
1946 0 ▶ return $sym if defined $sym;
Branch: 1 branch
BranchTrueFalseTotal
if defined $sym 0 0 0
1947 #return B::XOP::save(@_) if $op->type == $OP_CUSTOM;
1948  
1949 0 ▶ $level = 0 unless $level;
Branch: 1 branch
BranchTrueFalseTotal
unless $level 0 0 0
1950 0 $binopsect->comment("$opsect_common, first, last");
1951 $binopsect->add(
1952 sprintf( "%s, s\\_%x, s\\_%x",
1953 $op->_save_common,
1954 0 ${ $op->first },
1955 0 ${ $op->last } ));
1956 0 ▶ $binopsect->debug( $op->name, $op->flagspv ) if $debug{flags};
Branch: 1 branch
BranchTrueFalseTotal
if $B::C::debug{"flags"} 0 0 0
1957 0 my $ix = $binopsect->index;
1958 0 my $ppaddr = $op->ppaddr;
1959 0 ▶ if ($op->type == $OP_CUSTOM) {
Branch: 1 branch
BranchTrueFalseTotal
if ($op->type == $OP_CUSTOM) { } 0 0 0
1960 0 my $ptr = $$op;
1961 0 ▶ if ($] >= 5.019003 and ($op->name eq 'Devel_Peek_Dump' or $op->name eq 'Dump')){
Branch: 1 branch
BranchTrueFalseTotal
if ($] >= 5.019003 and $op->name eq 'Devel_Peek_Dump' || $op->name eq 'Dump') { } 0 0 0
Condition0%0/6
$] >= "5.019003" and $op->name eq "Devel_Peek_Dump" || $op->name eq "Dump"
!ll&&!rl&&r
000
$op->name eq "Devel_Peek_Dump" or $op->name eq "Dump"
l!l&&r!l&&!r
000
MC/DC0%0/3
$] >= "5.019003" and $op->name eq "Devel_Peek_Dump" || $op->name eq "Dump"
$] >= "5.019003" $op->name eq "Devel_Peek_Dump" $op->name eq "Dump"
Truth table0%0/4
A and B or C
A= $] >= "5.019003"B= $op->name eq "Devel_Peek_Dump"C= $op->name eq "Dump"
ABCresult
0XX0
1000
11X1
1011
1962 0 ▶ warn "custom op Devel_Peek_Dump\n" if $verbose;
Branch: 1 branch
BranchTrueFalseTotal
if $B::C::verbose 0 0 0
1963 0 ▶ $decl->add('
Branch: 1 branch
BranchTrueFalseTotal
unless $B::C::Devel_Peek_Dump_added 0 0 0
1964 static void
1965 S_do_dump(pTHX_ SV *const sv, I32 lim)
1966 {
1967 dVAR;
1968 SV *pv_lim_sv = get_svs("Devel::Peek::pv_limit", 0);
1969 const STRLEN pv_lim = pv_lim_sv ? SvIV(pv_lim_sv) : 0;
1970 SV *dumpop = get_svs("Devel::Peek::dump_ops", 0);
1971 const U16 save_dumpindent = PL_dumpindent;
1972 PL_dumpindent = 2;
1973 do_sv_dump(0, Perl_debug_log, sv, 0, lim,
1974 (bool)(dumpop && SvTRUE(dumpop)), pv_lim);
1975 PL_dumpindent = save_dumpindent;
1976 }
1977 static OP *
1978 S_pp_dump(pTHX)
1979 {
1980 dSP;
1981 const I32 lim = PL_op->op_private == 2 ? (I32)POPi : 4;
1982 dPOPss;
1983 S_do_dump(aTHX_ sv, lim);
1984 RETPUSHUNDEF;
1985 }') unless $B::C::Devel_Peek_Dump_added;
1986 0 $ppaddr = 'S_pp_dump';
1987 0 $B::C::Devel_Peek_Dump_added++;
1988 0 $init->add( sprintf( "binop_list[%d].op_ppaddr = %s;", $ix, $ppaddr ));
1989 } else {
1990 0 ▶ warn "Warning: Unknown custom op ".$op->name."\n" if $verbose;
Branch: 1 branch
BranchTrueFalseTotal
if $B::C::verbose 0 0 0
1991 0 $ppaddr = sprintf('Perl_custom_op_xop(aTHX_ INT2PTR(OP*, 0x%x))', $$op);
1992 0 $init->add( sprintf( "binop_list[%d].op_ppaddr = %s;", $ix, $ppaddr ));
1993 }
1994 } else {
1995 0 ▶ $init->add( sprintf( "binop_list[%d].op_ppaddr = %s;", $ix, $ppaddr ) )
Branch: 1 branch
BranchTrueFalseTotal
unless $B::C::optimize_ppaddr 0 0 0
1996 unless $B::C::optimize_ppaddr;
1997 }
1998 0 $sym = savesym( $op, "(OP*)&binop_list[$ix]" );
1999 0 do_labels ($op, $level+1, 'first', 'last');
2000 0 $sym;
2001 }
2002  
2003 0 ▶sub B::LISTOP::save {
Subroutine save: not called CC=18 SCAR=58.3
2004 0 my ( $op, $level ) = @_;
2005 0 my $sym = objsym($op);
2006 0 ▶ return $sym if defined $sym;
Branch: 1 branch
BranchTrueFalseTotal
if defined $sym 0 0 0
2007 0 ▶ $level = 0 unless $level;
Branch: 1 branch
BranchTrueFalseTotal
unless $level 0 0 0
2008 0 $listopsect->comment("$opsect_common, first, last");
2009 $listopsect->add(
2010 sprintf( "%s, s\\_%x, s\\_%x",
2011 $op->_save_common,
2012 0 ${ $op->first },
2013 0 ${ $op->last } ));
2014 0 ▶ $listopsect->debug( $op->name, $op->flagspv ) if $debug{flags};
Branch: 1 branch
BranchTrueFalseTotal
if $B::C::debug{"flags"} 0 0 0
2015 0 my $ix = $listopsect->index;
2016 0 ▶ $init->add( sprintf( "listop_list[%d].op_ppaddr = %s;", $ix, $op->ppaddr ) )
Branch: 1 branch
BranchTrueFalseTotal
unless $B::C::optimize_ppaddr 0 0 0
2017 unless $B::C::optimize_ppaddr;
2018 0 $sym = savesym( $op, "(OP*)&listop_list[$ix]" );
2019 0 ▶ if ($op->type == $OP_DBMOPEN) {
Branch: 2 branches
BranchTrueFalseTotal
if ($op->type == $OP_DBMOPEN) { } 0 0 0
elsif ($op->type == $OP_FORMLINE and $B::C::const_strings) { } 0 0 0
2020 # resolves it at compile-time, not at run-time
2021 0 mark_package('AnyDBM_File'); # to save $INC{AnyDBM_File}
2022 0 ▶ require AnyDBM_File unless $savINC{'AnyDBM_File.pm'};
Branch: 1 branch
BranchTrueFalseTotal
unless $B::C::savINC{"AnyDBM_File.pm"} 0 0 0
2023 0 $curINC{'AnyDBM_File.pm'} = $INC{'AnyDBM_File.pm'};
2024 0 AnyDBM_File->import; # strip the @ISA
2025 0 my $dbm = $AnyDBM_File::ISA[0]; # take the winner (only)
2026 0 svref_2object( \&{"$dbm\::bootstrap"} )->save;
2027 0 svref_2object( \&{"$dbm\::TIEHASH"} )->save; # called by pp_dbmopen
2028 0 $curINC{$dbm.".pm"} = $INC{$dbm.".pm"};
2029 ▶ } elsif ($op->type == $OP_FORMLINE and $B::C::const_strings) { # -O3 ~
Condition0%0/3
$op->type == $OP_FORMLINE and $B::C::const_strings
!ll&&!rl&&r
000
MC/DC0%0/2
$op->type == $OP_FORMLINE and $B::C::const_strings
$op->type == $OP_FORMLINE $B::C::const_strings
Truth table0%0/3
A and B
A= $op->type == $OP_FORMLINEB= $B::C::const_strings
ABresult
0X0
100
111
2030 # non-static only for all const strings containing ~ #277
2031 0 my $sv;
2032 0 my $fop = $op;
2033 0 my $svop = $op->first;
2034 0 ▶ while ($svop != $op and ref($svop) ne 'B::NULL') {
Branch: 1 branch
BranchTrueFalseTotal
if ($svop != $op and ref $svop ne "B::NULL") 0 0 0
Condition0%0/3
$svop != $op and ref $svop ne "B::NULL"
!ll&&!rl&&r
000
MC/DC0%0/2
$svop != $op and ref $svop ne "B::NULL"
$svop != $op ref $svop ne "B::NULL"
Truth table0%0/3
A and B
A= $svop != $opB= ref $svop ne "B::NULL"
ABresult
0X0
100
111
2035 0 ▶ if ($svop->name eq 'const' and $svop->can('sv')) {
Branch: 1 branch
BranchTrueFalseTotal
if ($svop->name eq "const" and $svop->can("sv")) 0 0 0
Condition0%0/3
$svop->name eq "const" and $svop->can("sv")
!ll&&!rl&&r
000
MC/DC0%0/2
$svop->name eq "const" and $svop->can("sv")
$svop->name eq "const" $svop->can("sv")
Truth table0%0/3
A and B
A= $svop->name eq "const"B= $svop->can("sv")
ABresult
0X0
100
111
2036 0 $sv = $svop->sv;
2037 }
2038 0 ▶ if ($sv and $sv->can("PV") and $sv->PV and $sv->PV =~ /~/m) {
Branch: 1 branch
BranchTrueFalseTotal
if ($sv and $sv->can("PV") and $sv->PV and $sv->PV =~ /~/m) 0 0 0
Condition0%0/9
$sv and $sv->can("PV") and $sv->PV and $sv->PV =~ /~/m
!ll&&!rl&&r
000
$sv and $sv->can("PV") and $sv->PV
!ll&&!rl&&r
000
$sv and $sv->can("PV")
!ll&&!rl&&r
000
MC/DC0%0/4
$sv and $sv->can("PV") and $sv->PV and $sv->PV =~ /~/m
$sv $sv->can("PV") $sv->PV $sv->PV =~ /~/m
Truth table0%0/5
A and B and C and D
A= $svB= $sv->can("PV")C= $sv->PVD= $sv->PV =~ /~/m
ABCDresult
0XXX0
10XX0
110X0
11100
11111
2039 0 local $B::C::const_strings;
2040 0 ▶ warn "force non-static formline arg ",cstring($sv->PV),"\n" if $debug{pv};
Branch: 1 branch
BranchTrueFalseTotal
if $B::C::debug{"pv"} 0 0 0
2041 0 $svop->save($level, "svop const");
2042 }
2043 0 $svop = $svop->next;
2044 }
2045 }
2046 0 do_labels ($op, $level+1, 'first', 'last');
2047 0 $sym;
2048 }
2049  
2050 0 ▶sub B::LOGOP::save {
Subroutine save: not called CC=5 SCAR=34.0
2051 0 my ( $op, $level ) = @_;
2052 0 my $sym = objsym($op);
2053 0 ▶ return $sym if defined $sym;
Branch: 1 branch
BranchTrueFalseTotal
if defined $sym 0 0 0
2054 0 ▶ $level = 0 unless $level;
Branch: 1 branch
BranchTrueFalseTotal
unless $level 0 0 0
2055 0 $logopsect->comment("$opsect_common, first, other");
2056 $logopsect->add(
2057 sprintf( "%s, s\\_%x, s\\_%x",
2058 $op->_save_common,
2059 0 ${ $op->first },
2060 0 ${ $op->other } ));
2061 0 ▶ $logopsect->debug( $op->name, $op->flagspv ) if $debug{flags};
Branch: 1 branch
BranchTrueFalseTotal
if $B::C::debug{"flags"} 0 0 0
2062 0 my $ix = $logopsect->index;
2063 0 ▶ $init->add( sprintf( "logop_list[%d].op_ppaddr = %s;", $ix, $op->ppaddr ) )
Branch: 1 branch
BranchTrueFalseTotal
unless $B::C::optimize_ppaddr 0 0 0
2064 unless $B::C::optimize_ppaddr;
2065 0 $sym = savesym( $op, "(OP*)&logop_list[$ix]" );
2066 0 do_labels ($op, $level+1, 'first', 'other');
2067 0 $sym;
2068 }
2069  
2070 0 ▶sub B::LOOP::save {
Subroutine save: not called CC=5 SCAR=34.0
2071 0 my ( $op, $level ) = @_;
2072 0 my $sym = objsym($op);
2073 0 ▶ return $sym if defined $sym;
Branch: 1 branch
BranchTrueFalseTotal
if defined $sym 0 0 0
2074  
2075 0 ▶ $level = 0 unless $level;
Branch: 1 branch
BranchTrueFalseTotal
unless $level 0 0 0
2076 #warn sprintf("LOOP: redoop %s, nextop %s, lastop %s\n",
2077 # peekop($op->redoop), peekop($op->nextop),
2078 # peekop($op->lastop)) if $debug{op};
2079 0 $loopsect->comment("$opsect_common, first, last, redoop, nextop, lastop");
2080 $loopsect->add(
2081 sprintf(
2082 "%s, s\\_%x, s\\_%x, s\\_%x, s\\_%x, s\\_%x",
2083 $op->_save_common,
2084 0 ${ $op->first },
2085 0 ${ $op->last },
2086 0 ${ $op->redoop },
2087 0 ${ $op->nextop },
2088 0 ${ $op->lastop }
2089 )
2090 );
2091 0 ▶ $loopsect->debug( $op->name, $op->flagspv ) if $debug{flags};
Branch: 1 branch
BranchTrueFalseTotal
if $B::C::debug{"flags"} 0 0 0
2092 0 my $ix = $loopsect->index;
2093 0 ▶ $init->add( sprintf( "loop_list[%d].op_ppaddr = %s;", $ix, $op->ppaddr ) )
Branch: 1 branch
BranchTrueFalseTotal
unless $B::C::optimize_ppaddr 0 0 0
2094 unless $B::C::optimize_ppaddr;
2095 0 $sym = savesym( $op, "(OP*)&loop_list[$ix]" );
2096 0 do_labels($op, $level+1, qw(first last redoop nextop lastop));
2097 0 $sym;
2098 }
2099  
2100 0 ▶sub B::METHOP::save {
Subroutine save: not called CC=15 SCAR=54.8
2101 0 my ( $op, $level ) = @_;
2102 0 my $sym = objsym($op);
2103 0 ▶ return $sym if defined $sym;
Branch: 1 branch
BranchTrueFalseTotal
if defined $sym 0 0 0
2104 0 ▶ $level = 0 unless $level;
Branch: 1 branch
BranchTrueFalseTotal
unless $level 0 0 0
2105 0 $methopsect->comment("$opsect_common, first, rclass");
2106 0 ▶ my $union = $op->name eq 'method' ? "{.op_first=(OP*)%s}" : "{.op_meth_sv=(SV*)%s}";
Branch: 1 branch
BranchTrueFalseTotal
$op->name eq 'method' ? : 0 0 0
2107 0 ▶ $union = "%s" unless $C99;
Branch: 1 branch
BranchTrueFalseTotal
unless $C99 0 0 0
2108 0 ▶ my $s = "%s, $union, ". ($ITHREADS ? "(PADOFFSET)%s" : "(SV*)%s"); # rclass
Branch: 1 branch
BranchTrueFalseTotal
$ITHREADS ? : 0 0 0
2109 0 my $ix = $methopsect->index + 1;
2110 0 ▶ my $rclass = $ITHREADS ? $op->rclass : $op->rclass->save("op_rclass_sv");
Branch: 1 branch
BranchTrueFalseTotal
$ITHREADS ? : 0 0 0
2111 0 ▶ if ($rclass =~ /^&sv_list/) {
Branch: 1 branch
BranchTrueFalseTotal
if ($rclass =~ /^&sv_list/) 0 0 0
2112 0 $init->add( sprintf( "SvREFCNT_inc_simple_NN(%s); /* methop_list[%d].op_rclass_sv */",
2113 $rclass, $ix ));
2114 # Put this simple PV into the PL_stashcache, it has no STASH,
2115 # and initialize the method cache.
2116 # TODO: backref magic for next, init the next::method cache
2117 0 $init->add( sprintf( "Perl_mro_method_changed_in(aTHX_ gv_stashsv(%s, GV_ADD));",
2118 $rclass ));
2119 }
2120 0 ▶ my $first = $op->name eq 'method' ? $op->first->save : $op->meth_sv->save;
Branch: 1 branch
BranchTrueFalseTotal
$op->name eq 'method' ? : 0 0 0
2121 0 ▶ if ($first =~ /^&sv_list/) {
Branch: 1 branch
BranchTrueFalseTotal
if ($first =~ /^&sv_list/) 0 0 0
2122 0 $init->add( sprintf( "SvREFCNT_inc_simple_NN(%s); /* methop_list[%d].op_meth_sv */",
2123 $first, $ix ));
2124 }
2125 0 ▶ $first = 'NULL' if !$C99 and $first eq 'Nullsv';
Branch: 1 branch
BranchTrueFalseTotal
if not $C99 and $first eq "Nullsv" 0 0 0
Condition0%0/3
not $C99 and $first eq "Nullsv"
!ll&&!rl&&r
000
MC/DC0%0/2
not $C99 and $first eq "Nullsv"
not $C99 $first eq "Nullsv"
Truth table0%0/3
not(A) and B
A= not $C99B= $first eq "Nullsv"
ABresult
0X0
100
111
2126 0 $methopsect->add(sprintf($s, $op->_save_common, $first, $rclass));
2127 0 ▶ $methopsect->debug( $op->name, $op->flagspv ) if $debug{flags};
Branch: 1 branch
BranchTrueFalseTotal
if $B::C::debug{"flags"} 0 0 0
2128 0 ▶ $init->add( sprintf( "methop_list[%d].op_ppaddr = %s;", $ix, $op->ppaddr ) )
Branch: 1 branch
BranchTrueFalseTotal
unless $B::C::optimize_ppaddr 0 0 0
2129 unless $B::C::optimize_ppaddr;
2130 0 $sym = savesym( $op, "(OP*)&methop_list[$ix]" );
2131 0 ▶ if ($op->name eq 'method') {
Branch: 1 branch
BranchTrueFalseTotal
if ($op->name eq 'method') { } 0 0 0
2132 0 do_labels($op, $level+1, 'first', 'rclass');
2133 } else {
2134 0 do_labels($op, $level+1, 'meth_sv', 'rclass');
2135 }
2136 0 $sym;
2137 }
2138  
2139 0 ▶sub B::PVOP::save {
Subroutine save: not called CC=5 SCAR=34.0
2140 0 my ( $op, $level ) = @_;
2141 0 my $sym = objsym($op);
2142 0 ▶ return $sym if defined $sym;
Branch: 1 branch
BranchTrueFalseTotal
if defined $sym 0 0 0
2143 0 ▶ $level = 0 unless $level;
Branch: 1 branch
BranchTrueFalseTotal
unless $level 0 0 0
2144 # op_pv must be dynamic
2145 0 $pvopsect->comment("$opsect_common, pv");
2146 0 $pvopsect->add( sprintf( "%s, NULL", $op->_save_common ) );
2147 0 ▶ $pvopsect->debug( $op->name, $op->flagspv ) if $debug{flags};
Branch: 1 branch
BranchTrueFalseTotal
if $B::C::debug{"flags"} 0 0 0
2148 0 my $ix = $pvopsect->index;
2149 0 ▶ $init->add( sprintf( "pvop_list[%d].op_ppaddr = %s;", $ix, $op->ppaddr ) )
Branch: 1 branch
BranchTrueFalseTotal
unless $B::C::optimize_ppaddr 0 0 0
2150 unless $B::C::optimize_ppaddr;
2151 0 my ($cstring,$cur,$utf8) = strlen_flags($op->pv); # utf8 in op_private as OPpPV_IS_UTF8 (0x80)
2152 # do not use savepvn here #362
2153 0 $init->add( sprintf( "pvop_list[%d].op_pv = savesharedpvn(%s, %u);", $ix, $cstring, $cur ));
2154 0 savesym( $op, "(OP*)&pvop_list[$ix]" );
2155 }
2156  
2157 # XXX Until we know exactly the package name for a method_call
2158 # we improve the method search heuristics by maintaining this mru list.
2159 0 ▶sub push_package ($) {
Subroutine push_package: not called CC=6 SCAR=37.4
Pod undocumented
2160 0 ▶ my $p = shift or return;
Branch: 1 branch
BranchTrueFalseTotal
my $p = shift() or return 0 0 0
2161 0 warn "save package_pv \"$package_pv\" for method_name from @{[(caller(1))[3]]}\n"
2162 0 ▶ if $debug{cv} or $debug{pkg} and !grep { $p eq $_ } @package_pv;
Branch: 1 branch
BranchTrueFalseTotal
if $B::C::debug{"cv"} or $B::C::debug{"pkg"} and not grep({$p eq $_;} @package_pv) 0 0 0
Condition0%0/6
$B::C::debug{"cv"} or $B::C::debug{"pkg"} and not grep({$p eq $_;} @package_pv)
l!l&&r!l&&!r
000
$B::C::debug{"pkg"} and not grep({$p eq $_;} @package_pv)
!ll&&!rl&&r
000
MC/DC0%0/3
$B::C::debug{"cv"} or $B::C::debug{"pkg"} and not grep({$p eq $_;} @package_pv)
$B::C::debug{"cv"} $B::C::debug{"pkg"} not grep({$p eq $_;} @package_pv)
Truth table0%0/4
A or B and not(C)
A= $B::C::debug{"cv"}B= $B::C::debug{"pkg"}C= not grep({$p eq $_;} @package_pv)
ABCresult
1XX1
0111
00X0
0100
2163 0 ▶ @package_pv = grep { $p ne $_ } @package_pv if @package_pv; # remove duplicates at the end
Branch: 1 branch
BranchTrueFalseTotal
if @package_pv 0 0 0
2164 0 unshift @package_pv, $p; # prepend at the front
2165 0 mark_package($p);
2166 }
2167  
2168 # method_named is in 5.6.1
2169 0 ▶sub method_named {
Subroutine method_named: not called CC=14 SCAR=51.9
Pod undocumented
2170 0 my $name = shift;
2171 0 ▶ return unless $name;
Branch: 1 branch
BranchTrueFalseTotal
unless $name 0 0 0
2172 0 my $cop = shift;
2173 0 ▶ my $loc = $cop ? " at ".$cop->file." line ".$cop->line : "";
Branch: 1 branch
BranchTrueFalseTotal
$cop ? : 0 0 0
2174 # Note: the pkg PV is unacessible(?) at PL_stack_base+TOPMARK+1.
2175 # But it is also at the const or padsv after the pushmark, before all args.
2176 # See L<perloptree/"Call a method">
2177 # We check it in op->_save_common
2178 0 ▶ if (ref($name) eq 'B::CV') {
Branch: 1 branch
BranchTrueFalseTotal
if (ref $name eq "B::CV") 0 0 0
2179 0 warn $name;
2180 0 return $name;
2181 }
2182 0 my $method;
2183 0 for ($package_pv, @package_pv, 'main') {
2184 41 ▶ no strict 'refs';
Subroutine BEGIN: called CC=1 SCAR=0.0
2185 0 ▶ next unless defined $_;
Branch: 1 branch
BranchTrueFalseTotal
unless defined $_ 0 0 0
2186 0 $method = $_ . '::' . $name;
2187 0 ▶ if (defined(&$method)) {
Branch: 1 branch
BranchTrueFalseTotal
if (defined &$method) { } 0 0 0
2188 0 ▶ warn sprintf( "Found &%s::%s\n", $_, $name ) if $debug{cv};
Branch: 1 branch
BranchTrueFalseTotal
if $B::C::debug{"cv"} 0 0 0
2189 0 $include_package{$_} = 1; # issue59
2190 0 mark_package($_, 1);
2191 0 last;
2192 } else {
2193 0 ▶ if (my $parent = try_isa($_,$name)) {
Branch: 1 branch
BranchTrueFalseTotal
if (my $parent = try_isa($_, $name)) 0 0 0
2194 0 ▶ warn sprintf( "Found &%s::%s\n", $parent, $name ) if $debug{cv};
Branch: 1 branch
BranchTrueFalseTotal
if $B::C::debug{"cv"} 0 0 0
2195 0 $method = $parent . '::' . $name;
2196 0 $include_package{$parent} = 1;
2197 0 last;
2198 }
2199 0 ▶ warn "no definition for method_name \"$method\"\n" if $debug{cv};
Branch: 1 branch
BranchTrueFalseTotal
if $B::C::debug{"cv"} 0 0 0
2200 }
2201 }
2202 #my $b = $Config{archname}."/B\.pm";
2203 #if ($name !~ /^tid|can|isa|pmreplroot$/ and $loc !~ m/$b line / and $package_pv !~ /^B::/) {
2204 # return undef if $ITHREADS;
2205 #}
2206 0 ▶ $method = $name unless $method;
Branch: 1 branch
BranchTrueFalseTotal
unless $method 0 0 0
2207 0 ▶ if (exists &$method) { # Do not try to save non-existing methods
Branch: 1 branch
BranchTrueFalseTotal
if (exists &$method) { } 0 0 0
2208 0 ▶ warn "save method_name \"$method\"$loc\n" if $debug{cv};
Branch: 1 branch
BranchTrueFalseTotal
if $B::C::debug{"cv"} 0 0 0
2209 0 return svref_2object( \&{$method} );
2210 } else {
2211 0 return 0;
2212 }
2213 }
2214  
2215  
2216 # scalar: pv. list: (stash,pv,sv)
2217 # pads are not named, but may be typed
2218 0 ▶sub padop_name {
Subroutine padop_name: not called CC=22 SCAR=62.3
Pod undocumented
2219 0 my $op = shift;
2220 0 my $cv = shift;
2221 0 ▶ if ($op->can('name')
Branch: 1 branch
BranchTrueFalseTotal
if ($op->can("name") and $op->name eq "padsv" || $op->name eq "method_named" || ref $op eq "B::SVOP") 0 0 0
Condition0%0/9
$op->can("name") and $op->name eq "padsv" || $op->name eq "method_named" || ref $op eq "B::SVOP"
!ll&&!rl&&r
000
$op->name eq "padsv" or $op->name eq "method_named" or ref $op eq "B::SVOP"
l!l&&r!l&&!r
000
$op->name eq "padsv" or $op->name eq "method_named"
l!l&&r!l&&!r
000
MC/DC0%0/4
$op->can("name") and $op->name eq "padsv" || $op->name eq "method_named" || ref $op eq "B::SVOP"
$op->can("name") $op->name eq "padsv" $op->name eq "method_named" ref $op eq "B::SVOP"
Truth table0%0/5
A and B or C or D
A= $op->can("name")B= $op->name eq "padsv"C= $op->name eq "method_named"D= ref $op eq "B::SVOP"
ABCDresult
0XXX0
10000
11XX1
101X1
10011
2222 and ($op->name eq 'padsv' or $op->name eq 'method_named'
2223 or ref($op) eq 'B::SVOP')) #threaded
2224 {
2225 0 ▶ return () if $cv and ref($cv->PADLIST) eq 'B::SPECIAL';
Branch: 1 branch
BranchTrueFalseTotal
if $cv and ref $cv->PADLIST eq "B::SPECIAL" 0 0 0
Condition0%0/3
$cv and ref $cv->PADLIST eq "B::SPECIAL"
!ll&&!rl&&r
000
MC/DC0%0/2
$cv and ref $cv->PADLIST eq "B::SPECIAL"
$cv ref $cv->PADLIST eq "B::SPECIAL"
Truth table0%0/3
A and B
A= $cvB= ref $cv->PADLIST eq "B::SPECIAL"
ABresult
0X0
100
111
2226 0 ▶ my @c = ($cv and ref($cv) eq 'B::CV' and ref($cv->PADLIST) ne 'B::NULL')
Branch: 1 branch
BranchTrueFalseTotal
$cv && ref $cv eq 'B::CV' && ref $cv->PADLIST ne 'B::NULL' ? : 0 0 0
Condition0%0/6
$cv and ref $cv eq "B::CV" and ref $cv->PADLIST ne "B::NULL"
!ll&&!rl&&r
000
$cv and ref $cv eq "B::CV"
!ll&&!rl&&r
000
MC/DC0%0/3
$cv and ref $cv eq "B::CV" and ref $cv->PADLIST ne "B::NULL"
$cv ref $cv eq "B::CV" ref $cv->PADLIST ne "B::NULL"
Truth table0%0/4
A and B and C
A= $cvB= ref $cv eq "B::CV"C= ref $cv->PADLIST ne "B::NULL"
ABCresult
0XX0
10X0
1100
1111
2227 ? $cv->PADLIST->ARRAY : comppadlist->ARRAY;
2228 0 my @types = $c[0]->ARRAY;
2229 0 my @pad = $c[1]->ARRAY;
2230 0 ▶ my $ix = $op->can('padix') ? $op->padix : $op->targ;
Branch: 1 branch
BranchTrueFalseTotal
$op->can('padix') ? : 0 0 0
2231 0 my $sv = $pad[$ix];
2232 0 my $t = $types[$ix];
2233 0 ▶ if (defined($t) and ref($t) ne 'B::SPECIAL') {
Branch: 2 branches
BranchTrueFalseTotal
if (defined $t and ref $t ne 'B::SPECIAL') { } 0 0 0
elsif ($sv) { } 0 0 0
Condition0%0/3
defined $t and ref $t ne "B::SPECIAL"
!ll&&!rl&&r
000
MC/DC0%0/2
defined $t and ref $t ne "B::SPECIAL"
defined $t ref $t ne "B::SPECIAL"
Truth table0%0/3
A and B
A= defined $tB= ref $t ne "B::SPECIAL"
ABresult
0X0
100
111
2234 0 ▶ my $pv = $sv->can("PV") ? $sv->PV : ($t->can('PVX') ? $t->PVX : '');
Branch: 2 branches
BranchTrueFalseTotal
$sv->can('PV') ? : 0 0 0
$t->can('PVX') ? : 0 0 0
2235 # need to fix B for SVpad_TYPEDI without formal STASH
2236 0 ▶ my $stash = (ref($t) eq 'B::PVMG' and ref($t->SvSTASH) ne 'B::SPECIAL') ? $t->SvSTASH->NAME : '';
Branch: 1 branch
BranchTrueFalseTotal
ref $t eq 'B::PVMG' && ref $t->SvSTASH ne 'B::SPECIAL' ? : 0 0 0
Condition0%0/3
ref $t eq "B::PVMG" and ref $t->SvSTASH ne "B::SPECIAL"
!ll&&!rl&&r
000
MC/DC0%0/2
ref $t eq "B::PVMG" and ref $t->SvSTASH ne "B::SPECIAL"
ref $t eq "B::PVMG" ref $t->SvSTASH ne "B::SPECIAL"
Truth table0%0/3
A and B
A= ref $t eq "B::PVMG"B= ref $t->SvSTASH ne "B::SPECIAL"
ABresult
0X0
100
111
2237 0 ▶ return wantarray ? ($stash,$pv,$sv) : $pv;
Branch: 1 branch
BranchTrueFalseTotal
wantarray ? : 0 0 0
2238 } elsif ($sv) {
2239 0 ▶ my $pv = $sv->PV if $sv->can("PV");
Branch: 1 branch
BranchTrueFalseTotal
if $sv->can("PV") 0 0 0
2240 0 ▶ my $stash = $sv->STASH->NAME if $sv->can("STASH");
Branch: 1 branch
BranchTrueFalseTotal
if $sv->can("STASH") 0 0 0
2241 0 ▶ return wantarray ? ($stash,$pv,$sv) : $pv;
Branch: 1 branch
BranchTrueFalseTotal
wantarray ? : 0 0 0
2242 }
2243 }
2244 }
2245  
2246 0 ▶sub svop_name {
Subroutine svop_name: not called CC=25 SCAR=64.8
Pod undocumented
2247 0 my $op = shift;
2248 0 my $cv = shift;
2249 0 my $sv;
2250 0 ▶ if ($op->can('name') and $op->name eq 'padsv') {
Branch: 1 branch
BranchTrueFalseTotal
if ($op->can('name') and $op->name eq 'padsv') { } 0 0 0
Condition0%0/3
$op->can("name") and $op->name eq "padsv"
!ll&&!rl&&r
000
MC/DC0%0/2
$op->can("name") and $op->name eq "padsv"
$op->can("name") $op->name eq "padsv"
Truth table0%0/3
A and B
A= $op->can("name")B= $op->name eq "padsv"
ABresult
0X0
100
111
2251 0 my @r = padop_name($op, $cv);
2252 0 ▶ return wantarray ? @r : ($r[1] ? $r[1] : $r[0]);
Branch: 2 branches
BranchTrueFalseTotal
wantarray ? : 0 0 0
$r[1] ? : 0 0 0
2253 } else {
2254 0 ▶ if (!$op->can("sv")) {
Branch: 1 branch
BranchTrueFalseTotal
if (not $op->can('sv')) { } 0 0 0
2255 0 ▶ if (ref($op) eq 'B::PMOP' and $op->pmreplroot->can("sv")) {
Branch: 1 branch
BranchTrueFalseTotal
if (ref $op eq 'B::PMOP' and $op->pmreplroot->can('sv')) { } 0 0 0
Condition0%0/3
ref $op eq "B::PMOP" and $op->pmreplroot->can("sv")
!ll&&!rl&&r
000
MC/DC0%0/2
ref $op eq "B::PMOP" and $op->pmreplroot->can("sv")
ref $op eq "B::PMOP" $op->pmreplroot->can("sv")
Truth table0%0/3
A and B
A= ref $op eq "B::PMOP"B= $op->pmreplroot->can("sv")
ABresult
0X0
100
111
2256 0 $sv = $op->pmreplroot->sv;
2257 } else {
2258 0 ▶ $sv = $op->first->sv unless $op->flags & 4
Branch: 1 branch
BranchTrueFalseTotal
unless $op->flags & 4 or $op->name eq "const" and $op->flags & 34 or $op->first->can("sv") 0 0 0
Condition0%0/9
$op->flags & 4 or $op->name eq "const" and $op->flags & 34 or $op->first->can("sv")
l!l&&r!l&&!r
000
$op->flags & 4 or $op->name eq "const" and $op->flags & 34
l!l&&r!l&&!r
000
$op->name eq "const" and $op->flags & 34
!ll&&!rl&&r
000
MC/DC0%0/4
$op->flags & 4 or $op->name eq "const" and $op->flags & 34 or $op->first->can("sv")
$op->flags & 4 $op->name eq "const" $op->flags & 34 $op->first->can("sv")
Truth table0%0/6
A or B and C or D
A= $op->flags & 4B= $op->name eq "const"C= $op->flags & 34D= $op->first->can("sv")
ABCDresult
1XXX1
011X1
00X11
01011
00X00
01000
2259 or ($op->name eq 'const' and $op->flags & 34) or $op->first->can("sv");
2260 }
2261 } else {
2262 0 $sv = $op->sv;
2263 }
2264 0 ▶ if ($sv and $$sv) {
Branch: 1 branch
BranchTrueFalseTotal
if ($sv and $$sv) 0 0 0
Condition0%0/3
$sv and $$sv
!ll&&!rl&&r
000
MC/DC0%0/2
$sv and $$sv
$sv $$sv
Truth table0%0/3
A and B
A= $svB= $$sv
ABresult
0X0
100
111
2265 0 ▶ if ($sv->FLAGS & SVf_ROK) {
Branch: 1 branch
BranchTrueFalseTotal
if ($sv->FLAGS & 2048) { } 0 0 0
2266 0 ▶ return '' if $sv->isa("B::NULL");
Branch: 1 branch
BranchTrueFalseTotal
if $sv->isa("B::NULL") 0 0 0
2267 0 my $rv = $sv->RV;
2268 0 ▶ if ($rv->isa("B::PVGV")) {
Branch: 1 branch
BranchTrueFalseTotal
if ($rv->isa("B::PVGV")) 0 0 0
2269 0 my $o = $rv->IO;
2270 0 ▶ return $o->STASH->NAME if $$o;
Branch: 1 branch
BranchTrueFalseTotal
if $$o 0 0 0
2271 }
2272 0 ▶ return '' if $rv->isa("B::PVMG");
Branch: 1 branch
BranchTrueFalseTotal
if $rv->isa("B::PVMG") 0 0 0
2273 0 return $rv->STASH->NAME;
2274 } else {
2275 0 ▶ if ($op->name eq 'gvsv') {
Branch: 2 branches
BranchTrueFalseTotal
if ($op->name eq 'gvsv') { } 0 0 0
elsif ($op->name eq 'gv') { } 0 0 0
2276 0 ▶ return wantarray ? ($sv->STASH->NAME, $sv->NAME) : $sv->STASH->NAME.'::'.$sv->NAME;
Branch: 1 branch
BranchTrueFalseTotal
wantarray ? : 0 0 0
2277 } elsif ($op->name eq 'gv') {
2278 0 ▶ return wantarray ? ($sv->STASH->NAME, $sv->NAME) : $sv->STASH->NAME.'::'.$sv->NAME;
Branch: 1 branch
BranchTrueFalseTotal
wantarray ? : 0 0 0
2279 } else {
2280 0 ▶ return $sv->can('STASH') ? $sv->STASH->NAME
Branch: 2 branches
BranchTrueFalseTotal
$sv->can('STASH') ? : 0 0 0
$sv->can('NAME') ? : 0 0 0
2281 : $sv->can('NAME') ? $sv->NAME : $sv->PV;
2282 }
2283 }
2284 }
2285 }
2286 }
2287  
2288 # return the next COP for file and line info
2289 0 ▶sub nextcop {
Subroutine nextcop: not called CC=6 SCAR=37.4
Pod undocumented
2290 0 my $op = shift;
2291 0 ▶ while ($op and ref($op) ne 'B::COP' and ref($op) ne 'B::NULL') { $op = $op->next; }
Branch: 1 branch
BranchTrueFalseTotal
if ($op and ref $op ne "B::COP" and ref $op ne "B::NULL") 0 0 0
Condition0%0/6
$op and ref $op ne "B::COP" and ref $op ne "B::NULL"
!ll&&!rl&&r
000
$op and ref $op ne "B::COP"
!ll&&!rl&&r
000
MC/DC0%0/3
$op and ref $op ne "B::COP" and ref $op ne "B::NULL"
$op ref $op ne "B::COP" ref $op ne "B::NULL"
Truth table0%0/4
A and B and C
A= $opB= ref $op ne "B::COP"C= ref $op ne "B::NULL"
ABCresult
0XX0
10X0
1100
1111
2292 0 ▶ return ($op and ref($op) eq 'B::COP') ? $op : undef;
Branch: 1 branch
BranchTrueFalseTotal
$op && ref $op eq 'B::COP' ? : 0 0 0
Condition0%0/3
$op and ref $op eq "B::COP"
!ll&&!rl&&r
000
MC/DC0%0/2
$op and ref $op eq "B::COP"
$op ref $op eq "B::COP"
Truth table0%0/3
A and B
A= $opB= ref $op eq "B::COP"
ABresult
0X0
100
111
2293 }
2294  
2295 0 ▶sub svimmortal {
Subroutine svimmortal: not called CC=2 SCAR=17.9
Pod undocumented
2296 0 my $sym = shift;
2297 0 ▶ if ($sym =~ /(\(SV\*\))?\&PL_sv_(yes|no|undef|placeholder|zero)/) {
Branch: 1 branch
BranchTrueFalseTotal
if ($sym =~ /(\(SV\*\))?\&PL_sv_(yes|no|undef|placeholder|zero)/) 0 0 0
2298 0 return 1;
2299 }
2300 0 return undef;
2301 }
2302  
2303 0 ▶sub B::SVOP::save {
Subroutine save: not called CC=24 SCAR=64.0
2304 0 my ( $op, $level, $fullname ) = @_;
2305 0 my $sym = objsym($op);
2306 0 ▶ return $sym if defined $sym;
Branch: 1 branch
BranchTrueFalseTotal
if defined $sym 0 0 0
2307 0 ▶ $level = 0 unless $level;
Branch: 1 branch
BranchTrueFalseTotal
unless $level 0 0 0
2308 0 my $svsym = 'Nullsv';
2309 # XXX moose1 crash with 5.8.5-nt, Cwd::_perl_abs_path also
2310 0 ▶ if ($op->name eq 'aelemfast' and $op->flags & 128) { #OPf_SPECIAL
Branch: 2 branches
BranchTrueFalseTotal
if ($op->name eq 'aelemfast' and $op->flags & 128) { } 0 0 0
elsif ($op->name eq 'gv' and $op->next and $op->next->name eq 'rv2cv' and $op->next->next and $op->next->next->name eq 'defined') { } 0 0 0
Condition0%0/3
$op->name eq "aelemfast" and $op->flags & 128
!ll&&!rl&&r
000
MC/DC0%0/2
$op->name eq "aelemfast" and $op->flags & 128
$op->name eq "aelemfast" $op->flags & 128
Truth table0%0/3
A and B
A= $op->name eq "aelemfast"B= $op->flags & 128
ABresult
0X0
100
111
2311 0 $svsym = '&PL_sv_undef'; # pad does not need to be saved
2312 0 ▶ warn sprintf("SVOP->sv aelemfast pad %d\n", $op->flags) if $debug{sv};
Branch: 1 branch
BranchTrueFalseTotal
if $B::C::debug{"sv"} 0 0 0
2313 ▶ } elsif ($op->name eq 'gv' and $op->next and $op->next->name eq 'rv2cv'
Condition0%0/12
$op->name eq "gv" and $op->next and $op->next->name eq "rv2cv" and $op->next->next and $op->next->next->name eq "defined"
!ll&&!rl&&r
000
$op->name eq "gv" and $op->next and $op->next->name eq "rv2cv" and $op->next->next
!ll&&!rl&&r
000
$op->name eq "gv" and $op->next and $op->next->name eq "rv2cv"
!ll&&!rl&&r
000
$op->name eq "gv" and $op->next
!ll&&!rl&&r
000
MC/DC0%0/5
$op->name eq "gv" and $op->next and $op->next->name eq "rv2cv" and $op->next->next and $op->next->next->name eq "defined"
$op->name eq "gv" $op->next $op->next->name eq "rv2cv" $op->next->next $op->next->next->name eq "defined"
Truth table0%0/6
A and B and C and D and E
A= $op->name eq "gv"B= $op->nextC= $op->next->name eq "rv2cv"D= $op->next->nextE= $op->next->next->name eq "defined"
ABCDEresult
0XXXX0
10XXX0
110XX0
1110X0
111100
111111
2314 and $op->next->next and $op->next->next->name eq 'defined' ) {
2315 # 96 do not save a gvsv->cv if just checked for defined'ness
2316 0 my $gv = $op->sv;
2317 0 my $gvsv = svop_name($op);
2318 0 ▶ if ($gvsv !~ /^DynaLoader::/) {
Branch: 1 branch
BranchTrueFalseTotal
if (not $gvsv =~ /^DynaLoader::/) { } 0 0 0
2319 0 ▶ warn "skip saving defined(&$gvsv)\n" if $debug{gv}; # defer to run-time
Branch: 1 branch
BranchTrueFalseTotal
if $B::C::debug{"gv"} 0 0 0
2320 0 $svsym = '(SV*)' . $gv->save( 8 ); # ~Save_CV in B::GV::save
2321 } else {
2322 0 $svsym = '(SV*)' . $gv->save();
2323 }
2324 } else {
2325 0 my $sv = $op->sv;
2326 0 $svsym = $sv->save("svop ".$op->name);
2327 0 ▶ if ($svsym =~ /^(gv_|PL_.*gv)/) {
Branch: 2 branches
BranchTrueFalseTotal
if ($svsym =~ /^(gv_|PL_.*gv)/) { } 0 0 0
elsif ($svsym =~ /^\([SAHC]V\*\)\&sv_list/) { } 0 0 0
2328 0 $svsym = '(SV*)' . $svsym;
2329 } elsif ($svsym =~ /^\([SAHC]V\*\)\&sv_list/) {
2330 0 $svsym =~ s/^\([SAHC]V\*\)//;
2331 } else {
2332 0 $svsym =~ s/^\([GAPH]V\*\)/(SV*)/;
2333 }
2334 0 ▶ warn "Error: SVOP: ".$op->name." $sv $svsym" if $svsym =~ /^\(SV\*\)lexwarn/; #322
Branch: 1 branch
BranchTrueFalseTotal
if $svsym =~ /^\(SV\*\)lexwarn/ 0 0 0
2335 }
2336 0 ▶ if ($op->name eq 'method_named') {
Branch: 1 branch
BranchTrueFalseTotal
if ($op->name eq "method_named") 0 0 0
2337 0 my $cv = method_named(svop_or_padop_pv($op), nextcop($op));
2338 0 ▶ $cv->save if $cv;
Branch: 1 branch
BranchTrueFalseTotal
if $cv 0 0 0
2339 }
2340 0 my $is_const_addr = $svsym =~ m/Null|\&/;
2341 0 ▶ if ($MULTI and svimmortal($svsym)) { # dVAR access. e.g. t/testm.sh Test::Pod
Branch: 1 branch
BranchTrueFalseTotal
if ($MULTI and svimmortal($svsym)) 0 0 0
Condition0%0/3
$MULTI and svimmortal($svsym)
!ll&&!rl&&r
000
MC/DC0%0/2
$MULTI and svimmortal($svsym)
$MULTI svimmortal($svsym)
Truth table0%0/3
A and B
A= $MULTIB= svimmortal($svsym)
ABresult
0X0
100
111
2342 0 $is_const_addr = 0;
2343 }
2344 0 $svopsect->comment("$opsect_common, sv");
2345 0 ▶ $svopsect->add(sprintf( "%s, %s",
Branch: 1 branch
BranchTrueFalseTotal
$is_const_addr ? : 0 0 0
2346 $op->_save_common, ( $is_const_addr ? $svsym : "Nullsv /* $svsym */" ) )
2347 );
2348 0 ▶ $svopsect->debug( $op->name, $op->flagspv ) if $debug{flags};
Branch: 1 branch
BranchTrueFalseTotal
if $B::C::debug{"flags"} 0 0 0
2349 0 my $ix = $svopsect->index;
2350 0 ▶ $init->add( sprintf( "svop_list[%d].op_ppaddr = %s;", $ix, $op->ppaddr ) )
Branch: 1 branch
BranchTrueFalseTotal
unless $B::C::optimize_ppaddr 0 0 0
2351 unless $B::C::optimize_ppaddr;
2352 0 ▶ $init->add("svop_list[$ix].op_sv = $svsym;")
Branch: 1 branch
BranchTrueFalseTotal
unless $is_const_addr 0 0 0
2353 unless $is_const_addr;
2354 0 savesym( $op, "(OP*)&svop_list[$ix]" );
2355 }
2356  
2357 0 ▶sub B::PADOP::save {
Subroutine save: not called CC=22 SCAR=62.3
2358 0 my ( $op, $level ) = @_;
2359 0 my $sym = objsym($op);
2360 0 ▶ return $sym if defined $sym;
Branch: 1 branch
BranchTrueFalseTotal
if defined $sym 0 0 0
2361 0 ▶ $level = 0 unless $level;
Branch: 1 branch
BranchTrueFalseTotal
unless $level 0 0 0
2362 0 my $skip_defined;
2363 0 ▶ if ($op->name eq 'method_named') {
Branch: 2 branches
BranchTrueFalseTotal
if ($op->name eq 'method_named') { } 0 0 0
elsif ($op->name eq 'gv' and $op->next and $op->next->name eq 'rv2cv' and $op->next->next and $op->next->next->name eq 'defined') { } 0 0 0
2364 0 my $cv = method_named(svop_or_padop_pv($op), nextcop($op));
2365 0 ▶ $cv->save if $cv;
Branch: 1 branch
BranchTrueFalseTotal
if $cv 0 0 0
2366 ▶ } elsif ($op->name eq 'gv' and $op->next and $op->next->name eq 'rv2cv'
Condition0%0/12
$op->name eq "gv" and $op->next and $op->next->name eq "rv2cv" and $op->next->next and $op->next->next->name eq "defined"
!ll&&!rl&&r
000
$op->name eq "gv" and $op->next and $op->next->name eq "rv2cv" and $op->next->next
!ll&&!rl&&r
000
$op->name eq "gv" and $op->next and $op->next->name eq "rv2cv"
!ll&&!rl&&r
000
$op->name eq "gv" and $op->next
!ll&&!rl&&r
000
MC/DC0%0/5
$op->name eq "gv" and $op->next and $op->next->name eq "rv2cv" and $op->next->next and $op->next->next->name eq "defined"
$op->name eq "gv" $op->next $op->next->name eq "rv2cv" $op->next->next $op->next->next->name eq "defined"
Truth table0%0/6
A and B and C and D and E
A= $op->name eq "gv"B= $op->nextC= $op->next->name eq "rv2cv"D= $op->next->nextE= $op->next->next->name eq "defined"
ABCDEresult
0XXXX0
10XXX0
110XX0
1110X0
111100
111111
2367 and $op->next->next and $op->next->next->name eq 'defined' ) {
2368 # 96 do not save a gvsv->cv if just checked for defined'ness
2369 0 $skip_defined++;
2370 }
2371 # This is saved by curpad syms at the end. But with __DATA__ handles it is better to save earlier
2372 0 ▶ if ($op->name eq 'padsv' or $op->name eq 'gvsv' or $op->name eq 'gv') {
Branch: 1 branch
BranchTrueFalseTotal
if ($op->name eq "padsv" or $op->name eq "gvsv" or $op->name eq "gv") 0 0 0
Condition0%0/6
$op->name eq "padsv" or $op->name eq "gvsv" or $op->name eq "gv"
l!l&&r!l&&!r
000
$op->name eq "padsv" or $op->name eq "gvsv"
l!l&&r!l&&!r
000
MC/DC0%0/3
$op->name eq "padsv" or $op->name eq "gvsv" or $op->name eq "gv"
$op->name eq "padsv" $op->name eq "gvsv" $op->name eq "gv"
Truth table0%0/4
A or B or C
A= $op->name eq "padsv"B= $op->name eq "gvsv"C= $op->name eq "gv"
ABCresult
1XX1
01X1
0011
0000
2373 0 my @c = comppadlist->ARRAY;
2374 0 my @pad = $c[1]->ARRAY;
2375 0 ▶ my $ix = $op->can('padix') ? $op->padix : $op->targ;
Branch: 1 branch
BranchTrueFalseTotal
$op->can('padix') ? : 0 0 0
2376 0 my $sv = $pad[$ix];
2377 0 ▶ if ($sv and $$sv) {
Branch: 1 branch
BranchTrueFalseTotal
if ($sv and $$sv) 0 0 0
Condition0%0/3
$sv and $$sv
!ll&&!rl&&r
000
MC/DC0%0/2
$sv and $$sv
$sv $$sv
Truth table0%0/3
A and B
A= $svB= $$sv
ABresult
0X0
100
111
2378 0 my $name = padop_name($op, curcv);
2379 0 ▶ if ($skip_defined and $name !~ /^DynaLoader::/) {
Branch: 1 branch
BranchTrueFalseTotal
if ($skip_defined and not $name =~ /^DynaLoader::/) { } 0 0 0
Condition0%0/3
$skip_defined and not $name =~ /^DynaLoader::/
!ll&&!rl&&r
000
MC/DC0%0/2
$skip_defined and not $name =~ /^DynaLoader::/
$skip_defined not $name =~ /^DynaLoader::/
Truth table0%0/3
A and not(B)
A= $skip_definedB= not $name =~ /^DynaLoader::/
ABresult
0X0
100
111
2380 0 ▶ warn "skip saving defined(&$name)\n" if $debug{gv}; # defer to run-time
Branch: 1 branch
BranchTrueFalseTotal
if $B::C::debug{"gv"} 0 0 0
2381 } else {
2382 0 ▶ $sv->save("padop ". ($name ? $name : ''));
Branch: 1 branch
BranchTrueFalseTotal
$name ? : 0 0 0
2383 }
2384 }
2385 }
2386 0 $padopsect->comment("$opsect_common, padix");
2387 0 $padopsect->add( sprintf( "%s, %d", $op->_save_common, $op->padix ) );
2388 0 ▶ $padopsect->debug( $op->name, $op->flagspv ) if $debug{flags};
Branch: 1 branch
BranchTrueFalseTotal
if $B::C::debug{"flags"} 0 0 0
2389 0 my $ix = $padopsect->index;
2390 0 ▶ $init->add( sprintf( "padop_list[%d].op_ppaddr = %s;", $ix, $op->ppaddr ) )
Branch: 1 branch
BranchTrueFalseTotal
unless $B::C::optimize_ppaddr 0 0 0
2391 unless $B::C::optimize_ppaddr;
2392 0 savesym( $op, "(OP*)&padop_list[$ix]" );
2393 }
2394  
2395 0 ▶sub B::COP::save {
Subroutine save: not called CC=78 SCAR=87.3
2396 0 my ( $op, $level ) = @_;
2397 0 my $sym = objsym($op);
2398 0 ▶ return $sym if defined $sym;
Branch: 1 branch
BranchTrueFalseTotal
if defined $sym 0 0 0
2399  
2400 0 ▶ $level = 0 unless $level;
Branch: 1 branch
BranchTrueFalseTotal
unless $level 0 0 0
2401 # we need to keep CvSTART cops, so check $level == 0
2402 # what a COP needs to do is to reset the stack, and restore locals
2403 0 ▶ if ($optimize_cop and $level and !$op->label
Branch: 1 branch
BranchTrueFalseTotal
if ($B::C::optimize_cop and $level and not $op->label and ref $prev_op ne "B::LISTOP") 0 0 0
Condition0%0/9
$B::C::optimize_cop and $level and not $op->label and ref $prev_op ne "B::LISTOP"
!ll&&!rl&&r
000
$B::C::optimize_cop and $level and not $op->label
!ll&&!rl&&r
000
$B::C::optimize_cop and $level
!ll&&!rl&&r
000
MC/DC0%0/4
$B::C::optimize_cop and $level and not $op->label and ref $prev_op ne "B::LISTOP"
$B::C::optimize_cop $level not $op->label ref $prev_op ne "B::LISTOP"
Truth table0%0/5
A and B and not(C) and D
A= $B::C::optimize_copB= $levelC= not $op->labelD= ref $prev_op ne "B::LISTOP"
ABCDresult
0XXX0
10XX0
110X0
11100
11111
2404 and ref($prev_op) ne 'B::LISTOP') { # XXX very unsafe!
2405 0 my $sym = savesym( $op, $op->next->save );
2406 warn sprintf( "Skip COP (0x%x) => %s (0x%x), line %d file %s\n",
2407 0 ▶ $$op, $sym, $op->next, $op->line, $op->file ) if $debug{cops};
Branch: 1 branch
BranchTrueFalseTotal
if $B::C::debug{"cops"} 0 0 0
2408 0 return $sym;
2409 }
2410  
2411 # TODO: if it is a nullified COP we must save it with all cop fields!
2412 warn sprintf( "COP: line %d file %s\n", $op->line, $op->file )
2413 0 ▶ if $debug{cops};
Branch: 1 branch
BranchTrueFalseTotal
if $B::C::debug{"cops"} 0 0 0
2414  
2415 # shameless cut'n'paste from B::Deparse
2416 0 my ($warn_sv, $isint);
2417 0 my $warnings = $op->warnings;
2418 0 my $is_special = ref($warnings) eq 'B::SPECIAL';
2419 0 ▶ my $warnsvcast = $PERL510 ? "(STRLEN*)" : "(SV*)";
Branch: 1 branch
BranchTrueFalseTotal
$PERL510 ? : 0 0 0
2420 0 ▶ if ( $is_special && $$warnings == 4 ) { # use warnings 'all';
Branch: 3 branches
BranchTrueFalseTotal
if ($is_special and $$warnings == 4) { } 0 0 0
elsif ($is_special and $$warnings == 5) { } 0 0 0
elsif ($is_special) { } 0 0 0
Condition0%0/3
$is_special and $$warnings == 4
!ll&&!rl&&r
000
MC/DC0%0/2
$is_special and $$warnings == 4
$is_special $$warnings == 4
Truth table0%0/3
A and B
A= $is_specialB= $$warnings == 4
ABresult
0X0
100
111
2421 0 $warn_sv = 'pWARN_ALL';
2422 }
2423 ▶ elsif ( $is_special && $$warnings == 5 ) { # no warnings 'all';
Condition0%0/3
$is_special and $$warnings == 5
!ll&&!rl&&r
000
MC/DC0%0/2
$is_special and $$warnings == 5
$is_special $$warnings == 5
Truth table0%0/3
A and B
A= $is_specialB= $$warnings == 5
ABresult
0X0
100
111
2424 0 $warn_sv = 'pWARN_NONE';
2425 }
2426 elsif ($is_special) { # use warnings;
2427 0 $warn_sv = 'pWARN_STD';
2428 }
2429 else {
2430 # LEXWARN_on: Original $warnings->save from 5.8.9 was wrong,
2431 # DUP_WARNINGS copied length PVX bytes.
2432 0 my $warn = bless $warnings, "B::LEXWARN";
2433 # TODO: isint here misses already seen lexwarn symbols
2434 0 ($warn_sv, $isint) = $warn->save;
2435 0 my $ix = $copsect->index + 1;
2436 # XXX No idea how a &sv_list[] came up here, a re-used object. Anyway.
2437 0 ▶ $warn_sv = substr($warn_sv,1) if substr($warn_sv,0,3) eq '&sv';
Branch: 1 branch
BranchTrueFalseTotal
if substr($warn_sv, 0, 3) eq "&sv" 0 0 0
2438 0 $warn_sv = $warnsvcast.'&'.$warn_sv;
2439 0 ▶ $free->add( sprintf( " cop_list[%d].cop_warnings = NULL;", $ix ) )
Branch: 1 branch
BranchTrueFalseTotal
unless $B::C::optimize_warn_sv and $PERL510 0 0 0
Condition0%0/3
$B::C::optimize_warn_sv and $PERL510
!ll&&!rl&&r
000
MC/DC0%0/2
$B::C::optimize_warn_sv and $PERL510
$B::C::optimize_warn_sv $PERL510
Truth table0%0/3
A and B
A= $B::C::optimize_warn_svB= $PERL510
ABresult
0X0
100
111
2440 if !$B::C::optimize_warn_sv or !$PERL510;
2441 #push @B::C::static_free, sprintf("cop_list[%d]", $ix);
2442 }
2443  
2444 0 ▶ my $dynamic_copwarn = ($PERL510 and !$is_special) ? 1 : !$B::C::optimize_warn_sv;
Branch: 1 branch
BranchTrueFalseTotal
$PERL510 && !$is_special ? : 0 0 0
Condition0%0/3
$PERL510 and not $is_special
!ll&&!rl&&r
000
MC/DC0%0/2
$PERL510 and not $is_special
$PERL510 not $is_special
Truth table0%0/3
A and not(B)
A= $PERL510B= not $is_special
ABresult
0X0
100
111
2445 # branch feature/gh70-static-lexwarn with PERL_SUPPORT_STATIC_COP
2446 0 ▶ $dynamic_copwarn = 0 if $Config{usecperl} and $] >= 5.022002;
Branch: 1 branch
BranchTrueFalseTotal
if $B::C::Config{"usecperl"} and $] >= "5.022002" 0 0 0
Condition0%0/3
$B::C::Config{"usecperl"} and $] >= "5.022002"
!ll&&!rl&&r
000
MC/DC0%0/2
$B::C::Config{"usecperl"} and $] >= "5.022002"
$B::C::Config{"usecperl"} $] >= "5.022002"
Truth table0%0/3
A and B
A= $B::C::Config{"usecperl"}B= $] >= "5.022002"
ABresult
0X0
100
111
2447  
2448 # Trim the .pl extension, to print the executable name only.
2449 0 my $file = $op->file;
2450 # $file =~ s/\.pl$/.c/;
2451 0 my $add_label = 0;
2452 0 ▶ if ($PERL512) {
Branch: 2 branches
BranchTrueFalseTotal
if ($PERL512) { } 0 0 0
elsif ($PERL510) { } 0 0 0
2453 0 ▶ if ($ITHREADS and $] >= 5.017) {
Branch: 3 branches
BranchTrueFalseTotal
if ($ITHREADS and $] >= 5.017) { } 0 0 0
elsif ($ITHREADS and $] >= 5.016) { } 0 0 0
elsif ($ITHREADS and $] >= 5.015004 and $] < 5.016) { } 0 0 0
Condition0%0/3
$ITHREADS and $] >= "5.017"
!ll&&!rl&&r
000
MC/DC0%0/2
$ITHREADS and $] >= "5.017"
$ITHREADS $] >= "5.017"
Truth table0%0/3
A and B
A= $ITHREADSB= $] >= "5.017"
ABresult
0X0
100
111
2454 0 $copsect->comment(
2455 "$opsect_common, line, stashoff, file, hints, seq, warnings, hints_hash");
2456 0 ▶ $copsect->add(
Branch: 1 branch
BranchTrueFalseTotal
!$dynamic_copwarn ? : 0 0 0
2457 sprintf( "%s, %u, " . "%d, %s, %u, " . "%s, %s, NULL",
2458 $op->_save_common, $op->line,
2459 $op->stashoff, "NULL", #hints=0
2460 $op->hints,
2461 ivx($op->cop_seq), !$dynamic_copwarn ? $warn_sv : 'NULL'
2462 ));
2463 ▶ } elsif ($ITHREADS and $] >= 5.016) {
Condition0%0/3
$ITHREADS and $] >= "5.016"
!ll&&!rl&&r
000
MC/DC0%0/2
$ITHREADS and $] >= "5.016"
$ITHREADS $] >= "5.016"
Truth table0%0/3
A and B
A= $ITHREADSB= $] >= "5.016"
ABresult
0X0
100
111
2464 # [perl #113034] [PATCH] 2d8d7b1 replace B::COP::stashflags by B::COP::stashlen (5.16.0 only)
2465 0 $copsect->comment(
2466 "$opsect_common, line, stashpv, file, stashlen, hints, seq, warnings, hints_hash");
2467 0 ▶ $copsect->add(
Branch: 2 branches
BranchTrueFalseTotal
$op->can('stashlen') ? : 0 0 0
!$dynamic_copwarn ? : 0 0 0
2468 sprintf( "%s, %u, " . "%s, %s, %d, %u, " . "%s, %s, NULL",
2469 $op->_save_common, $op->line,
2470 "NULL", "NULL",
2471 # XXX at broken 5.16.0 with B-1.34 we do non-utf8, non-null only (=> negative len),
2472 # 5.16.0 B-1.35 has stashlen, 5.16.1 we will see.
2473 $op->can('stashlen') ? $op->stashlen : length($op->stashpv),
2474 $op->hints,
2475 ivx($op->cop_seq), !$dynamic_copwarn ? $warn_sv : 'NULL'
2476 ));
2477 ▶ } elsif ($ITHREADS and $] >= 5.015004 and $] < 5.016) {
Condition0%0/6
$ITHREADS and $] >= "5.015004" and $] < "5.016"
!ll&&!rl&&r
000
$ITHREADS and $] >= "5.015004"
!ll&&!rl&&r
000
MC/DC0%0/3
$ITHREADS and $] >= "5.015004" and $] < "5.016"
$ITHREADS $] >= "5.015004" $] < "5.016"
Truth table0%0/4
A and B and C
A= $ITHREADSB= $] >= "5.015004"C= $] < "5.016"
ABCresult
0XX0
10X0
1100
1111
2478 0 $copsect->comment(
2479 "$opsect_common, line, stashpv, file, stashflags, hints, seq, warnings, hints_hash");
2480 0 ▶ $copsect->add(
Branch: 1 branch
BranchTrueFalseTotal
!$dynamic_copwarn ? : 0 0 0
2481 sprintf( "%s, %u, " . "%s, %s, %d, %u, " . "%s, %s, NULL",
2482 $op->_save_common, $op->line,
2483 "NULL", "NULL",
2484 $op->stashflags, $op->hints,
2485 ivx($op->cop_seq), !$dynamic_copwarn ? $warn_sv : 'NULL'
2486 ));
2487 } else {
2488 # cop_label now in hints_hash (Change #33656)
2489 0 $copsect->comment(
2490 "$opsect_common, line, stash, file, hints, seq, warn_sv, hints_hash");
2491 0 ▶ $copsect->add(
Branch: 3 branches
BranchTrueFalseTotal
$ITHREADS ? : 0 0 0
$ITHREADS ? : 0 0 0
!$dynamic_copwarn ? : 0 0 0
2492 sprintf( "%s, %u, " . "%s, %s, %u, " . "%s, %s, NULL",
2493 $op->_save_common, $op->line,
2494 $ITHREADS ? "NULL" : "Nullhv",# we cannot store this static (attribute exit)
2495 $ITHREADS ? "NULL" : "Nullgv",
2496 $op->hints, ivx($op->cop_seq), !$dynamic_copwarn ? $warn_sv : 'NULL'
2497 ));
2498 }
2499 0 ▶ if ( $op->label ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($op->label) 0 0 0
2500 0 $add_label = 1;
2501 }
2502 }
2503 elsif ($PERL510) {
2504 0 $copsect->comment("$opsect_common, line, label, stash, file, hints, seq, warnings, hints_hash");
2505 0 ▶ $copsect->add(sprintf("%s, %u, %s, " . "%s, %s, %u, " . "%u, %s, NULL",
Branch: 1 branch
BranchTrueFalseTotal
!$dynamic_copwarn ? : 0 0 0
2506 $op->_save_common, $op->line, 'NULL',
2507 "NULL", "NULL",
2508 $op->hints, $op->cop_seq, !$dynamic_copwarn ? $warn_sv : 'NULL'
2509 ));
2510 0 ▶ if ($op->label) {
Branch: 1 branch
BranchTrueFalseTotal
if ($op->label) 0 0 0
2511 0 $init->add(sprintf( "CopLABEL_set(&cop_list[%d], CopLABEL_alloc(%s));",
2512 $copsect->index, cstring( $op->label ) ));
2513 }
2514 }
2515 else {
2516 # 5.8 misses cop_io
2517 0 $copsect->comment("$opsect_common, label, stash, file, seq, arybase, line, warn_sv, io");
2518 0 ▶ $copsect->add(
Branch: 2 branches
BranchTrueFalseTotal
!$dynamic_copwarn ? : 0 0 0
$PERL56 ? : 0 0 0
2519 sprintf( "%s, %s, %s, %s, %s, %d, %u, %s %s",
2520 $op->_save_common, cstring( $op->label ),
2521 "NULL", "NULL",
2522 ivx($op->cop_seq), $op->arybase,
2523 $op->line, !$dynamic_copwarn ? $warn_sv : 'NULL',
2524 ( $PERL56 ? "" : ", 0" )
2525 ));
2526 }
2527 0 ▶ $copsect->debug( $op->name, $op->flagspv ) if $debug{flags};
Branch: 1 branch
BranchTrueFalseTotal
if $B::C::debug{"flags"} 0 0 0
2528 0 my $ix = $copsect->index;
2529 0 ▶ $init->add( sprintf( "cop_list[%d].op_ppaddr = %s;", $ix, $op->ppaddr ) )
Branch: 1 branch
BranchTrueFalseTotal
unless $B::C::optimize_ppaddr 0 0 0
2530 unless $B::C::optimize_ppaddr;
2531  
2532 0 my $i = 0;
2533 0 ▶ if ($PERL510 and $op->hints_hash) {
Branch: 1 branch
BranchTrueFalseTotal
if ($PERL510 and $op->hints_hash) 0 0 0
Condition0%0/3
$PERL510 and $op->hints_hash
!ll&&!rl&&r
000
MC/DC0%0/2
$PERL510 and $op->hints_hash
$PERL510 $op->hints_hash
Truth table0%0/3
A and B
A= $PERL510B= $op->hints_hash
ABresult
0X0
100
111
2534 0 my $hints = $op->hints_hash;
2535 0 ▶ if ($$hints) {
Branch: 1 branch
BranchTrueFalseTotal
if ($$hints) 0 0 0
2536 0 ▶ if (exists $cophhtable{$$hints}) {
Branch: 1 branch
BranchTrueFalseTotal
if (exists $cophhtable{$$hints}) { } 0 0 0
2537 0 my $cophh = $cophhtable{$$hints};
2538 0 $init->add(sprintf("CopHINTHASH_set(&cop_list[%d], %s);", $ix, $cophh));
2539 } else {
2540 0 ▶ my $hint_hv = $hints->HASH if ref $hints eq 'B::RHE';
Branch: 1 branch
BranchTrueFalseTotal
if ref $hints eq "B::RHE" 0 0 0
2541 0 my $cophh = sprintf( "cophh%d", scalar keys %cophhtable );
2542 0 $cophhtable{$$hints} = $cophh;
2543 0 $decl->add(sprintf("Static COPHH *%s;", $cophh));
2544 0 for my $k (keys %$hint_hv) {
2545 0 my ($ck, $kl, $utf8) = strlen_flags($k);
2546 0 my $v = $hint_hv->{$k};
2547 0 ▶ next if $k eq ':'; #skip label, see below
Branch: 1 branch
BranchTrueFalseTotal
if $k eq ":" 0 0 0
2548 0 my $val = B::svref_2object( \$v )->save("\$^H{$k}");
2549 0 ▶ if ($utf8) {
Branch: 1 branch
BranchTrueFalseTotal
if ($utf8) { } 0 0 0
2550 0 ▶ $init->add(sprintf("%s = cophh_store_pvn(%s, %s, %d, 0, %s, COPHH_KEY_UTF8);",
Branch: 1 branch
BranchTrueFalseTotal
$i ? : 0 0 0
2551 $cophh, $i ? $cophh : 'NULL', $ck, $kl, $val));
2552 } else {
2553 0 ▶ $init->add(sprintf("%s = cophh_store_pvs(%s, %s, %s, 0);",
Branch: 1 branch
BranchTrueFalseTotal
$i ? : 0 0 0
2554 $cophh, $i ? $cophh : 'NULL', $ck, $val));
2555 }
2556 #$init->add(sprintf("%s->refcounted_he_refcnt--;", $cophh));
2557 #if (!$ITHREADS) {
2558 # $init->add(sprintf("HEK_FLAGS(%s->refcounted_he_hek) |= HVhek_STATIC;", $cophh));
2559 #}
2560 #if ($PERL522 and !$ITHREADS) { # breaks issue220
2561 # $init->add(sprintf("unshare_hek_hek(%s->refcounted_he_hek);", $cophh));
2562 #}
2563 0 $i++;
2564 }
2565 0 $init->add(sprintf("CopHINTHASH_set(&cop_list[%d], %s);", $ix, $cophh));
2566 }
2567 }
2568 }
2569 0 ▶ if ($add_label) {
Branch: 1 branch
BranchTrueFalseTotal
if ($add_label) 0 0 0
2570 # test 29 and 15,16,21. 44,45
2571 0 my ($cstring, $cur, $utf8) = strlen_flags($op->label);
2572 0 ▶ if ($] >= 5.015001) { # officially added with 5.15.1 aebc0cbee
Branch: 3 branches
BranchTrueFalseTotal
if ($] >= 5.015001) { } 0 0 0
elsif ($] > 5.013004) { } 0 0 0
elsif (not $^O =~ /^(MSWin32|AIX)$/ || $ENV{'PERL_DL_NONLAZY'}) { } 0 0 0
2573 0 ▶ warn "utf8 label $cstring" if $utf8 and $verbose;
Branch: 1 branch
BranchTrueFalseTotal
if $utf8 and $B::C::verbose 0 0 0
Condition0%0/3
$utf8 and $B::C::verbose
!ll&&!rl&&r
000
MC/DC0%0/2
$utf8 and $B::C::verbose
$utf8 $B::C::verbose
Truth table0%0/3
A and B
A= $utf8B= $B::C::verbose
ABresult
0X0
100
111
2574 0 $init->add(sprintf("Perl_cop_store_label(aTHX_ &cop_list[%d], %s, %u, %s);",
2575 $copsect->index, $cstring, $cur, $utf8));
2576 } elsif ($] > 5.013004) {
2577 0 $init->add(sprintf("Perl_store_cop_label(aTHX_ &cop_list[%d], %s, %u, %s);",
2578 $copsect->index, $cstring, $cur, $utf8));
2579 ▶ } elsif (!($^O =~ /^(MSWin32|AIX)$/ or $ENV{PERL_DL_NONLAZY})) {
Condition0%0/3
$^O =~ /^(MSWin32|AIX)$/ || $ENV{'PERL_DL_NONLAZY'}
l!l&&r!l&&!r
000
MC/DC0%0/2
$^O =~ /^(MSWin32|AIX)$/ || $ENV{'PERL_DL_NONLAZY'}
$^O =~ /^(MSWin32|AIX)$/ $ENV{'PERL_DL_NONLAZY'}
Truth table0%0/3
A || B
A= $^O =~ /^(MSWin32|AIX)$/B= $ENV{'PERL_DL_NONLAZY'}
ABresult
1X1
011
000
2580 0 ▶ warn "Warning: Overwrote hints_hash with label\n" if $i;
Branch: 1 branch
BranchTrueFalseTotal
if $i 0 0 0
2581 0 my $ix = $copsect->index;
2582 0 $init->add(
2583 sprintf("cop_list[%d].cop_hints_hash = Perl_store_cop_label(aTHX_ cop_list[%d].cop_hints_hash, %s);",
2584 $ix, $ix, $cstring));
2585 }
2586 }
2587  
2588 0 ▶ if ($PERL510 and !$is_special and !$isint) {
Branch: 1 branch
BranchTrueFalseTotal
if ($PERL510 and not $is_special and not $isint) { } 0 0 0
Condition0%0/6
$PERL510 and not $is_special and not $isint
!ll&&!rl&&r
000
$PERL510 and not $is_special
!ll&&!rl&&r
000
MC/DC0%0/3
$PERL510 and not $is_special and not $isint
$PERL510 not $is_special not $isint
Truth table0%0/4
A and not(B) and not(C)
A= $PERL510B= not $is_specialC= not $isint
ABCresult
0XX0
10X0
1100
1111
2589 0 my $copw = $warn_sv;
2590 0 $copw =~ s/^\(STRLEN\*\)&//;
2591 # on cv_undef (scope exit, die, Attribute::Handlers, ...) CvROOT and kids are freed.
2592 # so lexical cop_warnings need to be dynamic.
2593 0 ▶ if ($copw) {
Branch: 1 branch
BranchTrueFalseTotal
if ($copw) 0 0 0
2594 0 my $dest = "cop_list[$ix].cop_warnings";
2595 # with DEBUGGING savepvn returns ptr + PERL_MEMORY_DEBUG_HEADER_SIZE
2596 # which is not the address which will be freed in S_cop_free.
2597 # Need to use old-style PerlMemShared_, see S_cop_free in op.c (#362)
2598 # lexwarn<n> might be also be STRLEN* 0
2599 0 $init->no_split;
2600 0 $init->add("#ifdef PERL_SUPPORT_STATIC_COP /* so far cperl only */",
2601 "$dest = $warn_sv;",
2602 "#else",
2603 sprintf("%s = (STRLEN*)savesharedpvn((const char*)%s, sizeof(%s));",
2604 $dest, $copw, $copw),
2605 "#endif");
2606 0 $init->split;
2607 }
2608 } else {
2609 0 ▶ $init->add( sprintf( "cop_list[%d].cop_warnings = %s;", $ix, $warn_sv ) )
Branch: 1 branch
BranchTrueFalseTotal
unless $B::C::optimize_warn_sv 0 0 0
2610 unless $B::C::optimize_warn_sv;
2611 }
2612 #push @B::C::static_free, "cop_list[$ix]" if $ITHREADS;
2613 0 ▶ if (!$B::C::optimize_cop) {
Branch: 1 branch
BranchTrueFalseTotal
unless ($B::C::optimize_cop) 0 0 0
2614 0 my $stash = savestashpv($op->stashpv);
2615 0 $init->add(sprintf( "CopSTASH_set(&cop_list[%d], %s);", $ix, $stash ));
2616 0 ▶ if (!$ITHREADS) {
Branch: 1 branch
BranchTrueFalseTotal
if (not $ITHREADS) { } 0 0 0
2617 0 ▶ if ($B::C::const_strings) {
Branch: 1 branch
BranchTrueFalseTotal
if ($B::C::const_strings) { } 0 0 0
2618 0 my $constpv = constpv($file);
2619 # define CopFILE_set(c,pv) CopFILEGV_set((c), gv_fetchfile(pv))
2620 # cache gv_fetchfile
2621 0 ▶ if ( !$copgvtable{$constpv} ) {
Branch: 1 branch
BranchTrueFalseTotal
unless ($copgvtable{$constpv}) 0 0 0
2622 0 $copgvtable{$constpv} = $gv_index++;
2623 0 $init->add( sprintf( "gv_list[%d] = gv_fetchfile(%s);", $copgvtable{$constpv}, $constpv ) );
2624 }
2625 $init->add( sprintf( "CopFILEGV_set(&cop_list[%d], gv_list[%d]); /* %s */",
2626 0 $ix, $copgvtable{$constpv}, cstring($file) ) );
2627 #$init->add(sprintf( "CopFILE_set(&cop_list[%d], %s);", $ix, constpv($file) ));
2628 } else {
2629 0 $init->add(sprintf( "CopFILE_set(&cop_list[%d], %s);", $ix, cstring($file) ));
2630 }
2631 } else { # cv_undef e.g. in bproto.t and many more core tests with threads
2632 0 $init->add(sprintf( "CopFILE_set(&cop_list[%d], %s);", $ix, cstring($file) ));
2633 }
2634 }
2635  
2636 # our root: store all packages from this file
2637 0 ▶ if (!$mainfile) {
Branch: 1 branch
BranchTrueFalseTotal
if (not $B::C::mainfile) { } 0 0 0
2638 0 ▶ $mainfile = $op->file
Branch: 2 branches
BranchTrueFalseTotal
if $op->stashpv eq ($B::C::module ? $B::C::module : "main") 0 0 0
$B::C::module ? : 0 0 0
2639 if $op->stashpv eq ($module ? $module : 'main');
2640 } else {
2641 0 ▶ mark_package($op->stashpv)
Branch: 2 branches
BranchTrueFalseTotal
if $B::C::mainfile eq $op->file and $op->stashpv ne ($B::C::module ? $B::C::module : "main") 0 0 0
$B::C::module ? : 0 0 0
Condition0%0/3
$B::C::mainfile eq $op->file and $op->stashpv ne ($B::C::module ? $B::C::module : "main")
!ll&&!rl&&r
000
MC/DC0%0/2
$B::C::mainfile eq $op->file and $op->stashpv ne ($B::C::module ? $B::C::module : "main")
$B::C::mainfile eq $op->file $op->stashpv ne ($B::C::module ? $B::C::module : "main")
Truth table0%0/3
A and B
A= $B::C::mainfile eq $op->fileB= $op->stashpv ne ($B::C::module ? $B::C::module : "main")
ABresult
0X0
100
111
2642 if $mainfile eq $op->file and $op->stashpv ne ($module ? $module : 'main');
2643 }
2644 0 savesym( $op, "(OP*)&cop_list[$ix]" );
2645 }
2646  
2647 # if REGCOMP can be called in init or deferred in init1
2648 0 ▶sub re_does_swash {
Subroutine re_does_swash: not called CC=4 SCAR=30.0
Pod undocumented
2649 0 my ($qstr, $pmflags) = @_;
2650 # SWASHNEW, now needing a multideref GV. 0x5000000 is just a hack. can be more
2651 0 ▶ if (($] >= 5.021006 and ($pmflags & 0x5000000 == 0x5000000))
Branch: 1 branch
BranchTrueFalseTotal
if ($] >= 5.021006 and $pmflags & !0 or $qstr =~ /\\P\{/) { } 0 0 0
Condition0%0/6
or $qstr =~ /\\P\{/
l!l&&r!l&&!r
000
$] >= "5.021006" and
!ll&&!rl&&r
000
MC/DC0%0/3
or $qstr =~ /\\P\{/
$] >= "5.021006" $qstr =~ /\\P\{/
Truth table0%0/5
A and B or C
A= $] >= "5.021006"B= C= $qstr =~ /\\P\{/
ABCresult
11X1
0X11
1011
0X00
1000
2652 # or any unicode property (#253). Note: \p{} breaks #242
2653 or ($qstr =~ /\\P\{/)
2654 )
2655 {
2656 0 return 1;
2657 } else {
2658 0 return 0;
2659 }
2660 }
2661  
2662 0 ▶sub B::PMOP::save {
Subroutine save: not called CC=60 SCAR=82.1
2663 0 my ( $op, $level, $fullname ) = @_;
2664 0 my ($replrootfield, $replstartfield, $gvsym) = ('NULL', 'NULL');
2665 0 my $sym = objsym($op);
2666 0 ▶ return $sym if defined $sym;
Branch: 1 branch
BranchTrueFalseTotal
if defined $sym 0 0 0
2667 # 5.8.5-thr crashes here (7) at pushre
2668 0 ▶ my $pushre = $PERL5257 ? "split" : "pushre";
Branch: 1 branch
BranchTrueFalseTotal
$PERL5257 ? : 0 0 0
2669 0 ▶ if ($] < 5.008008 and $ITHREADS and $$op < 256) { # B bug. split->first->pmreplroot = 0x1
Branch: 1 branch
BranchTrueFalseTotal
if ($] < "5.008008" and $ITHREADS and $$op < 256) 0 0 0
Condition0%0/6
$] < "5.008008" and $ITHREADS and $$op < 256
!ll&&!rl&&r
000
$] < "5.008008" and $ITHREADS
!ll&&!rl&&r
000
MC/DC0%0/3
$] < "5.008008" and $ITHREADS and $$op < 256
$] < "5.008008" $ITHREADS $$op < 256
Truth table0%0/4
A and B and C
A= $] < "5.008008"B= $ITHREADSC= $$op < 256
ABCresult
0XX0
10X0
1100
1111
2670 0 die "Internal B::walkoptree error: invalid PMOP for pushre\n";
2671 0 return;
2672 }
2673 0 ▶ $level = 0 unless $level;
Branch: 1 branch
BranchTrueFalseTotal
unless $level 0 0 0
2674 0 my $replroot = $op->pmreplroot;
2675 0 my $replstart = $op->pmreplstart;
2676 0 my $ppaddr = $op->ppaddr;
2677  
2678 # under ithreads, OP_PUSHRE.op_replroot is an integer. multi not.
2679 0 ▶ $replrootfield = sprintf( "s\\_%x", $$replroot ) if ref $replroot;
Branch: 1 branch
BranchTrueFalseTotal
if ref $replroot 0 0 0
2680 0 ▶ if ( $ITHREADS && $op->name eq $pushre ) {
Branch: 2 branches
BranchTrueFalseTotal
if ($ITHREADS and $op->name eq $pushre) { } 0 0 0
elsif (ref $replroot and $$replroot) { } 0 0 0
Condition0%0/3
$ITHREADS and $op->name eq $pushre
!ll&&!rl&&r
000
MC/DC0%0/2
$ITHREADS and $op->name eq $pushre
$ITHREADS $op->name eq $pushre
Truth table0%0/3
A and B
A= $ITHREADSB= $op->name eq $pushre
ABresult
0X0
100
111
2681 0 ▶ warn "PMOP::save saving a pp_$pushre as int ${replroot}\n" if $debug{gv};
Branch: 1 branch
BranchTrueFalseTotal
if $B::C::debug{"gv"} 0 0 0
2682 0 $replrootfield = "INT2PTR(OP*,${replroot})";
2683 }
2684 ▶ elsif (ref $replroot && $$replroot) {
Condition0%0/3
ref $replroot and $$replroot
!ll&&!rl&&r
000
MC/DC0%0/2
ref $replroot and $$replroot
ref $replroot $$replroot
Truth table0%0/3
A and B
A= ref $replrootB= $$replroot
ABresult
0X0
100
111
2685 # OP_PUSHRE (a mutated version of OP_MATCH for the regexp
2686 # argument to a split) stores a GV in op_pmreplroot instead
2687 # of a substitution syntax tree. We don't want to walk that...
2688 0 ▶ if ( $op->name eq $pushre ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($op->name eq $pushre) { } 0 0 0
2689 0 ▶ warn "PMOP::save saving a pp_$pushre with GV $gvsym\n" if $debug{gv};
Branch: 1 branch
BranchTrueFalseTotal
if $B::C::debug{"gv"} 0 0 0
2690 0 $gvsym = $replroot->save;
2691 0 $replrootfield = "NULL";
2692 0 ▶ $replstartfield = $replstart->save if $replstart;
Branch: 1 branch
BranchTrueFalseTotal
if $replstart 0 0 0
2693 }
2694 else {
2695 0 ▶ $replstart->save if $replstart;
Branch: 1 branch
BranchTrueFalseTotal
if $replstart 0 0 0
2696 0 $replstartfield = saveoptree( "*ignore*", $replroot, $replstart );
2697 0 $replstartfield =~ s/^hv/(OP*)hv/;
2698 }
2699 }
2700  
2701 # pmnext handling is broken in perl itself, we think. Bad op_pmnext
2702 # fields aren't noticed in perl's runtime (unless you try reset) but we
2703 # segfault when trying to dereference it to find op->op_pmnext->op_type
2704 0 ▶ if ($PERL510) {
Branch: 2 branches
BranchTrueFalseTotal
if ($PERL510) { } 0 0 0
elsif ($PERL56) { } 0 0 0
2705 0 $pmopsect->comment(
2706 "$opsect_common, first, last, pmoffset, pmflags, pmreplroot, pmreplstart"
2707 );
2708 $pmopsect->add(
2709 sprintf( "%s, s\\_%x, s\\_%x, %u, 0x%x, {%s}, {%s}",
2710 0 $op->_save_common, ${ $op->first },
2711 0 ▶ ${ $op->last }, ( $ITHREADS ? $op->pmoffset : 0 ),
Branch: 1 branch
BranchTrueFalseTotal
$ITHREADS ? : 0 0 0
2712 $op->pmflags, $replrootfield, $replstartfield
2713 ));
2714 0 ▶ if ($] >= 5.017) {
Branch: 1 branch
BranchTrueFalseTotal
if ($] >= "5.017") 0 0 0
2715 0 my $code_list = $op->code_list;
2716 0 ▶ if ($code_list and $$code_list) {
Branch: 1 branch
BranchTrueFalseTotal
if ($code_list and $$code_list) 0 0 0
Condition0%0/3
$code_list and $$code_list
!ll&&!rl&&r
000
MC/DC0%0/2
$code_list and $$code_list
$code_list $$code_list
Truth table0%0/3
A and B
A= $code_listB= $$code_list
ABresult
0X0
100
111
2717 warn sprintf("saving pmop_list[%d] code_list $code_list (?{})\n", $pmopsect->index)
2718 0 ▶ if $debug{gv};
Branch: 1 branch
BranchTrueFalseTotal
if $B::C::debug{"gv"} 0 0 0
2719 0 my $code_op = $code_list->save;
2720 0 ▶ $init->add(sprintf("pmop_list[%d].op_code_list = %s;", # (?{}) code blocks
Branch: 1 branch
BranchTrueFalseTotal
if $code_op 0 0 0
2721 $pmopsect->index, $code_op)) if $code_op;
2722 warn sprintf("done saving pmop_list[%d] code_list $code_list (?{})\n", $pmopsect->index)
2723 0 ▶ if $debug{gv};
Branch: 1 branch
BranchTrueFalseTotal
if $B::C::debug{"gv"} 0 0 0
2724 }
2725 }
2726 }
2727 elsif ($PERL56) {
2728 # pmdynflags does not exist as B method. It is only used for PMdf_UTF8 dynamically,
2729 # if static we set this already in pmflags.
2730 0 $pmopsect->comment(
2731 "$opsect_common, first, last, pmreplroot, pmreplstart, pmnext, pmregexp, pmflags, pmpermflags, pmdynflags"
2732 );
2733 $pmopsect->add(
2734 sprintf( "%s, s\\_%x, s\\_%x, %s, %s, 0, 0, 0x%x, 0x%x",
2735 $op->_save_common,
2736 0 ${ $op->first }, ${ $op->last },
2737 $replrootfield, $replstartfield,
2738 $op->pmflags, $op->pmpermflags, 0 # XXX original 5.6 B::C misses pmdynflags
2739 ));
2740 } else { # perl5.8.x
2741 0 $pmopsect->comment(
2742 "$opsect_common, first, last, pmreplroot, pmreplstart, pmoffset, pmflags, pmpermflags, pmdynflags, pmstash"
2743 );
2744 $pmopsect->add(
2745 sprintf( "%s, s\\_%x, s\\_%x, %s, %s, 0, %u, 0x%x, 0x%x, 0x%x, %s",
2746 0 $op->_save_common, ${ $op->first },
2747 0 ▶ ${ $op->last }, $replrootfield,
Branch: 2 branches
BranchTrueFalseTotal
$ITHREADS ? : 0 0 0
$MULTI ? : 0 0 0
2748 $replstartfield, $ITHREADS ? $op->pmoffset : 0,
2749 $op->pmflags, $op->pmpermflags,
2750 $op->pmdynflags, $MULTI ? cstring($op->pmstashpv) : "0"
2751 ));
2752 0 ▶ if (!$MULTI and $op->pmstash) {
Branch: 1 branch
BranchTrueFalseTotal
if (not $MULTI and $op->pmstash) 0 0 0
Condition0%0/3
not $MULTI and $op->pmstash
!ll&&!rl&&r
000
MC/DC0%0/2
not $MULTI and $op->pmstash
not $MULTI $op->pmstash
Truth table0%0/3
not(A) and B
A= not $MULTIB= $op->pmstash
ABresult
0X0
100
111
2753 0 my $stash = $op->pmstash->save;
2754 0 $init->add( sprintf( "pmop_list[%d].op_pmstash = %s;", $pmopsect->index, $stash ) );
2755 }
2756 }
2757 0 ▶ $pmopsect->debug( $op->name, $op->flagspv ) if $debug{flags};
Branch: 1 branch
BranchTrueFalseTotal
if $B::C::debug{"flags"} 0 0 0
2758 0 my $pm = sprintf( "pmop_list[%d]", $pmopsect->index );
2759 0 ▶ $init->add( sprintf( "%s.op_ppaddr = %s;", $pm, $ppaddr ) )
Branch: 1 branch
BranchTrueFalseTotal
unless $B::C::optimize_ppaddr 0 0 0
2760 unless $B::C::optimize_ppaddr;
2761 0 my $re = $op->precomp;
2762 0 ▶ if ( defined($re) ) {
Branch: 1 branch
BranchTrueFalseTotal
if (defined $re) 0 0 0
2763 0 my $initpm = $init;
2764 0 $Regexp{$$op} = $op;
2765 0 ▶ if ($PERL510) {
Branch: 2 branches
BranchTrueFalseTotal
if ($PERL510) { } 0 0 0
elsif ($PERL56) { } 0 0 0
2766 # TODO minor optim: fix savere( $re ) to avoid newSVpvn;
2767 # precomp did not set the utf8 flag (#333, #338), fixed with 1.52_01
2768 0 my ($qre, $relen, $utf8) = strlen_flags($re);
2769 0 my $pmflags = $op->pmflags;
2770 warn "pregcomp $pm $qre:$relen:$utf8".sprintf(" 0x%x\n",$pmflags)
2771 0 ▶ if $debug{pv} or $debug{gv};
Branch: 1 branch
BranchTrueFalseTotal
if $B::C::debug{"pv"} or $B::C::debug{"gv"} 0 0 0
Condition0%0/3
$B::C::debug{"pv"} or $B::C::debug{"gv"}
l!l&&r!l&&!r
000
MC/DC0%0/2
$B::C::debug{"pv"} or $B::C::debug{"gv"}
$B::C::debug{"pv"} $B::C::debug{"gv"}
Truth table0%0/3
A or B
A= $B::C::debug{"pv"}B= $B::C::debug{"gv"}
ABresult
1X1
011
000
2772 # Since 5.13.10 with PMf_FOLD (i) we need to swash_init("utf8::Cased").
2773 0 ▶ if ($] >= 5.013009 and $pmflags & 4) {
Branch: 1 branch
BranchTrueFalseTotal
if ($] >= "5.013009" and $pmflags & 4) 0 0 0
Condition0%0/3
$] >= "5.013009" and $pmflags & 4
!ll&&!rl&&r
000
MC/DC0%0/2
$] >= "5.013009" and $pmflags & 4
$] >= "5.013009" $pmflags & 4
Truth table0%0/3
A and B
A= $] >= "5.013009"B= $pmflags & 4
ABresult
0X0
100
111
2774 # Note: in CORE utf8::SWASHNEW is demand-loaded from utf8 with Perl_load_module()
2775 0 load_utf8_heavy();
2776 0 ▶ if ($PERL518 and !$swash_init and $swash_ToCf) {
Branch: 1 branch
BranchTrueFalseTotal
if ($PERL518 and not $swash_init and $swash_ToCf) 0 0 0
Condition0%0/6
$PERL518 and not $swash_init and $swash_ToCf
!ll&&!rl&&r
000
$PERL518 and not $swash_init
!ll&&!rl&&r
000
MC/DC0%0/3
$PERL518 and not $swash_init and $swash_ToCf
$PERL518 not $swash_init $swash_ToCf
Truth table0%0/4
A and not(B) and C
A= $PERL518B= not $swash_initC= $swash_ToCf
ABCresult
0XX0
10X0
1100
1111
2777 0 $init->add("PL_utf8_tofold = $swash_ToCf;");
2778 0 $swash_init++;
2779 }
2780 }
2781 # some pm need early init (242), SWASHNEW needs some late GVs (GH#273)
2782 # esp with 5.22 multideref init. i.e. all \p{} \N{}, \U, /i, ...
2783 # But XSLoader and utf8::SWASHNEW itself needs to be early.
2784 0 ▶ if (($utf8 and $] >= 5.013009 and ($pmflags & 4 == 4)) # needs SWASHNEW (case fold)
Branch: 1 branch
BranchTrueFalseTotal
if ($utf8 and $] >= 5.013009 and $pmflags & !0 or re_does_swash($qre, $pmflags)) { } 0 0 0
Condition0%0/9
or re_does_swash($qre, $pmflags)
l!l&&r!l&&!r
000
$utf8 and $] >= "5.013009" and
!ll&&!rl&&r
000
$utf8 and $] >= "5.013009"
!ll&&!rl&&r
000
MC/DC0%0/4
or re_does_swash($qre, $pmflags)
$utf8 $] >= "5.013009" re_does_swash($qre, $pmflags)
Truth table0%0/7
A and B and C or D
A= $utf8B= $] >= "5.013009"C= D= re_does_swash($qre, $pmflags)
ABCDresult
111X1
0XX11
10X11
11011
0XX00
10X00
11000
2785 or re_does_swash($qre, $pmflags))
2786 {
2787 0 $initpm = $init1;
2788 0 ▶ warn sprintf("deferred PMOP %s %s 0x%x\n", $qre, $fullname, $pmflags) if $debug{sv};
Branch: 1 branch
BranchTrueFalseTotal
if $B::C::debug{"sv"} 0 0 0
2789 } else {
2790 0 ▶ warn sprintf("normal PMOP %s %s 0x%x\n", $qre, $fullname, $pmflags) if $debug{sv};
Branch: 1 branch
BranchTrueFalseTotal
if $B::C::debug{"sv"} 0 0 0
2791 }
2792 0 ▶ if ($PERL518 and $op->reflags & RXf_EVAL_SEEN) { # set HINT_RE_EVAL on
Branch: 1 branch
BranchTrueFalseTotal
if ($PERL518 and $op->reflags & 131072) 0 0 0
Condition0%0/3
$PERL518 and $op->reflags & 131072
!ll&&!rl&&r
000
MC/DC0%0/2
$PERL518 and $op->reflags & 131072
$PERL518 $op->reflags & 131072
Truth table0%0/3
A and B
A= $PERL518B= $op->reflags & 131072
ABresult
0X0
100
111
2793 0 $pmflags |= PMf_EVAL;
2794 0 $initpm->no_split;
2795 0 $initpm->add("{",
2796 " U32 hints_sav = PL_hints;",
2797 " PL_hints |= HINT_RE_EVAL;");
2798 }
2799 0 ▶ if ($] > 5.008008) { # can do utf8 qr
Branch: 1 branch
BranchTrueFalseTotal
if ($] > 5.008008) { } 0 0 0
2800 0 $initpm->add( # XXX Modification of a read-only value attempted. use DateTime - threaded
2801 sprintf("PM_SETRE(&%s, CALLREGCOMP(newSVpvn_flags(%s, %s, SVs_TEMP|$utf8), 0x%x));",
2802 $pm, $qre, $relen, $pmflags),
2803 sprintf("RX_EXTFLAGS(PM_GETRE(&%s)) = 0x%x;", $pm, $op->reflags ));
2804 } else {
2805 0 $initpm->add
2806 ("PM_SETRE(&$pm,",
2807 " CALLREGCOMP(newSVpvn($qre, $relen), ".sprintf("0x%x));", $pmflags),
2808 sprintf("RX_EXTFLAGS(PM_GETRE(&%s)) = 0x%x;", $pm, $op->reflags ));
2809 0 ▶ $initpm->add("SvUTF8_on(PM_GETRE(&$pm));") if $utf8;
Branch: 1 branch
BranchTrueFalseTotal
if $utf8 0 0 0
2810 }
2811 0 ▶ if ($] >= 5.018 and $op->reflags & RXf_EVAL_SEEN) { # set HINT_RE_EVAL off
Branch: 1 branch
BranchTrueFalseTotal
if ($] >= "5.018" and $op->reflags & 131072) 0 0 0
Condition0%0/3
$] >= "5.018" and $op->reflags & 131072
!ll&&!rl&&r
000
MC/DC0%0/2
$] >= "5.018" and $op->reflags & 131072
$] >= "5.018" $op->reflags & 131072
Truth table0%0/3
A and B
A= $] >= "5.018"B= $op->reflags & 131072
ABresult
0X0
100
111
2812 0 $initpm->add(" PL_hints = hints_sav;",
2813 "}");
2814 0 $initpm->split();
2815 }
2816 # See toke.c:8964
2817 # set in the stash the PERL_MAGIC_symtab PTR to the PMOP: ((PMOP**)mg->mg_ptr) [elements++] = pm;
2818 0 ▶ if ($PERL510 and $op->pmflags & PMf_ONCE()) {
Branch: 1 branch
BranchTrueFalseTotal
if ($PERL510 and $op->pmflags & 65536) 0 0 0
Condition0%0/3
$PERL510 and $op->pmflags & 65536
!ll&&!rl&&r
000
MC/DC0%0/2
$PERL510 and $op->pmflags & 65536
$PERL510 $op->pmflags & 65536
Truth table0%0/3
A and B
A= $PERL510B= $op->pmflags & 65536
ABresult
0X0
100
111
2819 0 ▶ my $stash = $MULTI ? $op->pmstashpv
Branch: 2 branches
BranchTrueFalseTotal
$MULTI ? : 0 0 0
ref $op->pmstash eq 'B::HV' ? : 0 0 0
2820 : ref $op->pmstash eq 'B::HV' ? $op->pmstash->NAME : '__ANON__';
2821 0 $Regexp{$$op} = $op; #188: restore PMf_ONCE, set PERL_MAGIC_symtab in $stash
2822 }
2823 }
2824 elsif ($PERL56) {
2825 0 my ( $resym, $relen ) = savere( $re, 0 );
2826 0 $init->add(
2827 "$pm.op_pmregexp = pregcomp((char*)$resym, (char*)$resym + $relen, &$pm);"
2828 );
2829 }
2830 else { # 5.8
2831 0 my ( $resym, $relen ) = savere( $re, 0 );
2832 0 $init->add(
2833 "PM_SETRE(&$pm, CALLREGCOMP(aTHX_ (char*)$resym, (char*)$resym + $relen, &$pm));"
2834 );
2835 }
2836 }
2837 0 ▶ if ( $gvsym ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($gvsym) 0 0 0
2838 0 ▶ if ($PERL510) {
Branch: 1 branch
BranchTrueFalseTotal
if ($PERL510) { } 0 0 0
2839 # XXX need that for subst
2840 0 $init->add("$pm.op_pmreplrootu.op_pmreplroot = (OP*)$gvsym;");
2841 } else {
2842 0 $init->add("$pm.op_pmreplroot = (OP*)$gvsym;");
2843 }
2844 }
2845 0 savesym( $op, "(OP*)&$pm" );
2846 }
2847  
2848 0 ▶sub B::SPECIAL::save {
Subroutine save: not called CC=3 SCAR=24.8
2849 0 my ($sv, $fullname) = @_;
2850 # special case: $$sv is not the address but an index into specialsv_list
2851 # warn "SPECIAL::save specialsv $$sv\n"; # debug
2852 0 ▶ @specialsv_name = qw(Nullsv &PL_sv_undef &PL_sv_yes &PL_sv_no pWARN_ALL pWARN_NONE)
Branch: 1 branch
BranchTrueFalseTotal
unless @B::C::specialsv_name 0 0 0
2853 unless @specialsv_name; # 5.6.2 Exporter quirks. pWARN_STD was added to B with 5.8.9
2854 # &PL_sv_zero was added with 5.27.2 and was imported
2855 0 my $sym = $specialsv_name[$$sv];
2856 0 ▶ if ( !defined($sym) ) {
Branch: 1 branch
BranchTrueFalseTotal
unless (defined $sym) 0 0 0
2857 0 warn "unknown specialsv index $$sv passed to B::SPECIAL::save";
2858 }
2859 0 return $sym;
2860 }
2861  
2862 0 ▶sub B::OBJECT::save { }
Subroutine save: not called CC=1 SCAR=0.0
2863  
2864 0 ▶sub B::NULL::save {
Subroutine save: not called CC=10 SCAR=47.0
2865 0 my ($sv, $fullname) = @_;
2866 0 my $sym = objsym($sv);
2867 0 ▶ return $sym if defined $sym;
Branch: 1 branch
BranchTrueFalseTotal
if defined $sym 0 0 0
2868  
2869 # debug
2870 0 ▶ if ( $$sv == 0 ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($$sv == 0) 0 0 0
2871 0 ▶ warn "NULL::save for sv = 0 called from @{[(caller(1))[3]]}\n" if $verbose;
Branch: 1 branch
BranchTrueFalseTotal
if $B::C::verbose 0 0 0
2872 0 return savesym( $sv, "(void*)Nullsv" );
2873 }
2874  
2875 0 my $i = $svsect->index + 1;
2876 0 ▶ warn "Saving SVt_NULL sv_list[$i]\n" if $debug{sv};
Branch: 1 branch
BranchTrueFalseTotal
if $B::C::debug{"sv"} 0 0 0
2877 0 ▶ $svsect->add( sprintf( "NULL, $u32fmt, 0x%x".($PERL510?", {0}":''),
Branch: 1 branch
BranchTrueFalseTotal
$PERL510 ? : 0 0 0
2878 $sv->REFCNT, $sv->FLAGS ) );
2879 #$svsect->debug( $fullname, $sv->flagspv ) if $debug{flags}; # XXX where is this possible?
2880 0 ▶ if ($debug{flags} and (!$ITHREADS or $PERL514) and $DEBUG_LEAKING_SCALARS) { # add index to sv_debug_file to easily find the Nullsv
Branch: 1 branch
BranchTrueFalseTotal
if ($B::C::debug{"flags"} and !$ITHREADS || $PERL514 and $DEBUG_LEAKING_SCALARS) 0 0 0
Condition0%0/9
$B::C::debug{"flags"} and !$ITHREADS || $PERL514 and $DEBUG_LEAKING_SCALARS
!ll&&!rl&&r
000
$B::C::debug{"flags"} and !$ITHREADS || $PERL514
!ll&&!rl&&r
000
not $ITHREADS or $PERL514
l!l&&r!l&&!r
000
MC/DC0%0/4
$B::C::debug{"flags"} and !$ITHREADS || $PERL514 and $DEBUG_LEAKING_SCALARS
$B::C::debug{"flags"} not $ITHREADS $PERL514 $DEBUG_LEAKING_SCALARS
Truth table0%0/6
A and not(B) or C and D
A= $B::C::debug{"flags"}B= not $ITHREADSC= $PERL514D= $DEBUG_LEAKING_SCALARS
ABCDresult
0XXX0
100X0
11X00
10100
11X11
10111
2881 # $svsect->debug( "ix added to sv_debug_file" );
2882 0 $init->add(sprintf(qq(sv_list[%d].sv_debug_file = savesharedpv("NULL sv_list[%d] 0x%x");),
2883 $svsect->index, $svsect->index, $sv->FLAGS));
2884 }
2885 0 savesym( $sv, sprintf( "&sv_list[%d]", $svsect->index ) );
2886 }
2887  
2888 0 ▶sub B::UV::save {
Subroutine save: not called CC=15 SCAR=54.8
2889 0 my ($sv, $fullname) = @_;
2890 0 my $sym = objsym($sv);
2891 0 ▶ return $sym if defined $sym;
Branch: 1 branch
BranchTrueFalseTotal
if defined $sym 0 0 0
2892 0 my $uvuformat = $Config{uvuformat};
2893 0 $uvuformat =~ s/["\0]//g; #" poor editor
2894 0 $uvuformat =~ s/".$/"/; # cperl bug 5.22.2 #61
2895 0 my $uvx = $sv->UVX;
2896 0 my $suff = 'U';
2897 0 ▶ $suff .= 'L' if $uvx > 2147483647;
Branch: 1 branch
BranchTrueFalseTotal
if $uvx > 2147483647 0 0 0
2898 0 my $i = $svsect->index + 1;
2899 0 ▶ if ($PERL524) {
Branch: 3 branches
BranchTrueFalseTotal
if ($PERL524) { } 0 0 0
elsif ($PERL514) { } 0 0 0
elsif ($PERL510) { } 0 0 0
2900 # since 5.24 we need to point the xpvuv to the head
2901 } elsif ($PERL514) {
2902 # issue 145 warn $sv->UVX, " ", sprintf($u32fmt, $sv->UVX);
2903 0 $xpvuvsect->comment( "stash, magic, cur, len, xuv_u" );
2904 0 $xpvuvsect->add( sprintf( "Nullhv, {0}, 0, 0, {%".$uvuformat."$suff}", $uvx ) );
2905 } elsif ($PERL510) {
2906 0 $xpvuvsect->comment( "stash, magic, cur, len, xuv_u" );
2907 0 $xpvuvsect->add( sprintf( "{0}, 0, 0, {%".$uvuformat."$suff}", $uvx ) );
2908 } else {
2909 0 $xpvuvsect->comment( "pv, cur, len, uv" );
2910 0 $xpvuvsect->add( sprintf( "0, 0, 0, %".$uvuformat.$suff, $uvx ) );
2911 }
2912 0 ▶ if ($PERL524) {
Branch: 1 branch
BranchTrueFalseTotal
if ($PERL524) { } 0 0 0
2913 0 ▶ $svsect->add(sprintf( "NULL, $u32fmt, 0x%x".
Branch: 2 branches
BranchTrueFalseTotal
$PERL510 ? : 0 0 0
$C99 ? : 0 0 0
2914 ($PERL510?', {'.($C99?".svu_uv=":"").$uvx."$suff}":''),
2915 $sv->REFCNT, $sv->FLAGS));
2916 #32bit - sizeof(void*), 64bit: - 2*ptrsize
2917 0 ▶ if ($Config{ptrsize} == 4 and !IS_MSVC) {
Branch: 1 branch
BranchTrueFalseTotal
if ($B::C::Config{'ptrsize'} == 4 and not &IS_MSVC()) { } 0 0 0
Condition0%0/3
$B::C::Config{"ptrsize"} == 4 and not &IS_MSVC()
!ll&&!rl&&r
000
MC/DC0%0/2
$B::C::Config{"ptrsize"} == 4 and not &IS_MSVC()
$B::C::Config{"ptrsize"} == 4 not &IS_MSVC()
Truth table0%0/3
A and not(B)
A= $B::C::Config{"ptrsize"} == 4B= not &IS_MSVC()
ABresult
0X0
100
111
2918 0 $init->add(sprintf( "sv_list[%d].sv_any = (void*)&sv_list[%d] - sizeof(void*);", $i, $i));
2919 } else {
2920 $init->add(sprintf( "sv_list[%d].sv_any = (char*)&sv_list[%d] - %d;", $i, $i,
2921 0 2*$Config{ptrsize}));
2922 }
2923 } else {
2924 0 ▶ $svsect->add(sprintf( "&xpvuv_list[%d], $u32fmt, 0x%x".
Branch: 2 branches
BranchTrueFalseTotal
$PERL510 ? : 0 0 0
$C99 ? : 0 0 0
2925 ($PERL510?', {'.($C99?".svu_uv=":"").$uvx."$suff}":''),
2926 $xpvuvsect->index, $sv->REFCNT, $sv->FLAGS));
2927 }
2928 0 ▶ $svsect->debug( $fullname, $sv->flagspv ) if $debug{flags};
Branch: 1 branch
BranchTrueFalseTotal
if $B::C::debug{"flags"} 0 0 0
2929 warn sprintf( "Saving IV(UV) 0x%x to xpvuv_list[%d], sv_list[%d], called from %s:%s\n",
2930 0 $sv->UVX, $xpvuvsect->index, $i, @{[(caller(1))[3]]}, @{[(caller(0))[2]]} )
2931 0 ▶ if $debug{sv};
Branch: 1 branch
BranchTrueFalseTotal
if $B::C::debug{"sv"} 0 0 0
2932 0 savesym( $sv, sprintf( "&sv_list[%d]", $i ) );
2933 }
2934  
2935 0 ▶sub B::IV::save {
Subroutine save: not called CC=24 SCAR=64.0
2936 0 my ($sv, $fullname) = @_;
2937 0 my $sym = objsym($sv);
2938 0 ▶ return $sym if defined $sym;
Branch: 1 branch
BranchTrueFalseTotal
if defined $sym 0 0 0
2939 # Since 5.11 the RV is no special SV object anymore, just a IV (test 16)
2940 0 my $svflags = $sv->FLAGS;
2941 0 ▶ if ($PERL512 and $svflags & SVf_ROK) {
Branch: 1 branch
BranchTrueFalseTotal
if ($PERL512 and $svflags & 2048) 0 0 0
Condition0%0/3
$PERL512 and $svflags & 2048
!ll&&!rl&&r
000
MC/DC0%0/2
$PERL512 and $svflags & 2048
$PERL512 $svflags & 2048
Truth table0%0/3
A and B
A= $PERL512B= $svflags & 2048
ABresult
0X0
100
111
2942 0 return $sv->B::RV::save($fullname);
2943 }
2944 0 ▶ if ($svflags & SVf_IVisUV) {
Branch: 1 branch
BranchTrueFalseTotal
if ($svflags & 2147483648) 0 0 0
2945 0 return $sv->B::UV::save;
2946 }
2947 0 my $ivx = ivx($sv->IVX);
2948 0 my $i = $svsect->index + 1;
2949 0 ▶ if ($svflags & 0xff and !($svflags & (SVf_IOK|SVp_IOK))) { # Not nullified
Branch: 1 branch
BranchTrueFalseTotal
if ($svflags & 255 and not $svflags & 4352) 0 0 0
Condition0%0/3
$svflags & 255 and not $svflags & 4352
!ll&&!rl&&r
000
MC/DC0%0/2
$svflags & 255 and not $svflags & 4352
$svflags & 255 not $svflags & 4352
Truth table0%0/3
A and not(B)
A= $svflags & 255B= not $svflags & 4352
ABresult
0X0
100
111
2950 0 ▶ unless (($PERL510 and $svflags & 0x00010000) # PADSTALE - out of scope lexical is !IOK
Branch: 1 branch
BranchTrueFalseTotal
unless ($PERL510 and $svflags & 65536 or not $PERL510 and $svflags & 256 or $] > "5.015002" and $svflags & 393218) 0 0 0
Condition0%0/15
$PERL510 and $svflags & 65536 or not $PERL510 and $svflags & 256 or $] > "5.015002" and $svflags & 393218
l!l&&r!l&&!r
000
$PERL510 and $svflags & 65536 or not $PERL510 and $svflags & 256
l!l&&r!l&&!r
000
$PERL510 and $svflags & 65536
!ll&&!rl&&r
000
not $PERL510 and $svflags & 256
!ll&&!rl&&r
000
$] > "5.015002" and $svflags & 393218
!ll&&!rl&&r
000
MC/DC0%0/6
$PERL510 and $svflags & 65536 or not $PERL510 and $svflags & 256 or $] > "5.015002" and $svflags & 393218
$PERL510 $svflags & 65536 not $PERL510 $svflags & 256 $] > "5.015002" $svflags & 393218
Truth table0%0/15
A and B or not(C) and D or E and F
A= $PERL510B= $svflags & 65536C= not $PERL510D= $svflags & 256E= $] > "5.015002"F= $svflags & 393218
ABCDEFresult
11XXXX1
0X11XX1
1011XX1
0X0X111
0X10111
100X111
1010111
0X0X0X0
0X0X100
0X100X0
0X10100
100X0X0
100X100
10100X0
1010100
2951 or (!$PERL510 and $svflags & 0x00000100) # PADBUSY
2952 or ($] > 5.015002 and $svflags & 0x60002)) { # 5.15.3 changed PAD bits
2953 0 warn sprintf("Internal warning: IV !IOK $fullname sv_list[$i] 0x%x\n",$svflags);
2954 }
2955 }
2956 0 ▶ if ($PERL524) {
Branch: 3 branches
BranchTrueFalseTotal
if ($PERL524) { } 0 0 0
elsif ($PERL514) { } 0 0 0
elsif ($PERL510) { } 0 0 0
2957 # since 5.24 we need to point the xpviv to the head
2958 } elsif ($PERL514) {
2959 0 $xpvivsect->comment( "stash, magic, cur, len, xiv_u" );
2960 0 $xpvivsect->add( sprintf( "Nullhv, {0}, 0, 0, {%s}", $ivx ) );
2961 } elsif ($PERL510) {
2962 0 $xpvivsect->comment( "stash, magic, cur, len, xiv_u" );
2963 0 $xpvivsect->add( sprintf( "{0}, 0, 0, {%s}", $ivx ) );
2964 } else {
2965 0 $xpvivsect->comment( "pv, cur, len, iv" );
2966 0 $xpvivsect->add( sprintf( "0, 0, 0, %s", $ivx ) );
2967 }
2968 0 ▶ if ($PERL524) {
Branch: 1 branch
BranchTrueFalseTotal
if ($PERL524) { } 0 0 0
2969 0 ▶ $svsect->add(sprintf( "NULL, $u32fmt, 0x%x, {".($C99?".svu_iv=":"").$ivx.'}',
Branch: 1 branch
BranchTrueFalseTotal
$C99 ? : 0 0 0
2970 $sv->REFCNT, $svflags ));
2971 #32bit - sizeof(void*), 64bit: - 2*ptrsize
2972 0 ▶ if ($Config{ptrsize} == 4 and !IS_MSVC) {
Branch: 1 branch
BranchTrueFalseTotal
if ($B::C::Config{'ptrsize'} == 4 and not &IS_MSVC()) { } 0 0 0
Condition0%0/3
$B::C::Config{"ptrsize"} == 4 and not &IS_MSVC()
!ll&&!rl&&r
000
MC/DC0%0/2
$B::C::Config{"ptrsize"} == 4 and not &IS_MSVC()
$B::C::Config{"ptrsize"} == 4 not &IS_MSVC()
Truth table0%0/3
A and not(B)
A= $B::C::Config{"ptrsize"} == 4B= not &IS_MSVC()
ABresult
0X0
100
111
2973 0 $init->add(sprintf( "sv_list[%d].sv_any = (void*)&sv_list[%d] - sizeof(void*);", $i, $i));
2974 } else {
2975 $init->add(sprintf( "sv_list[%d].sv_any = (char*)&sv_list[%d] - %d;", $i, $i,
2976 0 2*$Config{ptrsize}));
2977 }
2978 } else {
2979 0 ▶ $svsect->add(sprintf( "&xpviv_list[%d], $u32fmt, 0x%x".($PERL510?', {'.($C99?".svu_iv=":"").$ivx.'}':''),
Branch: 2 branches
BranchTrueFalseTotal
$PERL510 ? : 0 0 0
$C99 ? : 0 0 0
2980 $xpvivsect->index, $sv->REFCNT, $svflags ));
2981 }
2982 0 ▶ $svsect->debug( $fullname, $sv->flagspv ) if $debug{flags};
Branch: 1 branch
BranchTrueFalseTotal
if $B::C::debug{"flags"} 0 0 0
2983 warn sprintf( "Saving IV 0x%x to xpviv_list[%d], sv_list[%d], called from %s:%s\n",
2984 0 $sv->IVX, $xpvivsect->index, $i, @{[(caller(1))[3]]}, @{[(caller(0))[2]]} )
2985 0 ▶ if $debug{sv};
Branch: 1 branch
BranchTrueFalseTotal
if $B::C::debug{"sv"} 0 0 0
2986 0 savesym( $sv, sprintf( "&sv_list[%d]", $i ) );
2987 }
2988  
2989 0 ▶sub B::NV::save {
Subroutine save: not called CC=11 SCAR=48.8
2990 0 my ($sv, $fullname) = @_;
2991 0 my $sym = objsym($sv);
2992 0 ▶ return $sym if defined $sym;
Branch: 1 branch
BranchTrueFalseTotal
if defined $sym 0 0 0
2993 0 my $nv = nvx($sv->NV);
2994 0 ▶ $nv .= '.00' if $nv =~ /^-?\d+$/;
Branch: 1 branch
BranchTrueFalseTotal
if $nv =~ /^-?\d+$/ 0 0 0
2995 # IVX is invalid in B.xs and unused
2996 0 ▶ my $iv = $sv->FLAGS & SVf_IOK ? $sv->IVX : 0;
Branch: 1 branch
BranchTrueFalseTotal
$sv->FLAGS & 256 ? : 0 0 0
2997 0 ▶ $nv = '0.00' if IS_MSVC and !$nv;
Branch: 1 branch
BranchTrueFalseTotal
if &IS_MSVC() and not $nv 0 0 0
Condition0%0/3
&IS_MSVC() and not $nv
!ll&&!rl&&r
000
MC/DC0%0/2
&IS_MSVC() and not $nv
&IS_MSVC() not $nv
Truth table0%0/3
A and not(B)
A= &IS_MSVC()B= not $nv
ABresult
0X0
100
111
2998 0 ▶ if ($PERL514) {
Branch: 2 branches
BranchTrueFalseTotal
if ($PERL514) { } 0 0 0
elsif ($PERL510) { } 0 0 0
2999 0 $xpvnvsect->comment('STASH, MAGIC, cur, len, IVX, NVX');
3000 0 $xpvnvsect->add( sprintf( "Nullhv, {0}, 0, 0, {%ld}, {%s}", $iv, $nv ) );
3001 } elsif ($PERL510) { # not fixed by NV isa IV >= 5.8
3002 0 $xpvnvsect->comment('NVX, cur, len, IVX');
3003 0 $xpvnvsect->add( sprintf( "{%s}, 0, 0, {%ld}", $nv, $iv ) );
3004 }
3005 else {
3006 0 $xpvnvsect->comment('PVX, cur, len, IVX, NVX');
3007 0 $xpvnvsect->add( sprintf( "0, 0, 0, %ld, %s", $iv, $nv ) );
3008 }
3009 0 ▶ $svsect->add(
Branch: 1 branch
BranchTrueFalseTotal
$PERL510 ? : 0 0 0
3010 sprintf( "&xpvnv_list[%d], $u32fmt, 0x%x %s",
3011 $xpvnvsect->index, $sv->REFCNT, $sv->FLAGS, $PERL510 ? ', {0}' : '' ));
3012 0 ▶ $svsect->debug( $fullname, $sv->flagspv ) if $debug{flags};
Branch: 1 branch
BranchTrueFalseTotal
if $B::C::debug{"flags"} 0 0 0
3013 warn sprintf( "Saving NV %s to xpvnv_list[%d], sv_list[%d]\n",
3014 $nv, $xpvnvsect->index, $svsect->index )
3015 0 ▶ if $debug{sv};
Branch: 1 branch
BranchTrueFalseTotal
if $B::C::debug{"sv"} 0 0 0
3016 0 savesym( $sv, sprintf( "&sv_list[%d]", $svsect->index ) );
3017 }
3018  
3019 0 ▶sub savepvn {
Subroutine savepvn: not called CC=20 SCAR=60.4
Pod undocumented
3020 0 my ( $dest, $pv, $sv, $cur ) = @_;
3021 0 my @init;
3022  
3023 # work with byte offsets/lengths
3024 0 ▶ $pv = pack "a*", $pv if defined $pv;
Branch: 1 branch
BranchTrueFalseTotal
if defined $pv 0 0 0
3025 0 ▶ if ( defined $max_string_len && length($pv) > $max_string_len ) {
Branch: 1 branch
BranchTrueFalseTotal
if (defined $max_string_len and length $pv > $max_string_len) { } 0 0 0
Condition0%0/3
defined $max_string_len and length $pv > $max_string_len
!ll&&!rl&&r
000
MC/DC0%0/2
defined $max_string_len and length $pv > $max_string_len
defined $max_string_len length $pv > $max_string_len
Truth table0%0/3
A and B
A= defined $max_string_lenB= length $pv > $max_string_len
ABresult
0X0
100
111
3026 0 push @init, sprintf( "Newx(%s, %u, char);", $dest, length($pv) + 2 );
3027 0 my $offset = 0;
3028 0 ▶ while ( length $pv ) {
Branch: 1 branch
BranchTrueFalseTotal
if (length $pv) 0 0 0
3029 0 my $str = substr $pv, 0, $max_string_len, '';
3030 0 push @init,
3031 sprintf( "Copy(%s, %s+%d, %u, char);",
3032 cstring($str), $dest, $offset, length($str) );
3033 0 $offset += length $str;
3034 }
3035 0 push @init, sprintf( "%s[%u] = '\\0';", $dest, $offset );
3036 warn sprintf( "Copying overlong PV %s to %s\n", cstring($pv), $dest )
3037 0 ▶ if $debug{sv} or $debug{pv};
Branch: 1 branch
BranchTrueFalseTotal
if $B::C::debug{"sv"} or $B::C::debug{"pv"} 0 0 0
Condition0%0/3
$B::C::debug{"sv"} or $B::C::debug{"pv"}
l!l&&r!l&&!r
000
MC/DC0%0/2
$B::C::debug{"sv"} or $B::C::debug{"pv"}
$B::C::debug{"sv"} $B::C::debug{"pv"}
Truth table0%0/3
A or B
A= $B::C::debug{"sv"}B= $B::C::debug{"pv"}
ABresult
1X1
011
000
3038 }
3039 else {
3040 # If READONLY and FAKE use newSVpvn_share instead. (test 75)
3041 # XXX IsCOW forgotten here. rather use a helper is_shared_hek()
3042 0 ▶ if ($PERL510 and $sv and (($sv->FLAGS & 0x09000000) == 0x09000000)) {
Branch: 1 branch
BranchTrueFalseTotal
if ($PERL510 and $sv and ($sv->FLAGS & 150994944) == 150994944) { } 0 0 0
Condition0%0/6
$PERL510 and $sv and ($sv->FLAGS & 150994944) == 150994944
!ll&&!rl&&r
000
$PERL510 and $sv
!ll&&!rl&&r
000
MC/DC0%0/3
$PERL510 and $sv and ($sv->FLAGS & 150994944) == 150994944
$PERL510 $sv ($sv->FLAGS & 150994944) == 150994944
Truth table0%0/4
A and B and C
A= $PERL510B= $svC= ($sv->FLAGS & 150994944) == 150994944
ABCresult
0XX0
10X0
1100
1111
3043 0 ▶ warn sprintf( "Saving shared HEK %s to %s\n", cstring($pv), $dest ) if $debug{sv};
Branch: 1 branch
BranchTrueFalseTotal
if $B::C::debug{"sv"} 0 0 0
3044 0 my $hek = save_hek($pv,'',1);
3045 0 ▶ push @init, sprintf( "%s = HEK_KEY(%s);", $dest, $hek ) unless $hek eq 'NULL';
Branch: 1 branch
BranchTrueFalseTotal
unless $hek eq "NULL" 0 0 0
3046 0 ▶ if ($DEBUGGING) { # we have to bypass a wrong HE->HEK assert in hv.c
Branch: 1 branch
BranchTrueFalseTotal
if ($DEBUGGING) 0 0 0
3047 0 push @B::C::static_free, $dest;
3048 }
3049 } else {
3050 0 my $cstr = cstring($pv);
3051 0 ▶ if (!$cstr and $cstr == 0) {
Branch: 1 branch
BranchTrueFalseTotal
if (not $cstr and $cstr == 0) 0 0 0
Condition0%0/3
not $cstr and $cstr == 0
!ll&&!rl&&r
000
MC/DC0%0/2
not $cstr and $cstr == 0
not $cstr $cstr == 0
Truth table0%0/3
not(A) and B
A= not $cstrB= $cstr == 0
ABresult
0X0
100
111
3052 0 $cstr = '""';
3053 }
3054 0 ▶ if ($sv and IsCOW($sv)) { # and ($B::C::cow or IsCOW_hek($sv)))
Branch: 1 branch
BranchTrueFalseTotal
if ($sv and IsCOW($sv)) 0 0 0
Condition0%0/3
$sv and IsCOW($sv)
!ll&&!rl&&r
000
MC/DC0%0/2
$sv and IsCOW($sv)
$sv IsCOW($sv)
Truth table0%0/3
A and B
A= $svB= IsCOW($sv)
ABresult
0X0
100
111
3055 # This cannot be savepvn allocated. TODO: READONLY COW => static hek?
3056 0 ▶ if ($cstr !~ /\\000\\00\d"$/) {
Branch: 1 branch
BranchTrueFalseTotal
unless ($cstr =~ /\\000\\00\d"$/) 0 0 0
3057 0 $cstr = substr($cstr,0,-1) . '\0\001"';
3058 0 $cur += 2;
3059 }
3060 0 ▶ warn sprintf( "Saving COW PV %s to %s\n", $cstr, $dest ) if $debug{sv};
Branch: 1 branch
BranchTrueFalseTotal
if $B::C::debug{"sv"} 0 0 0
3061 0 return (sprintf( "Newx(%s, sizeof(%s)-1, char);", $dest, $cstr ),
3062 sprintf( "Copy(%s, %s, sizeof(%s)-1, char);", $cstr, $dest, $cstr ));
3063 }
3064 0 ▶ warn sprintf( "Saving PV %s to %s\n", $cstr, $dest ) if $debug{sv};
Branch: 1 branch
BranchTrueFalseTotal
if $B::C::debug{"sv"} 0 0 0
3065 0 push @init, sprintf( "%s = Perl_savepvn(aTHX_ STR_WITH_LEN(%s));", $dest, $cstr );
3066 }
3067 }
3068 0 return @init;
3069 }
3070  
3071 0 ▶sub B::PVLV::save {
Subroutine save: not called CC=14 SCAR=53.5
3072 0 my ($sv, $fullname) = @_;
3073 0 my $sym = objsym($sv);
3074 0 ▶ if (defined $sym) {
Branch: 1 branch
BranchTrueFalseTotal
if (defined $sym) 0 0 0
3075 0 ▶ if ($in_endav) {
Branch: 1 branch
BranchTrueFalseTotal
if ($in_endav) 0 0 0
3076 0 ▶ warn "in_endav: static_free without $sym\n" if $debug{av};
Branch: 1 branch
BranchTrueFalseTotal
if $B::C::debug{"av"} 0 0 0
3077 0 @B::C::static_free = grep {$_ ne $sym} @B::C::static_free;
3078 }
3079 0 return $sym;
3080 }
3081 0 my ($pvsym, $cur, $len, $pv, $static, $flags) = save_pv_or_rv ($sv, $fullname);
3082 0 my ( $lvtarg, $lvtarg_sym ); # XXX missing
3083 0 my $tmp_pvsym = $pvsym;
3084 0 ▶ if ($PERL514) {
Branch: 2 branches
BranchTrueFalseTotal
if ($PERL514) { } 0 0 0
elsif ($PERL510) { } 0 0 0
3085 0 $xpvlvsect->comment('STASH, MAGIC, CUR, LEN, GvNAME, xnv_u, TARGOFF, TARGLEN, TARG, TYPE');
3086 0 $xpvlvsect->add(
3087 sprintf("Nullhv, {0}, %u, %d, 0/*GvNAME later*/, %s, %u, %u, Nullsv, %s",
3088 $cur, $len, nvx($sv->NVX),
3089 $sv->TARGOFF, $sv->TARGLEN, cchar( $sv->TYPE ) ));
3090 0 ▶ $tmp_pvsym = 'NULL' if $tmp_pvsym =~ /^hek/ and $static; # cannot init static
Branch: 1 branch
BranchTrueFalseTotal
if $tmp_pvsym =~ /^hek/ and $static 0 0 0
Condition0%0/3
$tmp_pvsym =~ /^hek/ and $static
!ll&&!rl&&r
000
MC/DC0%0/2
$tmp_pvsym =~ /^hek/ and $static
$tmp_pvsym =~ /^hek/ $static
Truth table0%0/3
A and B
A= $tmp_pvsym =~ /^hek/B= $static
ABresult
0X0
100
111
3091 0 $svsect->add(sprintf("&xpvlv_list[%d], $u32fmt, 0x%x, {(char*)%s}",
3092 $xpvlvsect->index, $sv->REFCNT, $sv->FLAGS, $tmp_pvsym));
3093 } elsif ($PERL510) {
3094 0 $xpvlvsect->comment('xnv_u, CUR, LEN, GvNAME, MAGIC, STASH, TARGOFF, TARGLEN, TARG, TYPE');
3095 0 $xpvlvsect->add(
3096 sprintf("%s, %u, %d, 0/*GvNAME later*/, 0, Nullhv, %u, %u, Nullsv, %s",
3097 nvx($sv->NVX), $cur, $len,
3098 $sv->TARGOFF, $sv->TARGLEN, cchar( $sv->TYPE ) ));
3099 0 ▶ $svsect->add(sprintf("&xpvlv_list[%d], $u32fmt, 0x%x, {%s}",
Branch: 1 branch
BranchTrueFalseTotal
$C99 ? : 0 0 0
3100 $xpvlvsect->index, $sv->REFCNT, $flags,
3101 ($C99?".svu_pv = (char*)":"(char*)").$tmp_pvsym));
3102 } else {
3103 0 $xpvlvsect->comment('PVX, CUR, LEN, IVX, NVX, TARGOFF, TARGLEN, TARG, TYPE');
3104 0 $xpvlvsect->add(
3105 sprintf("(char*)%s, %u, %u, %s, %s, 0, 0, %u, %u, Nullsv, %s",
3106 $pvsym, $cur, $len, ivx($sv->IVX), nvx($sv->NVX),
3107 $sv->TARGOFF, $sv->TARGLEN, cchar( $sv->TYPE ) ));
3108 0 $svsect->add(sprintf("&xpvlv_list[%d], $u32fmt, 0x%x",
3109 $xpvlvsect->index, $sv->REFCNT, $flags));
3110 }
3111 0 ▶ $svsect->debug( $fullname, $sv->flagspv ) if $debug{flags};
Branch: 1 branch
BranchTrueFalseTotal
if $B::C::debug{"flags"} 0 0 0
3112 0 my $s = "sv_list[".$svsect->index."]";
3113 0 ▶ if ( !$static ) {
Branch: 2 branches
BranchTrueFalseTotal
if (not $static) { } 0 0 0
elsif ($tmp_pvsym eq 'NULL' and $pvsym =~ /^hek/) { } 0 0 0
3114 0 ▶ if ($PERL510) {
Branch: 1 branch
BranchTrueFalseTotal
if ($PERL510) { } 0 0 0
3115 0 $init->add( savepvn( "$s.sv_u.svu_pv", $pv, $sv, $cur ) );
3116 }
3117 else {
3118 0 $init->add( savepvn( sprintf( "xpvlv_list[%d].xpv_pv", $xpvlvsect->index ), $pv, $cur ) );
3119 }
3120 ▶ } elsif ($tmp_pvsym eq 'NULL' and $pvsym =~ /^hek/) {
Condition0%0/3
$tmp_pvsym eq "NULL" and $pvsym =~ /^hek/
!ll&&!rl&&r
000
MC/DC0%0/2
$tmp_pvsym eq "NULL" and $pvsym =~ /^hek/
$tmp_pvsym eq "NULL" $pvsym =~ /^hek/
Truth table0%0/3
A and B
A= $tmp_pvsym eq "NULL"B= $pvsym =~ /^hek/
ABresult
0X0
100
111
3121 0 $init->add( sprintf("%s.sv_u.svu_pv = %s.hek_key;", $s, $pvsym ));
3122 }
3123 0 $sv->save_magic($fullname);
3124 0 savesym( $sv, "&".$s );
3125 }
3126  
3127 0 ▶sub B::PVIV::save {
Subroutine save: not called CC=16 SCAR=56.1
3128 0 my ($sv, $fullname) = @_;
3129 0 my $sym = objsym($sv);
3130 0 ▶ if (defined $sym) {
Branch: 1 branch
BranchTrueFalseTotal
if (defined $sym) 0 0 0
3131 0 ▶ if ($in_endav) {
Branch: 1 branch
BranchTrueFalseTotal
if ($in_endav) 0 0 0
3132 0 ▶ warn "in_endav: static_free without $sym\n" if $debug{av};
Branch: 1 branch
BranchTrueFalseTotal
if $B::C::debug{"av"} 0 0 0
3133 0 @B::C::static_free = grep {$_ ne $sym} @B::C::static_free;
3134 }
3135 0 return $sym;
3136 }
3137 0 my ( $pvsym, $cur, $len, $pv, $static, $flags ) = save_pv_or_rv($sv, $fullname);
3138 0 my $tmp_pvsym = $pvsym;
3139 0 ▶ if ($PERL514) {
Branch: 2 branches
BranchTrueFalseTotal
if ($PERL514) { } 0 0 0
elsif ($PERL510) { } 0 0 0
3140 0 $xpvivsect->comment('STASH, MAGIC, cur, len, IVX');
3141 0 $xpvivsect->add( sprintf( "Nullhv, {0}, %u, %u, {%s}", $cur, $len, ivx($sv->IVX) ) ); # IVTYPE long
3142 0 ▶ $tmp_pvsym = 'NULL' if $tmp_pvsym =~ /^hek/ and $static; # cannot init static
Branch: 1 branch
BranchTrueFalseTotal
if $tmp_pvsym =~ /^hek/ and $static 0 0 0
Condition0%0/3
$tmp_pvsym =~ /^hek/ and $static
!ll&&!rl&&r
000
MC/DC0%0/2
$tmp_pvsym =~ /^hek/ and $static
$tmp_pvsym =~ /^hek/ $static
Truth table0%0/3
A and B
A= $tmp_pvsym =~ /^hek/B= $static
ABresult
0X0
100
111
3143 } elsif ($PERL510) {
3144 0 $xpvivsect->comment('xnv_u, cur, len, IVX');
3145 0 $xpvivsect->add( sprintf( "{0}, %u, %u, {%s}", $cur, $len, ivx($sv->IVX) ) ); # IVTYPE long
3146 } else {
3147 #$iv = 0 if $sv->FLAGS & (SVf_IOK|SVp_IOK);
3148 0 $xpvivsect->comment('PVX, cur, len, IVX');
3149 0 $xpvivsect->add( sprintf( "(char*)%s, %u, %u, %s",
3150 $pvsym, $cur, $len, ivx($sv->IVX) ) ); # IVTYPE long
3151 }
3152 0 ▶ $svsect->add(
Branch: 2 branches
BranchTrueFalseTotal
$PERL510 ? : 0 0 0
$C99 ? : 0 0 0
3153 sprintf("&xpviv_list[%d], $u32fmt, 0x%x %s",
3154 $xpvivsect->index, $sv->REFCNT, $flags,
3155 $PERL510 ? ", {".($C99?".svu_pv=":"")."(char*)$tmp_pvsym}" : '' ) );
3156 0 ▶ $svsect->debug( $fullname, $sv->flagspv ) if $debug{flags};
Branch: 1 branch
BranchTrueFalseTotal
if $B::C::debug{"flags"} 0 0 0
3157 0 my $s = "sv_list[".$svsect->index."]";
3158 0 ▶ if ( defined($pv) ) {
Branch: 1 branch
BranchTrueFalseTotal
if (defined $pv) 0 0 0
3159 0 ▶ if ( !$static ) {
Branch: 2 branches
BranchTrueFalseTotal
if (not $static) { } 0 0 0
elsif ($tmp_pvsym eq 'NULL' and $pvsym =~ /^hek/) { } 0 0 0
3160 0 ▶ if ($PERL510) {
Branch: 1 branch
BranchTrueFalseTotal
if ($PERL510) { } 0 0 0
3161 0 $init->add( savepvn( "$s.sv_u.svu_pv", $pv, $sv, $cur ) );
3162 } else {
3163 0 $init->add( savepvn( sprintf( "xpviv_list[%d].xpv_pv", $xpvivsect->index ), $pv, $cur ) );
3164 }
3165 ▶ } elsif ($tmp_pvsym eq 'NULL' and $pvsym =~ /^hek/) {
Condition0%0/3
$tmp_pvsym eq "NULL" and $pvsym =~ /^hek/
!ll&&!rl&&r
000
MC/DC0%0/2
$tmp_pvsym eq "NULL" and $pvsym =~ /^hek/
$tmp_pvsym eq "NULL" $pvsym =~ /^hek/
Truth table0%0/3
A and B
A= $tmp_pvsym eq "NULL"B= $pvsym =~ /^hek/
ABresult
0X0
100
111
3166 0 $init->add( sprintf("%s.sv_u.svu_pv = %s.hek_key;", $s, $pvsym ));
3167 }
3168 }
3169 0 savesym( $sv, "&".$s );
3170 }
3171  
3172 0 ▶sub B::PVNV::save {
Subroutine save: not called CC=26 SCAR=65.5
3173 0 my ($sv, $fullname) = @_;
3174 0 my $sym = objsym($sv);
3175 0 ▶ if (defined $sym) {
Branch: 1 branch
BranchTrueFalseTotal
if (defined $sym) 0 0 0
3176 0 ▶ if ($in_endav) {
Branch: 1 branch
BranchTrueFalseTotal
if ($in_endav) 0 0 0
3177 0 ▶ warn "in_endav: static_free without $sym\n" if $debug{av};
Branch: 1 branch
BranchTrueFalseTotal
if $B::C::debug{"av"} 0 0 0
3178 0 @B::C::static_free = grep {$_ ne $sym} @B::C::static_free;
3179 }
3180 0 return $sym;
3181 }
3182 0 my ( $pvsym, $cur, $len, $pv, $static, $flags ) = save_pv_or_rv($sv, $fullname);
3183 0 my $tmp_pvsym = $pvsym;
3184 0 my $nvx = '0.0';
3185 0 my $ivx = ivx($sv->IVX); # here must be IVX!
3186 0 ▶ if ($flags & (SVf_NOK|SVp_NOK)) {
Branch: 1 branch
BranchTrueFalseTotal
if ($flags & 8704) { } 0 0 0
3187 # it could be a double, or it could be 2 ints - union xpad_cop_seq
3188 0 $nvx = nvx($sv->NV);
3189 } else {
3190 0 ▶ if ($PERL510 and $C99 and !$PERL522) {
Branch: 2 branches
BranchTrueFalseTotal
if ($PERL510 and $C99 and not $PERL522) { } 0 0 0
elsif (not $PERL522) { } 0 0 0
Condition0%0/6
$PERL510 and $C99 and not $PERL522
!ll&&!rl&&r
000
$PERL510 and $C99
!ll&&!rl&&r
000
MC/DC0%0/3
$PERL510 and $C99 and not $PERL522
$PERL510 $C99 not $PERL522
Truth table0%0/4
A and B and not(C)
A= $PERL510B= $C99C= not $PERL522
ABCresult
0XX0
10X0
1100
1111
3191 0 $nvx = sprintf(".xpad_cop_seq.xlow = %s, .xpad_cop_seq.xhigh = %s",
3192 ivx($sv->COP_SEQ_RANGE_LOW), ivx($sv->COP_SEQ_RANGE_HIGH),
3193 );
3194 } elsif (!$PERL522) {
3195 0 $nvx = nvx($sv->NVX);
3196 }
3197 }
3198 0 ▶ if ($PERL510) {
Branch: 1 branch
BranchTrueFalseTotal
if ($PERL510) { } 0 0 0
3199 # For some time the stringification works of NVX double to two ints worked ok.
3200 0 ▶ if ($PERL514) {
Branch: 1 branch
BranchTrueFalseTotal
if ($PERL514) { } 0 0 0
3201 0 ▶ $tmp_pvsym = 'NULL' if $tmp_pvsym =~ /^hek/ and $static; # cannot init static
Branch: 1 branch
BranchTrueFalseTotal
if $tmp_pvsym =~ /^hek/ and $static 0 0 0
Condition0%0/3
$tmp_pvsym =~ /^hek/ and $static
!ll&&!rl&&r
000
MC/DC0%0/2
$tmp_pvsym =~ /^hek/ and $static
$tmp_pvsym =~ /^hek/ $static
Truth table0%0/3
A and B
A= $tmp_pvsym =~ /^hek/B= $static
ABresult
0X0
100
111
3202 0 $xpvnvsect->comment('STASH, MAGIC, cur, len, IVX, NVX');
3203 0 $xpvnvsect->add(sprintf( "Nullhv, {0}, %u, %u, {%s}, {%s}", $cur, $len, $ivx, $nvx) );
3204 } else {
3205 0 $xpvnvsect->comment('NVX, cur, len, IVX');
3206 0 $xpvnvsect->add(sprintf( "{%s}, %u, %u, {%s}", $nvx, $cur, $len, $ivx ) );
3207 }
3208 0 ▶ if (!($sv->FLAGS & (SVf_NOK|SVp_NOK)) and !$PERL522) {
Branch: 1 branch
BranchTrueFalseTotal
unless ($sv->FLAGS & 8704 or $PERL522) 0 0 0
Condition0%0/3
$sv->FLAGS & 8704 or $PERL522
l!l&&r!l&&!r
000
MC/DC0%0/2
$sv->FLAGS & 8704 or $PERL522
$sv->FLAGS & 8704 $PERL522
Truth table0%0/3
A or B
A= $sv->FLAGS & 8704B= $PERL522
ABresult
1X1
011
000
3209 0 ▶ warn "NV => run-time union xpad_cop_seq init\n" if $debug{sv};
Branch: 1 branch
BranchTrueFalseTotal
if $B::C::debug{"sv"} 0 0 0
3210 0 $init->add(sprintf("xpvnv_list[%d].xnv_u.xpad_cop_seq.xlow = %s;",
3211 $xpvnvsect->index, ivx($sv->COP_SEQ_RANGE_LOW)),
3212 # pad.c: PAD_MAX = I32_MAX (4294967295)
3213 # U suffix <= "warning: this decimal constant is unsigned only in ISO C90"
3214 sprintf("xpvnv_list[%d].xnv_u.xpad_cop_seq.xhigh = %s;",
3215 $xpvnvsect->index, ivx($sv->COP_SEQ_RANGE_HIGH)));
3216 }
3217 }
3218 else {
3219 0 $xpvnvsect->comment('PVX, cur, len, IVX, NVX');
3220 0 $xpvnvsect->add(sprintf( "(char*)%s, %u, %u, %s, %s", $pvsym, $cur, $len, $ivx, $nvx ) );
3221 }
3222 0 ▶ $svsect->add(
Branch: 2 branches
BranchTrueFalseTotal
$PERL510 ? : 0 0 0
$C99 ? : 0 0 0
3223 sprintf("&xpvnv_list[%d], $u32fmt, 0x%x %s",
3224 $xpvnvsect->index, $sv->REFCNT, $flags,
3225 $PERL510 ? ", {".($C99?".svu_pv=":"")."(char*)$tmp_pvsym}" : '' ) );
3226 0 ▶ $svsect->debug( $fullname, $sv->flagspv ) if $debug{flags};
Branch: 1 branch
BranchTrueFalseTotal
if $B::C::debug{"flags"} 0 0 0
3227 0 my $s = "sv_list[".$svsect->index."]";
3228 0 ▶ if ( defined($pv) ) {
Branch: 1 branch
BranchTrueFalseTotal
if (defined $pv) 0 0 0
3229 0 ▶ if ( !$static ) {
Branch: 2 branches
BranchTrueFalseTotal
if (not $static) { } 0 0 0
elsif ($tmp_pvsym eq 'NULL' and $pvsym =~ /^hek/) { } 0 0 0
3230 0 ▶ if ($PERL510) {
Branch: 1 branch
BranchTrueFalseTotal
if ($PERL510) { } 0 0 0
3231 0 $init->add( savepvn( "$s.sv_u.svu_pv", $pv, $sv, $cur ) );
3232 }
3233 else {
3234 0 $init->add( savepvn( sprintf( "xpvnv_list[%d].xpv_pv", $xpvnvsect->index ), $pv, $cur ) );
3235 }
3236 ▶ } elsif ($tmp_pvsym eq 'NULL' and $pvsym =~ /^hek/) {
Condition0%0/3
$tmp_pvsym eq "NULL" and $pvsym =~ /^hek/
!ll&&!rl&&r
000
MC/DC0%0/2
$tmp_pvsym eq "NULL" and $pvsym =~ /^hek/
$tmp_pvsym eq "NULL" $pvsym =~ /^hek/
Truth table0%0/3
A and B
A= $tmp_pvsym eq "NULL"B= $pvsym =~ /^hek/
ABresult
0X0
100
111
3237 0 $init->add( sprintf("%s.sv_u.svu_pv = %s.hek_key;", $s, $pvsym ));
3238 }
3239 }
3240 0 ▶ push @B::C::static_free, "&".$s if $PERL518 and $sv->FLAGS & SVs_OBJECT;
Branch: 1 branch
BranchTrueFalseTotal
if $PERL518 and $sv->FLAGS & 1048576 0 0 0
Condition0%0/3
$PERL518 and $sv->FLAGS & 1048576
!ll&&!rl&&r
000
MC/DC0%0/2
$PERL518 and $sv->FLAGS & 1048576
$PERL518 $sv->FLAGS & 1048576
Truth table0%0/3
A and B
A= $PERL518B= $sv->FLAGS & 1048576
ABresult
0X0
100
111
3241 0 savesym( $sv, "&".$s );
3242 }
3243  
3244 0 ▶sub B::BM::save {
Subroutine save: not called CC=14 SCAR=53.5
3245 0 my ($sv, $fullname) = @_;
3246 0 my $sym = objsym($sv);
3247 0 ▶ return $sym if !$PERL510 and defined $sym;
Branch: 1 branch
BranchTrueFalseTotal
if not $PERL510 and defined $sym 0 0 0
Condition0%0/3
not $PERL510 and defined $sym
!ll&&!rl&&r
000
MC/DC0%0/2
not $PERL510 and defined $sym
not $PERL510 defined $sym
Truth table0%0/3
not(A) and B
A= not $PERL510B= defined $sym
ABresult
0X0
100
111
3248 0 ▶ $sv = bless $sv, "B::BM" if $PERL510;
Branch: 1 branch
BranchTrueFalseTotal
if $PERL510 0 0 0
3249 0 my $pv = pack "a*", ( $sv->PV . "\0" . $sv->TABLE );
3250 0 my $cur = $sv->CUR;
3251 0 my $len = $cur + length($sv->TABLE) + 1;
3252 0 my $s;
3253 0 ▶ if ($PERL510) {
Branch: 1 branch
BranchTrueFalseTotal
if ($PERL510) { } 0 0 0
3254 0 ▶ warn "Saving FBM for GV $sym\n" if $debug{gv};
Branch: 1 branch
BranchTrueFalseTotal
if $B::C::debug{"gv"} 0 0 0
3255 0 $init->add( sprintf( "%s = (GV*)newSV_type(SVt_PVGV);", $sym ),
3256 sprintf( "SvFLAGS(%s) = 0x%x;", $sym, $sv->FLAGS),
3257 sprintf( "SvREFCNT(%s) = $u32fmt;", $sym, $sv->REFCNT + 1 ),
3258 sprintf( "SvPVX(%s) = %s;", $sym, cstring($pv) ),
3259 sprintf( "SvCUR_set(%s, %d);", $sym, $cur ),
3260 sprintf( "SvLEN_set(%s, %d);", $sym, $len ),
3261 sprintf( "BmRARE(%s) = %d;", $sym, $sv->RARE ),
3262 sprintf( "BmPREVIOUS(%s) = %d;", $sym, $sv->PREVIOUS ),
3263 sprintf( "BmUSEFUL(%s) = %d;", $sym, $sv->USEFUL )
3264 );
3265 } else {
3266 0 my $static;
3267 0 $xpvbmsect->comment('pvx,cur,len(+258),IVX,NVX,MAGIC,STASH,USEFUL,PREVIOUS,RARE');
3268 0 ▶ $xpvbmsect->add(
Branch: 1 branch
BranchTrueFalseTotal
defined $pv && $static ? : 0 0 0
Condition0%0/3
defined $pv and $static
!ll&&!rl&&r
000
MC/DC0%0/2
defined $pv and $static
defined $pv $static
Truth table0%0/3
A and B
A= defined $pvB= $static
ABresult
0X0
100
111
3269 sprintf("%s, %u, %u, %s, %s, 0, 0, %d, %u, 0x%x",
3270 defined($pv) && $static ? cstring($pv) : "NULL",
3271 $cur, $len, ivx($sv->IVX), nvx($sv->NVX),
3272 $sv->USEFUL, $sv->PREVIOUS, $sv->RARE
3273 ));
3274 0 $svsect->add(sprintf("&xpvbm_list[%d], $u32fmt, 0x%x",
3275 $xpvbmsect->index, $sv->REFCNT, $sv->FLAGS));
3276 0 ▶ $svsect->debug( $fullname, $sv->flagspv ) if $debug{flags};
Branch: 1 branch
BranchTrueFalseTotal
if $B::C::debug{"flags"} 0 0 0
3277 0 $s = "sv_list[".$svsect->index."]";
3278 0 ▶ if (!$static) {
Branch: 1 branch
BranchTrueFalseTotal
if (not $static) { } 0 0 0
3279 0 $init->add(savepvn( sprintf( "xpvbm_list[%d].xpv_pv", $xpvbmsect->index ), $pv, 0, $len ) );
3280 } else {
3281 0 ▶ push @B::C::static_free, $s if defined($pv) and !$in_endav;
Branch: 1 branch
BranchTrueFalseTotal
if defined $pv and not $in_endav 0 0 0
Condition0%0/3
defined $pv and not $in_endav
!ll&&!rl&&r
000
MC/DC0%0/2
defined $pv and not $in_endav
defined $pv not $in_endav
Truth table0%0/3
A and not(B)
A= defined $pvB= not $in_endav
ABresult
0X0
100
111
3282 }
3283 }
3284 # Restore possible additional magic. fbm_compile adds just 'B'.
3285 0 $sv->save_magic($fullname);
3286  
3287 0 ▶ if ($PERL510) {
Branch: 1 branch
BranchTrueFalseTotal
if ($PERL510) { } 0 0 0
3288 0 return $sym;
3289 } else {
3290 0 ▶ if ($] == 5.008009) { # XXX 5.8.9 needs more. TODO test 5.8.0 - 5.8.7
Branch: 1 branch
BranchTrueFalseTotal
if ($] == "5.008009") 0 0 0
3291 0 $init->add( sprintf( "fbm_compile(&sv_list[%d], 0);", $svsect->index ) );
3292 }
3293 # cur+len was broken on all B::C versions
3294 #$init->add(sprintf( "xpvbm_list[%d].xpv_cur = %u;", $xpvbmsect->index, $len ) );
3295 0 return savesym( $sv, "&".$s );
3296 }
3297 }
3298  
3299 0 ▶sub B::PV::save {
Subroutine save: not called CC=42 SCAR=75.0
3300 0 my ($sv, $fullname) = @_;
3301 0 my $sym = objsym($sv);
3302 0 ▶ if (defined $sym) {
Branch: 1 branch
BranchTrueFalseTotal
if (defined $sym) 0 0 0
3303 0 ▶ if ($in_endav) {
Branch: 1 branch
BranchTrueFalseTotal
if ($in_endav) 0 0 0
3304 0 ▶ warn "in_endav: static_free without $sym\n" if $debug{av};
Branch: 1 branch
BranchTrueFalseTotal
if $B::C::debug{"av"} 0 0 0
3305 0 @B::C::static_free = grep {$_ ne $sym} @B::C::static_free;
3306 }
3307 0 return $sym;
3308 }
3309 #my $flags = $sv->FLAGS;
3310 0 my ( $pvsym, $cur, $len, $pv, $static, $flags ) = save_pv_or_rv($sv, $fullname);
3311 0 ▶ my $shared_hek = $PERL510 ? (($flags & 0x09000000) == 0x09000000) : undef;
Branch: 1 branch
BranchTrueFalseTotal
$PERL510 ? : 0 0 0
3312 0 ▶ if (!$shared_hek and (IsCOW_hek($sv) or ($len==0 and $flags & SVf_IsCOW))) {
Branch: 1 branch
BranchTrueFalseTotal
if (not $shared_hek and IsCOW_hek($sv) || $len == 0 && $flags & 268435456) 0 0 0
Condition0%0/9
not $shared_hek and IsCOW_hek($sv) || $len == 0 && $flags & 268435456
!ll&&!rl&&r
000
IsCOW_hek($sv) or $len == 0 and $flags & 268435456
l!l&&r!l&&!r
000
$len == 0 and $flags & 268435456
!ll&&!rl&&r
000
MC/DC0%0/4
not $shared_hek and IsCOW_hek($sv) || $len == 0 && $flags & 268435456
not $shared_hek IsCOW_hek($sv) $len == 0 $flags & 268435456
Truth table0%0/5
not(A) and B or C and D
A= not $shared_hekB= IsCOW_hek($sv)C= $len == 0D= $flags & 268435456
ABCDresult
0XXX0
100X0
10100
11XX1
10111
3313 0 $shared_hek = 1;
3314 }
3315 0 my $tmp_pvsym = $pvsym;
3316 # $static = 0 if !($flags & SVf_ROK) and $sv->PV and $sv->PV =~ /::bootstrap$/;
3317 0 my $refcnt = $sv->REFCNT;
3318 0 my $svix;
3319 # sv_free2 problem with !SvIMMORTAL and del_SV
3320 # repro with -O0 .. -O2 for all testcases
3321 0 ▶ if ($PERL518 and $fullname && $fullname eq 'svop const') {
Branch: 1 branch
BranchTrueFalseTotal
if ($PERL518 and ($fullname and $fullname eq "svop const")) 0 0 0
Condition0%0/6
$PERL518 and ($fullname and $fullname eq "svop const")
!ll&&!rl&&r
000
$fullname and $fullname eq "svop const"
!ll&&!rl&&r
000
MC/DC0%0/3
$PERL518 and ($fullname and $fullname eq "svop const")
$PERL518 $fullname $fullname eq "svop const"
Truth table0%0/4
A and B and C
A= $PERL518B= $fullnameC= $fullname eq "svop const"
ABCresult
0XX0
10X0
1100
1111
3322 0 ▶ $refcnt = $DEBUGGING ? 1000 : 0x7fffffff;
Branch: 1 branch
BranchTrueFalseTotal
$DEBUGGING ? : 0 0 0
3323 }
3324 #if (!$shared_hek and !$B::C::cow and IsCOW($sv)) {
3325 # $flags &= ~SVf_IsCOW;
3326 # warn sprintf("turn off SVf_IsCOW %s %s %s\n", $sym, cstring($pv), $fullname)
3327 # if $debug{pv};
3328 #}
3329 0 ▶ if ($PERL510) {
Branch: 1 branch
BranchTrueFalseTotal
if ($PERL510) { } 0 0 0
3330 # static pv, do not destruct. test 13 with pv0 "3".
3331 0 ▶ if ($B::C::const_strings and !$shared_hek and $flags & SVf_READONLY and !$len) {
Branch: 1 branch
BranchTrueFalseTotal
if ($B::C::const_strings and not $shared_hek and $flags & 134217728 and not $len) 0 0 0
Condition0%0/9
$B::C::const_strings and not $shared_hek and $flags & 134217728 and not $len
!ll&&!rl&&r
000
$B::C::const_strings and not $shared_hek and $flags & 134217728
!ll&&!rl&&r
000
$B::C::const_strings and not $shared_hek
!ll&&!rl&&r
000
MC/DC0%0/4
$B::C::const_strings and not $shared_hek and $flags & 134217728 and not $len
$B::C::const_strings not $shared_hek $flags & 134217728 not $len
Truth table0%0/5
A and not(B) and C and not(D)
A= $B::C::const_stringsB= not $shared_hekC= $flags & 134217728D= not $len
ABCDresult
0XXX0
10XX0
110X0
11100
11111
3332 0 $flags &= ~0x01000000;
3333 warn sprintf("constpv turn off SVf_FAKE %s %s %s\n", $sym, cstring($pv), $fullname)
3334 0 ▶ if $debug{pv};
Branch: 1 branch
BranchTrueFalseTotal
if $B::C::debug{"pv"} 0 0 0
3335 }
3336 0 ▶ $tmp_pvsym = 'NULL' if $tmp_pvsym =~ /^hek/ and $static; # cannot init static
Branch: 1 branch
BranchTrueFalseTotal
if $tmp_pvsym =~ /^hek/ and $static 0 0 0
Condition0%0/3
$tmp_pvsym =~ /^hek/ and $static
!ll&&!rl&&r
000
MC/DC0%0/2
$tmp_pvsym =~ /^hek/ and $static
$tmp_pvsym =~ /^hek/ $static
Truth table0%0/3
A and B
A= $tmp_pvsym =~ /^hek/B= $static
ABresult
0X0
100
111
3337 0 ▶ $xpvsect->comment( $PERL514 ? "stash, magic, cur, len" : "xnv_u, cur, len");
Branch: 1 branch
BranchTrueFalseTotal
$PERL514 ? : 0 0 0
3338 0 ▶ $xpvsect->add( sprintf( "%s{0}, %u, %u", $PERL514 ? "Nullhv, " : "", $cur, $len ) );
Branch: 1 branch
BranchTrueFalseTotal
$PERL514 ? : 0 0 0
3339 0 $svsect->comment( "any, refcnt, flags, sv_u" );
3340 0 ▶ $svsect->add( sprintf( "&xpv_list[%d], $u32fmt, 0x%x, {%s}",
Branch: 2 branches
BranchTrueFalseTotal
$tmp_pvsym eq 'NULL' ? : 0 0 0
$C99 ? : 0 0 0
3341 $xpvsect->index, $refcnt, $flags,
3342 $tmp_pvsym eq 'NULL' ? '0' :
3343 ($C99?".svu_pv=(char*)":"(char*)").$pvsym ));
3344 0 $svix = $svsect->index;
3345 0 ▶ if ( defined($pv) and !$static ) {
Branch: 2 branches
BranchTrueFalseTotal
if (defined $pv and not $static) { } 0 0 0
elsif ($shared_hek and $static and $pvsym =~ /^hek/) { } 0 0 0
Condition0%0/3
defined $pv and not $static
!ll&&!rl&&r
000
MC/DC0%0/2
defined $pv and not $static
defined $pv not $static
Truth table0%0/3
A and not(B)
A= defined $pvB= not $static
ABresult
0X0
100
111
3346 0 ▶ if ($shared_hek) {
Branch: 1 branch
BranchTrueFalseTotal
if ($shared_hek) { } 0 0 0
3347 0 my $hek = save_hek($pv, $fullname, 1);
3348 0 ▶ $init->add( sprintf( "sv_list[%d].sv_u.svu_pv = HEK_KEY(%s);", $svix, $hek ))
Branch: 1 branch
BranchTrueFalseTotal
unless $hek eq "NULL" 0 0 0
3349 unless $hek eq 'NULL';
3350 } else {
3351 0 $init->add( savepvn( sprintf( "sv_list[%d].sv_u.svu_pv", $svix ), $pv, $sv, $cur ) );
3352 }
3353 ▶ } elsif ($shared_hek and $static and $pvsym =~ /^hek/) {
Condition0%0/6
$shared_hek and $static and $pvsym =~ /^hek/
!ll&&!rl&&r
000
$shared_hek and $static
!ll&&!rl&&r
000
MC/DC0%0/3
$shared_hek and $static and $pvsym =~ /^hek/
$shared_hek $static $pvsym =~ /^hek/
Truth table0%0/4
A and B and C
A= $shared_hekB= $staticC= $pvsym =~ /^hek/
ABCresult
0XX0
10X0
1100
1111
3354 0 $init->add( sprintf( "sv_list[%d].sv_u.svu_pv = %s.hek_key;", $svix, $pvsym ));
3355 }
3356 0 ▶ if ($debug{flags} and (!$ITHREADS or $PERL514) and $DEBUG_LEAKING_SCALARS) { # add sv_debug_file
Branch: 1 branch
BranchTrueFalseTotal
if ($B::C::debug{"flags"} and !$ITHREADS || $PERL514 and $DEBUG_LEAKING_SCALARS) 0 0 0
Condition0%0/9
$B::C::debug{"flags"} and !$ITHREADS || $PERL514 and $DEBUG_LEAKING_SCALARS
!ll&&!rl&&r
000
$B::C::debug{"flags"} and !$ITHREADS || $PERL514
!ll&&!rl&&r
000
not $ITHREADS or $PERL514
l!l&&r!l&&!r
000
MC/DC0%0/4
$B::C::debug{"flags"} and !$ITHREADS || $PERL514 and $DEBUG_LEAKING_SCALARS
$B::C::debug{"flags"} not $ITHREADS $PERL514 $DEBUG_LEAKING_SCALARS
Truth table0%0/6
A and not(B) or C and D
A= $B::C::debug{"flags"}B= not $ITHREADSC= $PERL514D= $DEBUG_LEAKING_SCALARS
ABCDresult
0XXX0
100X0
11X00
10100
11X11
10111
3357 0 ▶ $init->add(sprintf(qq(sv_list[%d].sv_debug_file = %s" sv_list[%d] 0x%x";),
Branch: 1 branch
BranchTrueFalseTotal
cstring($pv) eq '0' ? : 0 0 0
3358 $svix, cstring($pv) eq '0' ? '"NULL"' : cstring($pv),
3359 $svix, $flags));
3360 }
3361 }
3362 else {
3363 0 $xpvsect->comment( "pv, cur, len");
3364 0 $xpvsect->add(sprintf( "(char*)%s, %u, %u", $pvsym, $cur, $len ) );
3365 0 $svsect->comment( "any, refcnt, flags" );
3366 0 $svsect->add(sprintf( "&xpv_list[%d], $u32fmt, 0x%x",
3367 $xpvsect->index, $refcnt, $flags));
3368 0 $svix = $svsect->index;
3369 0 ▶ if ( defined($pv) and !$static ) {
Branch: 1 branch
BranchTrueFalseTotal
if (defined $pv and not $static) 0 0 0
Condition0%0/3
defined $pv and not $static
!ll&&!rl&&r
000
MC/DC0%0/2
defined $pv and not $static
defined $pv not $static
Truth table0%0/3
A and not(B)
A= defined $pvB= not $static
ABresult
0X0
100
111
3370 0 $init->add( savepvn( sprintf( "xpv_list[%d].xpv_pv", $xpvsect->index ), $pv, 0, $cur ) );
3371 }
3372 }
3373 0 my $s = "sv_list[$svix]";
3374 0 ▶ $svsect->debug( $fullname, $sv->flagspv ) if $debug{flags};
Branch: 1 branch
BranchTrueFalseTotal
if $B::C::debug{"flags"} 0 0 0
3375 0 ▶ push @B::C::static_free, "&".$s if $PERL518 and $flags & SVs_OBJECT;
Branch: 1 branch
BranchTrueFalseTotal
if $PERL518 and $flags & 1048576 0 0 0
Condition0%0/3
$PERL518 and $flags & 1048576
!ll&&!rl&&r
000
MC/DC0%0/2
$PERL518 and $flags & 1048576
$PERL518 $flags & 1048576
Truth table0%0/3
A and B
A= $PERL518B= $flags & 1048576
ABresult
0X0
100
111
3376 0 savesym( $sv, "&".$s );
3377 }
3378  
3379 # 5.18-5.20 => PV::save, since 5.22 native using this method
3380 0 ▶sub B::PADNAME::save {
Subroutine save: not called CC=16 SCAR=56.1
3381 0 my ($pn, $fullname) = @_;
3382 0 my $sym = objsym($pn);
3383 0 ▶ if (defined $sym) {
Branch: 1 branch
BranchTrueFalseTotal
if (defined $sym) 0 0 0
3384 0 ▶ if ($in_endav) {
Branch: 1 branch
BranchTrueFalseTotal
if ($in_endav) 0 0 0
3385 0 ▶ warn "in_endav: static_free without $sym\n" if $debug{av};
Branch: 1 branch
BranchTrueFalseTotal
if $B::C::debug{"av"} 0 0 0
3386 0 @B::C::static_free = grep {$_ ne $sym} @B::C::static_free;
3387 }
3388 0 return $sym;
3389 }
3390 0 my $flags = $pn->FLAGS; # U8 + FAKE if OUTER. OUTER,STATE,LVALUE,TYPED,OUR
3391 0 $flags = $flags & 0xff;
3392 0 my $gen = $pn->GEN;
3393 0 my $stash = $pn->OURSTASH;
3394 0 my $type = $pn->TYPE;
3395 0 my $sn = $stash->save($fullname);
3396 0 my $tn = $type->save($fullname);
3397 0 my $refcnt = $pn->REFCNT;
3398 0 ▶ $refcnt++ if $refcnt < 1000; # XXX protect from free, but allow SvREFCOUNT_IMMORTAL
Branch: 1 branch
BranchTrueFalseTotal
if $refcnt < 1000 0 0 0
3399 0 my $str = $pn->PVX;
3400 0 my $cstr = cstring($str); # a 5.22 padname is always utf8
3401 0 my $len = $pn->LEN;
3402 0 my $alignedlen = 8*(int($len / 8)+1); # 5 -> 8, 9 -> 16
3403 0 my $struct_name = "my_padname_with_str_".$alignedlen;
3404 0 my $pnsect = $padnamesect{$alignedlen};
3405 0 ▶ if (!$pnsect) {
Branch: 1 branch
BranchTrueFalseTotal
unless ($pnsect) 0 0 0
3406 0 my $name = "padname_$alignedlen";
3407 0 ▶ warn "dynamically created oversized $name section\n" if $verbose;
Branch: 1 branch
BranchTrueFalseTotal
if $B::C::verbose 0 0 0
3408 0 $padnamesect{$alignedlen} = new B::C::Section $name, \%symtable, 0;
3409 }
3410 0 my $ix = $pnsect->index + 1;
3411 0 my $name = $pnsect->name;
3412 0 my $s = "&".$name."_list[$ix]";
3413 # 5.22 needs the buffer to be at the end, and the pv pointing to it.
3414 # We allocate a static buffer of different sizes.
3415 0 $pnsect->comment( "pv, ourstash, type, low, high, refcnt, gen, len, flags, str");
3416 0 my $pnstr = "((char*)$s)+STRUCT_OFFSET(struct $struct_name, xpadn_str[0])";
3417 0 ▶ if (IS_MSVC) {
Branch: 1 branch
BranchTrueFalseTotal
if (&IS_MSVC()) 0 0 0
3418 0 $pnstr = sprintf("((char*)$s)+%d", $Config{ptrsize} * 3 + 5);
3419 }
3420 0 ▶ $pnsect->add( sprintf
Branch: 4 branches
BranchTrueFalseTotal
$ix || $len ? : 0 0 0
is_constant($sn) ? : 0 0 0
is_constant($tn) ? : 0 0 0
$refcnt >= 1000 ? : 0 0 0
Condition0%0/3
$ix or $len
l!l&&r!l&&!r
000
MC/DC0%0/2
$ix or $len
$ix $len
Truth table0%0/3
A or B
A= $ixB= $len
ABresult
1X1
011
000
3421 ( "%s, %s, {%s}, %u, %u, %s, %i, %u, 0x%x, %s",
3422 ($ix or $len) ? $pnstr : 'NULL',
3423 is_constant($sn) ? "(HV*)$sn" : 'Nullhv',
3424 is_constant($tn) ? "(HV*)$tn" : 'Nullhv',
3425 $pn->COP_SEQ_RANGE_LOW,
3426 $pn->COP_SEQ_RANGE_HIGH,
3427 $refcnt >= 1000 ? sprintf("0x%x", $refcnt) : "$refcnt /* +1 */",
3428 $gen, $len, $flags, $cstr));
3429 #if ( $len > 64 ) {
3430 # Houston we have a problem, need to allocate this padname dynamically. Not done yet
3431 # either dynamic or seperate structs per size MyPADNAME(5)
3432 # die "Internal Error: Overlong name of lexical variable $cstr for $fullname [#229]";
3433 #}
3434 0 ▶ $pnsect->debug( $fullname." ".$str, $pn->flagspv ) if $debug{flags};
Branch: 1 branch
BranchTrueFalseTotal
if $B::C::debug{"flags"} 0 0 0
3435 0 ▶ $init->add("SvOURSTASH_set($s, $sn);") unless is_constant($sn);
Branch: 1 branch
BranchTrueFalseTotal
unless is_constant($sn) 0 0 0
3436 0 ▶ $init->add("PadnameTYPE($s) = (HV*)$tn;") unless is_constant($tn);
Branch: 1 branch
BranchTrueFalseTotal
unless is_constant($tn) 0 0 0
3437 0 push @B::C::static_free, $s;
3438 0 savesym( $pn, $s );
3439 }
3440  
3441 0 ▶sub lexwarnsym {
Subroutine lexwarnsym: not called CC=6 SCAR=37.4
Pod undocumented
3442 0 my $pv = shift;
3443 0 ▶ if ($lexwarnsym{$pv}) {
Branch: 1 branch
BranchTrueFalseTotal
if ($lexwarnsym{$pv}) { } 0 0 0
3444 0 return @{$lexwarnsym{$pv}};
3445 } else {
3446 0 my $sym = sprintf( "lexwarn%d", $pv_index++ );
3447 0 my ($cstring, $cur, $utf8) = strlen_flags($pv);
3448 0 my $isint = 0;
3449 0 ▶ if ($] < 5.009) { # need a SV->PV
Branch: 1 branch
BranchTrueFalseTotal
if ($] < 5.009) { } 0 0 0
3450 0 $decl->add( sprintf( "Static SV* %s;", $sym ));
3451 0 $init->add( sprintf( "%s = newSVpvn(%s, %u);", $sym, $cstring, $cur));
3452 } else {
3453 # if 8 use UVSIZE, if 4 use LONGSIZE
3454 0 ▶ my $t = ($Config{sizesize} == 8) ? "J" : "L";
Branch: 1 branch
BranchTrueFalseTotal
$B::C::Config{'sizesize'} == 8 ? : 0 0 0
3455 0 my ($iv) = unpack($t, $pv); # size_t
3456 0 ▶ if ($iv >= 0 and $iv <= 2) { # specialWARN: single STRLEN
Branch: 1 branch
BranchTrueFalseTotal
if ($iv >= 0 and $iv <= 2) { } 0 0 0
Condition0%0/3
$iv >= 0 and $iv <= 2
!ll&&!rl&&r
000
MC/DC0%0/2
$iv >= 0 and $iv <= 2
$iv >= 0 $iv <= 2
Truth table0%0/3
A and B
A= $iv >= 0B= $iv <= 2
ABresult
0X0
100
111
3457 0 $decl->add( sprintf( "Static const STRLEN* %s = %d;", $sym, $iv ));
3458 0 $isint = 1;
3459 } else { # sizeof(STRLEN) + (WARNsize)
3460 0 my $packedpv = pack("$t a*",length($pv), $pv);
3461 0 $decl->add( sprintf( "Static const char %s[] = %s;", $sym, cstring($packedpv) ));
3462 }
3463 }
3464 0 $lexwarnsym{$pv} = [$sym,$isint];
3465 0 return ($sym, $isint);
3466 }
3467 }
3468  
3469 # pre vs. post 5.8.9/5.9.4 logic for lexical warnings
3470 41 @B::LEXWARN::ISA = qw(B::PV B::IV);
3471 0 ▶sub B::LEXWARN::save {
Subroutine save: not called CC=2 SCAR=17.9
3472 0 my ($sv, $fullname) = @_;
3473 0 ▶ my $pv = $] >= 5.008009 ? $sv->PV : $sv->IV;
Branch: 1 branch
BranchTrueFalseTotal
$] >= 5.008009 ? : 0 0 0
3474 0 return lexwarnsym($pv); # look for shared const int's
3475 }
3476  
3477 # post 5.11: When called from save_rv not from PMOP::save precomp
3478 0 ▶sub B::REGEXP::save {
Subroutine save: not called CC=22 SCAR=62.3
3479 0 my ($sv, $fullname) = @_;
3480 0 my $sym = objsym($sv);
3481 0 ▶ return $sym if defined $sym;
Branch: 1 branch
BranchTrueFalseTotal
if defined $sym 0 0 0
3482 0 my $pv = $sv->PV;
3483 0 my $cur = $sv->CUR;
3484 0 my $is_utf8 = $sv->FLAGS & SVf_UTF8;
3485 # construct original PV
3486 0 $pv =~ s/^(\(\?\^[adluimsx-]*\:)(.*)\)$/$2/;
3487 0 $cur -= length($sv->PV) - length($pv);
3488 0 my $cstr = cstring($pv);
3489 # The SvPV field: since df6b4bd56551f2d39f7c again the PV, before the RX
3490 0 ▶ my $rx_or_pv = (!$CPERL51 and $] < 5.027003) or ($CPERL51 and $] < 5.027002) ? 1 : 0;
Branch: 2 branches
BranchTrueFalseTotal
my $rx_or_pv = !$CPERL51 && $] < "5.027003" or $CPERL51 && $] < "5.027002" ? '???' : '???' 0 0 0
$CPERL51 && $] < 5.027002 ? : 0 0 0
Condition0%0/6
!$CPERL51 && $] < 5.027003
!ll&&!rl&&r
000
$CPERL51 and $] < "5.027002"
!ll&&!rl&&r
000
MC/DC0%0/2
!$CPERL51 && $] < 5.027003
!$CPERL51 $] < 5.027003
MC/DC0%0/2
$CPERL51 and $] < "5.027002"
$CPERL51 $] < "5.027002"
Truth table0%0/3
not(A) && B
A= !$CPERL51B= $] < 5.027003
ABresult
0X0
100
111
Truth table0%0/3
A and B
A= $CPERL51B= $] < "5.027002"
ABresult
0X0
100
111
3491 # Unfortunately this XPV is needed temp. Later replaced by struct regexp.
3492 0 ▶ $xpvsect->add(sprintf("%s{0}, %u, %u", $PERL514 ? "Nullhv, " : "", $cur, 0 ) );
Branch: 1 branch
BranchTrueFalseTotal
$PERL514 ? : 0 0 0
3493 0 ▶ $svsect->add(sprintf("&xpv_list[%d], $u32fmt, 0x%x, {%s}",
Branch: 1 branch
BranchTrueFalseTotal
$] > 5.017006 ? : 0 0 0
3494 $xpvsect->index, $sv->REFCNT, $sv->FLAGS, $] > 5.017006 ? "NULL" : $cstr));
3495 0 my $ix = $svsect->index;
3496 0 ▶ warn "Saving RX $cstr to sv_list[$ix]\n" if $debug{rx} or $debug{sv};
Branch: 1 branch
BranchTrueFalseTotal
if $B::C::debug{"rx"} or $B::C::debug{"sv"} 0 0 0
Condition0%0/3
$B::C::debug{"rx"} or $B::C::debug{"sv"}
l!l&&r!l&&!r
000
MC/DC0%0/2
$B::C::debug{"rx"} or $B::C::debug{"sv"}
$B::C::debug{"rx"} $B::C::debug{"sv"}
Truth table0%0/3
A or B
A= $B::C::debug{"rx"}B= $B::C::debug{"sv"}
ABresult
1X1
011
000
3497 0 my $initpm = $init;
3498 0 ▶ if ($] > 5.011) {
Branch: 1 branch
BranchTrueFalseTotal
if ($] > "5.011") 0 0 0
3499 0 ▶ my $pmflags = $PERL522 ? $sv->compflags : $sv->EXTFLAGS;
Branch: 1 branch
BranchTrueFalseTotal
$PERL522 ? : 0 0 0
3500 0 ▶ $initpm = $init1 if re_does_swash($cstr, $pmflags);
Branch: 1 branch
BranchTrueFalseTotal
if re_does_swash($cstr, $pmflags) 0 0 0
3501 0 ▶ if ($PERL518 and $sv->EXTFLAGS & RXf_EVAL_SEEN) {
Branch: 1 branch
BranchTrueFalseTotal
if ($PERL518 and $sv->EXTFLAGS & 131072) 0 0 0
Condition0%0/3
$PERL518 and $sv->EXTFLAGS & 131072
!ll&&!rl&&r
000
MC/DC0%0/2
$PERL518 and $sv->EXTFLAGS & 131072
$PERL518 $sv->EXTFLAGS & 131072
Truth table0%0/3
A and B
A= $PERL518B= $sv->EXTFLAGS & 131072
ABresult
0X0
100
111
3502 0 $initpm->add("PL_hints |= HINT_RE_EVAL;");
3503 }
3504 0 ▶ $initpm->add("{",
Branch: 2 branches
BranchTrueFalseTotal
!$rx_or_pv && $sv->FLAGS & 13 ? : 0 0 0
$] < 5.017006 ? : 0 0 0
Condition0%0/3
not $rx_or_pv and $sv->FLAGS & 13
!ll&&!rl&&r
000
MC/DC0%0/2
not $rx_or_pv and $sv->FLAGS & 13
not $rx_or_pv $sv->FLAGS & 13
Truth table0%0/3
not(A) and B
A= not $rx_or_pvB= $sv->FLAGS & 13
ABresult
0X0
100
111
3505 sprintf(" SV* sv = newSVpvn_flags(%s, %d, %d);", $cstr, $cur, $is_utf8),
3506 # need pv and extflags
3507 sprintf(" REGEXP *re = CALLREGCOMP(sv, 0x%x);", $pmflags),
3508 # replace sv_any->XPV with struct regexp or pv.
3509 ((!$rx_or_pv and $sv->FLAGS & SVt_PVLV)
3510 ? " Copy(re, &sv_list[$ix], sizeof(REGEXP), char);"
3511 : " struct regexp *rx = (struct regexp *)SvANY(re);\n\t"
3512 . ($] < 5.017006
3513 ? " SvANY(&sv_list[$ix]) = rx;"
3514 : " SvANY(&sv_list[$ix]) = (&sv_list[$ix])->sv_u.svu_rx = rx;")),
3515 "}");
3516 0 ▶ if ($PERL518 and $sv->EXTFLAGS & RXf_EVAL_SEEN) {
Branch: 1 branch
BranchTrueFalseTotal
if ($PERL518 and $sv->EXTFLAGS & 131072) 0 0 0
Condition0%0/3
$PERL518 and $sv->EXTFLAGS & 131072
!ll&&!rl&&r
000
MC/DC0%0/2
$PERL518 and $sv->EXTFLAGS & 131072
$PERL518 $sv->EXTFLAGS & 131072
Truth table0%0/3
A and B
A= $PERL518B= $sv->EXTFLAGS & 131072
ABresult
0X0
100
111
3517 0 $initpm->add("PL_hints &= ~HINT_RE_EVAL;");
3518 }
3519 }
3520 0 ▶ if ($] < 5.017006) {
Branch: 1 branch
BranchTrueFalseTotal
if ($] < "5.017006") 0 0 0
3521 # since 5.17.6 the SvLEN stores RX_WRAPPED(rx)
3522 0 $init->add(sprintf("SvCUR(&sv_list[%d]) = %d;", $ix, $cur),
3523 "SvLEN(&sv_list[$ix]) = 0;");
3524 }
3525 0 ▶ $svsect->debug( $fullname, $sv->flagspv ) if $debug{flags};
Branch: 1 branch
BranchTrueFalseTotal
if $B::C::debug{"flags"} 0 0 0
3526 0 $sym = savesym( $sv, sprintf( "&sv_list[%d]", $ix ) );
3527 0 $sv->save_magic($fullname);
3528 0 return $sym;
3529 }
3530  
3531 0 ▶sub save_remap {
Subroutine save_remap: not called CC=3 SCAR=24.8
Pod undocumented
3532 0 my ($key, $pkg, $name, $ivx, $mandatory) = @_;
3533 0 my $id = $xpvmgsect->index + 1;
3534 #my $svid = $svsect->index + 1;
3535 0 ▶ warn "init remap for $key\: $name $ivx in xpvmg_list[$id]\n" if $verbose;
Branch: 1 branch
BranchTrueFalseTotal
if $B::C::verbose 0 0 0
3536 0 my $props = { NAME => $name, ID => $id, MANDATORY => $mandatory };
3537 0 ▶ $init2_remap{$key}{MG} = [] unless $init2_remap{$key}{'MG'};
Branch: 1 branch
BranchTrueFalseTotal
unless $init2_remap{$key}{"MG"} 0 0 0
3538 0 push @{$init2_remap{$key}{MG}}, $props;
3539 }
3540  
3541 0 ▶sub patch_dlsym {
Subroutine patch_dlsym: not called CC=47 SCAR=77.2
Pod undocumented
3542 0 my ($sv, $fullname, $ivx) = @_;
3543 0 my $pkg = '';
3544 0 ▶ if (ref($sv) eq 'B::PVMG') {
Branch: 1 branch
BranchTrueFalseTotal
if (ref $sv eq "B::PVMG") 0 0 0
3545 0 my $stash = $sv->SvSTASH;
3546 0 ▶ $pkg = $stash->can('NAME') ? $stash->NAME : '';
Branch: 1 branch
BranchTrueFalseTotal
$stash->can('NAME') ? : 0 0 0
3547 }
3548 0 ▶ my $name = $sv->FLAGS & SVp_POK ? $sv->PVX : "";
Branch: 1 branch
BranchTrueFalseTotal
$sv->FLAGS & 16384 ? : 0 0 0
3549 0 my $ivx_s = $ivx;
3550 0 $ivx_s =~ s/U?L?$//g;
3551 0 my $ivxhex = sprintf("0x%x", $ivx_s);
3552 # Encode RT #94221
3553 0 ▶ if ($name =~ /encoding$/ and $name =~ /^(ascii|ascii_ctrl|iso8859_1|null)/ and $Encode::VERSION eq '2.58') {
Branch: 5 branches
BranchTrueFalseTotal
if ($name =~ /encoding$/ and $name =~ /^(ascii|ascii_ctrl|iso8859_1|null)/ and $Encode::VERSION eq '2.58') { } 0 0 0
elsif ($pkg eq 'Encode::XS') { } 0 0 0
elsif ($Encode::VERSION ge '2.58' and &Encode::find_encoding($name)) { } 0 0 0
elsif (defined $Net::DNS::VERSION and $Net::DNS::VERSION =~ /^0\.(6[789]|7[1234])/) { } 0 0 0
elsif ($pkg eq 'Net::LibIDN') { } 0 0 0
Condition0%0/6
$name =~ /encoding$/ and $name =~ /^(ascii|ascii_ctrl|iso8859_1|null)/ and $Encode::VERSION eq "2.58"
!ll&&!rl&&r
000
$name =~ /encoding$/ and $name =~ /^(ascii|ascii_ctrl|iso8859_1|null)/
!ll&&!rl&&r
000
MC/DC0%0/3
$name =~ /encoding$/ and $name =~ /^(ascii|ascii_ctrl|iso8859_1|null)/ and $Encode::VERSION eq "2.58"
$name =~ /encoding$/ $name =~ /^(ascii|ascii_ctrl|iso8859_1|null)/ $Encode::VERSION eq "2.58"
Truth table0%0/4
A and B and C
A= $name =~ /encoding$/B= $name =~ /^(ascii|ascii_ctrl|iso8859_1|null)/C= $Encode::VERSION eq "2.58"
ABCresult
0XX0
10X0
1100
1111
3554 0 $name =~ s/-/_/g;
3555 0 ▶ $pkg = 'Encode' if $pkg eq 'Encode::XS'; # TODO foreign classes
Branch: 1 branch
BranchTrueFalseTotal
if $pkg eq "Encode::XS" 0 0 0
3556 0 ▶ mark_package($pkg) if $fullname eq '(unknown)' and $ITHREADS;
Branch: 1 branch
BranchTrueFalseTotal
if $fullname eq "(unknown)" and $ITHREADS 0 0 0
Condition0%0/3
$fullname eq "(unknown)" and $ITHREADS
!ll&&!rl&&r
000
MC/DC0%0/2
$fullname eq "(unknown)" and $ITHREADS
$fullname eq "(unknown)" $ITHREADS
Truth table0%0/3
A and B
A= $fullname eq "(unknown)"B= $ITHREADS
ABresult
0X0
100
111
3557 0 ▶ warn "$pkg $Encode::VERSION with remap support for $name\n" if $verbose;
Branch: 1 branch
BranchTrueFalseTotal
if $B::C::verbose 0 0 0
3558 }
3559 elsif ($pkg eq 'Encode::XS') {
3560 0 $pkg = 'Encode';
3561 0 ▶ if ($fullname eq 'Encode::Encoding{iso-8859-1}') {
Branch: 4 branches
BranchTrueFalseTotal
if ($fullname eq 'Encode::Encoding{iso-8859-1}') { } 0 0 0
elsif ($fullname eq 'Encode::Encoding{null}') { } 0 0 0
elsif ($fullname eq 'Encode::Encoding{ascii-ctrl}') { } 0 0 0
elsif ($fullname eq 'Encode::Encoding{ascii}') { } 0 0 0
3562 0 $name = "iso8859_1_encoding";
3563 }
3564 elsif ($fullname eq 'Encode::Encoding{null}') {
3565 0 $name = "null_encoding";
3566 }
3567 elsif ($fullname eq 'Encode::Encoding{ascii-ctrl}') {
3568 0 $name = "ascii_ctrl_encoding";
3569 }
3570 elsif ($fullname eq 'Encode::Encoding{ascii}') {
3571 0 $name = "ascii_encoding";
3572 }
3573  
3574 0 ▶ if ($name and $name =~ /^(ascii|ascii_ctrl|iso8859_1|null)/ and $Encode::VERSION gt '2.58') {
Branch: 1 branch
BranchTrueFalseTotal
if ($name and $name =~ /^(ascii|ascii_ctrl|iso8859_1|null)/ and $Encode::VERSION gt '2.58') { } 0 0 0
Condition0%0/6
$name and $name =~ /^(ascii|ascii_ctrl|iso8859_1|null)/ and $Encode::VERSION gt "2.58"
!ll&&!rl&&r
000
$name and $name =~ /^(ascii|ascii_ctrl|iso8859_1|null)/
!ll&&!rl&&r
000
MC/DC0%0/3
$name and $name =~ /^(ascii|ascii_ctrl|iso8859_1|null)/ and $Encode::VERSION gt "2.58"
$name $name =~ /^(ascii|ascii_ctrl|iso8859_1|null)/ $Encode::VERSION gt "2.58"
Truth table0%0/4
A and B and C
A= $nameB= $name =~ /^(ascii|ascii_ctrl|iso8859_1|null)/C= $Encode::VERSION gt "2.58"
ABCresult
0XX0
10X0
1100
1111
3575 0 my $enc = Encode::find_encoding($name);
3576 0 ▶ $name .= "_encoding" unless $name =~ /_encoding$/;
Branch: 1 branch
BranchTrueFalseTotal
unless $name =~ /_encoding$/ 0 0 0
3577 0 $name =~ s/-/_/g;
3578 0 ▶ warn "$pkg $Encode::VERSION with remap support for $name (find 1)\n" if $verbose;
Branch: 1 branch
BranchTrueFalseTotal
if $B::C::verbose 0 0 0
3579 0 mark_package($pkg);
3580 0 ▶ if ($pkg ne 'Encode') {
Branch: 1 branch
BranchTrueFalseTotal
if ($pkg ne "Encode") 0 0 0
3581 0 svref_2object( \&{"$pkg\::bootstrap"} )->save;
3582 0 mark_package('Encode');
3583 }
3584 }
3585 else {
3586 0 for my $n (Encode::encodings()) { # >=5.16 constsub without name
3587 0 my $enc = Encode::find_encoding($n);
3588 0 ▶ if ($enc and ref($enc) ne 'Encode::XS') { # resolve alias such as Encode::JP::JIS7=HASH(0x292a9d0)
Branch: 1 branch
BranchTrueFalseTotal
if ($enc and ref $enc ne "Encode::XS") 0 0 0
Condition0%0/3
$enc and ref $enc ne "Encode::XS"
!ll&&!rl&&r
000
MC/DC0%0/2
$enc and ref $enc ne "Encode::XS"
$enc ref $enc ne "Encode::XS"
Truth table0%0/3
A and B
A= $encB= ref $enc ne "Encode::XS"
ABresult
0X0
100
111
3589 0 $pkg = ref($enc);
3590 0 $pkg =~ s/^(Encode::\w+)(::.*)/$1/; # collapse to the @dl_module name
3591 0 $enc = Encode->find_alias($n);
3592 }
3593 0 ▶ if ($enc and ref($enc) eq 'Encode::XS' and $sv->IVX == $$enc) {
Branch: 1 branch
BranchTrueFalseTotal
if ($enc and ref $enc eq "Encode::XS" and $sv->IVX == $$enc) 0 0 0
Condition0%0/6
$enc and ref $enc eq "Encode::XS" and $sv->IVX == $$enc
!ll&&!rl&&r
000
$enc and ref $enc eq "Encode::XS"
!ll&&!rl&&r
000
MC/DC0%0/3
$enc and ref $enc eq "Encode::XS" and $sv->IVX == $$enc
$enc ref $enc eq "Encode::XS" $sv->IVX == $$enc
Truth table0%0/4
A and B and C
A= $encB= ref $enc eq "Encode::XS"C= $sv->IVX == $$enc
ABCresult
0XX0
10X0
1100
1111
3594 0 $name = $n;
3595 0 $name =~ s/-/_/g;
3596 0 ▶ $name .= "_encoding" if $name !~ /_encoding$/;
Branch: 1 branch
BranchTrueFalseTotal
unless $name =~ /_encoding$/ 0 0 0
3597 0 mark_package($pkg) ;
3598 0 ▶ if ($pkg ne 'Encode') {
Branch: 1 branch
BranchTrueFalseTotal
if ($pkg ne "Encode") 0 0 0
3599 0 svref_2object( \&{"$pkg\::bootstrap"} )->save;
3600 0 mark_package('Encode');
3601 }
3602 0 last;
3603 }
3604 }
3605 0 ▶ if ($name) {
Branch: 1 branch
BranchTrueFalseTotal
if ($name) { } 0 0 0
3606 0 ▶ warn "$pkg $Encode::VERSION remap found for constant $name\n" if $verbose;
Branch: 1 branch
BranchTrueFalseTotal
if $B::C::verbose 0 0 0
3607 } else {
3608 0 warn "Warning: Possible missing remap for compile-time XS symbol in $pkg $fullname $ivxhex [#305]\n";
3609 }
3610 }
3611 }
3612 # Encode-2.59 uses a different name without _encoding
3613 ▶ elsif ($Encode::VERSION ge '2.58' and Encode::find_encoding($name)) {
Condition0%0/3
$Encode::VERSION ge "2.58" and &Encode::find_encoding($name)
!ll&&!rl&&r
000
MC/DC0%0/2
$Encode::VERSION ge "2.58" and &Encode::find_encoding($name)
$Encode::VERSION ge "2.58" &Encode::find_encoding($name)
Truth table0%0/3
A and B
A= $Encode::VERSION ge "2.58"B= &Encode::find_encoding($name)
ABresult
0X0
100
111
3614 0 my $enc = Encode::find_encoding($name);
3615 0 ▶ $pkg = ref($enc) if ref($enc) ne 'Encode::XS';
Branch: 1 branch
BranchTrueFalseTotal
if ref $enc ne "Encode::XS" 0 0 0
3616 0 $name .= "_encoding";
3617 0 $name =~ s/-/_/g;
3618 0 ▶ $pkg = 'Encode' unless $pkg;
Branch: 1 branch
BranchTrueFalseTotal
unless $pkg 0 0 0
3619 0 ▶ warn "$pkg $Encode::VERSION with remap support for $name (find 2)\n" if $verbose;
Branch: 1 branch
BranchTrueFalseTotal
if $B::C::verbose 0 0 0
3620 }
3621 # now that is a weak heuristic, which misses #305
3622 ▶ elsif (defined $Net::DNS::VERSION
Condition0%0/3
defined $Net::DNS::VERSION and $Net::DNS::VERSION =~ /^0\.(6[789]|7[1234])/
!ll&&!rl&&r
000
MC/DC0%0/2
defined $Net::DNS::VERSION and $Net::DNS::VERSION =~ /^0\.(6[789]|7[1234])/
defined $Net::DNS::VERSION $Net::DNS::VERSION =~ /^0\.(6[789]|7[1234])/
Truth table0%0/3
A and B
A= defined $Net::DNS::VERSIONB= $Net::DNS::VERSION =~ /^0\.(6[789]|7[1234])/
ABresult
0X0
100
111
3623 and $Net::DNS::VERSION =~ /^0\.(6[789]|7[1234])/) {
3624 0 ▶ if ($fullname eq 'svop const') {
Branch: 1 branch
BranchTrueFalseTotal
if ($fullname eq "svop const") 0 0 0
3625 0 $name = "ascii_encoding";
3626 0 ▶ $pkg = 'Encode' unless $pkg;
Branch: 1 branch
BranchTrueFalseTotal
unless $pkg 0 0 0
3627 0 warn "Warning: Patch Net::DNS external XS symbol $pkg\::$name $ivxhex [RT #94069]\n";
3628 }
3629 }
3630 elsif ($pkg eq 'Net::LibIDN') {
3631 0 $name = "idn_to_ascii"; # ??
3632 }
3633  
3634 # new API (only Encode so far)
3635 0 ▶ if ($pkg and $name and $name =~ /^[a-zA-Z_0-9-]+$/) { # valid symbol name
Branch: 1 branch
BranchTrueFalseTotal
if ($pkg and $name and $name =~ /^[a-zA-Z_0-9-]+$/) { } 0 0 0
Condition0%0/6
$pkg and $name and $name =~ /^[a-zA-Z_0-9-]+$/
!ll&&!rl&&r
000
$pkg and $name
!ll&&!rl&&r
000
MC/DC0%0/3
$pkg and $name and $name =~ /^[a-zA-Z_0-9-]+$/
$pkg $name $name =~ /^[a-zA-Z_0-9-]+$/
Truth table0%0/4
A and B and C
A= $pkgB= $nameC= $name =~ /^[a-zA-Z_0-9-]+$/
ABCresult
0XX0
10X0
1100
1111
3636 0 ▶ warn "Remap IOK|POK $pkg with $name\n" if $verbose;
Branch: 1 branch
BranchTrueFalseTotal
if $B::C::verbose 0 0 0
3637 0 save_remap($pkg, $pkg, $name, $ivxhex, 0);
3638 0 $ivx = "0UL /* $ivxhex => $name */";
3639 0 ▶ mark_package($pkg, 1) if $fullname =~ /^(svop const|padop)/;
Branch: 1 branch
BranchTrueFalseTotal
if $fullname =~ /^(svop const|padop)/ 0 0 0
3640 }
3641 else {
3642 0 warn "Warning: Possible missing remap for compile-time XS symbol in $pkg $fullname $ivxhex [#305]\n";
3643 }
3644 0 return $ivx;
3645 }
3646  
3647 0 ▶sub B::PVMG::save {
Subroutine save: not called CC=27 SCAR=66.3
3648 0 my ($sv, $fullname) = @_;
3649 0 my $sym = objsym($sv);
3650 0 ▶ if (defined $sym) {
Branch: 1 branch
BranchTrueFalseTotal
if (defined $sym) 0 0 0
3651 0 ▶ if ($in_endav) {
Branch: 1 branch
BranchTrueFalseTotal
if ($in_endav) 0 0 0
3652 0 ▶ warn "in_endav: static_free without $sym\n" if $debug{av};
Branch: 1 branch
BranchTrueFalseTotal
if $B::C::debug{"av"} 0 0 0
3653 0 @B::C::static_free = grep {$_ ne $sym} @B::C::static_free;
3654 }
3655 0 return $sym;
3656 }
3657 0 my ( $pvsym, $cur, $len, $pv, $static, $flags ) = save_pv_or_rv($sv, $fullname);
3658 #warn sprintf( "PVMG %s (0x%x) $pvsym, $len, $cur, $pv\n", $sym, $$sv ) if $debug{mg};
3659  
3660 0 my ($ivx,$nvx);
3661 # since 5.11 REGEXP isa PVMG, but has no IVX and NVX methods
3662 0 ▶ if ($] >= 5.011 and ref($sv) eq 'B::REGEXP') {
Branch: 1 branch
BranchTrueFalseTotal
if ($] >= 5.011 and ref $sv eq 'B::REGEXP') { } 0 0 0
Condition0%0/3
$] >= "5.011" and ref $sv eq "B::REGEXP"
!ll&&!rl&&r
000
MC/DC0%0/2
$] >= "5.011" and ref $sv eq "B::REGEXP"
$] >= "5.011" ref $sv eq "B::REGEXP"
Truth table0%0/3
A and B
A= $] >= "5.011"B= ref $sv eq "B::REGEXP"
ABresult
0X0
100
111
3663 0 return B::REGEXP::save($sv, $fullname);
3664 }
3665 else {
3666 0 $ivx = ivx($sv->IVX); # XXX How to detect HEK* namehek?
3667 0 $nvx = nvx($sv->NVX); # it cannot be xnv_u.xgv_stash ptr (BTW set by GvSTASH later)
3668  
3669 # See #305 Encode::XS: XS objects are often stored as SvIV(SvRV(obj)). The real
3670 # address needs to be patched after the XS object is initialized.
3671 # But how detect them properly?
3672 # Detect ptr to extern symbol in shared library and remap it in init2
3673 # Safe and mandatory currently only Net-DNS-0.67 - 0.74.
3674 # svop const or pad OBJECT,IOK
3675 0 ▶ if (((!$ITHREADS
Branch: 1 branch
BranchTrueFalseTotal
if (!$ITHREADS && $fullname && $fullname =~ /^svop const|^padop|^Encode::Encoding| :pad\[1\]/ || $ITHREADS and $sv->IVX > 65536 and ref $sv->SvSTASH ne "B::SPECIAL") 0 0 0
Condition0%0/15
!$ITHREADS && $fullname && $fullname =~ /^svop const|^padop|^Encode::Encoding| :pad\[1\]/ || $ITHREADS and $sv->IVX > 65536 and ref $sv->SvSTASH ne "B::SPECIAL"
!ll&&!rl&&r
000
!$ITHREADS && $fullname && $fullname =~ /^svop const|^padop|^Encode::Encoding| :pad\[1\]/ || $ITHREADS and $sv->IVX > 65536
!ll&&!rl&&r
000
not $ITHREADS and $fullname and $fullname =~ /^svop const|^padop|^Encode::Encoding| :pad\[1\]/ or $ITHREADS
l!l&&r!l&&!r
000
not $ITHREADS and $fullname and $fullname =~ /^svop const|^padop|^Encode::Encoding| :pad\[1\]/
!ll&&!rl&&r
000
not $ITHREADS and $fullname
!ll&&!rl&&r
000
MC/DC0%0/6
!$ITHREADS && $fullname && $fullname =~ /^svop const|^padop|^Encode::Encoding| :pad\[1\]/ || $ITHREADS and $sv->IVX > 65536 and ref $sv->SvSTASH ne "B::SPECIAL"
not $ITHREADS $fullname $fullname =~ /^svop const|^padop|^Encode::Encoding| :pad\[1\]/ $ITHREADS $sv->IVX > 65536 ref $sv->SvSTASH ne "B::SPECIAL"
Truth table0%0/15
not(A) and B and C or D and E and F
A= not $ITHREADSB= $fullnameC= $fullname =~ /^svop const|^padop|^Encode::Encoding| :pad\[1\]/D= $ITHREADSE= $sv->IVX > 65536F= ref $sv->SvSTASH ne "B::SPECIAL"
ABCDEFresult
0XX0XX0
10X0XX0
1100XX0
111X0X0
0XX10X0
10X10X0
11010X0
111X100
0XX1100
10X1100
1101100
111X111
0XX1111
10X1111
1101111
3676 and $fullname
3677 and $fullname =~ /^svop const|^padop|^Encode::Encoding| :pad\[1\]/)
3678 or $ITHREADS)
3679 and $sv->IVX > LOWEST_IMAGEBASE # some crazy heuristic for a sharedlibrary ptr in .data (> image_base)
3680 and ref($sv->SvSTASH) ne 'B::SPECIAL')
3681 {
3682 0 $ivx = patch_dlsym($sv, $fullname, $ivx);
3683 }
3684 }
3685  
3686 0 my $tmp_pvsym = $pvsym;
3687 0 ▶ if ($PERL510) {
Branch: 1 branch
BranchTrueFalseTotal
if ($PERL510) { } 0 0 0
3688 0 ▶ if ($sv->FLAGS & SVf_ROK) { # sv => sv->RV cannot be initialized static.
Branch: 1 branch
BranchTrueFalseTotal
if ($sv->FLAGS & 2048) 0 0 0
3689 0 ▶ $init->add(sprintf("SvRV_set(&sv_list[%d], (SV*)%s);", $svsect->index+1, $pvsym))
Branch: 1 branch
BranchTrueFalseTotal
if $pvsym ne "" 0 0 0
3690 if $pvsym ne '';
3691 0 $pvsym = 'NULL';
3692 0 $static = 1;
3693 }
3694 0 ▶ if ($PERL514) {
Branch: 1 branch
BranchTrueFalseTotal
if ($PERL514) { } 0 0 0
3695 0 ▶ $tmp_pvsym = 'NULL' if $tmp_pvsym =~ /^hek/ and $static; # cannot init static
Branch: 1 branch
BranchTrueFalseTotal
if $tmp_pvsym =~ /^hek/ and $static 0 0 0
Condition0%0/3
$tmp_pvsym =~ /^hek/ and $static
!ll&&!rl&&r
000
MC/DC0%0/2
$tmp_pvsym =~ /^hek/ and $static
$tmp_pvsym =~ /^hek/ $static
Truth table0%0/3
A and B
A= $tmp_pvsym =~ /^hek/B= $static
ABresult
0X0
100
111
3696 0 $xpvmgsect->comment("STASH, MAGIC, cur, len, xiv_u, xnv_u");
3697 0 $xpvmgsect->add(sprintf("Nullhv, {0}, %u, %u, {%s}, {%s}",
3698 $cur, $len, $ivx, $nvx));
3699 } else {
3700 0 $xpvmgsect->comment("xnv_u, cur, len, xiv_u, xmg_u, xmg_stash");
3701 0 $xpvmgsect->add(sprintf("{%s}, %u, %u, {%s}, {0}, Nullhv",
3702 $nvx, $cur, $len, $ivx));
3703 }
3704 0 ▶ $svsect->add(sprintf("&xpvmg_list[%d], $u32fmt, 0x%x, {%s}",
Branch: 2 branches
BranchTrueFalseTotal
$tmp_pvsym eq 'NULL' ? : 0 0 0
$C99 ? : 0 0 0
3705 $xpvmgsect->index, $sv->REFCNT, $flags,
3706 $tmp_pvsym eq 'NULL' ? '0' :
3707 ($C99?".svu_pv=(char*)":"(char*)").$tmp_pvsym));
3708 }
3709 else {
3710 0 ▶ if ($pvsym =~ /PL_sv_undef/ and $ITHREADS) {
Branch: 1 branch
BranchTrueFalseTotal
if ($pvsym =~ /PL_sv_undef/ and $ITHREADS) 0 0 0
Condition0%0/3
$pvsym =~ /PL_sv_undef/ and $ITHREADS
!ll&&!rl&&r
000
MC/DC0%0/2
$pvsym =~ /PL_sv_undef/ and $ITHREADS
$pvsym =~ /PL_sv_undef/ $ITHREADS
Truth table0%0/3
A and B
A= $pvsym =~ /PL_sv_undef/B= $ITHREADS
ABresult
0X0
100
111
3711 0 $pvsym = 'NULL'; # Moose 5.8.9d
3712 }
3713 0 $xpvmgsect->add(sprintf("(char*)%s, %u, %u, %s, %s, 0, 0",
3714 $pvsym, $cur, $len, $ivx, $nvx));
3715 0 $svsect->add(sprintf("&xpvmg_list[%d], $u32fmt, 0x%x",
3716 $xpvmgsect->index, $sv->REFCNT, $flags));
3717 }
3718 0 ▶ $svsect->debug( $fullname, $sv->flagspv ) if $debug{flags};
Branch: 1 branch
BranchTrueFalseTotal
if $B::C::debug{"flags"} 0 0 0
3719 0 my $s = "sv_list[".$svsect->index."]";
3720 0 ▶ if ( !$static ) { # do not overwrite RV slot (#273)
Branch: 2 branches
BranchTrueFalseTotal
if (not $static) { } 0 0 0
elsif ($tmp_pvsym eq 'NULL' and $pvsym =~ /^hek/) { } 0 0 0
3721 # XXX comppadnames need &PL_sv_undef instead of 0 (?? which testcase?)
3722 0 ▶ if ($PERL510) {
Branch: 1 branch
BranchTrueFalseTotal
if ($PERL510) { } 0 0 0
3723 0 $init->add( savepvn( "$s.sv_u.svu_pv", $pv, $sv, $cur ) );
3724 } else {
3725 0 $init->add( savepvn( sprintf( "xpvmg_list[%d].xpv_pv", $xpvmgsect->index ),
3726 $pv, $sv, $cur ) );
3727 }
3728 ▶ } elsif ($tmp_pvsym eq 'NULL' and $pvsym =~ /^hek/) {
Condition0%0/3
$tmp_pvsym eq "NULL" and $pvsym =~ /^hek/
!ll&&!rl&&r
000
MC/DC0%0/2
$tmp_pvsym eq "NULL" and $pvsym =~ /^hek/
$tmp_pvsym eq "NULL" $pvsym =~ /^hek/
Truth table0%0/3
A and B
A= $tmp_pvsym eq "NULL"B= $pvsym =~ /^hek/
ABresult
0X0
100
111
3729 0 $init->add( sprintf("%s.sv_u.svu_pv = %s.hek_key;", $s, $pvsym ));
3730 }
3731 0 $sym = savesym( $sv, "&".$s );
3732 0 $sv->save_magic($fullname);
3733 0 return $sym;
3734 }
3735  
3736 # mark threads::shared to be xs-loaded
3737 0 ▶sub mark_threads {
Subroutine mark_threads: not called CC=7 SCAR=40.3
Pod undocumented
3738 0 ▶ if ( $INC{'threads.pm'} ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($INC{'threads.pm'}) { } 0 0 0
3739 0 my $stash = 'threads';
3740 0 mark_package($stash);
3741 0 $use_xsloader = 1;
3742 0 $xsub{$stash} = 'Dynamic-' . $INC{'threads.pm'};
3743 0 ▶ warn "mark threads for 'P' magic\n" if $debug{mg};
Branch: 1 branch
BranchTrueFalseTotal
if $B::C::debug{"mg"} 0 0 0
3744 } else {
3745 0 ▶ warn "ignore to mark threads for 'P' magic\n" if $debug{mg};
Branch: 1 branch
BranchTrueFalseTotal
if $B::C::debug{"mg"} 0 0 0
3746 }
3747 0 ▶ if ( $INC{'threads/shared.pm'} ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($INC{'threads/shared.pm'}) { } 0 0 0
3748 0 my $stash = 'threads::shared';
3749 0 mark_package($stash);
3750 # XXX why is this needed? threads::shared should be initialized automatically
3751 0 $use_xsloader = 1; # ensure threads::shared is initialized
3752 0 $xsub{$stash} = 'Dynamic-' . $INC{'threads/shared.pm'};
3753 0 ▶ warn "mark threads::shared for 'P' magic\n" if $debug{mg};
Branch: 1 branch
BranchTrueFalseTotal
if $B::C::debug{"mg"} 0 0 0
3754 } else {
3755 0 ▶ warn "ignore to mark threads::shared for 'P' magic\n" if $debug{mg};
Branch: 1 branch
BranchTrueFalseTotal
if $B::C::debug{"mg"} 0 0 0
3756 }
3757 }
3758  
3759 0 ▶sub B::PVMG::save_magic {
Subroutine save_magic: not called CC=73 SCAR=85.9
3760 0 my ($sv, $fullname) = @_;
3761 0 my $sv_flags = $sv->FLAGS;
3762 0 my $pkg;
3763 0 ▶ return if $fullname and $fullname eq '%B::C::';
Branch: 1 branch
BranchTrueFalseTotal
if $fullname and $fullname eq "%B::C::" 0 0 0
Condition0%0/3
$fullname and $fullname eq "%B::C::"
!ll&&!rl&&r
000
MC/DC0%0/2
$fullname and $fullname eq "%B::C::"
$fullname $fullname eq "%B::C::"
Truth table0%0/3
A and B
A= $fullnameB= $fullname eq "%B::C::"
ABresult
0X0
100
111
3764 0 ▶ if ($debug{mg}) {
Branch: 1 branch
BranchTrueFalseTotal
if ($B::C::debug{"mg"}) 0 0 0
3765 0 my $flagspv = "";
3766 0 ▶ $fullname = '' unless $fullname;
Branch: 1 branch
BranchTrueFalseTotal
unless $fullname 0 0 0
3767 0 ▶ $flagspv = $sv->flagspv if $debug{flags} and $PERL510 and !$sv->MAGICAL;
Branch: 1 branch
BranchTrueFalseTotal
if $B::C::debug{"flags"} and $PERL510 and not $sv->MAGICAL 0 0 0
Condition0%0/6
$B::C::debug{"flags"} and $PERL510 and not $sv->MAGICAL
!ll&&!rl&&r
000
$B::C::debug{"flags"} and $PERL510
!ll&&!rl&&r
000
MC/DC0%0/3
$B::C::debug{"flags"} and $PERL510 and not $sv->MAGICAL
$B::C::debug{"flags"} $PERL510 not $sv->MAGICAL
Truth table0%0/4
A and B and not(C)
A= $B::C::debug{"flags"}B= $PERL510C= not $sv->MAGICAL
ABCresult
0XX0
10X0
1100
1111
3768 warn sprintf( "saving magic for %s %s (0x%x) flags=0x%x%s - called from %s:%s\n",
3769 B::class($sv), $fullname, $$sv, $sv_flags, $debug{flags} ? "(".$flagspv.")" : "",
3770 0 ▶ @{[(caller(1))[3]]}, @{[(caller(1))[2]]});
Branch: 1 branch
BranchTrueFalseTotal
$B::C::debug{'flags'} ? : 0 0 0
3771 }
3772  
3773 # crashes on STASH=0x18 with HV PERL_MAGIC_overload_table stash %version:: flags=0x3280000c
3774 # issue267 GetOpt::Long SVf_AMAGIC|SVs_RMG|SVf_OOK
3775 # crashes with %Class::MOP::Instance:: flags=0x2280000c also
3776 0 ▶ if (ref($sv) eq 'B::HV' and $] > 5.018 and $sv->MAGICAL and $fullname =~ /::$/) {
Branch: 2 branches
BranchTrueFalseTotal
if (ref $sv eq 'B::HV' and $] > 5.018 and $sv->MAGICAL and $fullname =~ /::$/) { } 0 0 0
elsif (ref $sv eq 'B::HV' and $] > 5.018 and $fullname =~ /(version|File)::$/) { } 0 0 0
Condition0%0/9
ref $sv eq "B::HV" and $] > "5.018" and $sv->MAGICAL and $fullname =~ /::$/
!ll&&!rl&&r
000
ref $sv eq "B::HV" and $] > "5.018" and $sv->MAGICAL
!ll&&!rl&&r
000
ref $sv eq "B::HV" and $] > "5.018"
!ll&&!rl&&r
000
MC/DC0%0/4
ref $sv eq "B::HV" and $] > "5.018" and $sv->MAGICAL and $fullname =~ /::$/
ref $sv eq "B::HV" $] > "5.018" $sv->MAGICAL $fullname =~ /::$/
Truth table0%0/5
A and B and C and D
A= ref $sv eq "B::HV"B= $] > "5.018"C= $sv->MAGICALD= $fullname =~ /::$/
ABCDresult
0XXX0
10XX0
110X0
11100
11111
3777 0 ▶ warn sprintf("skip SvSTASH for overloaded HV %s flags=0x%x\n", $fullname, $sv_flags)
Branch: 1 branch
BranchTrueFalseTotal
if $B::C::verbose 0 0 0
3778 if $verbose;
3779 # [cperl #60] not only overloaded, version also
3780 ▶ } elsif (ref($sv) eq 'B::HV' and $] > 5.018 and $fullname =~ /(version|File)::$/) {
Condition0%0/6
ref $sv eq "B::HV" and $] > "5.018" and $fullname =~ /(version|File)::$/
!ll&&!rl&&r
000
ref $sv eq "B::HV" and $] > "5.018"
!ll&&!rl&&r
000
MC/DC0%0/3
ref $sv eq "B::HV" and $] > "5.018" and $fullname =~ /(version|File)::$/
ref $sv eq "B::HV" $] > "5.018" $fullname =~ /(version|File)::$/
Truth table0%0/4
A and B and C
A= ref $sv eq "B::HV"B= $] > "5.018"C= $fullname =~ /(version|File)::$/
ABCresult
0XX0
10X0
1100
1111
3781 0 ▶ warn sprintf("skip SvSTASH for %s flags=0x%x\n", $fullname, $sv_flags)
Branch: 1 branch
BranchTrueFalseTotal
if $B::C::verbose 0 0 0
3782 if $verbose;
3783 } else {
3784 0 my $pkgsym;
3785 0 $pkg = $sv->SvSTASH;
3786 0 ▶ if ($pkg and $$pkg) {
Branch: 1 branch
BranchTrueFalseTotal
if ($pkg and $$pkg) 0 0 0
Condition0%0/3
$pkg and $$pkg
!ll&&!rl&&r
000
MC/DC0%0/2
$pkg and $$pkg
$pkg $$pkg
Truth table0%0/3
A and B
A= $pkgB= $$pkg
ABresult
0X0
100
111
3787 0 ▶ my $pkgname = $pkg->can('NAME') ? $pkg->NAME : $pkg->NAME_HEK."::DESTROY";
Branch: 1 branch
BranchTrueFalseTotal
$pkg->can('NAME') ? : 0 0 0
3788 warn sprintf("stash isa class \"%s\" (%s)\n", $pkgname, ref $pkg)
3789 0 ▶ if $debug{mg} or $debug{gv};
Branch: 1 branch
BranchTrueFalseTotal
if $B::C::debug{"mg"} or $B::C::debug{"gv"} 0 0 0
Condition0%0/3
$B::C::debug{"mg"} or $B::C::debug{"gv"}
l!l&&r!l&&!r
000
MC/DC0%0/2
$B::C::debug{"mg"} or $B::C::debug{"gv"}
$B::C::debug{"mg"} $B::C::debug{"gv"}
Truth table0%0/3
A or B
A= $B::C::debug{"mg"}B= $B::C::debug{"gv"}
ABresult
1X1
011
000
3790 # 361 do not force dynaloading IO via IO::Handle upon us
3791 # core already initialized this stash for us
3792 0 ▶ unless ($fullname eq 'main::STDOUT' and $] >= 5.018) {
Branch: 1 branch
BranchTrueFalseTotal
unless ($fullname eq "main::STDOUT" and $] >= "5.018") 0 0 0
Condition0%0/3
$fullname eq "main::STDOUT" and $] >= "5.018"
!ll&&!rl&&r
000
MC/DC0%0/2
$fullname eq "main::STDOUT" and $] >= "5.018"
$fullname eq "main::STDOUT" $] >= "5.018"
Truth table0%0/3
A and B
A= $fullname eq "main::STDOUT"B= $] >= "5.018"
ABresult
0X0
100
111
3793 0 ▶ if (ref $pkg eq 'B::HV') {
Branch: 1 branch
BranchTrueFalseTotal
if (ref $pkg eq 'B::HV') { } 0 0 0
3794 0 ▶ if ($fullname !~ /::$/ or $B::C::stash) {
Branch: 1 branch
BranchTrueFalseTotal
if (not $fullname =~ /::$/ or $B::C::stash) { } 0 0 0
Condition0%0/3
not $fullname =~ /::$/ or $B::C::stash
l!l&&r!l&&!r
000
MC/DC0%0/2
not $fullname =~ /::$/ or $B::C::stash
not $fullname =~ /::$/ $B::C::stash
Truth table0%0/3
not(A) or B
A= not $fullname =~ /::$/B= $B::C::stash
ABresult
1X1
011
000
3795 0 $pkgsym = $pkg->save($fullname);
3796 } else {
3797 0 $pkgsym = savestashpv($pkgname);
3798 }
3799 } else {
3800 0 $pkgsym = 'NULL';
3801 }
3802  
3803 warn sprintf( "xmg_stash = \"%s\" as %s\n", $pkgname, $pkgsym )
3804 0 ▶ if $debug{mg} or $debug{gv};
Branch: 1 branch
BranchTrueFalseTotal
if $B::C::debug{"mg"} or $B::C::debug{"gv"} 0 0 0
Condition0%0/3
$B::C::debug{"mg"} or $B::C::debug{"gv"}
l!l&&r!l&&!r
000
MC/DC0%0/2
$B::C::debug{"mg"} or $B::C::debug{"gv"}
$B::C::debug{"mg"} $B::C::debug{"gv"}
Truth table0%0/3
A or B
A= $B::C::debug{"mg"}B= $B::C::debug{"gv"}
ABresult
1X1
011
000
3805 # Q: Who is initializing our stash from XS? ->save is missing that.
3806 # A: We only need to init it when we need a CV
3807 # defer for XS loaded stashes with AMT magic
3808 0 ▶ if (ref $pkg eq 'B::HV') {
Branch: 1 branch
BranchTrueFalseTotal
if (ref $pkg eq "B::HV") 0 0 0
3809 0 $init->add( sprintf( "SvSTASH_set(s\\_%x, (HV*)s\\_%x);", $$sv, $$pkg ) );
3810 0 $init->add( sprintf( "SvREFCNT((SV*)s\\_%x) += 1;", $$pkg ) );
3811 0 ▶ $init->add("++PL_sv_objcount;") unless ref($sv) eq "B::IO";
Branch: 1 branch
BranchTrueFalseTotal
unless ref $sv eq "B::IO" 0 0 0
3812 # XXX
3813 #push_package($pkg->NAME); # correct code, but adds lots of new stashes
3814 }
3815 }
3816 }
3817 }
3818 0 ▶ $init->add(sprintf("SvREADONLY_off((SV*)s\\_%x);", $$sv))
Branch: 1 branch
BranchTrueFalseTotal
if $sv_flags & 134217728 and ref $sv ne "B::HV" 0 0 0
Condition0%0/3
$sv_flags & 134217728 and ref $sv ne "B::HV"
!ll&&!rl&&r
000
MC/DC0%0/2
$sv_flags & 134217728 and ref $sv ne "B::HV"
$sv_flags & 134217728 ref $sv ne "B::HV"
Truth table0%0/3
A and B
A= $sv_flags & 134217728B= ref $sv ne "B::HV"
ABresult
0X0
100
111
3819 if $sv_flags & SVf_READONLY and ref($sv) ne 'B::HV';
3820  
3821 # Protect our SVs against non-magic or SvPAD_OUR. Fixes tests 16 and 14 + 23
3822 0 ▶ if ($PERL510 and !($sv->MAGICAL or $sv_flags & SVf_AMAGIC)) {
Branch: 1 branch
BranchTrueFalseTotal
if ($PERL510 and not $sv->MAGICAL || $sv_flags & 268435456) 0 0 0
Condition0%0/6
$PERL510 and not $sv->MAGICAL || $sv_flags & 268435456
!ll&&!rl&&r
000
$sv->MAGICAL || $sv_flags & 268435456
l!l&&r!l&&!r
000
MC/DC0%0/3
$PERL510 and not $sv->MAGICAL || $sv_flags & 268435456
$PERL510 $sv->MAGICAL $sv_flags & 268435456
Truth table0%0/4
A and not(B || C)
A= $PERL510B= $sv->MAGICALC= $sv_flags & 268435456
ABCresult
0XX0
11X0
1010
1001
3823 warn sprintf("Skipping non-magical PVMG type=%d, flags=0x%x%s\n",
3824 $sv_flags && 0xff, $sv_flags, $debug{flags} ? "(".$sv->flagspv.")" : "")
3825 0 ▶ if $debug{mg};
Branch: 2 branches
BranchTrueFalseTotal
if $B::C::debug{"mg"} 0 0 0
$B::C::debug{'flags'} ? : 0 0 0
Condition0%0/2
$sv_flags && 255
!ll
00
MC/DC0%0/1
$sv_flags && 255
$sv_flags
Truth table0%0/2
A
A= $sv_flags
Aresult
00
11
3826 0 return '';
3827 }
3828  
3829 # disabled. testcase: t/testm.sh Path::Class
3830 0 if (0 and $PERL518 and $sv_flags & SVf_AMAGIC) {
3831 my $name = $fullname;
3832 $name =~ s/^%(.*)::$/$1/;
3833 $name = $pkg->NAME if $pkg and $$pkg;
3834 warn sprintf("initialize overload cache for %s\n", $fullname )
3835 if $debug{mg} or $debug{gv};
3836 # This is destructive, it removes the magic instead of adding it.
3837 #$init1->add(sprintf("Gv_AMG(%s); /* init overload cache for %s */", savestashpv($name),
3838 # $fullname));
3839 }
3840  
3841 0 my @mgchain = $sv->MAGIC;
3842 0 my ( $mg, $type, $obj, $ptr, $len, $ptrsv );
3843 0 my $magic = '';
3844 0 foreach $mg (@mgchain) {
3845 0 $type = $mg->TYPE;
3846 0 $ptr = $mg->PTR;
3847 0 $len = $mg->LENGTH;
3848 0 $magic .= $type;
3849 0 ▶ if ( $debug{mg} ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($B::C::debug{"mg"}) 0 0 0
3850 0 warn sprintf( "%s %s magic 0x%x\n", $fullname, cchar($type), $mg->FLAGS );
3851 #eval {
3852 # warn sprintf( "magic %s (0x%x), obj %s (0x%x), type %s, ptr %s\n",
3853 # B::class($sv), $$sv, B::class($obj), $$obj, cchar($type),
3854 # cstring($ptr) );
3855 #};
3856 }
3857  
3858 0 ▶ unless ( $type =~ /^[rDn]$/ ) { # r - test 23 / D - Getopt::Long
Branch: 1 branch
BranchTrueFalseTotal
unless ($type =~ /^[rDn]$/) 0 0 0
3859 # 5.10: Can't call method "save" on unblessed reference
3860 #warn "Save MG ". $obj . "\n" if $PERL510;
3861 # 5.11 'P' fix in B::IV::save, IV => RV
3862 0 $obj = $mg->OBJ;
3863 0 ▶ $obj->save($fullname)
Branch: 1 branch
BranchTrueFalseTotal
unless $PERL510 and ref $obj eq "SCALAR" 0 0 0
Condition0%0/3
$PERL510 and ref $obj eq "SCALAR"
!ll&&!rl&&r
000
MC/DC0%0/2
$PERL510 and ref $obj eq "SCALAR"
$PERL510 ref $obj eq "SCALAR"
Truth table0%0/3
A and B
A= $PERL510B= ref $obj eq "SCALAR"
ABresult
0X0
100
111
3864 unless $PERL510 and ref $obj eq 'SCALAR';
3865 0 ▶ mark_threads if $type eq 'P';
Branch: 1 branch
BranchTrueFalseTotal
if $type eq "P" 0 0 0
3866 }
3867  
3868 0 ▶ if ( $len == HEf_SVKEY ) {
Branch: 6 branches
BranchTrueFalseTotal
if ($len == -2) { } 0 0 0
elsif ($type eq 'r') { } 0 0 0
elsif ($type eq 'D') { } 0 0 0
elsif ($type eq 'n') { } 0 0 0
elsif ($type eq 'c') { } 0 0 0
elsif ($type eq ':') { } 0 0 0
3869 # The pointer is an SV* ('s' sigelem e.g.)
3870 # XXX On 5.6 ptr might be a SCALAR ref to the PV, which was fixed later
3871 0 ▶ if (ref($ptr) eq 'SCALAR') {
Branch: 2 branches
BranchTrueFalseTotal
if (ref $ptr eq 'SCALAR') { } 0 0 0
elsif ($ptr and ref $ptr) { } 0 0 0
3872 0 $ptrsv = svref_2object($ptr)->save($fullname);
3873 ▶ } elsif ($ptr and ref $ptr) {
Condition0%0/3
$ptr and ref $ptr
!ll&&!rl&&r
000
MC/DC0%0/2
$ptr and ref $ptr
$ptr ref $ptr
Truth table0%0/3
A and B
A= $ptrB= ref $ptr
ABresult
0X0
100
111
3874 0 $ptrsv = $ptr->save($fullname);
3875 } else {
3876 0 $ptrsv = 'NULL';
3877 }
3878 0 ▶ warn "MG->PTR is an SV*\n" if $debug{mg};
Branch: 1 branch
BranchTrueFalseTotal
if $B::C::debug{"mg"} 0 0 0
3879 0 $init->add(sprintf("sv_magic((SV*)s\\_%x, (SV*)s\\_%x, %s, (char *)%s, %d);",
3880 $$sv, $$obj, cchar($type), $ptrsv, $len));
3881 0 ▶ if (!($mg->FLAGS & 2)) {
Branch: 1 branch
BranchTrueFalseTotal
unless ($mg->FLAGS & 2) 0 0 0
3882 0 mg_RC_off($mg, $sv, $type);
3883 }
3884 }
3885 # coverage $Template::Stash::PRIVATE
3886 elsif ( $type eq 'r' ) { # qr magic, for 5.6 done in C.xs. test 20
3887 0 ▶ my $rx = $PERL56 ? ${$mg->OBJ} : $mg->REGEX;
Branch: 1 branch
BranchTrueFalseTotal
$PERL56 ? : 0 0 0
3888 # stored by some PMOP *pm = cLOGOP->op_other (pp_ctl.c) in C.xs
3889 0 my $pmop = $Regexp{$rx};
3890 0 ▶ if (!$pmop) {
Branch: 1 branch
BranchTrueFalseTotal
if (not $pmop) { } 0 0 0
3891 0 warn "Warning: C.xs PMOP missing for QR\n";
3892 } else {
3893 0 my ($resym, $relen);
3894 0 ▶ if ($PERL56) {
Branch: 1 branch
BranchTrueFalseTotal
if ($PERL56) { } 0 0 0
3895 0 ($resym, $relen) = savere( $pmop->precomp ); # 5.6 has precomp only in PMOP
3896 0 ▶ ($resym, $relen) = savere( $mg->precomp ) unless $relen;
Branch: 1 branch
BranchTrueFalseTotal
unless $relen 0 0 0
3897 } else {
3898 0 ($resym, $relen) = savere( $mg->precomp );
3899 }
3900 0 my $pmsym = $pmop->save(0, $fullname);
3901 0 ▶ if ($PERL510) {
Branch: 1 branch
BranchTrueFalseTotal
if ($PERL510) { } 0 0 0
3902 0 push @B::C::static_free, $resym;
3903 0 $init->add( split /\n/,
3904 sprintf <<CODE1, $resym, $pmop->pmflags, $$sv, cchar($type), cstring($ptr), $len );
3905 {
3906 REGEXP* rx = CALLREGCOMP((SV* const)%s, %d);
3907 sv_magic((SV*)s\\_%x, (SV*)rx, %s, %s, %d);
3908 }
3909 CODE1
3910 }
3911 else {
3912 0 $pmsym =~ s/\(OP\*\)\&pmop_list/&pmop_list/;
3913 0 $init->add( split /\n/,
3914 sprintf <<CODE2, $$sv, cchar($type), cstring($ptr), $len );
3915 {
3916 REGEXP* rx = pregcomp((char*)$resym,(char*)($resym + $relen), (PMOP*)$pmsym);
3917 sv_magic((SV*)s\\_%x, (SV*)rx, %s, %s, %d);
3918 }
3919 CODE2
3920 }
3921 }
3922 }
3923 elsif ( $type eq 'D' ) { # XXX regdata AV - coverage? i95, 903
3924 # see Perl_mg_copy() in mg.c
3925 0 ▶ $init->add(sprintf("sv_magic((SV*)s\\_%x, (SV*)s\\_%x, %s, %s, %d);",
Branch: 1 branch
BranchTrueFalseTotal
$fullname eq 'main::-' ? : 0 0 0
3926 $$sv, $fullname eq 'main::-' ? 0 : $$sv, "'D'", cstring($ptr), $len ));
3927 }
3928 elsif ( $type eq 'n' ) { # shared_scalar is from XS dist/threads-shared
3929 # XXX check if threads is loaded also? otherwise it is only stubbed
3930 0 mark_threads;
3931 0 $init->add(sprintf("sv_magic((SV*)s\\_%x, Nullsv, %s, %s, %d);",
3932 $$sv, "'n'", cstring($ptr), $len ));
3933 }
3934 elsif ( $type eq 'c' ) { # and !$PERL518
3935 0 $init->add(sprintf(
3936 "/* AMT overload table for the stash %s s\\_%x is generated dynamically */",
3937 $fullname, $$sv ));
3938 }
3939 elsif ( $type eq ':' ) { # symtab magic
3940 # search $ptr in list of pmops and replace it. e.g. (char*)&pmop_list[0]
3941 0 my $pmop_ptr = unpack("J", $mg->PTR);
3942 0 my $pmop;
3943 0 ▶ $pmop = $B::C::Regexp{$pmop_ptr} if defined $pmop_ptr;
Branch: 1 branch
BranchTrueFalseTotal
if defined $pmop_ptr 0 0 0
3944 0 ▶ my $pmsym = $pmop ? $pmop->save(0, $fullname)
Branch: 1 branch
BranchTrueFalseTotal
$pmop ? : 0 0 0
3945 : ''; #sprintf('&pmop_list[%u]', $pmopsect->index);
3946 0 ▶ warn sprintf("pmop 0x%x not found in our B::C Regexp hash\n", $pmop_ptr || 'undef')
Branch: 1 branch
BranchTrueFalseTotal
if not $pmop and $B::C::verbose 0 0 0
Condition0%0/5
not $pmop and $B::C::verbose
!ll&&!rl&&r
000
$pmop_ptr || 'undef'
l!l
00
MC/DC0%0/2
not $pmop and $B::C::verbose
not $pmop $B::C::verbose
MC/DC0%0/1
$pmop_ptr || 'undef'
$pmop_ptr
Truth table0%0/3
not(A) and B
A= not $pmopB= $B::C::verbose
ABresult
0X0
100
111
Truth table0%0/2
A
A= $pmop_ptr
Aresult
11
00
3947 if !$pmop and $verbose;
3948 0 ▶ $init->add("{\tU32 elements;", # toke.c: PL_multi_open == '?'
Branch: 2 branches
BranchTrueFalseTotal
$pmop ? : 0 0 0
defined $pmop_ptr ? : 0 0 0
3949 sprintf("\tMAGIC *mg = sv_magicext((SV*)s\\_%x, 0, ':', 0, 0, 0);", $$sv),
3950 "\telements = mg->mg_len / sizeof(PMOP**);",
3951 "\tRenewc(mg->mg_ptr, elements + 1, PMOP*, char);",
3952 ($pmop
3953 ? (sprintf("\t((OP**)mg->mg_ptr) [elements++] = (OP*)%s;", $pmsym))
3954 : ( defined $pmop_ptr
3955 ? sprintf( "\t((OP**)mg->mg_ptr) [elements++] = (OP*)s\\_%x;", $pmop_ptr ) : '' )),
3956 "\tmg->mg_len = elements * sizeof(PMOP**);", "}");
3957 }
3958 else {
3959 0 $init->add(sprintf(
3960 "sv_magic((SV*)s\\_%x, (SV*)s\\_%x, %s, %s, %d);",
3961 $$sv, $$obj, cchar($type), cstring($ptr), $len));
3962 0 ▶ if (!($mg->FLAGS & 2)) {
Branch: 1 branch
BranchTrueFalseTotal
unless ($mg->FLAGS & 2) 0 0 0
3963 0 mg_RC_off($mg, $sv, $type);
3964 }
3965 }
3966 }
3967 0 ▶ $init->add(sprintf("SvREADONLY_on((SV*)s\\_%x);", $$sv))
Branch: 1 branch
BranchTrueFalseTotal
if $sv_flags & 134217728 and ref $sv ne "B::HV" 0 0 0
Condition0%0/3
$sv_flags & 134217728 and ref $sv ne "B::HV"
!ll&&!rl&&r
000
MC/DC0%0/2
$sv_flags & 134217728 and ref $sv ne "B::HV"
$sv_flags & 134217728 ref $sv ne "B::HV"
Truth table0%0/3
A and B
A= $sv_flags & 134217728B= ref $sv ne "B::HV"
ABresult
0X0
100
111
3968 if $sv_flags & SVf_READONLY and ref($sv) ne 'B::HV';
3969 0 $magic;
3970 }
3971  
3972 # Since 5.11 also called by IV::save (SV -> IV)
3973 0 ▶sub B::RV::save {
Subroutine save: not called CC=21 SCAR=61.4
3974 0 my ($sv, $fullname) = @_;
3975 0 my $sym = objsym($sv);
3976 0 ▶ return $sym if defined $sym;
Branch: 1 branch
BranchTrueFalseTotal
if defined $sym 0 0 0
3977 warn sprintf( "Saving RV %s (0x%x) - called from %s:%s\n",
3978 0 B::class($sv), $$sv, @{[(caller(1))[3]]}, @{[(caller(1))[2]]})
3979 0 ▶ if $debug{sv};
Branch: 1 branch
BranchTrueFalseTotal
if $B::C::debug{"sv"} 0 0 0
3980  
3981 0 my $rv = save_rv($sv, $fullname);
3982 0 ▶ return '0' unless $rv;
Branch: 1 branch
BranchTrueFalseTotal
unless $rv 0 0 0
3983 0 ▶ if ($PERL510) {
Branch: 1 branch
BranchTrueFalseTotal
if ($PERL510) { } 0 0 0
3984 0 $svsect->comment( "any, refcnt, flags, sv_u" );
3985 # 5.22 has a wrong RV->FLAGS (https://github.com/perl11/cperl/issues/63)
3986 0 my $flags = $sv->FLAGS;
3987 0 ▶ $flags = 0x801 if $flags & 9 and $PERL522; # not a GV but a ROK IV (21)
Branch: 1 branch
BranchTrueFalseTotal
if $flags & 9 and $PERL522 0 0 0
Condition0%0/3
$flags & 9 and $PERL522
!ll&&!rl&&r
000
MC/DC0%0/2
$flags & 9 and $PERL522
$flags & 9 $PERL522
Truth table0%0/3
A and B
A= $flags & 9B= $PERL522
ABresult
0X0
100
111
3988 # 5.10 has no struct xrv anymore, just sv_u.svu_rv. static or dynamic?
3989 # initializer element is computable at load time
3990 0 ▶ $svsect->add( sprintf( "ptr_undef, $u32fmt, 0x%x, {%s}", $sv->REFCNT, $flags,
Branch: 1 branch
BranchTrueFalseTotal
$C99 && is_constant($rv) ? : 0 0 0
Condition0%0/3
$C99 and is_constant($rv)
!ll&&!rl&&r
000
MC/DC0%0/2
$C99 and is_constant($rv)
$C99 is_constant($rv)
Truth table0%0/3
A and B
A= $C99B= is_constant($rv)
ABresult
0X0
100
111
3991 (($C99 && is_constant($rv)) ? ".svu_rv=$rv" : "0 /*-> $rv */")));
3992 0 ▶ $svsect->debug( $fullname, $sv->flagspv ) if $debug{flags};
Branch: 1 branch
BranchTrueFalseTotal
if $B::C::debug{"flags"} 0 0 0
3993 0 my $s = "sv_list[".$svsect->index."]";
3994 # 354 defined needs SvANY
3995 0 ▶ $init->add( sprintf("$s.sv_any = (char*)&$s - %d;", $Config{ptrsize}))
Branch: 1 branch
BranchTrueFalseTotal
if $] > "5.019" or $ITHREADS 0 0 0
Condition0%0/3
$] > "5.019" or $ITHREADS
l!l&&r!l&&!r
000
MC/DC0%0/2
$] > "5.019" or $ITHREADS
$] > "5.019" $ITHREADS
Truth table0%0/3
A or B
A= $] > "5.019"B= $ITHREADS
ABresult
1X1
011
000
3996 if $] > 5.019 or $ITHREADS;
3997 0 ▶ unless ($C99 && is_constant($rv)) {
Branch: 1 branch
BranchTrueFalseTotal
unless ($C99 and is_constant($rv)) 0 0 0
Condition0%0/3
$C99 and is_constant($rv)
!ll&&!rl&&r
000
MC/DC0%0/2
$C99 and is_constant($rv)
$C99 is_constant($rv)
Truth table0%0/3
A and B
A= $C99B= is_constant($rv)
ABresult
0X0
100
111
3998 0 ▶ if ( $rv =~ /get_cv/ ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($rv =~ /get_cv/) { } 0 0 0
3999 0 $init2->add( "$s.sv_u.svu_rv = (SV*)$rv;" ) ;
4000 } else {
4001 0 $init->add( "$s.sv_u.svu_rv = (SV*)$rv;" ) ;
4002 }
4003 }
4004 0 return savesym( $sv, "&".$s );
4005 }
4006 else {
4007 # GVs need to be handled at runtime
4008 0 ▶ if ( ref( $sv->RV ) eq 'B::GV' or $rv =~ /^gv_list/) {
Branch: 3 branches
BranchTrueFalseTotal
if (ref $sv->RV eq 'B::GV' or $rv =~ /^gv_list/) { } 0 0 0
elsif ($sv->RV->isa('B::HV') and $sv->RV->NAME) { } 0 0 0
elsif ($rv =~ /get_cv/) { } 0 0 0
Condition0%0/3
ref $sv->RV eq "B::GV" or $rv =~ /^gv_list/
l!l&&r!l&&!r
000
MC/DC0%0/2
ref $sv->RV eq "B::GV" or $rv =~ /^gv_list/
ref $sv->RV eq "B::GV" $rv =~ /^gv_list/
Truth table0%0/3
A or B
A= ref $sv->RV eq "B::GV"B= $rv =~ /^gv_list/
ABresult
1X1
011
000
4009 0 $xrvsect->add("Nullsv /* $rv */");
4010 0 $init->add(
4011 sprintf( "xrv_list[%d].xrv_rv = (SV*)%s;", $xrvsect->index, $rv ) );
4012 }
4013 # and stashes, too
4014 ▶ elsif ( $sv->RV->isa('B::HV') && $sv->RV->NAME ) {
Condition0%0/3
$sv->RV->isa("B::HV") and $sv->RV->NAME
!ll&&!rl&&r
000
MC/DC0%0/2
$sv->RV->isa("B::HV") and $sv->RV->NAME
$sv->RV->isa("B::HV") $sv->RV->NAME
Truth table0%0/3
A and B
A= $sv->RV->isa("B::HV")B= $sv->RV->NAME
ABresult
0X0
100
111
4015 0 $xrvsect->add("Nullsv /* $rv */");
4016 0 $init->add(
4017 sprintf( "xrv_list[%d].xrv_rv = (SV*)%s;", $xrvsect->index, $rv ) );
4018 }
4019 # one more: bootstrapped XS CVs (test Class::MOP, no simple testcase yet)
4020 # dynamic; so we need to inc it
4021 elsif ( $rv =~ /get_cv/ ) {
4022 0 $xrvsect->add("Nullsv /* $rv */");
4023 0 $init2->add(
4024 sprintf( "xrv_list[%d].xrv_rv = (SV*)SvREFCNT_inc(%s);", $xrvsect->index, $rv ) );
4025 }
4026 else {
4027 #$xrvsect->add($rv); # not static initializable (e.g. cv160 for ExtUtils::Install)
4028 0 $xrvsect->add("Nullsv /* $rv */");
4029 0 $init->add(
4030 sprintf( "xrv_list[%d].xrv_rv = (SV*)SvREFCNT_inc(%s);", $xrvsect->index, $rv ) );
4031 }
4032 0 $svsect->comment( "any, refcnt, flags" );
4033 0 $svsect->add(sprintf("&xrv_list[%d], $u32fmt, 0x%x",
4034 $xrvsect->index, $sv->REFCNT, $sv->FLAGS));
4035 0 ▶ $svsect->debug( $fullname, $sv->flagspv ) if $debug{flags};
Branch: 1 branch
BranchTrueFalseTotal
if $B::C::debug{"flags"} 0 0 0
4036 0 my $s = "sv_list[".$svsect->index."]";
4037 0 return savesym( $sv, "&".$s );
4038 }
4039 }
4040  
4041 0 ▶sub get_isa ($) {
Subroutine get_isa: not called CC=5 SCAR=30.9
Pod undocumented
4042 0 my $name = shift;
4043 0 ▶ if ($PERL510) {
Branch: 1 branch
BranchTrueFalseTotal
if ($PERL510) { } 0 0 0
4044 0 ▶ if (is_using_mro()) { # mro.xs loaded. c3 or dfs
Branch: 1 branch
BranchTrueFalseTotal
if (is_using_mro()) { } 0 0 0
4045 0 return @{mro::get_linear_isa($name)};
4046 } else { # dfs only, without loading mro
4047 0 return @{B::C::get_linear_isa($name)};
4048 }
4049 } else {
4050 41 ▶ no strict 'refs';
Subroutine BEGIN: called CC=1 SCAR=0.0
4051 0 my $s = "$name\::";
4052 0 ▶ if (exists(${$s}{ISA})) {
Branch: 1 branch
BranchTrueFalseTotal
if (exists do { $s }->{"ISA"}) 0 0 0
4053 0 ▶ if (exists(${$s}{ISA}{ARRAY})) {
Branch: 1 branch
BranchTrueFalseTotal
if (exists do { $s }->{"ISA"}{"ARRAY"}) 0 0 0
4054 0 return @{ "$s\::ISA" };
4055 }
4056 }
4057 }
4058 }
4059  
4060 # try_isa($pkg,$name) returns the found $pkg for the method $pkg::$name
4061 # If a method can be called (via UNIVERSAL::can) search the ISA's. No AUTOLOAD needed.
4062 # XXX issue 64, empty @ISA if a package has no subs. in Bytecode ok
4063 0 ▶sub try_isa {
Subroutine try_isa: not called CC=17 SCAR=56.0
Pod undocumented
4064 0 my ( $cvstashname, $cvname ) = @_;
4065 0 ▶ return 0 unless defined $cvstashname && defined $cvname;
Branch: 1 branch
BranchTrueFalseTotal
unless defined $cvstashname and defined $cvname 0 0 0
Condition0%0/3
defined $cvstashname and defined $cvname
!ll&&!rl&&r
000
MC/DC0%0/2
defined $cvstashname and defined $cvname
defined $cvstashname defined $cvname
Truth table0%0/3
A and B
A= defined $cvstashnameB= defined $cvname
ABresult
0X0
100
111
4066 0 ▶ if (my $found = $isa_cache{"$cvstashname\::$cvname"}) {
Branch: 1 branch
BranchTrueFalseTotal
if (my $found = $isa_cache{"${cvstashname}::$cvname"}) 0 0 0
4067 0 return $found;
4068 }
4069 41 ▶ no strict 'refs';
Subroutine BEGIN: called CC=1 SCAR=0.0
4070 # XXX theoretically a valid shortcut. In reality it fails when $cvstashname is not loaded.
4071 # return 0 unless $cvstashname->can($cvname);
4072 0 my @isa = get_isa($cvstashname);
4073 warn sprintf( "No definition for sub %s::%s. Try \@%s::ISA=(%s)\n",
4074 $cvstashname, $cvname, $cvstashname, join(",",@isa))
4075 0 ▶ if $debug{cv};
Branch: 1 branch
BranchTrueFalseTotal
if $B::C::debug{"cv"} 0 0 0
4076 0 for (@isa) { # global @ISA or in pad
4077 0 ▶ next if $_ eq $cvstashname;
Branch: 1 branch
BranchTrueFalseTotal
if $_ eq $cvstashname 0 0 0
4078 0 ▶ warn sprintf( "Try &%s::%s\n", $_, $cvname ) if $debug{cv};
Branch: 1 branch
BranchTrueFalseTotal
if $B::C::debug{"cv"} 0 0 0
4079 0 ▶ if (defined(&{$_ .'::'. $cvname})) {
Branch: 1 branch
BranchTrueFalseTotal
if (defined &{$_ . '::' . $cvname;}) { } 0 0 0
4080 0 ▶ if (exists(${$cvstashname.'::'}{ISA})) {
Branch: 1 branch
BranchTrueFalseTotal
if (exists do { $cvstashname . '::' }->{"ISA"}) 0 0 0
4081 0 svref_2object( \@{$cvstashname . '::ISA'} )->save("$cvstashname\::ISA");
4082 }
4083 0 $isa_cache{"$cvstashname\::$cvname"} = $_;
4084 0 mark_package($_, 1); # force
4085 0 return $_;
4086 } else {
4087 0 $isa_cache{"$_\::$cvname"} = 0;
4088 0 ▶ if (get_isa($_)) {
Branch: 1 branch
BranchTrueFalseTotal
if (&get_isa($_)) 0 0 0
4089 0 my $parent = try_isa($_, $cvname);
4090 0 ▶ if ($parent) {
Branch: 1 branch
BranchTrueFalseTotal
if ($parent) 0 0 0
4091 0 $isa_cache{"$_\::$cvname"} = $parent;
4092 0 $isa_cache{"$cvstashname\::$cvname"} = $parent;
4093 0 ▶ warn sprintf( "Found &%s::%s\n", $parent, $cvname ) if $debug{gv};
Branch: 1 branch
BranchTrueFalseTotal
if $B::C::debug{"gv"} 0 0 0
4094 0 ▶ if (exists(${$parent.'::'}{ISA})) {
Branch: 1 branch
BranchTrueFalseTotal
if (exists do { $parent . '::' }->{"ISA"}) 0 0 0
4095 0 ▶ warn "save \@$parent\::ISA\n" if $debug{pkg};
Branch: 1 branch
BranchTrueFalseTotal
if $B::C::debug{"pkg"} 0 0 0
4096 0 svref_2object( \@{$parent . '::ISA'} )->save("$parent\::ISA");
4097 }
4098 0 ▶ if (exists(${$_.'::'}{ISA})) {
Branch: 1 branch
BranchTrueFalseTotal
if (exists do { $_ . '::' }->{"ISA"}) 0 0 0
4099 0 ▶ warn "save \@$_\::ISA\n" if $debug{pkg};
Branch: 1 branch
BranchTrueFalseTotal
if $B::C::debug{"pkg"} 0 0 0
4100 0 svref_2object( \@{$_ . '::ISA'} )->save("$_\::ISA");
4101 }
4102 0 return $parent;
4103 }
4104 }
4105 }
4106 }
4107 0 return 0; # not found
4108 }
4109  
4110 0 ▶sub load_utf8_heavy {
Subroutine load_utf8_heavy: not called CC=2 SCAR=17.9
Pod undocumented
4111 0 ▶ return if $savINC{"utf8_heavy.pl"};
Branch: 1 branch
BranchTrueFalseTotal
if $B::C::savINC{"utf8_heavy.pl"} 0 0 0
4112  
4113 0 require 'utf8_heavy.pl';
4114 0 mark_package('utf8_heavy.pl');
4115 0 $curINC{'utf8_heavy.pl'} = $INC{'utf8_heavy.pl'};
4116 0 $savINC{"utf8_heavy.pl"} = 1;
4117 0 add_hashINC("utf8");
4118  
4119 # FIXME: we want to use add_hashINC for utf8_heavy, inc_packname should return an array
4120 # add_hashINC("utf8_heavy.pl");
4121  
4122 # In CORE utf8::SWASHNEW is demand-loaded from utf8 with Perl_load_module()
4123 # It adds about 1.6MB exe size 32-bit.
4124 0 svref_2object( \&{"utf8\::SWASHNEW"} )->save;
4125  
4126 0 return 1;
4127 }
4128  
4129 # If the sub or method is not found:
4130 # 1. try @ISA, mark_package and return.
4131 # 2. try UNIVERSAL::method
4132 # 3. try compile-time expansion of AUTOLOAD to get the goto &sub addresses
4133 0 ▶sub try_autoload {
Subroutine try_autoload: not called CC=28 SCAR=65.5
Pod undocumented
4134 0 my ( $cvstashname, $cvname ) = @_;
4135 41 ▶ no strict 'refs';
Subroutine BEGIN: called CC=1 SCAR=0.0
4136 0 ▶ return unless defined $cvstashname && defined $cvname;
Branch: 1 branch
BranchTrueFalseTotal
unless defined $cvstashname and defined $cvname 0 0 0
Condition0%0/3
defined $cvstashname and defined $cvname
!ll&&!rl&&r
000
MC/DC0%0/2
defined $cvstashname and defined $cvname
defined $cvstashname defined $cvname
Truth table0%0/3
A and B
A= defined $cvstashnameB= defined $cvname
ABresult
0X0
100
111
4137 0 ▶ return 1 if try_isa($cvstashname, $cvname);
Branch: 1 branch
BranchTrueFalseTotal
if try_isa($cvstashname, $cvname) 0 0 0
4138  
4139 41 ▶ no strict 'refs';
Subroutine BEGIN: called CC=1 SCAR=0.0
4140 0 ▶ if (defined(*{'UNIVERSAL::'. $cvname}{CODE})) {
Branch: 1 branch
BranchTrueFalseTotal
if (defined *{'UNIVERSAL::' . $cvname;}{"CODE"}) 0 0 0
4141 0 ▶ warn "Found UNIVERSAL::$cvname\n" if $debug{cv};
Branch: 1 branch
BranchTrueFalseTotal
if $B::C::debug{"cv"} 0 0 0
4142 0 return svref_2object( \&{'UNIVERSAL::'.$cvname} );
4143 }
4144 0 my $fullname = $cvstashname . '::' . $cvname;
4145 warn sprintf( "No definition for sub %s. Try %s::AUTOLOAD\n",
4146 0 ▶ $fullname, $cvstashname ) if $debug{cv};
Branch: 1 branch
BranchTrueFalseTotal
if $B::C::debug{"cv"} 0 0 0
4147 0 ▶ if ($fullname eq 'utf8::SWASHNEW') {
Branch: 1 branch
BranchTrueFalseTotal
if ($fullname eq "utf8::SWASHNEW") 0 0 0
4148 # utf8_heavy was loaded so far, so defer to a demand-loading stub
4149 # always require utf8_heavy, do not care if it s already in
4150 0 ▶ my $stub = sub { require 'utf8_heavy.pl'; goto &utf8::SWASHNEW };
Subroutine __ANON__: not called CC=1 SCAR=6.9
4151 0 return svref_2object( $stub );
4152 }
4153  
4154 # Handle AutoLoader classes. Any more general AUTOLOAD
4155 # use should be handled by the class itself.
4156 0 my @isa = get_isa($cvstashname);
4157 0 ▶ if ( $cvstashname =~ /^POSIX|Storable|DynaLoader|Net::SSLeay|Class::MethodMaker$/
Branch: 1 branch
BranchTrueFalseTotal
if ($cvstashname =~ /^POSIX|Storable|DynaLoader|Net::SSLeay|Class::MethodMaker$/ or exists do { $cvstashname . '::' }->{"AUTOLOAD"} and grep(($_ eq "AutoLoader"), @isa)) 0 0 0
Condition0%0/6
$cvstashname =~ /^POSIX|Storable|DynaLoader|Net::SSLeay|Class::MethodMaker$/ or exists do { $cvstashname . '::' }->{"AUTOLOAD"} and grep(($_ eq "AutoLoader"), @isa)
l!l&&r!l&&!r
000
exists do { $cvstashname . '::' }->{"AUTOLOAD"} and grep(($_ eq "AutoLoader"), @isa)
!ll&&!rl&&r
000
MC/DC0%0/3
$cvstashname =~ /^POSIX|Storable|DynaLoader|Net::SSLeay|Class::MethodMaker$/ or exists do { $cvstashname . '::' }->{"AUTOLOAD"} and grep(($_ eq "AutoLoader"), @isa)
$cvstashname =~ /^POSIX|Storable|DynaLoader|Net::SSLeay|Class::MethodMaker$/ exists do { $cvstashname . '::' }->{"AUTOLOAD"} grep(($_ eq "AutoLoader"), @isa)
Truth table0%0/4
A or B and C
A= $cvstashname =~ /^POSIX|Storable|DynaLoader|Net::SSLeay|Class::MethodMaker$/B= exists do { $cvstashname . '::' }->{"AUTOLOAD"}C= grep(($_ eq "AutoLoader"), @isa)
ABCresult
1XX1
0111
00X0
0100
4158 0 or (exists ${$cvstashname.'::'}{AUTOLOAD} and grep( $_ eq "AutoLoader", @isa ) ) )
4159 {
4160 # Tweaked version of AutoLoader::AUTOLOAD
4161 0 my $dir = $cvstashname;
4162 0 $dir =~ s(::)(/)g;
4163 0 ▶ warn "require \"auto/$dir/$cvname.al\"\n" if $debug{cv};
Branch: 1 branch
BranchTrueFalseTotal
if $B::C::debug{"cv"} 0 0 0
4164 0 ▶ eval { local $SIG{__DIE__}; require "auto/$dir/$cvname.al" unless $INC{"auto/$dir/$cvname.al"} };
Branch: 1 branch
BranchTrueFalseTotal
unless $INC{"auto/$dir/$cvname.al"} 0 0 0
4165 0 ▶ unless ($@) {
Branch: 1 branch
BranchTrueFalseTotal
unless ($@) 0 0 0
4166 0 ▶ warn "Forced load of \"auto/$dir/$cvname.al\"\n" if $verbose;
Branch: 1 branch
BranchTrueFalseTotal
if $B::C::verbose 0 0 0
4167 0 ▶ return svref_2object( \&$fullname )
Branch: 1 branch
BranchTrueFalseTotal
if defined &$fullname 0 0 0
4168 if defined &$fullname;
4169 }
4170 }
4171  
4172 # XXX Still not found, now it's getting dangerous (until 5.10 only)
4173 # Search and call ::AUTOLOAD (=> ROOT and XSUB) (test 27, 5.8)
4174 # Since 5.10 AUTOLOAD xsubs are already resolved
4175 0 ▶ if (exists ${$cvstashname.'::'}{AUTOLOAD} and !$PERL510) {
Branch: 1 branch
BranchTrueFalseTotal
if (exists do { $cvstashname . '::' }->{"AUTOLOAD"} and not $PERL510) 0 0 0
Condition0%0/3
exists do { $cvstashname . '::' }->{"AUTOLOAD"} and not $PERL510
!ll&&!rl&&r
000
MC/DC0%0/2
exists do { $cvstashname . '::' }->{"AUTOLOAD"} and not $PERL510
exists do { $cvstashname . '::' }->{"AUTOLOAD"} not $PERL510
Truth table0%0/3
A and not(B)
A= exists do { $cvstashname . '::' }->{"AUTOLOAD"}B= not $PERL510
ABresult
0X0
100
111
4176 0 my $auto = \&{$cvstashname.'::AUTOLOAD'};
4177 # Tweaked version of __PACKAGE__::AUTOLOAD
4178 0 $AutoLoader::AUTOLOAD = ${$cvstashname.'::AUTOLOAD'} = "$cvstashname\::$cvname";
4179  
4180 # Prevent eval from polluting STDOUT,STDERR and our c code.
4181 # With a debugging perl STDERR is written
4182 0 local *REALSTDOUT;
4183 0 ▶ local *REALSTDERR unless $DEBUGGING;
Branch: 1 branch
BranchTrueFalseTotal
unless $DEBUGGING 0 0 0
4184 0 open(REALSTDOUT,">&STDOUT");
4185 0 ▶ open(REALSTDERR,">&STDERR") unless $DEBUGGING;
Branch: 1 branch
BranchTrueFalseTotal
unless $DEBUGGING 0 0 0
4186 0 open(STDOUT,">","/dev/null");
4187 0 ▶ open(STDERR,">","/dev/null") unless $DEBUGGING;
Branch: 1 branch
BranchTrueFalseTotal
unless $DEBUGGING 0 0 0
4188 0 ▶ warn "eval \&$cvstashname\::AUTOLOAD\n" if $debug{cv};
Branch: 1 branch
BranchTrueFalseTotal
if $B::C::debug{"cv"} 0 0 0
4189 0 eval { &$auto };
4190 0 open(STDOUT,">&REALSTDOUT");
4191 0 ▶ open(STDERR,">&REALSTDERR") unless $DEBUGGING;
Branch: 1 branch
BranchTrueFalseTotal
unless $DEBUGGING 0 0 0
4192  
4193 0 ▶ unless ($@) {
Branch: 1 branch
BranchTrueFalseTotal
unless ($@) 0 0 0
4194 # we need just the empty auto GV, $cvname->ROOT and $cvname->XSUB,
4195 # but not the whole CV optree. XXX This still fails with 5.8
4196 0 my $cv = svref_2object( \&{$fullname} );
4197 0 return $cv;
4198 }
4199 }
4200  
4201 # XXX TODO Check Selfloader (test 31?)
4202 0 svref_2object( \*{$cvstashname.'::AUTOLOAD'} )->save
4203 0 ▶ if $cvstashname and exists ${$cvstashname.'::'}{AUTOLOAD};
Branch: 1 branch
BranchTrueFalseTotal
if $cvstashname and exists do { $cvstashname . '::' }->{"AUTOLOAD"} 0 0 0
Condition0%0/3
$cvstashname and exists do { $cvstashname . '::' }->{"AUTOLOAD"}
!ll&&!rl&&r
000
MC/DC0%0/2
$cvstashname and exists do { $cvstashname . '::' }->{"AUTOLOAD"}
$cvstashname exists do { $cvstashname . '::' }->{"AUTOLOAD"}
Truth table0%0/3
A and B
A= $cvstashnameB= exists do { $cvstashname . '::' }->{"AUTOLOAD"}
ABresult
0X0
100
111
4204 0 svref_2object( \*{$cvstashname.'::CLONE'} )->save
4205 0 ▶ if $cvstashname and exists ${$cvstashname.'::'}{CLONE};
Branch: 1 branch
BranchTrueFalseTotal
if $cvstashname and exists do { $cvstashname . '::' }->{"CLONE"} 0 0 0
Condition0%0/3
$cvstashname and exists do { $cvstashname . '::' }->{"CLONE"}
!ll&&!rl&&r
000
MC/DC0%0/2
$cvstashname and exists do { $cvstashname . '::' }->{"CLONE"}
$cvstashname exists do { $cvstashname . '::' }->{"CLONE"}
Truth table0%0/3
A and B
A= $cvstashnameB= exists do { $cvstashname . '::' }->{"CLONE"}
ABresult
0X0
100
111
4206 }
4207 0 ▶sub Dummy_initxs { }
Subroutine Dummy_initxs: not called CC=1 SCAR=0.0
Pod undocumented
4208  
4209 # A lexical sub contains no CvGV, just a NAME_HEK, thus the name CvNAMED.
4210 # More problematically $cv->GV vivifies the GV of a NAMED cv from an RV, so avoid !$cv->GV
4211 # See https://github.com/perl11/cperl/issues/63
4212 0 ▶sub B::CV::is_named {
Subroutine is_named: not called CC=3 SCAR=24.8
4213 0 my ($cv) = @_;
4214 0 ▶ return 0 unless $PERL518;
Branch: 1 branch
BranchTrueFalseTotal
unless $PERL518 0 0 0
4215 0 ▶ return $cv->NAME_HEK if $cv->can('NAME_HEK');
Branch: 1 branch
BranchTrueFalseTotal
if $cv->can("NAME_HEK") 0 0 0
4216 0 return 0;
4217 # my $gv = $cv->GV;
4218 # return (!$gv or ref($gv) eq 'B::SPECIAL')) ? 1 : 0;
4219 }
4220  
4221 0 ▶sub is_phase_name {
Subroutine is_phase_name: not called CC=2 SCAR=17.9
Pod undocumented
4222 0 ▶ $_[0] =~ /^(BEGIN|INIT|UNITCHECK|CHECK|END)$/ ? 1 : 0;
Branch: 1 branch
BranchTrueFalseTotal
$_[0] =~ /^(BEGIN|INIT|UNITCHECK|CHECK|END)$/ ? : 0 0 0
4223 }
4224  
4225 0 ▶sub B::CV::save {
Subroutine save: not called CC=269 SCAR=111.6
4226 0 my ($cv, $origname) = @_;
4227 0 my $sym = objsym($cv);
4228 0 ▶ if ( defined($sym) ) {
Branch: 1 branch
BranchTrueFalseTotal
if (defined $sym) 0 0 0
4229 0 ▶ warn sprintf( "CV 0x%x already saved as $sym\n", $$cv ) if $$cv and $debug{cv};
Branch: 1 branch
BranchTrueFalseTotal
if $$cv and $B::C::debug{"cv"} 0 0 0
Condition0%0/3
$$cv and $B::C::debug{"cv"}
!ll&&!rl&&r
000
MC/DC0%0/2
$$cv and $B::C::debug{"cv"}
$$cv $B::C::debug{"cv"}
Truth table0%0/3
A and B
A= $$cvB= $B::C::debug{"cv"}
ABresult
0X0
100
111
4230 0 return $sym;
4231 }
4232 0 ▶ my $gv = $cv->is_named ? undef : $cv->GV;
Branch: 1 branch
BranchTrueFalseTotal
$cv->is_named ? : 0 0 0
4233 0 my ( $cvname, $cvstashname, $fullname, $isutf8 );
4234 0 $fullname = '';
4235 0 my $CvFLAGS = $cv->CvFLAGS;
4236 0 ▶ if (!$gv and $cv->is_named) {
Branch: 2 branches
BranchTrueFalseTotal
if (not $gv and $cv->is_named) { } 0 0 0
elsif ($gv and $$gv) { } 0 0 0
Condition0%0/3
not $gv and $cv->is_named
!ll&&!rl&&r
000
MC/DC0%0/2
not $gv and $cv->is_named
not $gv $cv->is_named
Truth table0%0/3
not(A) and B
A= not $gvB= $cv->is_named
ABresult
0X0
100
111
4237 0 $fullname = $cv->NAME_HEK;
4238 0 ▶ $fullname = '' unless defined $fullname;
Branch: 1 branch
BranchTrueFalseTotal
unless defined $fullname 0 0 0
4239 0 $isutf8 = $cv->FLAGS & SVf_UTF8;
4240 0 ▶ warn sprintf( "CV lexsub NAME_HEK $fullname\n") if $debug{cv};
Branch: 1 branch
BranchTrueFalseTotal
if $B::C::debug{"cv"} 0 0 0
4241 0 ▶ if ($fullname =~ /^(.*)::(.*?)$/) {
Branch: 1 branch
BranchTrueFalseTotal
if ($fullname =~ /^(.*)::(.*?)$/) 0 0 0
4242 0 $cvstashname = $1;
4243 0 $cvname = $2;
4244 }
4245 }
4246 ▶ elsif ($gv and $$gv) {
Condition0%0/3
$gv and $$gv
!ll&&!rl&&r
000
MC/DC0%0/2
$gv and $$gv
$gv $$gv
Truth table0%0/3
A and B
A= $gvB= $$gv
ABresult
0X0
100
111
4247 0 $cvstashname = $gv->STASH->NAME;
4248 0 $cvname = $gv->NAME;
4249 0 ▶ $isutf8 = ($gv->FLAGS & SVf_UTF8) || ($gv->STASH->FLAGS & SVf_UTF8);
Condition0%0/3
$gv->FLAGS & SVf_UTF8() || $gv->STASH->FLAGS & SVf_UTF8()
l!l&&r!l&&!r
000
MC/DC0%0/2
$gv->FLAGS & SVf_UTF8() || $gv->STASH->FLAGS & SVf_UTF8()
$gv->FLAGS & SVf_UTF8() $gv->STASH->FLAGS & SVf_UTF8()
Truth table0%0/3
A || B
A= $gv->FLAGS & SVf_UTF8()B= $gv->STASH->FLAGS & SVf_UTF8()
ABresult
1X1
011
000
4250 0 $fullname = $cvstashname.'::'.$cvname;
4251 # XXX gv->EGV does not really help here
4252 0 ▶ if ($PERL522 and $cvname eq '__ANON__') {
Branch: 1 branch
BranchTrueFalseTotal
if ($PERL522 and $cvname eq "__ANON__") 0 0 0
Condition0%0/3
$PERL522 and $cvname eq "__ANON__"
!ll&&!rl&&r
000
MC/DC0%0/2
$PERL522 and $cvname eq "__ANON__"
$PERL522 $cvname eq "__ANON__"
Truth table0%0/3
A and B
A= $PERL522B= $cvname eq "__ANON__"
ABresult
0X0
100
111
4253 0 ▶ if ($origname) {
Branch: 1 branch
BranchTrueFalseTotal
if ($origname) { } 0 0 0
4254 warn sprintf( "CV with empty PVGV %s -> %s\n",
4255 0 ▶ $fullname, $origname) if $debug{cv};
Branch: 1 branch
BranchTrueFalseTotal
if $B::C::debug{"cv"} 0 0 0
4256 0 $cvname = $fullname = $origname;
4257 0 ▶ $cvname =~ s/^\Q$cvstashname\E::(.*)( :pad\[.*)?$/$1/ if $cvstashname;
Branch: 1 branch
BranchTrueFalseTotal
if $cvstashname 0 0 0
4258 0 $cvname =~ s/^.*:://;
4259 0 ▶ if ($cvname =~ m/ :pad\[.*$/) {
Branch: 1 branch
BranchTrueFalseTotal
if ($cvname =~ / :pad\[.*$/) 0 0 0
4260 0 $cvname =~ s/ :pad\[.*$//;
4261 0 ▶ $cvname = '__ANON__' if is_phase_name($cvname);
Branch: 1 branch
BranchTrueFalseTotal
if is_phase_name($cvname) 0 0 0
4262 0 $fullname = $cvstashname.'::'.$cvname;
4263 }
4264 0 ▶ warn sprintf( "empty -> %s\n", $cvname) if $debug{cv};
Branch: 1 branch
BranchTrueFalseTotal
if $B::C::debug{"cv"} 0 0 0
4265 } else {
4266 0 $cvname = $gv->EGV->NAME;
4267 warn sprintf( "CV with empty PVGV %s -> %s::%s\n",
4268 0 ▶ $fullname, $cvstashname, $cvname) if $debug{cv};
Branch: 1 branch
BranchTrueFalseTotal
if $B::C::debug{"cv"} 0 0 0
4269 0 $fullname = $cvstashname.'::'.$cvname;
4270 }
4271 }
4272 warn sprintf( "CV 0x%x as PVGV 0x%x %s CvFLAGS=0x%x\n",
4273 0 ▶ $$cv, $$gv, $fullname, $CvFLAGS ) if $debug{cv};
Branch: 1 branch
BranchTrueFalseTotal
if $B::C::debug{"cv"} 0 0 0
4274 # XXX not needed, we already loaded utf8_heavy
4275 #return if $fullname eq 'utf8::AUTOLOAD';
4276 0 ▶ return '0' if $all_bc_subs{$fullname} or skip_pkg($cvstashname);
Branch: 1 branch
BranchTrueFalseTotal
if $all_bc_subs{$fullname} or skip_pkg($cvstashname) 0 0 0
Condition0%0/3
$all_bc_subs{$fullname} or skip_pkg($cvstashname)
l!l&&r!l&&!r
000
MC/DC0%0/2
$all_bc_subs{$fullname} or skip_pkg($cvstashname)
$all_bc_subs{$fullname} skip_pkg($cvstashname)
Truth table0%0/3
A or B
A= $all_bc_subs{$fullname}B= skip_pkg($cvstashname)
ABresult
1X1
011
000
4277 0 ▶ $CvFLAGS &= ~0x400 if $PERL514; # no CVf_CVGV_RC otherwise we cannot set the GV
Branch: 1 branch
BranchTrueFalseTotal
if $PERL514 0 0 0
4278 0 ▶ mark_package($cvstashname, 1) unless $include_package{$cvstashname};
Branch: 1 branch
BranchTrueFalseTotal
unless $include_package{$cvstashname} 0 0 0
4279 }
4280 0 ▶ $cvstashname = '' unless defined $cvstashname;
Branch: 1 branch
BranchTrueFalseTotal
unless defined $cvstashname 0 0 0
4281  
4282 # XXX TODO need to save the gv stash::AUTOLOAD if exists
4283 0 my $root = $cv->ROOT;
4284 0 my $cvxsub = $cv->XSUB;
4285 0 my $isconst;
4286 0 ▶ { no strict 'subs';
Subroutine BEGIN: called CC=1 SCAR=0.2
4287 0 ▶ $isconst = $PERL56 ? 0 : $CvFLAGS & CVf_CONST;
Branch: 1 branch
BranchTrueFalseTotal
$PERL56 ? : 0 0 0
4288 }
4289  
4290 0 ▶ if ( !$isconst && $cvxsub && ( $cvname ne "INIT" ) ) {
Branch: 1 branch
BranchTrueFalseTotal
if (not $isconst and $cvxsub and $cvname ne "INIT") 0 0 0
Condition0%0/6
not $isconst and $cvxsub and $cvname ne "INIT"
!ll&&!rl&&r
000
not $isconst and $cvxsub
!ll&&!rl&&r
000
MC/DC0%0/3
not $isconst and $cvxsub and $cvname ne "INIT"
not $isconst $cvxsub $cvname ne "INIT"
Truth table0%0/4
not(A) and B and C
A= not $isconstB= $cvxsubC= $cvname ne "INIT"
ABCresult
0XX0
10X0
1100
1111
4291 0 my $egv = $gv->EGV;
4292 0 my $stashname = $egv->STASH->NAME;
4293 0 $fullname = $stashname.'::'.$cvname;
4294 0 ▶ if ( $cvname eq "bootstrap" and !$xsub{$stashname} ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($cvname eq 'bootstrap' and not $xsub{$stashname}) { } 0 0 0
Condition0%0/3
$cvname eq "bootstrap" and not $xsub{$stashname}
!ll&&!rl&&r
000
MC/DC0%0/2
$cvname eq "bootstrap" and not $xsub{$stashname}
$cvname eq "bootstrap" not $xsub{$stashname}
Truth table0%0/3
A and not(B)
A= $cvname eq "bootstrap"B= not $xsub{$stashname}
ABresult
0X0
100
111
4295 0 my $file = $gv->FILE;
4296 0 $decl->add("/* bootstrap $file */");
4297 0 ▶ warn "Bootstrap $stashname $file\n" if $verbose;
Branch: 1 branch
BranchTrueFalseTotal
if $B::C::verbose 0 0 0
4298 0 mark_package($stashname);
4299  
4300 # Without DynaLoader we must boot and link static
4301 0 ▶ if ( !$Config{usedl} ) {
Branch: 2 branches
BranchTrueFalseTotal
if (not $B::C::Config{'usedl'}) { } 0 0 0
elsif (not UNIVERSAL::isa($stashname, 'DynaLoader') and $stashname ne 'attributes' || $] >= 5.011) { } 0 0 0
4302 0 $xsub{$stashname} = 'Static';
4303 }
4304 # if it not isa('DynaLoader'), it should hopefully be XSLoaded
4305 # ( attributes being an exception, of course )
4306 ▶ elsif ( !UNIVERSAL::isa( $stashname, 'DynaLoader' )
Condition0%0/6
not UNIVERSAL::isa($stashname, "DynaLoader") and $stashname ne "attributes" || $] >= "5.011"
!ll&&!rl&&r
000
$stashname ne "attributes" or $] >= "5.011"
l!l&&r!l&&!r
000
MC/DC0%0/3
not UNIVERSAL::isa($stashname, "DynaLoader") and $stashname ne "attributes" || $] >= "5.011"
not UNIVERSAL::isa($stashname, "DynaLoader") $stashname ne "attributes" $] >= "5.011"
Truth table0%0/4
not(A) and B or C
A= not UNIVERSAL::isa($stashname, "DynaLoader")B= $stashname ne "attributes"C= $] >= "5.011"
ABCresult
0XX0
1000
11X1
1011
4307 and ($stashname ne 'attributes' || $] >= 5.011))
4308 {
4309 0 my $stashfile = $stashname;
4310 0 $stashfile =~ s/::/\//g;
4311 0 ▶ if ($file =~ /XSLoader\.pm$/) { # almost always the case
Branch: 1 branch
BranchTrueFalseTotal
if ($file =~ /XSLoader\.pm$/) 0 0 0
4312 0 $file = $INC{$stashfile . ".pm"};
4313 }
4314 0 ▶ unless ($file) { # do the reverse as DynaLoader: soname => pm
Branch: 1 branch
BranchTrueFalseTotal
unless ($file) 0 0 0
4315 0 my ($laststash) = $stashname =~ /::([^:]+)$/;
4316 0 ▶ $laststash = $stashname unless $laststash;
Branch: 1 branch
BranchTrueFalseTotal
unless $laststash 0 0 0
4317 0 my $sofile = "auto/" . $stashfile . '/' . $laststash . '\.' . $Config{dlext};
4318 0 for (@DynaLoader::dl_shared_objects) {
4319 0 ▶ if (m{^(.+/)$sofile$}) {
Branch: 1 branch
BranchTrueFalseTotal
if (m[^(.+/)$sofile$]) 0 0 0
4320 0 $file = $1. $stashfile.".pm"; last;
4321 }
4322 }
4323 }
4324 0 $xsub{$stashname} = 'Dynamic-'.$file;
4325 0 force_saving_xsloader();
4326 }
4327 else {
4328 0 $xsub{$stashname} = 'Dynamic';
4329 # DynaLoader was for sure loaded, before so we execute the branch which
4330 # does walk_syms and add_hashINC
4331 0 mark_package('DynaLoader', 1);
4332 }
4333  
4334 # INIT is removed from the symbol table, so this call must come
4335 # from PL_initav->save. Re-bootstrapping will push INIT back in,
4336 # so nullop should be sent.
4337 0 ▶ warn $fullname."\n" if $debug{sub};
Branch: 1 branch
BranchTrueFalseTotal
if $B::C::debug{"sub"} 0 0 0
4338 0 return qq/NULL/;
4339 }
4340 else {
4341 # XSUBs for IO::File, IO::Handle, IO::Socket, IO::Seekable and IO::Poll
4342 # are defined in IO.xs, so let's bootstrap it
4343 0 my @IO = qw(IO::File IO::Handle IO::Socket IO::Seekable IO::Poll);
4344 0 ▶ if (grep { $stashname eq $_ } @IO) {
Branch: 1 branch
BranchTrueFalseTotal
if (grep {$stashname eq $_;} @IO) 0 0 0
4345 # mark_package('IO', 1);
4346 # $xsub{IO} = 'Dynamic-'. $INC{'IO.pm'}; # XSLoader (issue59)
4347 0 svref_2object( \&IO::bootstrap )->save;
4348 0 mark_package('IO::Handle', 1);
4349 0 mark_package('SelectSaver', 1);
4350 #for (@IO) { # mark all IO packages
4351 # mark_package($_, 1);
4352 #}
4353 }
4354 }
4355 0 ▶ warn $fullname."\n" if $debug{sub};
Branch: 1 branch
BranchTrueFalseTotal
if $B::C::debug{"sub"} 0 0 0
4356 0 ▶ unless ( in_static_core($stashname, $cvname) ) {
Branch: 1 branch
BranchTrueFalseTotal
if (in_static_core($stashname, $cvname)) { } 0 0 0
4357 41 ▶ no strict 'refs';
Subroutine BEGIN: called CC=1 SCAR=0.0
4358 warn sprintf( "XSUB $fullname CV 0x%x\n", $$cv )
4359 0 ▶ if $debug{cv};
Branch: 1 branch
BranchTrueFalseTotal
if $B::C::debug{"cv"} 0 0 0
4360 0 ▶ svref_2object( \*{"$stashname\::bootstrap"} )->save
Branch: 1 branch
BranchTrueFalseTotal
if $stashname 0 0 0
4361 if $stashname;# and defined ${"$stashname\::bootstrap"};
4362 # delsym($cv);
4363 0 return get_cv($fullname, 0);
4364 } else { # Those cvs are already booted. Reuse their GP.
4365 # Esp. on windows it is impossible to get at the XS function ptr
4366 0 ▶ warn sprintf( "core XSUB $fullname CV 0x%x\n", $$cv ) if $debug{cv};
Branch: 1 branch
BranchTrueFalseTotal
if $B::C::debug{"cv"} 0 0 0
4367 0 return get_cv($fullname, 0);
4368 }
4369 }
4370 0 ▶ if ( !$isconst && $cvxsub && $cvname eq "INIT" ) {
Branch: 1 branch
BranchTrueFalseTotal
if (not $isconst and $cvxsub and $cvname eq "INIT") 0 0 0
Condition0%0/6
not $isconst and $cvxsub and $cvname eq "INIT"
!ll&&!rl&&r
000
not $isconst and $cvxsub
!ll&&!rl&&r
000
MC/DC0%0/3
not $isconst and $cvxsub and $cvname eq "INIT"
not $isconst $cvxsub $cvname eq "INIT"
Truth table0%0/4
not(A) and B and C
A= not $isconstB= $cvxsubC= $cvname eq "INIT"
ABCresult
0XX0
10X0
1100
1111
4371 41 ▶ no strict 'refs';
Subroutine BEGIN: called CC=1 SCAR=0.0
4372 0 ▶ warn $fullname."\n" if $debug{sub};
Branch: 1 branch
BranchTrueFalseTotal
if $B::C::debug{"sub"} 0 0 0
4373 0 return svref_2object( \&Dummy_initxs )->save;
4374 }
4375  
4376 # XXX how is ANON with CONST handled? CONST uses XSUBANY [GH #246]
4377 0 ▶ if ($isconst and $cvxsub and !is_phase_name($cvname) and
Branch: 1 branch
BranchTrueFalseTotal
if ($isconst and $cvxsub and not is_phase_name($cvname) and $PERL522 && !($CvFLAGS & 262144) && !($CvFLAGS & 16) && !($fullname && $fullname =~ qr/^File::Glob::GLOB/ && $CvFLAGS & 131076) || !($PERL522 || $CvFLAGS & 128)) 0 0 0
Condition0%0/30
$isconst and $cvxsub and not is_phase_name($cvname) and $PERL522 && !($CvFLAGS & 262144) && !($CvFLAGS & 16) && !($fullname && $fullname =~ qr/^File::Glob::GLOB/ && $CvFLAGS & 131076) || !($PERL522 || $CvFLAGS & 128)
!ll&&!rl&&r
000
$isconst and $cvxsub and not is_phase_name($cvname)
!ll&&!rl&&r
000
$isconst and $cvxsub
!ll&&!rl&&r
000
$PERL522 and not $CvFLAGS & 262144 and not $CvFLAGS & 16 and not $fullname && $fullname =~ qr/^File::Glob::GLOB/ && $CvFLAGS & 131076 or not $PERL522 || $CvFLAGS & 128
l!l&&r!l&&!r
000
$PERL522 and not $CvFLAGS & 262144 and not $CvFLAGS & 16 and not $fullname && $fullname =~ qr/^File::Glob::GLOB/ && $CvFLAGS & 131076
!ll&&!rl&&r
000
$PERL522 and not $CvFLAGS & 262144 and not $CvFLAGS & 16
!ll&&!rl&&r
000
$PERL522 and not $CvFLAGS & 262144
!ll&&!rl&&r
000
$fullname && $fullname =~ qr/^File::Glob::GLOB/ && $CvFLAGS & 131076
!ll&&!rl&&r
000
$fullname and $fullname =~ qr/^File::Glob::GLOB/
!ll&&!rl&&r
000
$PERL522 || $CvFLAGS & 128
l!l&&r!l&&!r
000
MC/DC0%0/11
$isconst and $cvxsub and not is_phase_name($cvname) and $PERL522 && !($CvFLAGS & 262144) && !($CvFLAGS & 16) && !($fullname && $fullname =~ qr/^File::Glob::GLOB/ && $CvFLAGS & 131076) || !($PERL522 || $CvFLAGS & 128)
$isconst $cvxsub not is_phase_name($cvname) $PERL522 not $CvFLAGS & 262144 not $CvFLAGS & 16 $fullname $fullname =~ qr/^File::Glob::GLOB/ $CvFLAGS & 131076 $PERL522 $CvFLAGS & 128
Truth table0%0/18
A and B and not(C) and D and not(E) and not(F) and not(G and H && I) or not(J || K)
A= $isconstB= $cvxsubC= not is_phase_name($cvname)D= $PERL522E= not $CvFLAGS & 262144F= not $CvFLAGS & 16G= $fullnameH= $fullname =~ qr/^File::Glob::GLOB/I= $CvFLAGS & 131076J= $PERL522K= $CvFLAGS & 128
ABCDEFGHIJKresult
0XXXXXXXXXX0
10XXXXXXXXX0
110XXXXXXXX0
1110XXXXX1X0
1110XXXXX010
11110XXXX1X0
11110XXXX010
111110XXX1X0
111110XXX010
1111111111X0
111111111010
1111110XXXX1
11111110XXX1
111111110XX1
1110XXXXX001
11110XXXX001
111110XXX001
111111111001
4378 (
4379 (
4380 $PERL522
4381 and !( $CvFLAGS & SVs_PADSTALE )
4382 and !( $CvFLAGS & CVf_WEAKOUTSIDE )
4383 and !( $fullname && $fullname =~ qr{^File::Glob::GLOB}
4384 and ( $CvFLAGS & (CVf_ANONCONST|CVf_CONST) ) )
4385 )
4386 or (!$PERL522 and !($CvFLAGS & CVf_ANON)) )
4387 ) # skip const magic blocks (Attribute::Handlers)
4388 {
4389 0 my $stash = $gv->STASH;
4390 #warn sprintf("$cvstashname\::$cvname 0x%x -> XSUBANY", $CvFLAGS) if $debug{cv};
4391 0 my $sv = $cv->XSUBANY;
4392 warn sprintf( "CV CONST 0x%x %s::%s -> 0x%x as %s\n", $$gv, $cvstashname, $cvname,
4393 0 ▶ $sv, ref $sv) if $debug{cv};
Branch: 1 branch
BranchTrueFalseTotal
if $B::C::debug{"cv"} 0 0 0
4394 # warn sprintf( "%s::%s\n", $cvstashname, $cvname) if $debug{sub};
4395 0 my $stsym = $stash->save;
4396 0 my $name = cstring($cvname);
4397 0 ▶ if ($] >= 5.016) { # need to check 'Encode::XS' constant encodings
Branch: 1 branch
BranchTrueFalseTotal
if ($] >= "5.016") 0 0 0
4398 # warn "$sv CONSTSUB $name";
4399 0 ▶ if ((ref($sv) eq 'B::IV' or ref($sv) eq 'B::PVMG') and $sv->FLAGS & SVf_ROK) {
Branch: 1 branch
BranchTrueFalseTotal
if (ref $sv eq "B::IV" || ref $sv eq "B::PVMG" and $sv->FLAGS & 2048) 0 0 0
Condition0%0/6
ref $sv eq "B::IV" || ref $sv eq "B::PVMG" and $sv->FLAGS & 2048
!ll&&!rl&&r
000
ref $sv eq "B::IV" or ref $sv eq "B::PVMG"
l!l&&r!l&&!r
000
MC/DC0%0/3
ref $sv eq "B::IV" || ref $sv eq "B::PVMG" and $sv->FLAGS & 2048
ref $sv eq "B::IV" ref $sv eq "B::PVMG" $sv->FLAGS & 2048
Truth table0%0/5
A or B and C
A= ref $sv eq "B::IV"B= ref $sv eq "B::PVMG"C= $sv->FLAGS & 2048
ABCresult
00X0
1X00
0100
1X11
0111
4400 0 my $rv = $sv->RV;
4401 0 ▶ if ($rv->FLAGS & (SVp_POK|SVf_IOK) and $rv->IVX > LOWEST_IMAGEBASE) {
Branch: 1 branch
BranchTrueFalseTotal
if ($rv->FLAGS & 16640 and $rv->IVX > 65536) 0 0 0
Condition0%0/3
$rv->FLAGS & 16640 and $rv->IVX > 65536
!ll&&!rl&&r
000
MC/DC0%0/2
$rv->FLAGS & 16640 and $rv->IVX > 65536
$rv->FLAGS & 16640 $rv->IVX > 65536
Truth table0%0/3
A and B
A= $rv->FLAGS & 16640B= $rv->IVX > 65536
ABresult
0X0
100
111
4402 0 patch_dlsym($rv, $fullname, $rv->IVX);
4403 }
4404 }
4405 }
4406 # scalarref: t/CORE/v5.22/t/op/const-optree.t at curpad_syms[6]
4407 # main::__ANON__ -> CxPOPSUB_DONE=SCALAR
4408 # TODO Attribute::Handlers #171, test 176
4409 0 ▶ if ($sv and ref($sv) and ref($sv) =~ /^(SCALAR|ARRAY|HASH|CODE|REF)$/) {
Branch: 2 branches
BranchTrueFalseTotal
if ($sv and ref $sv and ref($sv) =~ /^(SCALAR|ARRAY|HASH|CODE|REF)$/) { } 0 0 0
elsif ($sv and ref($sv) =~ /^B::[ANRPI]/) { } 0 0 0
Condition0%0/6
$sv and ref $sv and ref($sv) =~ /^(SCALAR|ARRAY|HASH|CODE|REF)$/
!ll&&!rl&&r
000
$sv and ref $sv
!ll&&!rl&&r
000
MC/DC0%0/3
$sv and ref $sv and ref($sv) =~ /^(SCALAR|ARRAY|HASH|CODE|REF)$/
$sv ref $sv ref($sv) =~ /^(SCALAR|ARRAY|HASH|CODE|REF)$/
Truth table0%0/4
A and B and C
A= $svB= ref $svC= ref($sv) =~ /^(SCALAR|ARRAY|HASH|CODE|REF)$/
ABCresult
0XX0
10X0
1100
1111
4410 # Save XSUBANY, maybe ARRAY or HASH also?
4411 0 ▶ warn "SCALAR const sub $cvstashname\::$cvname -> $sv\n" if $debug{cv};
Branch: 1 branch
BranchTrueFalseTotal
if $B::C::debug{"cv"} 0 0 0
4412 0 my $vsym = svref_2object( \$sv )->save;
4413 0 my $cvi = "cv".$cv_index++;
4414 0 $decl->add("Static CV* $cvi;");
4415 0 $init->add("$cvi = newCONSTSUB( $stsym, $name, (SV*)$vsym );");
4416 0 return savesym( $cv, $cvi );
4417 }
4418 ▶ elsif ($sv and ref($sv) =~ /^B::[ANRPI]/) { # use constant => ()
Condition0%0/3
$sv and ref($sv) =~ /^B::[ANRPI]/
!ll&&!rl&&r
000
MC/DC0%0/2
$sv and ref($sv) =~ /^B::[ANRPI]/
$sv ref($sv) =~ /^B::[ANRPI]/
Truth table0%0/3
A and B
A= $svB= ref($sv) =~ /^B::[ANRPI]/
ABresult
0X0
100
111
4419 0 my $vsym = $sv->save;
4420 0 my $cvi = "cv".$cv_index++;
4421 0 $decl->add("Static CV* $cvi;");
4422 0 $init->add("$cvi = newCONSTSUB( $stsym, $name, (SV*)$vsym );");
4423 0 return savesym( $cv, $cvi );
4424 } else {
4425 0 ▶ warn "Warning: Undefined const sub $cvstashname\::$cvname -> $sv\n" if $verbose;
Branch: 1 branch
BranchTrueFalseTotal
if $B::C::verbose 0 0 0
4426 }
4427 }
4428  
4429 # This define is forwarded to the real sv below
4430 # The new method, which saves a SV only works since 5.10 (? Does not work in newer perls)
4431 0 my $sv_ix = $svsect->index + 1;
4432 0 my $xpvcv_ix;
4433 0 my $new_cv_fw = 0;#$PERL510; # XXX this does not work yet
4434 0 ▶ if ($new_cv_fw) {
Branch: 1 branch
BranchTrueFalseTotal
if ($new_cv_fw) { } 0 0 0
4435 0 $sym = savesym( $cv, "CVIX$sv_ix" );
4436 } else {
4437 0 $svsect->add("CVIX$sv_ix");
4438 0 ▶ $svsect->debug( "&".$fullname, $cv->flagspv ) if $debug{flags};
Branch: 1 branch
BranchTrueFalseTotal
if $B::C::debug{"flags"} 0 0 0
4439 0 $xpvcv_ix = $xpvcvsect->index + 1;
4440 0 $xpvcvsect->add("XPVCVIX$xpvcv_ix");
4441 # Save symbol now so that GvCV() doesn't recurse back to us via CvGV()
4442 0 $sym = savesym( $cv, "&sv_list[$sv_ix]" );
4443 }
4444  
4445 warn sprintf( "saving %s CV 0x%x as %s\n", $fullname, $$cv, $sym )
4446 0 ▶ if $debug{cv};
Branch: 1 branch
BranchTrueFalseTotal
if $B::C::debug{"cv"} 0 0 0
4447 0 ▶ if (!$$root and $] < 5.010) {
Branch: 1 branch
BranchTrueFalseTotal
if (not $$root and $] < "5.01") 0 0 0
Condition0%0/3
not $$root and $] < "5.01"
!ll&&!rl&&r
000
MC/DC0%0/2
not $$root and $] < "5.01"
not $$root $] < "5.01"
Truth table0%0/3
not(A) and B
A= not $$rootB= $] < "5.01"
ABresult
0X0
100
111
4448 0 $package_pv = $cvstashname;
4449 0 push_package($package_pv);
4450 }
4451 0 ▶ if ($fullname eq 'utf8::SWASHNEW') { # bypass utf8::AUTOLOAD, a new 5.13.9 mess
Branch: 1 branch
BranchTrueFalseTotal
if ($fullname eq "utf8::SWASHNEW") 0 0 0
4452 0 load_utf8_heavy();
4453 }
4454  
4455 0 ▶ if ($fullname eq 'IO::Socket::SSL::SSL_Context::new') {
Branch: 1 branch
BranchTrueFalseTotal
if ($fullname eq "IO::Socket::SSL::SSL_Context::new") 0 0 0
4456 0 ▶ if ($IO::Socket::SSL::VERSION ge '1.956' and $IO::Socket::SSL::VERSION lt '1.995') {
Branch: 1 branch
BranchTrueFalseTotal
if ($IO::Socket::SSL::VERSION ge "1.956" and $IO::Socket::SSL::VERSION lt "1.995") 0 0 0
Condition0%0/3
$IO::Socket::SSL::VERSION ge "1.956" and $IO::Socket::SSL::VERSION lt "1.995"
!ll&&!rl&&r
000
MC/DC0%0/2
$IO::Socket::SSL::VERSION ge "1.956" and $IO::Socket::SSL::VERSION lt "1.995"
$IO::Socket::SSL::VERSION ge "1.956" $IO::Socket::SSL::VERSION lt "1.995"
Truth table0%0/3
A and B
A= $IO::Socket::SSL::VERSION ge "1.956"B= $IO::Socket::SSL::VERSION lt "1.995"
ABresult
0X0
100
111
4457 # See https://code.google.com/p/perl-compiler/issues/detail?id=317
4458 # https://rt.cpan.org/Ticket/Display.html?id=95452
4459 0 warn "Warning: Your IO::Socket::SSL version $IO::Socket::SSL::VERSION is unsupported to create\n".
4460 " a server. You need to upgrade IO::Socket::SSL to at least 1.995 [CPAN #95452]\n";
4461 }
4462 }
4463  
4464 0 ▶ if (!$$root && !$cvxsub) {
Branch: 1 branch
BranchTrueFalseTotal
unless ($$root or $cvxsub) 0 0 0
Condition0%0/3
$$root or $cvxsub
l!l&&r!l&&!r
000
MC/DC0%0/2
$$root or $cvxsub
$$root $cvxsub
Truth table0%0/3
A or B
A= $$rootB= $cvxsub
ABresult
1X1
011
000
4465 0 my $reloaded;
4466 0 ▶ if ($cvstashname =~ /^(bytes|utf8)$/) { # no autoload, force compile-time
Branch: 2 branches
BranchTrueFalseTotal
if ($cvstashname =~ /^(bytes|utf8)$/) { } 0 0 0
elsif ($fullname eq 'Coro::State::_jit') { } 0 0 0
4467 0 force_heavy($cvstashname);
4468 0 $cv = svref_2object( \&{$cvstashname."::".$cvname} );
4469 0 $reloaded = 1;
4470 } elsif ($fullname eq 'Coro::State::_jit') { # 293
4471 # need to force reload the jit src
4472 0 my ($pl) = grep { m|^Coro/jit-| } keys %INC;
4473 0 ▶ if ($pl) {
Branch: 1 branch
BranchTrueFalseTotal
if ($pl) 0 0 0
4474 0 delete $INC{$pl};
4475 0 require $pl;
4476 0 $cv = svref_2object( \&{$fullname} );
4477 0 $reloaded = 1;
4478 }
4479 }
4480 0 ▶ if ($reloaded) {
Branch: 1 branch
BranchTrueFalseTotal
if ($reloaded) 0 0 0
4481 0 ▶ if (!$cv->is_named) {
Branch: 1 branch
BranchTrueFalseTotal
if (not $cv->is_named) { } 0 0 0
4482 0 $gv = $cv->GV;
4483 warn sprintf( "Redefined CV 0x%x as PVGV 0x%x %s CvFLAGS=0x%x\n",
4484 0 ▶ $$cv, $$gv, $fullname, $CvFLAGS ) if $debug{cv};
Branch: 1 branch
BranchTrueFalseTotal
if $B::C::debug{"cv"} 0 0 0
4485 } else {
4486 0 $fullname = $cv->NAME_HEK;
4487 0 ▶ $fullname = '' unless defined $fullname;
Branch: 1 branch
BranchTrueFalseTotal
unless defined $fullname 0 0 0
4488 0 ▶ if ($fullname =~ /^(.*)::(.*?)$/) {
Branch: 1 branch
BranchTrueFalseTotal
if ($fullname =~ /^(.*)::(.*?)$/) 0 0 0
4489 0 $cvstashname = $1;
4490 0 $cvname = $2;
4491 }
4492 warn sprintf( "Redefined CV 0x%x as NAMED %s CvFLAGS=0x%x\n",
4493 0 ▶ $$cv, $fullname, $CvFLAGS ) if $debug{cv};
Branch: 1 branch
BranchTrueFalseTotal
if $B::C::debug{"cv"} 0 0 0
4494 }
4495 0 $sym = savesym( $cv, $sym );
4496 0 $root = $cv->ROOT;
4497 0 $cvxsub = $cv->XSUB;
4498 }
4499 }
4500 0 ▶ if ( !$$root && !$cvxsub ) {
Branch: 1 branch
BranchTrueFalseTotal
unless ($$root or $cvxsub) 0 0 0
Condition0%0/3
$$root or $cvxsub
l!l&&r!l&&!r
000
MC/DC0%0/2
$$root or $cvxsub
$$root $cvxsub
Truth table0%0/3
A or B
A= $$rootB= $cvxsub
ABresult
1X1
011
000
4501 0 ▶ if ( my $auto = try_autoload( $cvstashname, $cvname ) ) {
Branch: 1 branch
BranchTrueFalseTotal
if (my $auto = try_autoload($cvstashname, $cvname)) 0 0 0
4502 0 ▶ if (ref $auto eq 'B::CV') { # explicit goto or UNIVERSAL
Branch: 1 branch
BranchTrueFalseTotal
if (ref $auto eq 'B::CV') { } 0 0 0
4503 0 $root = $auto->ROOT;
4504 0 $cvxsub = $auto->XSUB;
4505 0 ▶ if ($$auto) {
Branch: 1 branch
BranchTrueFalseTotal
if ($$auto) 0 0 0
4506 # XXX This has now created a wrong GV name!
4507 0 my $oldcv = $cv;
4508 0 $cv = $auto ; # This is new. i.e. via AUTOLOAD or UNIVERSAL, in another stash
4509 0 my $gvnew = $cv->GV;
4510 0 ▶ if ($$gvnew) {
Branch: 1 branch
BranchTrueFalseTotal
if ($$gvnew) 0 0 0
4511 0 ▶ if ($cvstashname ne $gvnew->STASH->NAME or $cvname ne $gvnew->NAME) { # UNIVERSAL or AUTOLOAD
Branch: 1 branch
BranchTrueFalseTotal
if ($cvstashname ne $gvnew->STASH->NAME or $cvname ne $gvnew->NAME) 0 0 0
Condition0%0/3
$cvstashname ne $gvnew->STASH->NAME or $cvname ne $gvnew->NAME
l!l&&r!l&&!r
000
MC/DC0%0/2
$cvstashname ne $gvnew->STASH->NAME or $cvname ne $gvnew->NAME
$cvstashname ne $gvnew->STASH->NAME $cvname ne $gvnew->NAME
Truth table0%0/3
A or B
A= $cvstashname ne $gvnew->STASH->NAMEB= $cvname ne $gvnew->NAME
ABresult
1X1
011
000
4512 0 my $newname = $gvnew->STASH->NAME."::".$gvnew->NAME;
4513 0 ▶ warn " New $newname autoloaded. remove old cv\n" if $debug{sub}; # and wrong GV?
Branch: 1 branch
BranchTrueFalseTotal
if $B::C::debug{"sub"} 0 0 0
4514 0 ▶ unless ($new_cv_fw) {
Branch: 1 branch
BranchTrueFalseTotal
unless ($new_cv_fw) 0 0 0
4515 0 $svsect->remove;
4516 0 $xpvcvsect->remove;
4517 }
4518 0 delsym($oldcv);
4519 0 ▶ return $cv->save($newname) if !$PERL510;
Branch: 1 branch
BranchTrueFalseTotal
unless $PERL510 0 0 0
4520  
4521 41 ▶ no strict 'refs';
Subroutine BEGIN: called CC=1 SCAR=0.0
4522 0 my $newsym = svref_2object( \*{$newname} )->save;
4523 0 ▶ my $cvsym = defined objsym($cv) ? objsym($cv) : $cv->save($newname);
Branch: 1 branch
BranchTrueFalseTotal
defined objsym($cv) ? : 0 0 0
4524 0 ▶ if (my $oldsym = objsym($gv)) {
Branch: 1 branch
BranchTrueFalseTotal
if (my $oldsym = objsym($gv)) 0 0 0
4525 0 ▶ warn "Alias polluted $oldsym to $newsym\n" if $debug{gv};
Branch: 1 branch
BranchTrueFalseTotal
if $B::C::debug{"gv"} 0 0 0
4526 0 $init->add("$oldsym = $newsym;");
4527 0 delsym($gv);
4528 }# else {
4529 #$init->add("GvCV_set(gv_fetchpv(\"$fullname\", GV_ADD, SVt_PV), (CV*)NULL);");
4530 #}
4531 0 return $cvsym;
4532 }
4533 }
4534 0 $sym = savesym( $cv, "&sv_list[$sv_ix]" ); # GOTO
4535 0 ▶ warn "$fullname GOTO\n" if $verbose;
Branch: 1 branch
BranchTrueFalseTotal
if $B::C::verbose 0 0 0
4536 }
4537 } else {
4538 # Recalculated root and xsub
4539 0 $root = $cv->ROOT;
4540 0 $cvxsub = $cv->XSUB;
4541 0 my $gv = $cv->GV;
4542 0 ▶ if ($$gv) {
Branch: 1 branch
BranchTrueFalseTotal
if ($$gv) 0 0 0
4543 0 ▶ if ($cvstashname ne $gv->STASH->NAME or $cvname ne $gv->NAME) { # UNIVERSAL or AUTOLOAD
Branch: 1 branch
BranchTrueFalseTotal
if ($cvstashname ne $gv->STASH->NAME or $cvname ne $gv->NAME) 0 0 0
Condition0%0/3
$cvstashname ne $gv->STASH->NAME or $cvname ne $gv->NAME
l!l&&r!l&&!r
000
MC/DC0%0/2
$cvstashname ne $gv->STASH->NAME or $cvname ne $gv->NAME
$cvstashname ne $gv->STASH->NAME $cvname ne $gv->NAME
Truth table0%0/3
A or B
A= $cvstashname ne $gv->STASH->NAMEB= $cvname ne $gv->NAME
ABresult
1X1
011
000
4544 0 my $newname = $gv->STASH->NAME."::".$gv->NAME;
4545 0 ▶ warn "Recalculated root and xsub $newname. remove old cv\n" if $verbose;
Branch: 1 branch
BranchTrueFalseTotal
if $B::C::verbose 0 0 0
4546 0 $svsect->remove;
4547 0 $xpvcvsect->remove;
4548 0 delsym($cv);
4549 0 return $cv->save($newname);
4550 }
4551 }
4552 }
4553 0 ▶ if ( $$root || $cvxsub ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($$root or $cvxsub) 0 0 0
Condition0%0/3
$$root or $cvxsub
l!l&&r!l&&!r
000
MC/DC0%0/2
$$root or $cvxsub
$$root $cvxsub
Truth table0%0/3
A or B
A= $$rootB= $cvxsub
ABresult
1X1
011
000
4554 0 ▶ warn "Successful forced autoload\n" if $verbose and $debug{cv};
Branch: 1 branch
BranchTrueFalseTotal
if $B::C::verbose and $B::C::debug{"cv"} 0 0 0
Condition0%0/3
$B::C::verbose and $B::C::debug{"cv"}
!ll&&!rl&&r
000
MC/DC0%0/2
$B::C::verbose and $B::C::debug{"cv"}
$B::C::verbose $B::C::debug{"cv"}
Truth table0%0/3
A and B
A= $B::C::verboseB= $B::C::debug{"cv"}
ABresult
0X0
100
111
4555 }
4556 }
4557 }
4558 0 ▶ if (!$$root) {
Branch: 1 branch
BranchTrueFalseTotal
unless ($$root) 0 0 0
4559 0 ▶ if ($fullname ne 'threads::tid'
Branch: 1 branch
BranchTrueFalseTotal
if ($fullname ne "threads::tid" and $fullname ne "main::main::" and ($PERL510 and not defined &{$cvstashname . '::AUTOLOAD';})) 0 0 0
Condition0%0/9
$fullname ne "threads::tid" and $fullname ne "main::main::" and ($PERL510 and not defined &{$cvstashname . '::AUTOLOAD';})
!ll&&!rl&&r
000
$fullname ne "threads::tid" and $fullname ne "main::main::"
!ll&&!rl&&r
000
$PERL510 and not defined &{$cvstashname . '::AUTOLOAD';}
!ll&&!rl&&r
000
MC/DC0%0/4
$fullname ne "threads::tid" and $fullname ne "main::main::" and ($PERL510 and not defined &{$cvstashname . '::AUTOLOAD';})
$fullname ne "threads::tid" $fullname ne "main::main::" $PERL510 not defined &{$cvstashname . '::AUTOLOAD';}
Truth table0%0/5
A and B and C and not(D)
A= $fullname ne "threads::tid"B= $fullname ne "main::main::"C= $PERL510D= not defined &{$cvstashname . '::AUTOLOAD';}
ABCDresult
0XXX0
10XX0
110X0
11100
11111
4560 and $fullname ne 'main::main::'
4561 0 and ($PERL510 and !defined(&{$cvstashname."::AUTOLOAD"})))
4562 {
4563 # XXX What was here?
4564 }
4565 0 ▶ if (exists &$fullname) {
Branch: 2 branches
BranchTrueFalseTotal
if (exists &$fullname) { } 0 0 0
elsif ($cv->is_named) { } 0 0 0
4566 0 ▶ warn "Warning: Empty &".$fullname."\n" if $debug{sub};
Branch: 1 branch
BranchTrueFalseTotal
if $B::C::debug{"sub"} 0 0 0
4567 0 ▶ $init->add( "/* empty CV $fullname */" ) if $verbose or $debug{sub};
Branch: 1 branch
BranchTrueFalseTotal
if $B::C::verbose or $B::C::debug{"sub"} 0 0 0
Condition0%0/3
$B::C::verbose or $B::C::debug{"sub"}
l!l&&r!l&&!r
000
MC/DC0%0/2
$B::C::verbose or $B::C::debug{"sub"}
$B::C::verbose $B::C::debug{"sub"}
Truth table0%0/3
A or B
A= $B::C::verboseB= $B::C::debug{"sub"}
ABresult
1X1
011
000
4568 } elsif ($cv->is_named) {
4569 # need to find the attached lexical sub (#130 + #341) at run-time
4570 # in the PadNAMES array. So keep the empty PVCV
4571 0 ▶ warn "lexsub &".$fullname." saved as empty $sym\n" if $debug{sub};
Branch: 1 branch
BranchTrueFalseTotal
if $B::C::debug{"sub"} 0 0 0
4572 } else {
4573 0 ▶ warn "Warning: &".$fullname." not found\n" if $fullname and $debug{sub};
Branch: 1 branch
BranchTrueFalseTotal
if $fullname and $B::C::debug{"sub"} 0 0 0
Condition0%0/3
$fullname and $B::C::debug{"sub"}
!ll&&!rl&&r
000
MC/DC0%0/2
$fullname and $B::C::debug{"sub"}
$fullname $B::C::debug{"sub"}
Truth table0%0/3
A and B
A= $fullnameB= $B::C::debug{"sub"}
ABresult
0X0
100
111
4574 0 ▶ $init->add( "/* CV $fullname not found */" ) if $verbose or $debug{sub};
Branch: 1 branch
BranchTrueFalseTotal
if $B::C::verbose or $B::C::debug{"sub"} 0 0 0
Condition0%0/3
$B::C::verbose or $B::C::debug{"sub"}
l!l&&r!l&&!r
000
MC/DC0%0/2
$B::C::verbose or $B::C::debug{"sub"}
$B::C::verbose $B::C::debug{"sub"}
Truth table0%0/3
A or B
A= $B::C::verboseB= $B::C::debug{"sub"}
ABresult
1X1
011
000
4575 # This block broke test 15, disabled
4576 0 ▶ if ($sv_ix == $svsect->index and !$new_cv_fw) { # can delete, is the last SV
Branch: 1 branch
BranchTrueFalseTotal
if ($sv_ix == $svsect->index and not $new_cv_fw) { } 0 0 0
Condition0%0/3
$sv_ix == $svsect->index and not $new_cv_fw
!ll&&!rl&&r
000
MC/DC0%0/2
$sv_ix == $svsect->index and not $new_cv_fw
$sv_ix == $svsect->index not $new_cv_fw
Truth table0%0/3
A and not(B)
A= $sv_ix == $svsect->indexB= not $new_cv_fw
ABresult
0X0
100
111
4577 warn "No definition for sub $fullname (unable to autoload), skip CV[$sv_ix]\n"
4578 0 ▶ if $debug{cv};
Branch: 1 branch
BranchTrueFalseTotal
if $B::C::debug{"cv"} 0 0 0
4579 0 $svsect->remove;
4580 0 $xpvcvsect->remove;
4581 0 delsym( $cv );
4582 # Empty CV (methods) must be skipped not to disturb method resolution
4583 # (e.g. t/testm.sh POSIX)
4584 0 return '0';
4585 } else {
4586 # interim &AUTOLOAD saved, cannot delete. e.g. Fcntl, POSIX
4587 warn "No definition for sub $fullname (unable to autoload), stub CV[$sv_ix]\n"
4588 0 ▶ if $debug{cv} or $verbose;
Branch: 1 branch
BranchTrueFalseTotal
if $B::C::debug{"cv"} or $B::C::verbose 0 0 0
Condition0%0/3
$B::C::debug{"cv"} or $B::C::verbose
l!l&&r!l&&!r
000
MC/DC0%0/2
$B::C::debug{"cv"} or $B::C::verbose
$B::C::debug{"cv"} $B::C::verbose
Truth table0%0/3
A or B
A= $B::C::debug{"cv"}B= $B::C::verbose
ABresult
1X1
011
000
4589 # continue, must save the 2 symbols from above
4590 }
4591 }
4592 }
4593  
4594 0 my $startfield = 0;
4595 0 my $padlist = $cv->PADLIST;
4596 0 set_curcv $cv;
4597 0 my $padlistsym = 'NULL';
4598 0 my $pv = $cv->PV;
4599 0 my $xsub = 0;
4600 0 my $xsubany = "{0}";
4601 0 ▶ if ($$root) {
Branch: 3 branches
BranchTrueFalseTotal
if ($$root) { } 0 0 0
elsif ($cv->is_named) { } 0 0 0
elsif (not exists &$fullname) { } 0 0 0
4602 warn sprintf( "saving op tree for CV 0x%x, root=0x%x\n",
4603 $$cv, $$root )
4604 0 ▶ if $debug{cv} and $debug{gv};
Branch: 1 branch
BranchTrueFalseTotal
if $B::C::debug{"cv"} and $B::C::debug{"gv"} 0 0 0
Condition0%0/3
$B::C::debug{"cv"} and $B::C::debug{"gv"}
!ll&&!rl&&r
000
MC/DC0%0/2
$B::C::debug{"cv"} and $B::C::debug{"gv"}
$B::C::debug{"cv"} $B::C::debug{"gv"}
Truth table0%0/3
A and B
A= $B::C::debug{"cv"}B= $B::C::debug{"gv"}
ABresult
0X0
100
111
4605 0 my $ppname = "";
4606 0 ▶ if ($cv->is_named) {
Branch: 2 branches
BranchTrueFalseTotal
if ($cv->is_named) { } 0 0 0
elsif ($gv and $$gv) { } 0 0 0
4607 0 ▶ my $name = $cv->can('NAME_HEK') ? $cv->NAME_HEK : "anonlex";
Branch: 1 branch
BranchTrueFalseTotal
$cv->can('NAME_HEK') ? : 0 0 0
4608 0 $ppname = "pp_lexsub_".$name;
4609 0 $fullname = "<lex>".$name;
4610 }
4611 ▶ elsif ($gv and $$gv) {
Condition0%0/3
$gv and $$gv
!ll&&!rl&&r
000
MC/DC0%0/2
$gv and $$gv
$gv $$gv
Truth table0%0/3
A and B
A= $gvB= $$gv
ABresult
0X0
100
111
4612 0 my ($stashname, $gvname);
4613 0 $stashname = $gv->STASH->NAME;
4614 0 $gvname = $gv->NAME;
4615 0 $fullname = $stashname.'::'.$gvname;
4616 0 ▶ $ppname = ( ${ $gv->FORM } == $$cv ) ? "pp_form_" : "pp_sub_";
Branch: 1 branch
BranchTrueFalseTotal
${$gv->FORM;} == $$cv ? : 0 0 0
4617 0 ▶ if ( $gvname ne "__ANON__" ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($gvname ne "__ANON__") 0 0 0
4618 0 ▶ $ppname .= ( $stashname eq "main" ) ? $gvname : "$stashname\::$gvname";
Branch: 1 branch
BranchTrueFalseTotal
$stashname eq 'main' ? : 0 0 0
4619 0 $ppname =~ s/::/__/g;
4620 0 $ppname =~ s/(\W)/sprintf("0x%x", ord($1))/ge;
4621 0 ▶ if ( $gvname eq "INIT" ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($gvname eq "INIT") 0 0 0
4622 0 $ppname .= "_$initsub_index";
4623 0 $initsub_index++;
4624 }
4625 }
4626 }
4627 0 ▶ if ( !$ppname ) {
Branch: 1 branch
BranchTrueFalseTotal
unless ($ppname) 0 0 0
4628 0 $ppname = "pp_anonsub_$anonsub_index";
4629 0 $anonsub_index++;
4630 }
4631 0 $startfield = saveoptree( $ppname, $root, $cv->START, $padlist->ARRAY ); # XXX padlist is ignored
4632 #warn sprintf( "done saving op tree for CV 0x%x, flags (%s), name %s, root=0x%x => start=%s\n",
4633 # $$cv, $debug{flags}?$cv->flagspv:sprintf("0x%x",$cv->FLAGS), $ppname, $$root, $startfield )
4634 # if $debug{cv};
4635 # XXX missing cv_start for AUTOLOAD on 5.8
4636 0 ▶ $startfield = objsym($root->next) unless $startfield; # 5.8 autoload has only root
Branch: 1 branch
BranchTrueFalseTotal
unless $startfield 0 0 0
4637 0 ▶ $startfield = "0" unless $startfield; # XXX either CONST ANON or empty body
Branch: 1 branch
BranchTrueFalseTotal
unless $startfield 0 0 0
4638 0 ▶ if ($$padlist) {
Branch: 1 branch
BranchTrueFalseTotal
if ($$padlist) 0 0 0
4639 # XXX readonly comppad names and symbols invalid
4640 #local $B::C::pv_copy_on_grow = 1 if $B::C::ro_inc;
4641 warn sprintf( "saving PADLIST 0x%x for CV 0x%x\n", $$padlist, $$cv )
4642 0 ▶ if $debug{cv} and $debug{gv};
Branch: 1 branch
BranchTrueFalseTotal
if $B::C::debug{"cv"} and $B::C::debug{"gv"} 0 0 0
Condition0%0/3
$B::C::debug{"cv"} and $B::C::debug{"gv"}
!ll&&!rl&&r
000
MC/DC0%0/2
$B::C::debug{"cv"} and $B::C::debug{"gv"}
$B::C::debug{"cv"} $B::C::debug{"gv"}
Truth table0%0/3
A and B
A= $B::C::debug{"cv"}B= $B::C::debug{"gv"}
ABresult
0X0
100
111
4643 # XXX avlen 2
4644 0 $padlistsym = $padlist->save($fullname.' :pad', $cv);
4645 warn sprintf( "done saving %s 0x%x for CV 0x%x\n",
4646 $padlistsym, $$padlist, $$cv )
4647 0 ▶ if $debug{cv} and $debug{gv};
Branch: 1 branch
BranchTrueFalseTotal
if $B::C::debug{"cv"} and $B::C::debug{"gv"} 0 0 0
Condition0%0/3
$B::C::debug{"cv"} and $B::C::debug{"gv"}
!ll&&!rl&&r
000
MC/DC0%0/2
$B::C::debug{"cv"} and $B::C::debug{"gv"}
$B::C::debug{"cv"} $B::C::debug{"gv"}
Truth table0%0/3
A and B
A= $B::C::debug{"cv"}B= $B::C::debug{"gv"}
ABresult
0X0
100
111
4648 # do not record a forward for the pad only
4649  
4650 # issue 298: dynamic CvPADLIST(&END) since 5.18 - END{} blocks
4651 # and #169 and #304 Attribute::Handlers
4652 0 ▶ if ($] > 5.017 and
Branch: 1 branch
BranchTrueFalseTotal
if ($] > 5.017 and $B::C::dyn_padlist || $fullname =~ /^(main::END|main::INIT|Attribute::Handlers)/) { } 0 0 0
Condition0%0/6
$] > "5.017" and $B::C::dyn_padlist || $fullname =~ /^(main::END|main::INIT|Attribute::Handlers)/
!ll&&!rl&&r
000
$B::C::dyn_padlist or $fullname =~ /^(main::END|main::INIT|Attribute::Handlers)/
l!l&&r!l&&!r
000
MC/DC0%0/3
$] > "5.017" and $B::C::dyn_padlist || $fullname =~ /^(main::END|main::INIT|Attribute::Handlers)/
$] > "5.017" $B::C::dyn_padlist $fullname =~ /^(main::END|main::INIT|Attribute::Handlers)/
Truth table0%0/4
A and B or C
A= $] > "5.017"B= $B::C::dyn_padlistC= $fullname =~ /^(main::END|main::INIT|Attribute::Handlers)/
ABCresult
0XX0
1000
11X1
1011
4653 ($B::C::dyn_padlist or $fullname =~ /^(main::END|main::INIT|Attribute::Handlers)/))
4654 {
4655 0 $init->add("{ /* &$fullname needs a dynamic padlist */",
4656 " PADLIST *pad;",
4657 " Newxz(pad, sizeof(PADLIST), PADLIST);",
4658 " Copy($padlistsym, pad, sizeof(PADLIST), char);",
4659 " CvPADLIST($sym) = pad;",
4660 "}");
4661 } else {
4662 0 $init->add( "CvPADLIST($sym) = $padlistsym;" );
4663 }
4664 }
4665 0 ▶ warn $fullname."\n" if $debug{sub};
Branch: 1 branch
BranchTrueFalseTotal
if $B::C::debug{"sub"} 0 0 0
4666 }
4667 elsif ($cv->is_named) {
4668 ;
4669 }
4670 elsif (!exists &$fullname) {
4671 0 ▶ warn $fullname." not found\n" if $debug{sub};
Branch: 1 branch
BranchTrueFalseTotal
if $B::C::debug{"sub"} 0 0 0
4672 warn "No definition for sub $fullname (unable to autoload)\n"
4673 0 ▶ if $debug{cv};
Branch: 1 branch
BranchTrueFalseTotal
if $B::C::debug{"cv"} 0 0 0
4674 0 ▶ $init->add( "/* $fullname not found */" ) if $verbose or $debug{sub};
Branch: 1 branch
BranchTrueFalseTotal
if $B::C::verbose or $B::C::debug{"sub"} 0 0 0
Condition0%0/3
$B::C::verbose or $B::C::debug{"sub"}
l!l&&r!l&&!r
000
MC/DC0%0/2
$B::C::verbose or $B::C::debug{"sub"}
$B::C::verbose $B::C::debug{"sub"}
Truth table0%0/3
A or B
A= $B::C::verboseB= $B::C::debug{"sub"}
ABresult
1X1
011
000
4675 # XXX empty CV should not be saved. #159, #235
4676 # $svsect->remove( $sv_ix );
4677 # $xpvcvsect->remove( $xpvcv_ix );
4678 # delsym( $cv );
4679 0 ▶ if (!$new_cv_fw) {
Branch: 1 branch
BranchTrueFalseTotal
unless ($new_cv_fw) 0 0 0
4680 0 $symsect->add("XPVCVIX$xpvcv_ix\t0");
4681 }
4682 0 ▶ $CvFLAGS &= ~0x1000 if $PERL514; # CVf_DYNFILE
Branch: 1 branch
BranchTrueFalseTotal
if $PERL514 0 0 0
4683 0 ▶ $CvFLAGS &= ~0x400 if $gv and $$gv and $PERL514; #CVf_CVGV_RC
Branch: 1 branch
BranchTrueFalseTotal
if $gv and $$gv and $PERL514 0 0 0
Condition0%0/6
$gv and $$gv and $PERL514
!ll&&!rl&&r
000
$gv and $$gv
!ll&&!rl&&r
000
MC/DC0%0/3
$gv and $$gv and $PERL514
$gv $$gv $PERL514
Truth table0%0/4
A and B and C
A= $gvB= $$gvC= $PERL514
ABCresult
0XX0
10X0
1100
1111
4684 0 ▶ $symsect->add(sprintf(
Branch: 1 branch
BranchTrueFalseTotal
$PERL510 ? : 0 0 0
4685 "CVIX%d\t(XPVCV*)&xpvcv_list[%u], $u32fmt, 0x%x".($PERL510?", {0}":''),
4686 $sv_ix, $xpvcv_ix, $cv->REFCNT, $CvFLAGS));
4687 0 return get_cv($fullname, 0);
4688 }
4689  
4690 # Now it is time to record the CV
4691 0 ▶ if ($new_cv_fw) {
Branch: 1 branch
BranchTrueFalseTotal
if ($new_cv_fw) 0 0 0
4692 0 $sv_ix = $svsect->index + 1;
4693 0 ▶ if (!$cvforward{$sym}) { # avoid duplicates
Branch: 1 branch
BranchTrueFalseTotal
unless ($cvforward{$sym}) 0 0 0
4694 0 $symsect->add(sprintf("%s\t&sv_list[%d]", $sym, $sv_ix )); # forward the old CVIX to the new CV
4695 0 $cvforward{$sym}++;
4696 }
4697 0 $sym = savesym( $cv, "&sv_list[$sv_ix]" );
4698 }
4699  
4700 # $pv = '' unless defined $pv; # Avoid use of undef warnings
4701 #warn sprintf( "CV prototype %s for CV 0x%x\n", cstring($pv), $$cv )
4702 # if $pv and $debug{cv};
4703 0 ▶ my $proto = defined $pv ? cstring($pv) : 'NULL';
Branch: 1 branch
BranchTrueFalseTotal
defined $pv ? : 0 0 0
4704 0 my $pvsym = 'NULL';
4705 0 ▶ my $cur = defined $pv ? $cv->CUR : 0;
Branch: 1 branch
BranchTrueFalseTotal
defined $pv ? : 0 0 0
4706 0 my $len = $cur + 1;
4707 0 ▶ $len++ if IsCOW($cv) and !$B::C::cow;
Branch: 1 branch
BranchTrueFalseTotal
if IsCOW($cv) and not $B::C::cow 0 0 0
Condition0%0/3
IsCOW($cv) and not $B::C::cow
!ll&&!rl&&r
000
MC/DC0%0/2
IsCOW($cv) and not $B::C::cow
IsCOW($cv) not $B::C::cow
Truth table0%0/3
A and not(B)
A= IsCOW($cv)B= not $B::C::cow
ABresult
0X0
100
111
4708 0 ▶ $len = 0 if $B::C::const_strings;
Branch: 1 branch
BranchTrueFalseTotal
if $B::C::const_strings 0 0 0
4709 # need to survive cv_undef as there is no protection against static CVs
4710 0 ▶ my $refcnt = $cv->REFCNT + ($PERL510 ? 1 : 0);
Branch: 1 branch
BranchTrueFalseTotal
$PERL510 ? : 0 0 0
4711 # GV cannot be initialized statically
4712 0 my $xcv_outside = ${ $cv->OUTSIDE };
4713 0 ▶ if ($xcv_outside == ${ main_cv() }) {
Branch: 2 branches
BranchTrueFalseTotal
if ($xcv_outside == ${main_cv();}) { } 0 0 0
elsif (ref $cv->OUTSIDE eq 'B::CV') { } 0 0 0
4714 # Provide a temp. debugging hack for CvOUTSIDE. The address of the symbol &PL_main_cv
4715 # is known to the linker, the address of the value PL_main_cv not. This is set later
4716 # (below) at run-time.
4717 0 ▶ $xcv_outside = $MULTI ? '0' : '&PL_main_cv';
Branch: 1 branch
BranchTrueFalseTotal
$MULTI ? : 0 0 0
4718 } elsif (ref($cv->OUTSIDE) eq 'B::CV') {
4719 0 $xcv_outside = 0; # just a placeholder for a run-time GV
4720 }
4721 0 ▶ if ($PERL510) {
Branch: 2 branches
BranchTrueFalseTotal
if ($PERL510) { } 0 0 0
elsif ($PERL56) { } 0 0 0
4722 0 $pvsym = save_hek($pv,$fullname,1);
4723 # XXX issue 84: we need to check the cv->PV ptr not the value.
4724 # "" is different to NULL for prototypes
4725 0 ▶ $len = $cur ? $cur+1 : 0;
Branch: 1 branch
BranchTrueFalseTotal
$cur ? : 0 0 0
4726 # TODO:
4727 # my $ourstash = "0"; # TODO stash name to bless it (test 16: "main::")
4728 0 ▶ if ($PERL522) {
Branch: 2 branches
BranchTrueFalseTotal
if ($PERL522) { } 0 0 0
elsif ($PERL514) { } 0 0 0
4729 0 $CvFLAGS &= ~0x1000; # CVf_DYNFILE off
4730 0 ▶ $CvFLAGS |= 0x200000 if $CPERL52; # CVf_STATIC on
Branch: 1 branch
BranchTrueFalseTotal
if $CPERL52 0 0 0
4731 0 my $xpvc = sprintf
4732 # stash magic cur {len} cvstash {start} {root} {cvgv} cvfile {cvpadlist} outside outside_seq cvflags cvdepth
4733 ("Nullhv, {0}, %u, {%u}, %s, {%s}, {s\\_%x}, {%s}, %s, {%s}, (CV*)%s, %s, 0x%x, %d",
4734 $cur, $len, "Nullhv",#CvSTASH later
4735 $startfield, $$root,
4736 "0", #GV later
4737 "NULL", #cvfile later (now a HEK)
4738 $padlistsym,
4739 $xcv_outside, #if main_cv set later
4740 ivx($cv->OUTSIDE_SEQ),
4741 $CvFLAGS,
4742 $cv->DEPTH);
4743 # repro only with 5.15.* threaded -q (70c0620) Encode::Alias::define_alias
4744 0 ▶ warn "lexwarnsym in XPVCV OUTSIDE: $xpvc" if $xpvc =~ /, \(CV\*\)iv\d/; # t/testc.sh -q -O3 227
Branch: 1 branch
BranchTrueFalseTotal
if $xpvc =~ /, \(CV\*\)iv\d/ 0 0 0
4745 0 ▶ if (!$new_cv_fw) {
Branch: 1 branch
BranchTrueFalseTotal
if (not $new_cv_fw) { } 0 0 0
4746 0 $symsect->add("XPVCVIX$xpvcv_ix\t$xpvc");
4747 #$symsect->add
4748 # (sprintf("CVIX%d\t(XPVCV*)&xpvcv_list[%u], $u32fmt, 0x%x, {0}"),
4749 # $sv_ix, $xpvcv_ix, $cv->REFCNT, $cv->FLAGS
4750 # ));
4751 } else {
4752 0 $xpvcvsect->comment('STASH mg_u cur len CV_STASH START_U ROOT_U GV file PADLIST OUTSIDE outside_seq flags depth');
4753 0 $xpvcvsect->add($xpvc);
4754 0 ▶ $svsect->add(sprintf("&xpvcv_list[%d], $u32fmt, 0x%x, {%s}",
Branch: 1 branch
BranchTrueFalseTotal
$CPERL52 ? : 0 0 0
4755 $xpvcvsect->index, $cv->REFCNT, $cv->FLAGS,
4756 $CPERL52 ? $proto : "0"));
4757 0 ▶ $svsect->debug( $fullname, $cv->flagspv ) if $debug{flags};
Branch: 1 branch
BranchTrueFalseTotal
if $B::C::debug{"flags"} 0 0 0
4758 }
4759 } elsif ($PERL514) {
4760 # cv_undef wants to free it when CvDYNFILE(cv) is true.
4761 # E.g. DateTime: boot_POSIX. newXS reuses cv if autoloaded. So turn it off globally.
4762 0 $CvFLAGS &= ~0x1000; # CVf_DYNFILE off
4763 0 my $xpvc = sprintf
4764 # stash magic cur len cvstash start root cvgv cvfile cvpadlist outside outside_seq cvflags cvdepth
4765 ("Nullhv, {0}, %u, %u, %s, {%s}, {s\\_%x}, %s, %s, %s, (CV*)%s, %s, 0x%x, %d",
4766 $cur, $len, "Nullhv",#CvSTASH later
4767 $startfield, $$root,
4768 "0", #GV later
4769 "NULL", #cvfile later (now a HEK)
4770 $padlistsym,
4771 $xcv_outside, #if main_cv set later
4772 ivx($cv->OUTSIDE_SEQ),
4773 $CvFLAGS,
4774 $cv->DEPTH);
4775 #warn "lexwarnsym in XPVCV OUTSIDE: $xpvc" if $xpvc =~ /, \(CV\*\)iv\d/; # t/testc.sh -q -O3 227
4776 0 ▶ if (!$new_cv_fw) {
Branch: 1 branch
BranchTrueFalseTotal
if (not $new_cv_fw) { } 0 0 0
4777 0 $symsect->add("XPVCVIX$xpvcv_ix\t$xpvc");
4778 #$symsect->add
4779 # (sprintf("CVIX%d\t(XPVCV*)&xpvcv_list[%u], $u32fmt, 0x%x, {0}"),
4780 # $sv_ix, $xpvcv_ix, $cv->REFCNT, $cv->FLAGS
4781 # ));
4782 } else {
4783 0 $xpvcvsect->comment('STASH mg_u cur len CV_STASH START_U ROOT_U GV file PADLIST OUTSIDE outside_seq flags depth');
4784 0 $xpvcvsect->add($xpvc);
4785 0 $svsect->add(sprintf("&xpvcv_list[%d], $u32fmt, 0x%x, {0}",
4786 $xpvcvsect->index, $cv->REFCNT, $cv->FLAGS));
4787 0 ▶ $svsect->debug( $fullname, $cv->flagspv ) if $debug{flags};
Branch: 1 branch
BranchTrueFalseTotal
if $B::C::debug{"flags"} 0 0 0
4788 }
4789 } else { # 5.10-5.13
4790 # Note: GvFORM ends also here. #149 (B::FM), t/testc.sh -O3 -DGCF,-v 149
4791 0 ▶ my $depth = ref($cv) eq 'B::CV' ? $cv->DEPTH : 0;
Branch: 1 branch
BranchTrueFalseTotal
ref $cv eq 'B::CV' ? : 0 0 0
4792 0 ▶ my $outside_seq = ref($cv) eq 'B::CV' ? $cv->OUTSIDE_SEQ : '0'; # XXX? #238
Branch: 1 branch
BranchTrueFalseTotal
ref $cv eq 'B::CV' ? : 0 0 0
4793 0 my $xpvc = sprintf
4794 ("{%d}, %u, %u, {%s}, {%s}, %s,"
4795 ." %s, {%s}, {s\\_%x}, %s, %s, %s,"
4796 ." (CV*)%s, %s, 0x%x",
4797 0, # GvSTASH later. test 29 or Test::Harness
4798 $cur, $len,
4799 $depth,
4800 "NULL", "Nullhv", #MAGIC + STASH later
4801 "Nullhv",#CvSTASH later
4802 $startfield,
4803 $$root,
4804 "0", #GV later
4805 "NULL", #cv_file later (now a HEK)
4806 $padlistsym,
4807 $xcv_outside, #if main_cv set later
4808 $outside_seq,
4809 $CvFLAGS
4810 );
4811 0 ▶ if (!$new_cv_fw) {
Branch: 1 branch
BranchTrueFalseTotal
if (not $new_cv_fw) { } 0 0 0
4812 0 $symsect->add("XPVCVIX$xpvcv_ix\t$xpvc");
4813 #$symsect->add
4814 # (sprintf("CVIX%d\t(XPVCV*)&xpvcv_list[%u], $u32fmt, 0x%x, {0}",
4815 # $sv_ix, $xpvcv_ix, $cv->REFCNT, $cv->FLAGS
4816 # ));
4817 } else {
4818 0 $xpvcvsect->comment('GvSTASH cur len depth mg_u MG_STASH CV_STASH START_U ROOT_U CV_GV cv_file PADLIST OUTSIDE outside_seq cv_flags');
4819 0 $xpvcvsect->add($xpvc);
4820 0 $svsect->add(sprintf("&xpvcv_list[%d], $u32fmt, 0x%x, {0}",
4821 $xpvcvsect->index, $cv->REFCNT, $cv->FLAGS));
4822 0 ▶ $svsect->debug( $fullname, $cv->flagspv ) if $debug{flags};
Branch: 1 branch
BranchTrueFalseTotal
if $B::C::debug{"flags"} 0 0 0
4823 }
4824 }
4825 0 ▶ if ($$cv) {
Branch: 1 branch
BranchTrueFalseTotal
if ($$cv) 0 0 0
4826 0 ▶ if ($PERL518 and (!$gv or ref($gv) eq 'B::SPECIAL')) {
Branch: 1 branch
BranchTrueFalseTotal
if ($PERL518 and !$gv || ref $gv eq 'B::SPECIAL') { } 0 0 0
Condition0%0/6
$PERL518 and !$gv || ref $gv eq "B::SPECIAL"
!ll&&!rl&&r
000
not $gv or ref $gv eq "B::SPECIAL"
l!l&&r!l&&!r
000
MC/DC0%0/3
$PERL518 and !$gv || ref $gv eq "B::SPECIAL"
$PERL518 not $gv ref $gv eq "B::SPECIAL"
Truth table0%0/4
A and not(B) or C
A= $PERL518B= not $gvC= ref $gv eq "B::SPECIAL"
ABCresult
0XX0
1000
11X1
1011
4827 0 ▶ my $lexsub = $cv->can('NAME_HEK') ? $cv->NAME_HEK : "_anonlex_";
Branch: 1 branch
BranchTrueFalseTotal
$cv->can('NAME_HEK') ? : 0 0 0
4828 0 ▶ $lexsub = '' unless defined $lexsub;
Branch: 1 branch
BranchTrueFalseTotal
unless defined $lexsub 0 0 0
4829 0 ▶ warn "lexsub name $lexsub" if $debug{gv};
Branch: 1 branch
BranchTrueFalseTotal
if $B::C::debug{"gv"} 0 0 0
4830 0 my ($cstring, $cur, $utf8) = strlen_flags($lexsub);
4831 0 ▶ if (!$PERL56 and $utf8) {
Branch: 1 branch
BranchTrueFalseTotal
if (not $PERL56 and $utf8) 0 0 0
Condition0%0/3
not $PERL56 and $utf8
!ll&&!rl&&r
000
MC/DC0%0/2
not $PERL56 and $utf8
not $PERL56 $utf8
Truth table0%0/3
not(A) and B
A= not $PERL56B= $utf8
ABresult
0X0
100
111
4832 0 $cur = -$cur;
4833 }
4834 0 $init->add( "{ /* need a dynamic name hek */",
4835 sprintf(" HEK *lexhek = share_hek(savepvn(%s, %d), %d);",
4836 $cstring, abs($cur), $cur),
4837 sprintf(" CvNAME_HEK_set(s\\_%x, lexhek);", $$cv),
4838 "}");
4839 } else {
4840 0 my $gvstash = $gv->STASH;
4841 # defer GvSTASH because with DEBUGGING it checks for GP but
4842 # there's no GP yet.
4843 # But with -fstash the gvstash is set later
4844 0 ▶ $init->add( sprintf( "GvXPVGV(s\\_%x)->xnv_u.xgv_stash = s\\_%x;",
Branch: 1 branch
BranchTrueFalseTotal
if $gvstash and not $B::C::stash 0 0 0
Condition0%0/3
$gvstash and not $B::C::stash
!ll&&!rl&&r
000
MC/DC0%0/2
$gvstash and not $B::C::stash
$gvstash not $B::C::stash
Truth table0%0/3
A and not(B)
A= $gvstashB= not $B::C::stash
ABresult
0X0
100
111
4845 $$cv, $$gvstash ) ) if $gvstash and !$B::C::stash;
4846 warn sprintf( "done saving GvSTASH 0x%x for CV 0x%x\n", $$gvstash, $$cv )
4847 0 ▶ if $gvstash and $debug{cv} and $debug{gv};
Branch: 1 branch
BranchTrueFalseTotal
if $gvstash and $B::C::debug{"cv"} and $B::C::debug{"gv"} 0 0 0
Condition0%0/6
$gvstash and $B::C::debug{"cv"} and $B::C::debug{"gv"}
!ll&&!rl&&r
000
$gvstash and $B::C::debug{"cv"}
!ll&&!rl&&r
000
MC/DC0%0/3
$gvstash and $B::C::debug{"cv"} and $B::C::debug{"gv"}
$gvstash $B::C::debug{"cv"} $B::C::debug{"gv"}
Truth table0%0/4
A and B and C
A= $gvstashB= $B::C::debug{"cv"}C= $B::C::debug{"gv"}
ABCresult
0XX0
10X0
1100
1111
4848 }
4849 }
4850 0 ▶ if ( $cv->OUTSIDE_SEQ ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($cv->OUTSIDE_SEQ) 0 0 0
4851 0 my $cop = $symtable{ sprintf( "s\\_%x", $cv->OUTSIDE_SEQ ) };
4852 0 ▶ $init->add( sprintf( "CvOUTSIDE_SEQ(%s) = %s;", $sym, $cop ) ) if $cop;
Branch: 1 branch
BranchTrueFalseTotal
if $cop 0 0 0
4853 }
4854 }
4855 elsif ($PERL56) {
4856 0 my $xpvc = sprintf("%s, %u, %u, %s, %s, 0, Nullhv, Nullhv, %s, s\\_%x, $xsub, "
4857 ."$xsubany, Nullgv, \"\", %d, s\\_%x, (CV*)%s, 0x%x",
4858 $proto, $cur, $len, ivx($cv->IVX),
4859 nvx($cv->NVX), $startfield, $$root, $cv->DEPTH,
4860 $$padlist, $xcv_outside, $cv->CvFLAGS
4861 );
4862 0 ▶ if ($new_cv_fw) {
Branch: 1 branch
BranchTrueFalseTotal
if ($new_cv_fw) { } 0 0 0
4863 0 $xpvcvsect->comment('pv cur len off nv magic mg_stash cv_stash start root xsub '
4864 .'xsubany cv_gv cv_file cv_depth cv_padlist cv_outside cv_flags');
4865 0 $xpvcvsect->add($xpvc);
4866 0 $svsect->add(sprintf("&xpvcv_list[%d], $u32fmt, 0x%x"),
4867 $xpvcvsect->index, $cv->REFCNT, $cv->FLAGS);
4868 0 ▶ $svsect->debug( $fullname, $cv->flagspv ) if $debug{flags};
Branch: 1 branch
BranchTrueFalseTotal
if $B::C::debug{"flags"} 0 0 0
4869 } else {
4870 0 $symsect->add("XPVCVIX$xpvcv_ix\t$xpvc");
4871 }
4872 }
4873 else { #5.8
4874 0 my $xpvc = sprintf("%s, %u, %u, %s, %s, 0, Nullhv, Nullhv, %s, s\\_%x, $xsub,"
4875 ." $xsubany, Nullgv, \"\", %d, s\\_%x, (CV*)s\\_%x, 0x%x, 0x%x",
4876 $proto, $cur, $len, ivx($cv->IVX),
4877 nvx($cv->NVX), $startfield, $$root, $cv->DEPTH,
4878 $$padlist, $xcv_outside, $cv->CvFLAGS, $cv->OUTSIDE_SEQ
4879 );
4880 0 ▶ if ($new_cv_fw) {
Branch: 1 branch
BranchTrueFalseTotal
if ($new_cv_fw) { } 0 0 0
4881 0 $xpvcvsect->comment('pv cur len off nv magic mg_stash cv_stash '
4882 .'start root xsub xsubany cv_gv cv_file cv_depth cv_padlist '
4883 .'cv_outside cv_flags outside_seq');
4884 0 $xpvcvsect->add($xpvc);
4885 0 $svsect->add(sprintf("&xpvcv_list[%d], $u32fmt, 0x%x"),
4886 $xpvcvsect->index, $cv->REFCNT, $cv->FLAGS);
4887 0 ▶ $svsect->debug( $fullname, $cv->flagspv ) if $debug{flags};
Branch: 1 branch
BranchTrueFalseTotal
if $B::C::debug{"flags"} 0 0 0
4888 } else {
4889 0 $symsect->add("XPVCVIX$xpvcv_ix\t$xpvc");
4890 }
4891 }
4892  
4893 0 ▶ if ($CPERL52 and $Config{uselongdouble}) {
Branch: 1 branch
BranchTrueFalseTotal
if ($CPERL52 and $B::C::Config{"uselongdouble"}) 0 0 0
Condition0%0/3
$CPERL52 and $B::C::Config{"uselongdouble"}
!ll&&!rl&&r
000
MC/DC0%0/2
$CPERL52 and $B::C::Config{"uselongdouble"}
$CPERL52 $B::C::Config{"uselongdouble"}
Truth table0%0/3
A and B
A= $CPERL52B= $B::C::Config{"uselongdouble"}
ABresult
0X0
100
111
4894 # some very odd static struct init bug: CvOUTSIDE is pointing to CvROOT, CvROOT is corrupt.
4895 # CvPADLIST also pointing somewhere else. with gcc-5 and 4.8.
4896 0 $init->add(sprintf("xpvcv_list[$xpvcv_ix].xcv_root_u.xcv_root = s\\_%x;", $$root));
4897 0 $init->add("xpvcv_list[$xpvcv_ix].xcv_padlist_u.xcv_padlist = $padlistsym;");
4898 }
4899  
4900 0 $xcv_outside = ${ $cv->OUTSIDE };
4901 0 ▶ if ($xcv_outside == ${ main_cv() } or ref($cv->OUTSIDE) eq 'B::CV') {
Branch: 2 branches
BranchTrueFalseTotal
if ($xcv_outside == ${main_cv();} or ref $cv->OUTSIDE eq 'B::CV') { } 0 0 0
elsif ($] >= 5.017005 and $xcv_outside and $$padlist) { } 0 0 0
Condition0%0/3
$xcv_outside == ${main_cv();} or ref $cv->OUTSIDE eq "B::CV"
l!l&&r!l&&!r
000
MC/DC0%0/2
$xcv_outside == ${main_cv();} or ref $cv->OUTSIDE eq "B::CV"
$xcv_outside == ${main_cv();} ref $cv->OUTSIDE eq "B::CV"
Truth table0%0/3
A or B
A= $xcv_outside == ${main_cv();}B= ref $cv->OUTSIDE eq "B::CV"
ABresult
1X1
011
000
4902 # patch CvOUTSIDE at run-time
4903 0 ▶ if ( $xcv_outside == ${ main_cv() } ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($xcv_outside == ${main_cv();}) { } 0 0 0
4904 0 $init->add( "CvOUTSIDE($sym) = PL_main_cv;",
4905 "SvREFCNT_inc(PL_main_cv);" );
4906 0 ▶ if ($$padlist) {
Branch: 1 branch
BranchTrueFalseTotal
if ($$padlist) 0 0 0
4907 0 ▶ if ($PERL522) {
Branch: 2 branches
BranchTrueFalseTotal
if ($PERL522) { } 0 0 0
elsif ($] >= 5.017005) { } 0 0 0
4908 0 $init->add( "CvPADLIST($sym)->xpadl_outid = CvPADLIST(PL_main_cv)->xpadl_id;");
4909 } elsif ($] >= 5.017005) {
4910 0 $init->add( "CvPADLIST($sym)->xpadl_outid = PadlistNAMES(CvPADLIST(PL_main_cv));");
4911 }
4912 }
4913 } else {
4914 0 $init->add( sprintf("CvOUTSIDE(%s) = (CV*)s\\_%x;", $sym, $xcv_outside) );
4915 #if ($PERL522) {
4916 # $init->add( sprintf("CvPADLIST(%s)->xpadl_outid = CvPADLIST(s\\_%x)->xpadl_id;",
4917 # $sym, $xcv_outside));
4918 #}
4919 }
4920 }
4921 ▶ elsif ($] >= 5.017005 and $xcv_outside and $$padlist) {
Condition0%0/6
$] >= "5.017005" and $xcv_outside and $$padlist
!ll&&!rl&&r
000
$] >= "5.017005" and $xcv_outside
!ll&&!rl&&r
000
MC/DC0%0/3
$] >= "5.017005" and $xcv_outside and $$padlist
$] >= "5.017005" $xcv_outside $$padlist
Truth table0%0/4
A and B and C
A= $] >= "5.017005"B= $xcv_outsideC= $$padlist
ABCresult
0XX0
10X0
1100
1111
4922 0 my $padl = $cv->OUTSIDE->PADLIST->save;
4923 0 ▶ if ($PERL522) {
Branch: 1 branch
BranchTrueFalseTotal
if ($PERL522) { } 0 0 0
4924 0 $init->add( sprintf("CvPADLIST(%s)->xpadl_outid = CvPADLIST(s\\_%x)->xpadl_id;",
4925 $sym, $xcv_outside));
4926 } else {
4927 # Make sure that the outer padlist is allocated before PadlistNAMES is accessed.
4928 # This needs to be postponed (test 227)
4929 0 $init1->add( sprintf( "CvPADLIST(%s)->xpadl_outid = PadlistNAMES(%s);", $sym, $padl) );
4930 }
4931 }
4932 0 ▶ if ($gv and $$gv) {
Branch: 1 branch
BranchTrueFalseTotal
if ($gv and $$gv) 0 0 0
Condition0%0/3
$gv and $$gv
!ll&&!rl&&r
000
MC/DC0%0/2
$gv and $$gv
$gv $$gv
Truth table0%0/3
A and B
A= $gvB= $$gv
ABresult
0X0
100
111
4933 #test 16: Can't call method "FETCH" on unblessed reference. gdb > b S_method_common
4934 0 ▶ warn sprintf( "Saving GV 0x%x for CV 0x%x\n", $$gv, $$cv ) if $debug{cv} and $debug{gv};
Branch: 1 branch
BranchTrueFalseTotal
if $B::C::debug{"cv"} and $B::C::debug{"gv"} 0 0 0
Condition0%0/3
$B::C::debug{"cv"} and $B::C::debug{"gv"}
!ll&&!rl&&r
000
MC/DC0%0/2
$B::C::debug{"cv"} and $B::C::debug{"gv"}
$B::C::debug{"cv"} $B::C::debug{"gv"}
Truth table0%0/3
A and B
A= $B::C::debug{"cv"}B= $B::C::debug{"gv"}
ABresult
0X0
100
111
4935 0 $gv->save;
4936 0 ▶ if ($PERL514) { # FIXME 5.18.0 with lexsubs
Branch: 1 branch
BranchTrueFalseTotal
if ($PERL514) { } 0 0 0
4937 # XXX gvcv might be PVMG
4938 0 $init->add( sprintf( "CvGV_set((CV*)%s, (GV*)%s);", $sym, objsym($gv)) );
4939 # Since 5.13.3 and CvGV_set there are checks that the CV is not RC (refcounted).
4940 # Assertion "!CvCVGV_RC(cv)" failed: file "gv.c", line 219, function: Perl_cvgv_set
4941 # We init with CvFLAGS = 0 and set it later, as successfully done in the Bytecode compiler
4942 0 ▶ if ($CvFLAGS & 0x0400) { # CVf_CVGV_RC
Branch: 1 branch
BranchTrueFalseTotal
if ($CvFLAGS & 1024) 0 0 0
4943 warn sprintf( "CvCVGV_RC turned off. CV flags=0x%x %s CvFLAGS=0x%x \n",
4944 $cv->FLAGS, $debug{flags}?$cv->flagspv:"", $CvFLAGS & ~0x400)
4945 0 ▶ if $debug{cv};
Branch: 2 branches
BranchTrueFalseTotal
if $B::C::debug{"cv"} 0 0 0
$B::C::debug{'flags'} ? : 0 0 0
4946 $init->add( sprintf( "CvFLAGS((CV*)%s) = 0x%x; %s", $sym, $CvFLAGS,
4947 0 ▶ $debug{flags}?"/* ".$cv->flagspv." */":"" ) );
Branch: 1 branch
BranchTrueFalseTotal
$B::C::debug{'flags'} ? : 0 0 0
4948 }
4949 0 $init->add("CvSTART($sym) = $startfield;"); # XXX TODO someone is overwriting CvSTART also
4950 } else {
4951 0 $init->add( sprintf( "CvGV(%s) = %s;", $sym, objsym($gv) ) );
4952 }
4953 warn sprintf("done saving GV 0x%x for CV 0x%x\n",
4954 0 ▶ $$gv, $$cv) if $debug{cv} and $debug{gv};
Branch: 1 branch
BranchTrueFalseTotal
if $B::C::debug{"cv"} and $B::C::debug{"gv"} 0 0 0
Condition0%0/3
$B::C::debug{"cv"} and $B::C::debug{"gv"}
!ll&&!rl&&r
000
MC/DC0%0/2
$B::C::debug{"cv"} and $B::C::debug{"gv"}
$B::C::debug{"cv"} $B::C::debug{"gv"}
Truth table0%0/3
A and B
A= $B::C::debug{"cv"}B= $B::C::debug{"gv"}
ABresult
0X0
100
111
4955 }
4956 0 ▶ unless ($optimize_cop) {
Branch: 1 branch
BranchTrueFalseTotal
unless ($B::C::optimize_cop) 0 0 0
4957 0 my $file = $cv->FILE();
4958 0 ▶ if ($MULTI) {
Branch: 2 branches
BranchTrueFalseTotal
if ($MULTI) { } 0 0 0
elsif ($B::C::const_strings and length $file) { } 0 0 0
4959 0 $init->add( savepvn( "CvFILE($sym)", $file ) );
4960 ▶ } elsif ($B::C::const_strings && length $file) {
Condition0%0/3
$B::C::const_strings and length $file
!ll&&!rl&&r
000
MC/DC0%0/2
$B::C::const_strings and length $file
$B::C::const_strings length $file
Truth table0%0/3
A and B
A= $B::C::const_stringsB= length $file
ABresult
0X0
100
111
4961 0 $init->add( sprintf( "CvFILE(%s) = (char *) %s;", $sym, constpv( $file ) ) );
4962 } else {
4963 0 $init->add( sprintf( "CvFILE(%s) = %s;", $sym, cstring( $file ) ) );
4964 }
4965 }
4966 0 my $stash = $cv->STASH;
4967 0 ▶ if ($$stash and ref($stash)) {
Branch: 1 branch
BranchTrueFalseTotal
if ($$stash and ref $stash) 0 0 0
Condition0%0/3
$$stash and ref $stash
!ll&&!rl&&r
000
MC/DC0%0/2
$$stash and ref $stash
$$stash ref $stash
Truth table0%0/3
A and B
A= $$stashB= ref $stash
ABresult
0X0
100
111
4968 # $init->add("/* saving STASH $fullname */\n" if $debug{cv};
4969 0 $stash->save($fullname);
4970 # $sym fixed test 27
4971 0 $init->add( sprintf( "CvSTASH_set((CV*)%s, s\\_%x);", $sym, $$stash ) );
4972 # 5.18 bless does not inc sv_objcount anymore. broken by ddf23d4a1ae (#208)
4973 # We workaround this 5.18 de-optimization by adding it if at least a DESTROY
4974 # method exists.
4975 0 ▶ $init->add("++PL_sv_objcount;") if $cvname eq 'DESTROY' and $] >= 5.017011;
Branch: 1 branch
BranchTrueFalseTotal
if $cvname eq "DESTROY" and $] >= "5.017011" 0 0 0
Condition0%0/3
$cvname eq "DESTROY" and $] >= "5.017011"
!ll&&!rl&&r
000
MC/DC0%0/2
$cvname eq "DESTROY" and $] >= "5.017011"
$cvname eq "DESTROY" $] >= "5.017011"
Truth table0%0/3
A and B
A= $cvname eq "DESTROY"B= $] >= "5.017011"
ABresult
0X0
100
111
4976 warn sprintf( "done saving STASH 0x%x for CV 0x%x\n", $$stash, $$cv )
4977 0 ▶ if $debug{cv} and $debug{gv};
Branch: 1 branch
BranchTrueFalseTotal
if $B::C::debug{"cv"} and $B::C::debug{"gv"} 0 0 0
Condition0%0/3
$B::C::debug{"cv"} and $B::C::debug{"gv"}
!ll&&!rl&&r
000
MC/DC0%0/2
$B::C::debug{"cv"} and $B::C::debug{"gv"}
$B::C::debug{"cv"} $B::C::debug{"gv"}
Truth table0%0/3
A and B
A= $B::C::debug{"cv"}B= $B::C::debug{"gv"}
ABresult
0X0
100
111
4978 }
4979 0 my $magic = $cv->MAGIC;
4980 0 ▶ if ($magic and $$magic) {
Branch: 1 branch
BranchTrueFalseTotal
if ($magic and $$magic) 0 0 0
Condition0%0/3
$magic and $$magic
!ll&&!rl&&r
000
MC/DC0%0/2
$magic and $$magic
$magic $$magic
Truth table0%0/3
A and B
A= $magicB= $$magic
ABresult
0X0
100
111
4981 0 $cv->save_magic($fullname); # XXX will this work?
4982 }
4983 0 ▶ if (!$new_cv_fw) {
Branch: 1 branch
BranchTrueFalseTotal
unless ($new_cv_fw) 0 0 0
4984 0 ▶ $symsect->add(sprintf(
Branch: 1 branch
BranchTrueFalseTotal
$PERL510 ? : 0 0 0
4985 "CVIX%d\t(XPVCV*)&xpvcv_list[%u], $u32fmt, 0x%x".($PERL510?", {0}":''),
4986 $sv_ix, $xpvcv_ix, $cv->REFCNT, $cv->FLAGS
4987 )
4988 );
4989 }
4990 0 ▶ if ($cur) {
Branch: 1 branch
BranchTrueFalseTotal
if ($cur) 0 0 0
4991 0 ▶ warn sprintf( "Saving CV proto %s for CV $sym 0x%x\n", cstring($pv), $$cv ) if $debug{cv};
Branch: 1 branch
BranchTrueFalseTotal
if $B::C::debug{"cv"} 0 0 0
4992 }
4993 # issue 84: empty prototypes sub xx(){} vs sub xx{}
4994 0 ▶ if (defined $pv) {
Branch: 1 branch
BranchTrueFalseTotal
if (defined $pv) 0 0 0
4995 0 ▶ if ($PERL510 and $cur) {
Branch: 2 branches
BranchTrueFalseTotal
if ($PERL510 and $cur) { } 0 0 0
elsif (not $B::C::const_strings) { } 0 0 0
Condition0%0/3
$PERL510 and $cur
!ll&&!rl&&r
000
MC/DC0%0/2
$PERL510 and $cur
$PERL510 $cur
Truth table0%0/3
A and B
A= $PERL510B= $cur
ABresult
0X0
100
111
4996 0 $init->add( sprintf("SvPVX(&sv_list[%d]) = HEK_KEY(%s);", $sv_ix, $pvsym));
4997 } elsif (!$B::C::const_strings) { # not static, they are freed when redefined
4998 0 $init->add( sprintf("SvPVX(&sv_list[%d]) = savepvn(%s, %u);",
4999 $sv_ix, $proto, $cur));
5000 } else {
5001 0 $init->add( sprintf("SvPVX(&sv_list[%d]) = %s;",
5002 $sv_ix, $proto));
5003 }
5004 }
5005 0 ▶ $cv->OUTSIDE->save if $xcv_outside;
Branch: 1 branch
BranchTrueFalseTotal
if $xcv_outside 0 0 0
5006 0 return $sym;
5007 }
5008  
5009 package B::C;
5010 41 ▶my @_v = Internals::V() if $] >= 5.011;
Branch: 1 branch
BranchTrueFalseTotal
if $] >= "5.011" 41 0 41
5011 0 ▶sub __ANON__::_V { @_v };
Subroutine _V: not called CC=1 SCAR=6.9
5012  
5013 0 ▶sub B::GV::save {
Subroutine save: not called CC=222 SCAR=107.5
5014 0 my ($gv, $filter) = @_;
5015 0 my $sym = objsym($gv);
5016 0 ▶ if ( defined($sym) ) {
Branch: 1 branch
BranchTrueFalseTotal
if (defined $sym) { } 0 0 0
5017 0 ▶ warn sprintf( "GV 0x%x already saved as $sym\n", $$gv ) if $debug{gv};
Branch: 1 branch
BranchTrueFalseTotal
if $B::C::debug{"gv"} 0 0 0
5018 0 return $sym;
5019 }
5020 else {
5021 0 my $ix = $gv_index++;
5022 0 $sym = savesym( $gv, "gv_list[$ix]" );
5023 0 ▶ warn sprintf( "Saving GV 0x%x as $sym\n", $$gv ) if $debug{gv};
Branch: 1 branch
BranchTrueFalseTotal
if $B::C::debug{"gv"} 0 0 0
5024 }
5025 warn sprintf( " GV *%s $sym type=%d, flags=0x%x %s\n", $gv->NAME,
5026 # B::SV::SvTYPE not with 5.6
5027 0 ▶ B::SV::SvTYPE($gv), $gv->FLAGS) if $debug{gv} and !$PERL56;
Branch: 1 branch
BranchTrueFalseTotal
if $B::C::debug{"gv"} and not $PERL56 0 0 0
Condition0%0/3
$B::C::debug{"gv"} and not $PERL56
!ll&&!rl&&r
000
MC/DC0%0/2
$B::C::debug{"gv"} and not $PERL56
$B::C::debug{"gv"} not $PERL56
Truth table0%0/3
A and not(B)
A= $B::C::debug{"gv"}B= not $PERL56
ABresult
0X0
100
111
5028 0 ▶ if ($PERL510 and !$PERL5257 and $gv->FLAGS & 0x40000000) { # SVpbm_VALID
Branch: 1 branch
BranchTrueFalseTotal
if ($PERL510 and not $PERL5257 and $gv->FLAGS & 1073741824) 0 0 0
Condition0%0/6
$PERL510 and not $PERL5257 and $gv->FLAGS & 1073741824
!ll&&!rl&&r
000
$PERL510 and not $PERL5257
!ll&&!rl&&r
000
MC/DC0%0/3
$PERL510 and not $PERL5257 and $gv->FLAGS & 1073741824
$PERL510 not $PERL5257 $gv->FLAGS & 1073741824
Truth table0%0/4
A and not(B) and C
A= $PERL510B= not $PERL5257C= $gv->FLAGS & 1073741824
ABCresult
0XX0
10X0
1100
1111
5029 0 ▶ warn sprintf( " GV $sym isa FBM\n") if $debug{gv};
Branch: 1 branch
BranchTrueFalseTotal
if $B::C::debug{"gv"} 0 0 0
5030 0 return B::BM::save($gv);
5031 }
5032 # since 5.25.7 VALID is just a B magic at a gv->SV->PVMG. See below.
5033  
5034 0 my $gvname = $gv->NAME;
5035 0 my $package;
5036 0 ▶ if (ref($gv->STASH) eq 'B::SPECIAL') {
Branch: 1 branch
BranchTrueFalseTotal
if (ref $gv->STASH eq 'B::SPECIAL') { } 0 0 0
5037 0 $package = '__ANON__';
5038 0 ▶ warn sprintf( "GV STASH = SPECIAL $gvname\n") if $debug{gv};
Branch: 1 branch
BranchTrueFalseTotal
if $B::C::debug{"gv"} 0 0 0
5039 } else {
5040 0 $package = $gv->STASH->NAME;
5041 }
5042 0 ▶ return q/(SV*)&PL_sv_undef/ if skip_pkg($package);
Branch: 1 branch
BranchTrueFalseTotal
if skip_pkg($package) 0 0 0
5043  
5044 0 my $fullname = $package . "::" . $gvname;
5045 0 my $fancyname;
5046 sub Save_HV() { 1 }
5047 sub Save_AV() { 2 }
5048 sub Save_SV() { 4 }
5049 sub Save_CV() { 8 }
5050 sub Save_FORM() { 16 }
5051 sub Save_IO() { 32 }
5052 sub Save_ALL() { 63 }
5053 0 ▶ if ( $filter and $filter =~ m/ :pad/ ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($filter and $filter =~ / :pad/) { } 0 0 0
Condition0%0/3
$filter and $filter =~ / :pad/
!ll&&!rl&&r
000
MC/DC0%0/2
$filter and $filter =~ / :pad/
$filter $filter =~ / :pad/
Truth table0%0/3
A and B
A= $filterB= $filter =~ / :pad/
ABresult
0X0
100
111
5054 0 $fancyname = cstring($filter);
5055 0 $filter = 0;
5056 } else {
5057 0 $fancyname = cstring($fullname);
5058 }
5059 # checked for defined'ness in Carp. So the GV must exist, the CV not
5060 0 ▶ if ($fullname =~ /^threads::(tid|AUTOLOAD)$/ and !$ITHREADS) {
Branch: 1 branch
BranchTrueFalseTotal
if ($fullname =~ /^threads::(tid|AUTOLOAD)$/ and not $ITHREADS) 0 0 0
Condition0%0/3
$fullname =~ /^threads::(tid|AUTOLOAD)$/ and not $ITHREADS
!ll&&!rl&&r
000
MC/DC0%0/2
$fullname =~ /^threads::(tid|AUTOLOAD)$/ and not $ITHREADS
$fullname =~ /^threads::(tid|AUTOLOAD)$/ not $ITHREADS
Truth table0%0/3
A and not(B)
A= $fullname =~ /^threads::(tid|AUTOLOAD)$/B= not $ITHREADS
ABresult
0X0
100
111
5061 0 $filter = Save_CV;
5062 }
5063 # no need to assign any SV/AV/HV to them (172)
5064 0 ▶ if ($PERL518 and $fullname =~ /^DynaLoader::dl_(
Branch: 1 branch
BranchTrueFalseTotal
if ($PERL518 and $fullname =~ /^DynaLoader::dl_( require_symbols| modules| shared_objects| resolve_using| librefs)/x) 0 0 0
Condition0%0/3
$PERL518 and $fullname =~ /^DynaLoader::dl_( require_symbols| modules| shared_objects| resolve_using| librefs)/x
!ll&&!rl&&r
000
MC/DC0%0/2
$PERL518 and $fullname =~ /^DynaLoader::dl_( require_symbols| modules| shared_objects| resolve_using| librefs)/x
$PERL518 $fullname =~ /^DynaLoader::dl_( require_symbols| modules| shared_objects| resolve_using| librefs)/x
Truth table0%0/3
A and B
A= $PERL518B= $fullname =~ /^DynaLoader::dl_( require_symbols| modules| shared_objects| resolve_using| librefs)/x
ABresult
0X0
100
111
5065 require_symbols|
5066 modules|
5067 shared_objects|
5068 resolve_using|
5069 librefs)/x)
5070 {
5071 0 $filter = Save_SV + Save_AV + Save_HV;
5072 }
5073 # skip static %Encode::Encoding since 5.20. GH #200.
5074 # Let it be initialized by boot_Encode/Encode_XSEncoding
5075 #if ($] >= 5.020 and $fullname eq 'Encode::Encoding') {
5076 # warn "skip %Encode::Encoding - XS initialized\n" if $debug{gv};
5077 # $filter = Save_HV;
5078 #}
5079  
5080 0 my $is_empty = $gv->is_empty;
5081 0 ▶ if (!defined $gvname and $is_empty) { # 5.8 curpad name
Branch: 1 branch
BranchTrueFalseTotal
if (not defined $gvname and $is_empty) 0 0 0
Condition0%0/3
not defined $gvname and $is_empty
!ll&&!rl&&r
000
MC/DC0%0/2
not defined $gvname and $is_empty
not defined $gvname $is_empty
Truth table0%0/3
not(A) and B
A= not defined $gvnameB= $is_empty
ABresult
0X0
100
111
5082 0 return q/(SV*)&PL_sv_undef/;
5083 }
5084 0 ▶ my $name = $package eq 'main' ? $gvname : $fullname;
Branch: 1 branch
BranchTrueFalseTotal
$package eq 'main' ? : 0 0 0
5085 0 my $cname = cstring($name);
5086 0 ▶ my $notqual = ($] >= 5.008009 and $package eq 'main') ? 'GV_NOTQUAL' : '0';
Branch: 1 branch
BranchTrueFalseTotal
$] >= 5.008009 && $package eq 'main' ? : 0 0 0
Condition0%0/3
$] >= "5.008009" and $package eq "main"
!ll&&!rl&&r
000
MC/DC0%0/2
$] >= "5.008009" and $package eq "main"
$] >= "5.008009" $package eq "main"
Truth table0%0/3
A and B
A= $] >= "5.008009"B= $package eq "main"
ABresult
0X0
100
111
5087 0 ▶ warn " GV name is $fancyname\n" if $debug{gv};
Branch: 1 branch
BranchTrueFalseTotal
if $B::C::debug{"gv"} 0 0 0
5088 0 my $egvsym;
5089 0 my $is_special = ref($gv) eq 'B::SPECIAL';
5090  
5091 # If we come across a stash, we therefore have code using this symbol.
5092 # But this does not mean that we need to save the package then.
5093 # if (defined %Exporter::) should not import Exporter, it should return undef.
5094 #if ( $gvname =~ m/::$/ ) {
5095 # my $package = $gvname;
5096 # $package =~ s/::$//;
5097 # mark_package($package); #wrong
5098 #}
5099 0 ▶ if ($fullname =~ /^(bytes|utf8)::AUTOLOAD$/) {
Branch: 1 branch
BranchTrueFalseTotal
if ($fullname =~ /^(bytes|utf8)::AUTOLOAD$/) 0 0 0
5100 0 $gv = force_heavy($package); # defer to run-time autoload, or compile it in?
5101 0 $sym = savesym( $gv, $sym ); # override new gv ptr to sym
5102 }
5103 0 ▶ if ( !$is_empty ) {
Branch: 1 branch
BranchTrueFalseTotal
unless ($is_empty) 0 0 0
5104 0 my $egv = $gv->EGV;
5105 0 ▶ unless (ref($egv) eq 'B::SPECIAL' or ref($egv->STASH) eq 'B::SPECIAL') {
Branch: 1 branch
BranchTrueFalseTotal
unless (ref $egv eq "B::SPECIAL" or ref $egv->STASH eq "B::SPECIAL") 0 0 0
Condition0%0/3
ref $egv eq "B::SPECIAL" or ref $egv->STASH eq "B::SPECIAL"
l!l&&r!l&&!r
000
MC/DC0%0/2
ref $egv eq "B::SPECIAL" or ref $egv->STASH eq "B::SPECIAL"
ref $egv eq "B::SPECIAL" ref $egv->STASH eq "B::SPECIAL"
Truth table0%0/3
A or B
A= ref $egv eq "B::SPECIAL"B= ref $egv->STASH eq "B::SPECIAL"
ABresult
1X1
011
000
5106 0 my $estash = $egv->STASH->NAME;
5107 0 ▶ if ( $$gv != $$egv ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($$gv != $$egv) 0 0 0
5108 warn(sprintf( "EGV name is %s, saving it now\n",
5109 $estash . "::" . $egv->NAME )
5110 0 ▶ ) if $debug{gv};
Branch: 1 branch
BranchTrueFalseTotal
if $B::C::debug{"gv"} 0 0 0
5111 0 $egvsym = $egv->save;
5112 }
5113 }
5114 }
5115 #if ($fullname eq 'threads::tid' and !$ITHREADS) { # checked for defined'ness in Carp
5116 # $init->add(qq[$sym = (GV*)&PL_sv_undef;]);
5117 # return $sym;
5118 #}
5119 0 ▶ if ($fullname =~ /^main::STDOUT$/i and $PERL56) {
Branch: 1 branch
BranchTrueFalseTotal
if ($fullname =~ /^main::STDOUT$/i and $PERL56) 0 0 0
Condition0%0/3
$fullname =~ /^main::STDOUT$/i and $PERL56
!ll&&!rl&&r
000
MC/DC0%0/2
$fullname =~ /^main::STDOUT$/i and $PERL56
$fullname =~ /^main::STDOUT$/i $PERL56
Truth table0%0/3
A and B
A= $fullname =~ /^main::STDOUT$/iB= $PERL56
ABresult
0X0
100
111
5120 0 return 'Nullgv'; # perl.c: setdefout(Nullgv)
5121 }
5122 0 my $core_syms = {ENV => 'PL_envgv',
5123 ARGV => 'PL_argvgv',
5124 INC => 'PL_incgv',
5125 STDIN => 'PL_stdingv',
5126 STDERR => 'PL_stderrgv',
5127 "\010" => 'PL_hintgv', # ^H
5128 "_" => 'PL_defgv',
5129 "@" => 'PL_errgv',
5130 "\022" => 'PL_replgv', # ^R
5131 };
5132 0 my $is_coresym;
5133 # those are already initialized in init_predump_symbols()
5134 # and init_main_stash()
5135 0 for my $s (sort keys %$core_syms) {
5136 0 ▶ if ($fullname eq 'main::'.$s) {
Branch: 1 branch
BranchTrueFalseTotal
if ($fullname eq 'main::' . $s) 0 0 0
5137 0 $sym = savesym( $gv, $core_syms->{$s} );
5138 # $init->add( sprintf( "SvREFCNT($sym) = $u32fmt;", $gv->REFCNT ) );
5139 # return $sym;
5140 0 $is_coresym++;
5141 }
5142 }
5143 0 ▶ if ($fullname =~ /^main::std(in|out|err)$/) { # same as uppercase above
Branch: 3 branches
BranchTrueFalseTotal
if ($fullname =~ /^main::std(in|out|err)$/) { } 0 0 0
elsif ($fullname eq 'main::0') { } 0 0 0
elsif ($B::C::ro_inc and $fullname =~ /^main::([0-9])$/) { } 0 0 0
5144 0 $init->add(qq[$sym = gv_fetchpv($cname, $notqual, SVt_PVGV);]);
5145 0 $init->add( sprintf( "SvREFCNT(%s) = $u32fmt;", $sym, $gv->REFCNT ) );
5146 0 return $sym;
5147 }
5148 elsif ($fullname eq 'main::0') { # dollar_0 already handled before, so don't overwrite it
5149 # only the $0 part, not @0 &0 ...
5150 #$init->add(qq[$sym = gv_fetchpv($cname, $notqual, SVt_PV);]);
5151 #$init->add( sprintf( "SvREFCNT(%s) = $u32fmt;", $sym, $gv->REFCNT ) );
5152 0 $filter = Save_SV;
5153 #return $sym;
5154 }
5155 ▶ elsif ($B::C::ro_inc and $fullname =~ /^main::([0-9])$/) { # ignore PV regexp captures with -O2
Condition0%0/3
$B::C::ro_inc and $fullname =~ /^main::([0-9])$/
!ll&&!rl&&r
000
MC/DC0%0/2
$B::C::ro_inc and $fullname =~ /^main::([0-9])$/
$B::C::ro_inc $fullname =~ /^main::([0-9])$/
Truth table0%0/3
A and B
A= $B::C::ro_incB= $fullname =~ /^main::([0-9])$/
ABresult
0X0
100
111
5156 0 $filter = Save_SV;
5157 }
5158 # gv_fetchpv loads Errno resp. Tie::Hash::NamedCapture, but needs *INC #90
5159 #elsif ( $fullname eq 'main::!' or $fullname eq 'main::+' or $fullname eq 'main::-') {
5160 # $init1->add(qq[$sym = gv_fetchpv($name, TRUE, SVt_PVGV);]); # defer until INC is setup
5161 # $init1->add( sprintf( "SvREFCNT(%s) = $u32fmt;", $sym, $gv->REFCNT ) );
5162 # return $sym;
5163 #}
5164 0 my $svflags = $gv->FLAGS;
5165 0 my $savefields = 0;
5166  
5167 0 my $gp;
5168 0 ▶ my $gvadd = $notqual ? "$notqual|GV_ADD" : "GV_ADD";
Branch: 1 branch
BranchTrueFalseTotal
$notqual ? : 0 0 0
5169 0 ▶ if ( $PERL510 and $gv->isGV_with_GP and !$is_coresym) {
Branch: 2 branches
BranchTrueFalseTotal
if ($PERL510 and $gv->isGV_with_GP and not $is_coresym) { } 0 0 0
elsif (not $is_coresym) { } 0 0 0
Condition0%0/6
$PERL510 and $gv->isGV_with_GP and not $is_coresym
!ll&&!rl&&r
000
$PERL510 and $gv->isGV_with_GP
!ll&&!rl&&r
000
MC/DC0%0/3
$PERL510 and $gv->isGV_with_GP and not $is_coresym
$PERL510 $gv->isGV_with_GP not $is_coresym
Truth table0%0/4
A and B and not(C)
A= $PERL510B= $gv->isGV_with_GPC= not $is_coresym
ABCresult
0XX0
10X0
1100
1111
5170 0 $gp = $gv->GP; # B limitation
5171 # warn "XXX EGV='$egvsym' for IMPORTED_HV" if $gv->GvFLAGS & 0x40;
5172 0 ▶ if ( defined($egvsym) && $egvsym !~ m/Null/ ) {
Branch: 4 branches
BranchTrueFalseTotal
if (defined $egvsym and not $egvsym =~ /Null/) { } 0 0 0
elsif ($gp and exists $gptable{0 + $gp}) { } 0 0 0
elsif ($gp and not $is_empty and $gvname =~ /::$/) { } 0 0 0
elsif ($gp and not $is_empty) { } 0 0 0
Condition0%0/3
defined $egvsym and not $egvsym =~ /Null/
!ll&&!rl&&r
000
MC/DC0%0/2
defined $egvsym and not $egvsym =~ /Null/
defined $egvsym not $egvsym =~ /Null/
Truth table0%0/3
A and not(B)
A= defined $egvsymB= not $egvsym =~ /Null/
ABresult
0X0
100
111
5173 warn(sprintf("Shared GV alias for *$fullname 0x%x%s %s to $egvsym\n",
5174 $svflags, $debug{flags} ? "(".$gv->flagspv.")" : "",
5175 0 ▶ )) if $debug{gv};
Branch: 2 branches
BranchTrueFalseTotal
if $B::C::debug{"gv"} 0 0 0
$B::C::debug{'flags'} ? : 0 0 0
5176 # Shared glob *foo = *bar
5177 0 ▶ $init->add("$sym = ".gv_fetchpvn($package eq 'main' ? $gvname : $fullname,
Branch: 1 branch
BranchTrueFalseTotal
$package eq 'main' ? : 0 0 0
5178 "$gvadd|GV_ADDMULTI", "SVt_PVGV").";");
5179 0 $init->add( "GvGP_set($sym, GvGP($egvsym));" );
5180 0 $is_empty = 1;
5181 }
5182 ▶ elsif ( $gp and exists $gptable{0+$gp} ) {
Condition0%0/3
$gp and exists $gptable{0 + $gp}
!ll&&!rl&&r
000
MC/DC0%0/2
$gp and exists $gptable{0 + $gp}
$gp exists $gptable{0 + $gp}
Truth table0%0/3
A and B
A= $gpB= exists $gptable{0 + $gp}
ABresult
0X0
100
111
5183 warn(sprintf("Shared GvGP for *$fullname 0x%x%s %s GP:0x%x\n",
5184 $svflags, $debug{flags} ? "(".$gv->flagspv.")" : "",
5185 $gv->FILE, $gp
5186 0 ▶ )) if $debug{gv};
Branch: 2 branches
BranchTrueFalseTotal
if $B::C::debug{"gv"} 0 0 0
$B::C::debug{'flags'} ? : 0 0 0
5187 0 $init->add("$sym = ".gv_fetchpvn($name, $notqual, "SVt_PVGV").";");
5188 0 $init->add( sprintf("GvGP_set(%s, %s);", $sym, $gptable{0+$gp}) );
5189 0 $is_empty = 1;
5190 }
5191 ▶ elsif ( $gp and !$is_empty and $gvname =~ /::$/) {
Condition0%0/6
$gp and not $is_empty and $gvname =~ /::$/
!ll&&!rl&&r
000
$gp and not $is_empty
!ll&&!rl&&r
000
MC/DC0%0/3
$gp and not $is_empty and $gvname =~ /::$/
$gp not $is_empty $gvname =~ /::$/
Truth table0%0/4
A and not(B) and C
A= $gpB= not $is_emptyC= $gvname =~ /::$/
ABCresult
0XX0
10X0
1100
1111
5192 warn(sprintf("Shared GvGP for stash %$fullname 0x%x%s %s GP:0x%x\n",
5193 $svflags, $debug{flags} ? "(".$gv->flagspv.")" : "",
5194 $gv->FILE, $gp
5195 0 ▶ )) if $debug{gv};
Branch: 2 branches
BranchTrueFalseTotal
if $B::C::debug{"gv"} 0 0 0
$B::C::debug{'flags'} ? : 0 0 0
5196 0 $init->add("$sym = ".gv_fetchpvn($name, "GV_ADD", "SVt_PVHV").";");
5197 0 ▶ $gptable{0+$gp} = "GvGP($sym)" if 0+$gp;
Branch: 1 branch
BranchTrueFalseTotal
if 0 + $gp 0 0 0
5198 }
5199 ▶ elsif ( $gp and !$is_empty ) {
Condition0%0/3
$gp and not $is_empty
!ll&&!rl&&r
000
MC/DC0%0/2
$gp and not $is_empty
$gp not $is_empty
Truth table0%0/3
A and not(B)
A= $gpB= not $is_empty
ABresult
0X0
100
111
5200 warn(sprintf("New GV for *$fullname 0x%x%s %s GP:0x%x\n",
5201 $svflags, $debug{flags} ? "(".$gv->flagspv.")" : "",
5202 $gv->FILE, $gp
5203 0 ▶ )) if $debug{gv};
Branch: 2 branches
BranchTrueFalseTotal
if $B::C::debug{"gv"} 0 0 0
$B::C::debug{'flags'} ? : 0 0 0
5204 # XXX !PERL510 and OPf_COP_TEMP we need to fake PL_curcop for gp_file hackery
5205 0 $init->add("$sym = ".gv_fetchpvn($name, $gvadd, "SVt_PV").";");
5206 0 $savefields = Save_ALL;
5207 0 $gptable{0+$gp} = "GvGP($sym)";
5208 }
5209 else {
5210 0 $init->add("$sym = ".gv_fetchpvn($name, $gvadd, "SVt_PVGV").";");
5211 }
5212 } elsif (!$is_coresym) {
5213 0 $init->add("$sym = ".gv_fetchpvn($name, $gvadd, "SVt_PV").";");
5214 }
5215 0 my $gvflags = $gv->GvFLAGS;
5216 0 ▶ if ($gvflags > 256 and !$PERL510) { # $gv->GvFLAGS as U8 single byte only
Branch: 1 branch
BranchTrueFalseTotal
if ($gvflags > 256 and not $PERL510) 0 0 0
Condition0%0/3
$gvflags > 256 and not $PERL510
!ll&&!rl&&r
000
MC/DC0%0/2
$gvflags > 256 and not $PERL510
$gvflags > 256 not $PERL510
Truth table0%0/3
A and not(B)
A= $gvflags > 256B= not $PERL510
ABresult
0X0
100
111
5217 0 $gvflags = $gvflags & 255;
5218 }
5219 $init->add( sprintf( "SvFLAGS(%s) = 0x%x;%s", $sym, $svflags,
5220 $debug{flags}?" /* ".$gv->flagspv." */":"" ),
5221 sprintf( "GvFLAGS(%s) = 0x%x; %s", $sym, $gvflags,
5222 0 ▶ $debug{flags}?"/* ".$gv->flagspv(SVt_PVGV)." */":"" ));
Branch: 2 branches
BranchTrueFalseTotal
$B::C::debug{'flags'} ? : 0 0 0
$B::C::debug{'flags'} ? : 0 0 0
5223 0 ▶ $init->add( sprintf( "GvLINE(%s) = %d;", $sym,
Branch: 2 branches
BranchTrueFalseTotal
unless $is_empty 0 0 0
$gv->LINE > 2147483647 ? : 0 0 0
5224 ($gv->LINE > 2147483647 # S32 INT_MAX
5225 ? 4294967294 - $gv->LINE
5226 : $gv->LINE )))
5227 unless $is_empty;
5228  
5229 # XXX hack for when Perl accesses PVX of GVs, only if SvPOK
5230 #if (!($svflags && 0x400)) { # defer to run-time (0x400 -> SvPOK) for convenience
5231 # XXX also empty "main::" destruction accesses a PVX, so do not check if_empty
5232 0 ▶ if ( !$PERL510 ) {
Branch: 1 branch
BranchTrueFalseTotal
unless ($PERL510) 0 0 0
5233 0 $init->add("if (SvPOK($sym) && !SvPVX($sym)) SvPVX($sym) = (char*)emptystring;");
5234 }
5235  
5236 # walksymtable creates an extra reference to the GV (#197)
5237 0 ▶ if ( $gv->REFCNT > 1 ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($gv->REFCNT > 1) 0 0 0
5238 0 $init->add( sprintf( "SvREFCNT(%s) = $u32fmt;", $sym, $gv->REFCNT) );
5239 }
5240 0 ▶ return $sym if $is_empty;
Branch: 1 branch
BranchTrueFalseTotal
if $is_empty 0 0 0
5241  
5242 0 my $gvrefcnt = $gv->GvREFCNT;
5243 0 ▶ if ( $gvrefcnt > 1 ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($gvrefcnt > 1) 0 0 0
5244 0 $init->add( sprintf( "GvREFCNT(%s) += $u32fmt;", $sym, $gvrefcnt - 1) );
5245 }
5246  
5247 0 ▶ warn "check which savefields for \"$gvname\"\n" if $debug{gv};
Branch: 1 branch
BranchTrueFalseTotal
if $B::C::debug{"gv"} 0 0 0
5248 # some non-alphabetic globs require some parts to be saved
5249 # ( ex. %!, but not $! )
5250 0 ▶ if ( $gvname !~ /^([^A-Za-z]|STDIN|STDOUT|STDERR|ARGV|SIG|ENV)$/ ) {
Branch: 5 branches
BranchTrueFalseTotal
if (not $gvname =~ /^([^A-Za-z]|STDIN|STDOUT|STDERR|ARGV|SIG|ENV)$/) { } 0 0 0
elsif ($fullname eq 'main::!') { } 0 0 0
elsif ($fullname eq 'main::ENV' or $fullname eq 'main::SIG') { } 0 0 0
elsif ($fullname eq 'main::ARGV') { } 0 0 0
elsif ($fullname =~ /^main::STD(IN|OUT|ERR)$/) { } 0 0 0
5251 0 $savefields = Save_HV | Save_AV | Save_SV | Save_CV | Save_FORM | Save_IO;
5252 }
5253 elsif ( $fullname eq 'main::!' ) { #Errno
5254 0 $savefields = Save_HV | Save_SV | Save_CV;
5255 }
5256 ▶ elsif ( $fullname eq 'main::ENV' or $fullname eq 'main::SIG' ) {
Condition0%0/3
$fullname eq "main::ENV" or $fullname eq "main::SIG"
l!l&&r!l&&!r
000
MC/DC0%0/2
$fullname eq "main::ENV" or $fullname eq "main::SIG"
$fullname eq "main::ENV" $fullname eq "main::SIG"
Truth table0%0/3
A or B
A= $fullname eq "main::ENV"B= $fullname eq "main::SIG"
ABresult
1X1
011
000
5257 0 $savefields = Save_AV | Save_SV | Save_CV | Save_FORM | Save_IO;
5258 }
5259 elsif ( $fullname eq 'main::ARGV' ) {
5260 0 $savefields = Save_HV | Save_SV | Save_CV | Save_FORM | Save_IO;
5261 }
5262 elsif ( $fullname =~ /^main::STD(IN|OUT|ERR)$/ ) {
5263 0 $savefields = Save_FORM | Save_IO;
5264 }
5265 0 ▶ $savefields &= ~$filter if ($filter and $filter !~ m/ :pad/
Branch: 1 branch
BranchTrueFalseTotal
if $filter and not $filter =~ / :pad/ and $filter =~ /^\d+$/ and $filter > 0 and $filter < 64 0 0 0
Condition0%0/12
$filter and not $filter =~ / :pad/ and $filter =~ /^\d+$/ and $filter > 0 and $filter < 64
!ll&&!rl&&r
000
$filter and not $filter =~ / :pad/ and $filter =~ /^\d+$/ and $filter > 0
!ll&&!rl&&r
000
$filter and not $filter =~ / :pad/ and $filter =~ /^\d+$/
!ll&&!rl&&r
000
$filter and not $filter =~ / :pad/
!ll&&!rl&&r
000
MC/DC0%0/5
$filter and not $filter =~ / :pad/ and $filter =~ /^\d+$/ and $filter > 0 and $filter < 64
$filter not $filter =~ / :pad/ $filter =~ /^\d+$/ $filter > 0 $filter < 64
Truth table0%0/6
A and not(B) and C and D and E
A= $filterB= not $filter =~ / :pad/C= $filter =~ /^\d+$/D= $filter > 0E= $filter < 64
ABCDEresult
0XXXX0
10XXX0
110XX0
1110X0
111100
111111
5266 and $filter =~ m/^\d+$/ and $filter > 0 and $filter < 64);
5267 # issue 79: Only save stashes for stashes.
5268 # But not other values to avoid recursion into unneeded territory.
5269 # We walk via savecv, not via stashes.
5270 0 ▶ if (ref($gv) eq 'B::STASHGV' and $gvname !~ /::$/) {
Branch: 1 branch
BranchTrueFalseTotal
if (ref $gv eq "B::STASHGV" and not $gvname =~ /::$/) 0 0 0
Condition0%0/3
ref $gv eq "B::STASHGV" and not $gvname =~ /::$/
!ll&&!rl&&r
000
MC/DC0%0/2
ref $gv eq "B::STASHGV" and not $gvname =~ /::$/
ref $gv eq "B::STASHGV" not $gvname =~ /::$/
Truth table0%0/3
A and not(B)
A= ref $gv eq "B::STASHGV"B= not $gvname =~ /::$/
ABresult
0X0
100
111
5271 0 return $sym;
5272 }
5273  
5274 # attributes::bootstrap is created in perl_parse.
5275 # Saving it would overwrite it, because perl_init() is
5276 # called after perl_parse(). But we need to xsload it.
5277 0 ▶ if ($fullname eq 'attributes::bootstrap') {
Branch: 1 branch
BranchTrueFalseTotal
if ($fullname eq "attributes::bootstrap") 0 0 0
5278 0 ▶ unless ( defined( &{ $package . '::bootstrap' } ) ) {
Branch: 1 branch
BranchTrueFalseTotal
unless (defined &{$package . '::bootstrap';}) 0 0 0
5279 0 ▶ warn "Forcing bootstrap of $package\n" if $verbose;
Branch: 1 branch
BranchTrueFalseTotal
if $B::C::verbose 0 0 0
5280 0 eval { $package->bootstrap };
5281 }
5282 0 mark_package('attributes', 1);
5283 0 ▶ if ($] >= 5.011) {
Branch: 1 branch
BranchTrueFalseTotal
if ($] >= 5.011) { } 0 0 0
5284 0 $savefields &= ~Save_CV;
5285 0 $xsub{attributes} = 'Dynamic-'. $INC{'attributes.pm'}; # XSLoader
5286 0 $use_xsloader = 1;
5287 } else {
5288 0 $xsub{attributes} = 'Static';
5289 }
5290 }
5291  
5292 # avoid overly dynamic POSIX redefinition warnings: GH #335, #345
5293 0 ▶ if ($PERL522 and $fullname =~ /^POSIX::M/) {
Branch: 1 branch
BranchTrueFalseTotal
if ($PERL522 and $fullname =~ /^POSIX::M/) 0 0 0
Condition0%0/3
$PERL522 and $fullname =~ /^POSIX::M/
!ll&&!rl&&r
000
MC/DC0%0/2
$PERL522 and $fullname =~ /^POSIX::M/
$PERL522 $fullname =~ /^POSIX::M/
Truth table0%0/3
A and B
A= $PERL522B= $fullname =~ /^POSIX::M/
ABresult
0X0
100
111
5294 0 $savefields &= ~Save_CV;
5295 }
5296 0 my $gvsv;
5297 0 ▶ if ($savefields) {
Branch: 1 branch
BranchTrueFalseTotal
if ($savefields) 0 0 0
5298 # Don't save subfields of special GVs (*_, *1, *# and so on)
5299 0 ▶ warn "GV::save saving subfields $savefields\n" if $debug{gv};
Branch: 1 branch
BranchTrueFalseTotal
if $B::C::debug{"gv"} 0 0 0
5300 0 $gvsv = $gv->SV;
5301 0 ▶ if ( $$gvsv && $savefields & Save_SV ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($$gvsv and $savefields & 4) 0 0 0
Condition0%0/3
$$gvsv and $savefields & 4
!ll&&!rl&&r
000
MC/DC0%0/2
$$gvsv and $savefields & 4
$$gvsv $savefields & 4
Truth table0%0/3
A and B
A= $$gvsvB= $savefields & 4
ABresult
0X0
100
111
5302 0 ▶ warn "GV::save \$".$sym." $gvsv\n" if $debug{gv};
Branch: 1 branch
BranchTrueFalseTotal
if $B::C::debug{"gv"} 0 0 0
5303 0 my $core_svs = { # special SV syms to assign to the right GvSV
5304 "\\" => 'PL_ors_sv',
5305 "/" => 'PL_rs',
5306 "@" => 'PL_errors',
5307 };
5308 0 for my $s (sort keys %$core_svs) {
5309 0 ▶ if ($fullname eq 'main::'.$s) {
Branch: 1 branch
BranchTrueFalseTotal
if ($fullname eq 'main::' . $s) 0 0 0
5310 0 savesym( $gvsv, $core_svs->{$s} ); # TODO: This could bypass BEGIN settings (->save is ignored)
5311 }
5312 }
5313 0 ▶ if ($PERL5257 and $gvsv->MAGICAL) {
Branch: 1 branch
BranchTrueFalseTotal
if ($PERL5257 and $gvsv->MAGICAL) 0 0 0
Condition0%0/3
$PERL5257 and $gvsv->MAGICAL
!ll&&!rl&&r
000
MC/DC0%0/2
$PERL5257 and $gvsv->MAGICAL
$PERL5257 $gvsv->MAGICAL
Truth table0%0/3
A and B
A= $PERL5257B= $gvsv->MAGICAL
ABresult
0X0
100
111
5314 0 my @magic = $gvsv->MAGIC;
5315 0 foreach my $mg (@magic) {
5316 0 ▶ if ($mg->TYPE eq 'B') {
Branch: 1 branch
BranchTrueFalseTotal
if ($mg->TYPE eq "B") 0 0 0
5317 0 ▶ warn sprintf( " GvSV $sym isa FBM\n") if $debug{gv};
Branch: 1 branch
BranchTrueFalseTotal
if $B::C::debug{"gv"} 0 0 0
5318 0 savesym($gvsv, B::BM::save($gvsv));
5319 }
5320 }
5321 }
5322 0 ▶ if ($gvname eq 'VERSION' and $xsub{$package} and $gvsv->FLAGS & SVf_ROK and !$PERL56) {
Branch: 1 branch
BranchTrueFalseTotal
if ($gvname eq 'VERSION' and $xsub{$package} and $gvsv->FLAGS & 2048 and not $PERL56) { } 0 0 0
Condition0%0/9
$gvname eq "VERSION" and $xsub{$package} and $gvsv->FLAGS & 2048 and not $PERL56
!ll&&!rl&&r
000
$gvname eq "VERSION" and $xsub{$package} and $gvsv->FLAGS & 2048
!ll&&!rl&&r
000
$gvname eq "VERSION" and $xsub{$package}
!ll&&!rl&&r
000
MC/DC0%0/4
$gvname eq "VERSION" and $xsub{$package} and $gvsv->FLAGS & 2048 and not $PERL56
$gvname eq "VERSION" $xsub{$package} $gvsv->FLAGS & 2048 not $PERL56
Truth table0%0/5
A and B and C and not(D)
A= $gvname eq "VERSION"B= $xsub{$package}C= $gvsv->FLAGS & 2048D= not $PERL56
ABCDresult
0XXX0
10XX0
110X0
11100
11111
5323 0 ▶ warn "Strip overload from $package\::VERSION, fails to xs boot (issue 91)\n" if $debug{gv};
Branch: 1 branch
BranchTrueFalseTotal
if $B::C::debug{"gv"} 0 0 0
5324 0 my $rv = $gvsv->object_2svref();
5325 0 my $origsv = $$rv;
5326 41 ▶ no strict 'refs';
Subroutine BEGIN: called CC=1 SCAR=0.0
5327 0 ${$fullname} = "$origsv";
5328 0 svref_2object(\${$fullname})->save($fullname);
5329 0 $init->add( sprintf( "GvSVn(%s) = (SV*)s\\_%x;", $sym, $$gvsv ) );
5330 } else {
5331 0 $gvsv->save($fullname); #even NULL save it, because of gp_free nonsense
5332 # we need sv magic for the core_svs (PL_rs -> gv) (#314)
5333 0 ▶ if (exists $core_svs->{$gvname}) {
Branch: 1 branch
BranchTrueFalseTotal
if (exists $core_svs->{$gvname}) 0 0 0
5334 0 ▶ if ($gvname eq "\\") { # ORS special case #318 (initially NULL)
Branch: 1 branch
BranchTrueFalseTotal
if ($gvname eq '\\') { } 0 0 0
5335 0 return $sym;
5336 } else {
5337 0 ▶ $gvsv->save_magic($fullname) if ref($gvsv) eq 'B::PVMG';
Branch: 1 branch
BranchTrueFalseTotal
if ref $gvsv eq "B::PVMG" 0 0 0
5338 0 $init->add( sprintf( "SvREFCNT(s\\_%x) += 1;", $$gvsv ) );
5339 }
5340 }
5341 0 $init->add( sprintf( "GvSVn(%s) = (SV*)s\\_%x;", $sym, $$gvsv ) );
5342 }
5343 0 ▶ if ($fullname eq 'main::$') { # $$ = PerlProc_getpid() issue #108
Branch: 1 branch
BranchTrueFalseTotal
if ($fullname eq "main::\$") 0 0 0
5344 0 ▶ warn sprintf( " GV $sym \$\$ perlpid\n") if $debug{gv};
Branch: 1 branch
BranchTrueFalseTotal
if $B::C::debug{"gv"} 0 0 0
5345 0 $init->add( "sv_setiv(GvSV($sym), (IV)PerlProc_getpid());" );
5346 }
5347 0 ▶ warn "GV::save \$$fullname\n" if $debug{gv};
Branch: 1 branch
BranchTrueFalseTotal
if $B::C::debug{"gv"} 0 0 0
5348 }
5349 0 my $gvav = $gv->AV;
5350 0 ▶ if ( $$gvav && $savefields & Save_AV ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($$gvav and $savefields & 2) 0 0 0
Condition0%0/3
$$gvav and $savefields & 2
!ll&&!rl&&r
000
MC/DC0%0/2
$$gvav and $savefields & 2
$$gvav $savefields & 2
Truth table0%0/3
A and B
A= $$gvavB= $savefields & 2
ABresult
0X0
100
111
5351 0 ▶ warn "GV::save \@$fullname\n" if $debug{gv};
Branch: 1 branch
BranchTrueFalseTotal
if $B::C::debug{"gv"} 0 0 0
5352 0 $gvav->save($fullname);
5353 0 $init->add( sprintf( "GvAV(%s) = s\\_%x;", $sym, $$gvav ) );
5354 0 ▶ if ($fullname eq 'main::-') {
Branch: 1 branch
BranchTrueFalseTotal
if ($fullname eq "main::-") 0 0 0
5355 0 $init->add( sprintf("AvFILLp(s\\_%x) = -1;", $$gvav),
5356 sprintf("AvMAX(s\\_%x) = -1;", $$gvav));
5357 }
5358 }
5359 0 my $gvhv = $gv->HV;
5360 0 ▶ if ( $$gvhv && $savefields & Save_HV ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($$gvhv and $savefields & 1) 0 0 0
Condition0%0/3
$$gvhv and $savefields & 1
!ll&&!rl&&r
000
MC/DC0%0/2
$$gvhv and $savefields & 1
$$gvhv $savefields & 1
Truth table0%0/3
A and B
A= $$gvhvB= $savefields & 1
ABresult
0X0
100
111
5361 0 ▶ if ($fullname ne 'main::ENV') {
Branch: 1 branch
BranchTrueFalseTotal
if ($fullname ne "main::ENV") 0 0 0
5362 0 ▶ warn "GV::save \%$fullname\n" if $debug{gv};
Branch: 1 branch
BranchTrueFalseTotal
if $B::C::debug{"gv"} 0 0 0
5363 0 ▶ if (!$module) {
Branch: 1 branch
BranchTrueFalseTotal
unless ($B::C::module) 0 0 0
5364 0 ▶ if ($fullname eq 'main::!') { # force loading Errno
Branch: 2 branches
BranchTrueFalseTotal
if ($fullname eq 'main::!') { } 0 0 0
elsif ($fullname eq 'main::+' or $fullname eq 'main::-') { } 0 0 0
5365 0 $init->add("/* \%! force saving of Errno */");
5366 0 mark_package('Config', 1); # Errno needs Config to set the EGV
5367 0 walk_syms('Config');
5368 0 mark_package('Errno', 1); # B::C needs Errno but does not import $!
5369 ▶ } elsif ($fullname eq 'main::+' or $fullname eq 'main::-') {
Condition0%0/3
$fullname eq "main::+" or $fullname eq "main::-"
l!l&&r!l&&!r
000
MC/DC0%0/2
$fullname eq "main::+" or $fullname eq "main::-"
$fullname eq "main::+" $fullname eq "main::-"
Truth table0%0/3
A or B
A= $fullname eq "main::+"B= $fullname eq "main::-"
ABresult
1X1
011
000
5370 0 $init->add("/* \%$gvname force saving of Tie::Hash::NamedCapture */");
5371 0 ▶ if ($PERL514) {
Branch: 1 branch
BranchTrueFalseTotal
if ($PERL514) 0 0 0
5372 0 mark_package('Config', 1); # DynaLoader needs Config to set the EGV
5373 0 walk_syms('Config');
5374 0 svref_2object(\&{'Tie::Hash::NamedCapture::bootstrap'})->save;
5375 }
5376 0 mark_package('Tie::Hash::NamedCapture', 1);
5377 }
5378 }
5379 # skip static %Encode::Encoding since 5.20. GH #200. sv_upgrade cannot upgrade itself.
5380 # Let it be initialized by boot_Encode/Encode_XSEncodingm with exceptions.
5381 # GH #200 and t/testc.sh 75
5382 0 ▶ if ($] >= 5.020 and $fullname eq 'Encode::Encoding') {
Branch: 2 branches
BranchTrueFalseTotal
if ($] >= 5.02 and $fullname eq 'Encode::Encoding') { } 0 0 0
elsif ($fullname ne 'main::INC') { } 0 0 0
Condition0%0/3
$] >= "5.02" and $fullname eq "Encode::Encoding"
!ll&&!rl&&r
000
MC/DC0%0/2
$] >= "5.02" and $fullname eq "Encode::Encoding"
$] >= "5.02" $fullname eq "Encode::Encoding"
Truth table0%0/3
A and B
A= $] >= "5.02"B= $fullname eq "Encode::Encoding"
ABresult
0X0
100
111
5383 0 ▶ warn "skip some %Encode::Encoding - XS initialized\n" if $debug{gv};
Branch: 1 branch
BranchTrueFalseTotal
if $B::C::debug{"gv"} 0 0 0
5384 0 my %tmp_Encode_Encoding = %Encode::Encoding;
5385 0 %Encode::Encoding = (); # but we need some non-XS encoding keys
5386 0 for my $k (qw(utf8 utf-8-strict Unicode Internal Guess)) {
5387 0 ▶ $Encode::Encoding{$k} = $tmp_Encode_Encoding{$k} if exists $tmp_Encode_Encoding{$k};
Branch: 1 branch
BranchTrueFalseTotal
if exists $tmp_Encode_Encoding{$k} 0 0 0
5388 }
5389 0 $gvhv->save($fullname);
5390 0 $init->add( "/* deferred some XS enc pointers for \%Encode::Encoding */",
5391 sprintf("GvHV(%s) = s\\_%x;", $sym, $$gvhv ) );
5392 0 %Encode::Encoding = %tmp_Encode_Encoding;
5393 }
5394 # XXX TODO 49: crash at BEGIN { %warnings::Bits = ... }
5395 elsif ($fullname ne 'main::INC') {
5396 0 $gvhv->save($fullname);
5397 0 $init->add( sprintf( "GvHV(%s) = s\\_%x;", $sym, $$gvhv ) );
5398 }
5399 }
5400 }
5401 0 my $gvcv = $gv->CV;
5402 0 ▶ if ( !$$gvcv and $savefields & Save_CV ) {
Branch: 1 branch
BranchTrueFalseTotal
if (not $$gvcv and $savefields & 8) 0 0 0
Condition0%0/3
not $$gvcv and $savefields & 8
!ll&&!rl&&r
000
MC/DC0%0/2
not $$gvcv and $savefields & 8
not $$gvcv $savefields & 8
Truth table0%0/3
not(A) and B
A= not $$gvcvB= $savefields & 8
ABresult
0X0
100
111
5403 0 ▶ warn "Empty CV $fullname, AUTOLOAD and try again\n" if $debug{gv};
Branch: 1 branch
BranchTrueFalseTotal
if $B::C::debug{"gv"} 0 0 0
5404 41 ▶ no strict 'refs';
Subroutine BEGIN: called CC=1 SCAR=0.0
5405 # Fix test 31, catch unreferenced AUTOLOAD. The downside:
5406 # It stores the whole optree and all its children.
5407 # Similar with test 39: re::is_regexp
5408 0 svref_2object( \*{"$package\::AUTOLOAD"} )->save
5409 0 ▶ if $package and exists ${"$package\::"}{AUTOLOAD};
Branch: 1 branch
BranchTrueFalseTotal
if $package and exists do { "${package}::" }->{"AUTOLOAD"} 0 0 0
Condition0%0/3
$package and exists do { "${package}::" }->{"AUTOLOAD"}
!ll&&!rl&&r
000
MC/DC0%0/2
$package and exists do { "${package}::" }->{"AUTOLOAD"}
$package exists do { "${package}::" }->{"AUTOLOAD"}
Truth table0%0/3
A and B
A= $packageB= exists do { "${package}::" }->{"AUTOLOAD"}
ABresult
0X0
100
111
5410 0 svref_2object( \*{"$package\::CLONE"} )->save
5411 0 ▶ if $package and exists ${"$package\::"}{CLONE};
Branch: 1 branch
BranchTrueFalseTotal
if $package and exists do { "${package}::" }->{"CLONE"} 0 0 0
Condition0%0/3
$package and exists do { "${package}::" }->{"CLONE"}
!ll&&!rl&&r
000
MC/DC0%0/2
$package and exists do { "${package}::" }->{"CLONE"}
$package exists do { "${package}::" }->{"CLONE"}
Truth table0%0/3
A and B
A= $packageB= exists do { "${package}::" }->{"CLONE"}
ABresult
0X0
100
111
5412 0 $gvcv = $gv->CV; # try again
5413 }
5414 # This will autovivify the CvGV of a named CV
5415 0 ▶ if ( $$gvcv and $savefields & Save_CV
Branch: 1 branch
BranchTrueFalseTotal
if ($$gvcv and $savefields & 8 and ref $gvcv eq "B::CV" and ref $gvcv->GV->EGV ne "B::SPECIAL" and not skip_pkg($package)) 0 0 0
Condition0%0/12
$$gvcv and $savefields & 8 and ref $gvcv eq "B::CV" and ref $gvcv->GV->EGV ne "B::SPECIAL" and not skip_pkg($package)
!ll&&!rl&&r
000
$$gvcv and $savefields & 8 and ref $gvcv eq "B::CV" and ref $gvcv->GV->EGV ne "B::SPECIAL"
!ll&&!rl&&r
000
$$gvcv and $savefields & 8 and ref $gvcv eq "B::CV"
!ll&&!rl&&r
000
$$gvcv and $savefields & 8
!ll&&!rl&&r
000
MC/DC0%0/5
$$gvcv and $savefields & 8 and ref $gvcv eq "B::CV" and ref $gvcv->GV->EGV ne "B::SPECIAL" and not skip_pkg($package)
$$gvcv $savefields & 8 ref $gvcv eq "B::CV" ref $gvcv->GV->EGV ne "B::SPECIAL" not skip_pkg($package)
Truth table0%0/6
A and B and C and D and not(E)
A= $$gvcvB= $savefields & 8C= ref $gvcv eq "B::CV"D= ref $gvcv->GV->EGV ne "B::SPECIAL"E= not skip_pkg($package)
ABCDEresult
0XXXX0
10XXX0
110XX0
1110X0
111100
111111
5416 and ref($gvcv) eq 'B::CV'
5417 #and !is_named($gvcv)
5418 and ref($gvcv->GV->EGV) ne 'B::SPECIAL'
5419 and !skip_pkg($package) )
5420 {
5421 0 my $package = $gvcv->GV->EGV->STASH->NAME;
5422 0 my $oname = $gvcv->GV->EGV->NAME;
5423 0 my $origname = $package . "::" . $oname;
5424 0 my $cvsym;
5425 0 ▶ if ( $gvcv->XSUB and $oname ne '__ANON__' and $fullname ne $origname ) { #XSUB CONSTSUB alias
Branch: 2 branches
BranchTrueFalseTotal
if ($gvcv->XSUB and $oname ne '__ANON__' and $fullname ne $origname) { } 0 0 0
elsif (not $PERL510 or $gp) { } 0 0 0
Condition0%0/6
$gvcv->XSUB and $oname ne "__ANON__" and $fullname ne $origname
!ll&&!rl&&r
000
$gvcv->XSUB and $oname ne "__ANON__"
!ll&&!rl&&r
000
MC/DC0%0/3
$gvcv->XSUB and $oname ne "__ANON__" and $fullname ne $origname
$gvcv->XSUB $oname ne "__ANON__" $fullname ne $origname
Truth table0%0/4
A and B and C
A= $gvcv->XSUBB= $oname ne "__ANON__"C= $fullname ne $origname
ABCresult
0XX0
10X0
1100
1111
5426 warn "Boot $package, XS CONSTSUB alias of $fullname to $origname\n"
5427 0 ▶ if $debug{pkg};
Branch: 1 branch
BranchTrueFalseTotal
if $B::C::debug{"pkg"} 0 0 0
5428 0 mark_package($package, 1);
5429 {
5430 0 ▶ no strict 'refs';
Subroutine BEGIN: called CC=1 SCAR=0.2
5431 0 svref_2object( \&{"$package\::bootstrap"} )->save
5432 0 ▶ if $package and defined &{"$package\::bootstrap"};
Branch: 1 branch
BranchTrueFalseTotal
if $package and defined &{"${package}::bootstrap";} 0 0 0
Condition0%0/3
$package and defined &{"${package}::bootstrap";}
!ll&&!rl&&r
000
MC/DC0%0/2
$package and defined &{"${package}::bootstrap";}
$package defined &{"${package}::bootstrap";}
Truth table0%0/3
A and B
A= $packageB= defined &{"${package}::bootstrap";}
ABresult
0X0
100
111
5433 }
5434 # XXX issue 57: incomplete xs dependency detection
5435 0 my %hack_xs_detect =
5436 ('Scalar::Util' => 'List::Util',
5437 'Sub::Exporter' => 'Params::Util',
5438 );
5439 0 ▶ if (my $dep = $hack_xs_detect{$package}) {
Branch: 1 branch
BranchTrueFalseTotal
if (my $dep = $hack_xs_detect{$package}) 0 0 0
5440 0 svref_2object( \&{"$dep\::bootstrap"} )->save;
5441 }
5442 # must save as a 'stub' so newXS() has a CV to populate
5443 0 ▶ warn "save stub CvGV for $sym GP assignments $origname\n" if $debug{gv};
Branch: 1 branch
BranchTrueFalseTotal
if $B::C::debug{"gv"} 0 0 0
5444 0 $init2->add(
5445 sprintf("if ((sv = (SV*)%s))", get_cv($origname, "GV_ADD")),
5446 sprintf(" GvCV_set(%s, (CV*)SvREFCNT_inc_simple_NN(sv));", $sym));
5447 # TODO: add evtl. to SvRV also.
5448 }
5449 ▶ elsif (!$PERL510 or $gp) {
Condition0%0/3
not $PERL510 or $gp
l!l&&r!l&&!r
000
MC/DC0%0/2
not $PERL510 or $gp
not $PERL510 $gp
Truth table0%0/3
not(A) or B
A= not $PERL510B= $gp
ABresult
1X1
011
000
5450 0 ▶ if ($fullname eq 'Internals::V') { # local_patches if $] >= 5.011
Branch: 1 branch
BranchTrueFalseTotal
if ($fullname eq "Internals::V") 0 0 0
5451 0 $gvcv = svref_2object( \&__ANON__::_V );
5452 }
5453 # TODO: may need fix CvGEN if >0 to re-validate the CV methods
5454 # on PERL510 (>0 + <subgeneration)
5455 0 ▶ warn "GV::save &$fullname...\n" if $debug{gv};
Branch: 1 branch
BranchTrueFalseTotal
if $B::C::debug{"gv"} 0 0 0
5456 0 $cvsym = $gvcv->save($fullname);
5457 # backpatch "$sym = gv_fetchpv($name, GV_ADD, SVt_PV)" to SVt_PVCV
5458 0 ▶ if ($cvsym =~ /get_cv/) {
Branch: 2 branches
BranchTrueFalseTotal
if ($cvsym =~ /get_cv/) { } 0 0 0
elsif ($cvsym =~ /^(cv|&sv_list)/) { } 0 0 0
5459 0 ▶ if (!$xsub{$package} and in_static_core($package, $gvname)) {
Branch: 2 branches
BranchTrueFalseTotal
if (not $xsub{$package} and in_static_core($package, $gvname)) { } 0 0 0
elsif ($xsub{$package}) { } 0 0 0
Condition0%0/3
not $xsub{$package} and in_static_core($package, $gvname)
!ll&&!rl&&r
000
MC/DC0%0/2
not $xsub{$package} and in_static_core($package, $gvname)
not $xsub{$package} in_static_core($package, $gvname)
Truth table0%0/3
not(A) and B
A= not $xsub{$package}B= in_static_core($package, $gvname)
ABresult
0X0
100
111
5460 0 my $in_gv;
5461 0 for (@{ $init->[-1]{current} }) {
5462 0 ▶ if ($in_gv) {
Branch: 1 branch
BranchTrueFalseTotal
if ($in_gv) 0 0 0
5463 0 s/^.*\Q$sym\E.*=.*;//;
5464 0 s/GvGP_set\(\Q$sym\E.*;//;
5465 }
5466 0 my $gv_get = gv_fetchpvn($name, "GV_ADD", "SVt_PV");
5467 0 my $new_gv_get = gv_fetchpvn($name, "GV_ADD", "SVt_PVCV");
5468 0 ▶ if (/^\Q$sym = $gv_get;\E/) {
Branch: 1 branch
BranchTrueFalseTotal
if (/^\Q$sym = $gv_get;\E/) 0 0 0
5469 0 s/^\Q$sym = $gv_get;\E/$sym = $new_gv_get;/;
5470 0 $in_gv++;
5471 0 ▶ warn "removed $sym GP assignments $origname (core CV)\n" if $debug{gv};
Branch: 1 branch
BranchTrueFalseTotal
if $B::C::debug{"gv"} 0 0 0
5472 }
5473 }
5474 0 $init->add( sprintf( "GvCV_set(%s, (CV*)SvREFCNT_inc(%s));", $sym, $cvsym ));
5475 }
5476 elsif ($xsub{$package}) {
5477 # must save as a 'stub' so newXS() has a CV to populate later in dl_init()
5478 0 ▶ warn "save stub CvGV for $sym GP assignments $origname (XS CV)\n" if $debug{gv};
Branch: 1 branch
BranchTrueFalseTotal
if $B::C::debug{"gv"} 0 0 0
5479 0 ▶ my $get_cv = get_cv($oname ne "__ANON__" ? $origname : $fullname, "GV_ADD");
Branch: 1 branch
BranchTrueFalseTotal
$oname ne '__ANON__' ? : 0 0 0
5480 0 $init2->add(sprintf("if ((sv = (SV*)%s))", $get_cv),
5481 sprintf(" GvCV_set(%s, (CV*)SvREFCNT_inc_simple_NN(sv));", $sym));
5482 }
5483 else {
5484 0 $init->add( sprintf( "GvCV_set(%s, (CV*)(%s));", $sym, $cvsym ));
5485 }
5486 0 ▶ if ($gvcv->XSUBANY) {
Branch: 1 branch
BranchTrueFalseTotal
if ($gvcv->XSUBANY) 0 0 0
5487 # some XSUB's set this field. but which part?
5488 0 my $xsubany = $gvcv->XSUBANY;
5489 0 ▶ if ($package =~ /^DBI::(common|db|dr|st)/) {
Branch: 2 branches
BranchTrueFalseTotal
if ($package =~ /^DBI::(common|db|dr|st)/) { } 0 0 0
elsif ($package eq 'Tie::Hash::NamedCapture') { } 0 0 0
5490 # DBI uses the any_ptr for dbi_ima_t *ima, and all dr,st,db,fd,xx handles
5491 # for which several ptrs need to be patched. #359
5492 # the ima is internal only
5493 0 my $dr = $1;
5494 warn sprintf("eval_pv: DBI->_install_method(%s-) (XSUBANY=0x%x)\n",
5495 0 ▶ $fullname, $xsubany) if $verbose and $debug{cv};
Branch: 1 branch
BranchTrueFalseTotal
if $B::C::verbose and $B::C::debug{"cv"} 0 0 0
Condition0%0/3
$B::C::verbose and $B::C::debug{"cv"}
!ll&&!rl&&r
000
MC/DC0%0/2
$B::C::verbose and $B::C::debug{"cv"}
$B::C::verbose $B::C::debug{"cv"}
Truth table0%0/3
A and B
A= $B::C::verboseB= $B::C::debug{"cv"}
ABresult
0X0
100
111
5496 0 $init2->add_eval(sprintf("DBI->_install_method('%s', 'DBI.pm', \$DBI::DBI_methods{%s}{%s})",
5497 $fullname, $dr, $fullname));
5498 } elsif ($package eq 'Tie::Hash::NamedCapture') {
5499 # pretty high _ALIAS CvXSUBANY.any_i32 values
5500 } else {
5501 # try if it points to an already registered symbol
5502 0 my $anyptr = $symtable{ sprintf( "s\\_%x", $xsubany ) };
5503 0 ▶ if ($anyptr and $xsubany > 1000) { # not a XsubAliases
Branch: 3 branches
BranchTrueFalseTotal
if ($anyptr and $xsubany > 1000) { } 0 0 0
elsif ($xsubany > 1048576 and $xsubany < 4294967040 || $xsubany > 4294967295) { } 0 0 0
elsif ($package eq 'Fcntl') { } 0 0 0
Condition0%0/3
$anyptr and $xsubany > 1000
!ll&&!rl&&r
000
MC/DC0%0/2
$anyptr and $xsubany > 1000
$anyptr $xsubany > 1000
Truth table0%0/3
A and B
A= $anyptrB= $xsubany > 1000
ABresult
0X0
100
111
5504 0 $init2->add( sprintf( "CvXSUBANY(GvCV(%s)).any_ptr = &%s;", $sym, $anyptr ));
5505 } # some heuristics TODO. long or ptr? TODO 32bit
5506 ▶ elsif ($xsubany > 0x100000
Condition0%0/6
$xsubany > 1048576 and $xsubany < 4294967040 || $xsubany > 4294967295
!ll&&!rl&&r
000
$xsubany < 4294967040 or $xsubany > 4294967295
l!l&&r!l&&!r
000
MC/DC0%0/3
$xsubany > 1048576 and $xsubany < 4294967040 || $xsubany > 4294967295
$xsubany > 1048576 $xsubany < 4294967040 $xsubany > 4294967295
Truth table0%0/4
A and B or C
A= $xsubany > 1048576B= $xsubany < 4294967040C= $xsubany > 4294967295
ABCresult
0XX0
1000
11X1
1011
5507 and ($xsubany < 0xffffff00 or $xsubany > 0xffffffff))
5508 {
5509 0 ▶ if ($package eq 'POSIX' and $gvname =~ /^is/) {
Branch: 2 branches
BranchTrueFalseTotal
if ($package eq 'POSIX' and $gvname =~ /^is/) { } 0 0 0
elsif ($package eq 'List::MoreUtils' and $gvname =~ /_iterator$/) { } 0 0 0
Condition0%0/3
$package eq "POSIX" and $gvname =~ /^is/
!ll&&!rl&&r
000
MC/DC0%0/2
$package eq "POSIX" and $gvname =~ /^is/
$package eq "POSIX" $gvname =~ /^is/
Truth table0%0/3
A and B
A= $package eq "POSIX"B= $gvname =~ /^is/
ABresult
0X0
100
111
5510 # need valid XSANY.any_dptr
5511 0 $init2->add( sprintf( "CvXSUBANY(GvCV(%s)).any_dptr = (void*)&%s;", $sym, $gvname));
5512 ▶ } elsif ($package eq 'List::MoreUtils' and $gvname =~ /_iterator$/) {
Condition0%0/3
$package eq "List::MoreUtils" and $gvname =~ /_iterator$/
!ll&&!rl&&r
000
MC/DC0%0/2
$package eq "List::MoreUtils" and $gvname =~ /_iterator$/
$package eq "List::MoreUtils" $gvname =~ /_iterator$/
Truth table0%0/3
A and B
A= $package eq "List::MoreUtils"B= $gvname =~ /_iterator$/
ABresult
0X0
100
111
5513 # should be only the 2 iterators
5514 0 $init2->add( sprintf( "CvXSUBANY(GvCV(%s)).any_ptr = (void*)&%s;", $sym,
5515 "XS_List__MoreUtils__".$gvname));
5516 } else {
5517 0 ▶ warn sprintf("TODO: Skipping %s->XSUBANY = 0x%x\n", $fullname, $xsubany ) if $verbose;
Branch: 1 branch
BranchTrueFalseTotal
if $B::C::verbose 0 0 0
5518 0 $init2->add( sprintf( "/* TODO CvXSUBANY(GvCV(%s)).any_ptr = 0x%lx; */", $sym, $xsubany ));
5519 }
5520 } elsif ($package eq 'Fcntl') {
5521 # S_ macro values
5522 } else {
5523 # most likely any_i32 values for the XsubAliases provided by xsubpp
5524 0 $init2->add( sprintf( "/* CvXSUBANY(GvCV(%s)).any_i32 = 0x%x; XSUB Alias */", $sym, $xsubany ));
5525 }
5526 }
5527 }
5528 }
5529 elsif ($cvsym =~ /^(cv|&sv_list)/) {
5530 0 $init->add( sprintf( "GvCV_set(%s, (CV*)(%s));", $sym, $cvsym ));
5531 }
5532 else {
5533 0 ▶ warn "wrong CvGV for $sym $origname: $cvsym\n" if $debug{gv} or $verbose;
Branch: 1 branch
BranchTrueFalseTotal
if $B::C::debug{"gv"} or $B::C::verbose 0 0 0
Condition0%0/3
$B::C::debug{"gv"} or $B::C::verbose
l!l&&r!l&&!r
000
MC/DC0%0/2
$B::C::debug{"gv"} or $B::C::verbose
$B::C::debug{"gv"} $B::C::verbose
Truth table0%0/3
A or B
A= $B::C::debug{"gv"}B= $B::C::verbose
ABresult
1X1
011
000
5534 }
5535 }
5536 # special handling for backref magic
5537 0 ▶ if ($PERL514 and $cvsym and $cvsym !~ /(get_cv|NULL|lexwarn)/ and $gv->MAGICAL) {
Branch: 1 branch
BranchTrueFalseTotal
if ($PERL514 and $cvsym and not $cvsym =~ /(get_cv|NULL|lexwarn)/ and $gv->MAGICAL) 0 0 0
Condition0%0/9
$PERL514 and $cvsym and not $cvsym =~ /(get_cv|NULL|lexwarn)/ and $gv->MAGICAL
!ll&&!rl&&r
000
$PERL514 and $cvsym and not $cvsym =~ /(get_cv|NULL|lexwarn)/
!ll&&!rl&&r
000
$PERL514 and $cvsym
!ll&&!rl&&r
000
MC/DC0%0/4
$PERL514 and $cvsym and not $cvsym =~ /(get_cv|NULL|lexwarn)/ and $gv->MAGICAL
$PERL514 $cvsym not $cvsym =~ /(get_cv|NULL|lexwarn)/ $gv->MAGICAL
Truth table0%0/5
A and B and not(C) and D
A= $PERL514B= $cvsymC= not $cvsym =~ /(get_cv|NULL|lexwarn)/D= $gv->MAGICAL
ABCDresult
0XXX0
10XX0
110X0
11100
11111
5538 0 my @magic = $gv->MAGIC;
5539 0 foreach my $mg (@magic) {
5540 0 ▶ if ($mg->TYPE eq '<') {
Branch: 1 branch
BranchTrueFalseTotal
if ($mg->TYPE eq "<") 0 0 0
5541 0 $init->add( "sv_magic((SV*)$sym, (SV*)$cvsym, '<', 0, 0);",
5542 "CvCVGV_RC_off($cvsym);");
5543 0 ▶ if (!($mg->FLAGS & 2)) {
Branch: 1 branch
BranchTrueFalseTotal
unless ($mg->FLAGS & 2) 0 0 0
5544 0 mg_RC_off($mg, $sym, '<'); # 390
5545 }
5546 }
5547 }
5548 }
5549 }
5550 0 ▶ if (!$PERL510 or $gp) {
Branch: 1 branch
BranchTrueFalseTotal
if (not $PERL510 or $gp) 0 0 0
Condition0%0/3
not $PERL510 or $gp
l!l&&r!l&&!r
000
MC/DC0%0/2
not $PERL510 or $gp
not $PERL510 $gp
Truth table0%0/3
not(A) or B
A= not $PERL510B= $gp
ABresult
1X1
011
000
5551 0 ▶ if ( $] > 5.009 ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($] > 5.009) { } 0 0 0
5552 # TODO implement heksect to place all heks at the beginning
5553 #$heksect->add($gv->FILE);
5554 #$init->add(sprintf("GvFILE_HEK($sym) = hek_list[%d];", $heksect->index));
5555  
5556 # XXX Maybe better leave it NULL or asis, than fighting broken
5557 0 ▶ if ($B::C::stash and $fullname =~ /::$/) {
Branch: 1 branch
BranchTrueFalseTotal
if ($B::C::stash and $fullname =~ /::$/) { } 0 0 0
Condition0%0/3
$B::C::stash and $fullname =~ /::$/
!ll&&!rl&&r
000
MC/DC0%0/2
$B::C::stash and $fullname =~ /::$/
$B::C::stash $fullname =~ /::$/
Truth table0%0/3
A and B
A= $B::C::stashB= $fullname =~ /::$/
ABresult
0X0
100
111
5558 # ignore stash hek asserts when adding the stash
5559 # he->shared_he_he.hent_hek == hek assertions (#46 with IO::Poll::)
5560 } else {
5561 0 my $file = save_hek($gv->FILE,$fullname,1);
5562 0 ▶ $init->add(sprintf("GvFILE_HEK(%s) = %s;", $sym, $file))
Branch: 1 branch
BranchTrueFalseTotal
if $file ne "NULL" and not $B::C::optimize_cop 0 0 0
Condition0%0/3
$file ne "NULL" and not $B::C::optimize_cop
!ll&&!rl&&r
000
MC/DC0%0/2
$file ne "NULL" and not $B::C::optimize_cop
$file ne "NULL" not $B::C::optimize_cop
Truth table0%0/3
A and not(B)
A= $file ne "NULL"B= not $B::C::optimize_cop
ABresult
0X0
100
111
5563 if $file ne 'NULL' and !$optimize_cop;
5564 }
5565 # $init->add(sprintf("GvNAME_HEK($sym) = %s;", save_hek($gv->NAME))) if $gv->NAME;
5566 } else {
5567 # XXX ifdef USE_ITHREADS and PL_curcop->op_flags & OPf_COP_TEMP
5568 # GvFILE is at gp+1
5569 0 ▶ $init->add( sprintf( "GvFILE(%s) = %s;", $sym, cstring( $gv->FILE ) ))
Branch: 1 branch
BranchTrueFalseTotal
unless $B::C::optimize_cop 0 0 0
5570 unless $optimize_cop;
5571 warn "GV::save GvFILE(*$fullname) " . cstring( $gv->FILE ) . "\n"
5572 0 ▶ if $debug{gv} and !$ITHREADS;
Branch: 1 branch
BranchTrueFalseTotal
if $B::C::debug{"gv"} and not $ITHREADS 0 0 0
Condition0%0/3
$B::C::debug{"gv"} and not $ITHREADS
!ll&&!rl&&r
000
MC/DC0%0/2
$B::C::debug{"gv"} and not $ITHREADS
$B::C::debug{"gv"} not $ITHREADS
Truth table0%0/3
A and not(B)
A= $B::C::debug{"gv"}B= not $ITHREADS
ABresult
0X0
100
111
5573 }
5574 0 my $gvform = $gv->FORM;
5575 0 ▶ if ( $$gvform && $savefields & Save_FORM ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($$gvform and $savefields & 16) 0 0 0
Condition0%0/3
$$gvform and $savefields & 16
!ll&&!rl&&r
000
MC/DC0%0/2
$$gvform and $savefields & 16
$$gvform $savefields & 16
Truth table0%0/3
A and B
A= $$gvformB= $savefields & 16
ABresult
0X0
100
111
5576 0 ▶ warn "GV::save GvFORM(*$fullname) ...\n" if $debug{gv};
Branch: 1 branch
BranchTrueFalseTotal
if $B::C::debug{"gv"} 0 0 0
5577 0 $gvform->save($fullname);
5578 0 $init->add( sprintf( "GvFORM(%s) = (CV*)s\\_%x;", $sym, $$gvform ));
5579 # glob_assign_glob analog to CV
5580 0 ▶ $init->add( sprintf( "SvREFCNT_inc(s\\_%x);", $$gvform )) if $PERL510;
Branch: 1 branch
BranchTrueFalseTotal
if $PERL510 0 0 0
5581 0 ▶ warn "GV::save GvFORM(*$fullname) done\n" if $debug{gv};
Branch: 1 branch
BranchTrueFalseTotal
if $B::C::debug{"gv"} 0 0 0
5582 }
5583 0 my $gvio = $gv->IO;
5584 0 ▶ if ( $$gvio && $savefields & Save_IO ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($$gvio and $savefields & 32) 0 0 0
Condition0%0/3
$$gvio and $savefields & 32
!ll&&!rl&&r
000
MC/DC0%0/2
$$gvio and $savefields & 32
$$gvio $savefields & 32
Truth table0%0/3
A and B
A= $$gvioB= $savefields & 32
ABresult
0X0
100
111
5585 0 ▶ warn "GV::save GvIO(*$fullname)...\n" if $debug{gv};
Branch: 1 branch
BranchTrueFalseTotal
if $B::C::debug{"gv"} 0 0 0
5586 0 ▶ if ( $fullname =~ m/::DATA$/ &&
Branch: 2 branches
BranchTrueFalseTotal
if ($fullname =~ /::DATA$/ and $fullname eq 'main::DATA' || $B::C::save_data_fh) { } 0 0 0
elsif ($fullname =~ /::DATA$/ and not $B::C::save_data_fh) { } 0 0 0
Condition0%0/6
$fullname =~ /::DATA$/ and $fullname eq "main::DATA" || $B::C::save_data_fh
!ll&&!rl&&r
000
$fullname eq "main::DATA" or $B::C::save_data_fh
l!l&&r!l&&!r
000
MC/DC0%0/3
$fullname =~ /::DATA$/ and $fullname eq "main::DATA" || $B::C::save_data_fh
$fullname =~ /::DATA$/ $fullname eq "main::DATA" $B::C::save_data_fh
Truth table0%0/4
A and B or C
A= $fullname =~ /::DATA$/B= $fullname eq "main::DATA"C= $B::C::save_data_fh
ABCresult
0XX0
1000
11X1
1011
5587 ( $fullname eq 'main::DATA' or $B::C::save_data_fh) ) # -O2 or 5.8
5588 {
5589 41 ▶ no strict 'refs';
Subroutine BEGIN: called CC=1 SCAR=0.0
5590 0 my $fh = *{$fullname}{IO};
5591 41 ▶ use strict 'refs';
Subroutine BEGIN: called CC=1 SCAR=0.0
5592 0 ▶ warn "GV::save_data $sym, $fullname ...\n" if $debug{gv};
Branch: 1 branch
BranchTrueFalseTotal
if $B::C::debug{"gv"} 0 0 0
5593 0 $gvio->save($fullname, 'is_DATA');
5594 0 $init->add( sprintf( "GvIOp(%s) = s\\_%x;", $sym, $$gvio ) );
5595 0 ▶ $gvio->save_data( $sym, $fullname, <$fh> ) if $fh->opened;
Branch: 1 branch
BranchTrueFalseTotal
if $fh->opened 0 0 0
5596 ▶ } elsif ( $fullname =~ m/::DATA$/ && !$B::C::save_data_fh ) {
Condition0%0/3
$fullname =~ /::DATA$/ and not $B::C::save_data_fh
!ll&&!rl&&r
000
MC/DC0%0/2
$fullname =~ /::DATA$/ and not $B::C::save_data_fh
$fullname =~ /::DATA$/ not $B::C::save_data_fh
Truth table0%0/3
A and not(B)
A= $fullname =~ /::DATA$/B= not $B::C::save_data_fh
ABresult
0X0
100
111
5597 0 $gvio->save($fullname, 'is_DATA');
5598 0 $init->add( sprintf( "GvIOp(%s) = s\\_%x;", $sym, $$gvio ) );
5599 0 warn "Warning: __DATA__ handle $fullname not stored. Need -O2 or -fsave-data.\n";
5600 } else {
5601 0 $gvio->save($fullname);
5602 0 $init->add( sprintf( "GvIOp(%s) = s\\_%x;", $sym, $$gvio ) );
5603 }
5604 0 ▶ warn "GV::save GvIO(*$fullname) done\n" if $debug{gv};
Branch: 1 branch
BranchTrueFalseTotal
if $B::C::debug{"gv"} 0 0 0
5605 }
5606 0 $init->add("");
5607 }
5608 }
5609 # Shouldn't need to do save_magic since gv_fetchpv handles that. Esp. < and IO not
5610 # $gv->save_magic($fullname) if $PERL510;
5611 0 ▶ warn "GV::save *$fullname done\n" if $debug{gv};
Branch: 1 branch
BranchTrueFalseTotal
if $B::C::debug{"gv"} 0 0 0
5612 0 return $sym;
5613 }
5614  
5615 0 ▶sub B::AV::save {
Subroutine save: not called CC=127 SCAR=97.0
5616 0 my ($av, $fullname, $cv) = @_;
5617 0 my $sym = objsym($av);
5618 0 ▶ return $sym if defined $sym;
Branch: 1 branch
BranchTrueFalseTotal
if defined $sym 0 0 0
5619  
5620 0 ▶ $fullname = '' unless $fullname;
Branch: 1 branch
BranchTrueFalseTotal
unless $fullname 0 0 0
5621 0 my ($fill, $avreal, $max, $static_av, $av_cow, $av_cog);
5622 0 my $ispadlist = ref($av) eq 'B::PADLIST';
5623 0 my $ispadnamelist = ref($av) eq 'B::PADNAMELIST';
5624 0 ▶ if ($ispadnamelist or $ispadlist) {
Branch: 1 branch
BranchTrueFalseTotal
if ($ispadnamelist or $ispadlist) { } 0 0 0
Condition0%0/3
$ispadnamelist or $ispadlist
l!l&&r!l&&!r
000
MC/DC0%0/2
$ispadnamelist or $ispadlist
$ispadnamelist $ispadlist
Truth table0%0/3
A or B
A= $ispadnamelistB= $ispadlist
ABresult
1X1
011
000
5625 0 $fill = $av->MAX;
5626 } else {
5627 # cornercase: tied array without FETCHSIZE
5628 0 eval { $fill = $av->FILL; };
5629 0 ▶ $fill = -1 if $@; # catch error in tie magic
Branch: 1 branch
BranchTrueFalseTotal
if $@ 0 0 0
5630 }
5631 0 $max = $fill;
5632 0 ▶ my $svpcast = $ispadlist ? "(PAD*)" : "(SV*)";
Branch: 1 branch
BranchTrueFalseTotal
$ispadlist ? : 0 0 0
5633 0 ▶ $svpcast = "(PADNAME*)" if $ispadnamelist;
Branch: 1 branch
BranchTrueFalseTotal
if $ispadnamelist 0 0 0
5634  
5635 0 ▶ if ($PERL522 and $ispadnamelist) {
Branch: 7 branches
BranchTrueFalseTotal
if ($PERL522 and $ispadnamelist) { } 0 0 0
elsif ($ispadlist and $] >= 5.021008) { } 0 0 0
elsif ($ispadlist and $] >= 5.017006 and $] < 5.021008) { } 0 0 0
elsif ($ispadlist and $] >= 5.017004) { } 0 0 0
elsif ($CPERL52 and $B::C::av_init and $fill > -1 and &isAvSTATIC($av) || canAvSTATIC($av, $fullname)) { } 0 0 0
elsif ($PERL514) { } 0 0 0
elsif ($PERL510) { } 0 0 0
Condition0%0/3
$PERL522 and $ispadnamelist
!ll&&!rl&&r
000
MC/DC0%0/2
$PERL522 and $ispadnamelist
$PERL522 $ispadnamelist
Truth table0%0/3
A and B
A= $PERL522B= $ispadnamelist
ABresult
0X0
100
111
5636 0 $padnlsect->comment("xpadnl_fill, xpadnl_alloc, xpadnl_max, xpadnl_max_named, xpadnl_refcnt");
5637 # TODO: max_named walk all names and look for non-empty names
5638 0 my $refcnt = $av->REFCNT + 1; # XXX defer free to global destruction: 28
5639 0 my $maxnamed = $av->MAXNAMED;
5640 0 $padnlsect->add("$fill, NULL, $fill, $maxnamed, $refcnt /* +1 */");
5641 0 $padnl_index = $padnlsect->index;
5642 0 $sym = savesym( $av, "&padnamelist_list[$padnl_index]" );
5643 0 push @B::C::static_free, $sym;
5644 }
5645 ▶ elsif ($ispadlist and $] >= 5.021008) { # id+outid as U32 (PL_padlist_generation++)
Condition0%0/3
$ispadlist and $] >= "5.021008"
!ll&&!rl&&r
000
MC/DC0%0/2
$ispadlist and $] >= "5.021008"
$ispadlist $] >= "5.021008"
Truth table0%0/3
A and B
A= $ispadlistB= $] >= "5.021008"
ABresult
0X0
100
111
5646 0 $padlistsect->comment("xpadl_max, xpadl_alloc, xpadl_id, xpadl_outid");
5647 0 my ($id, $outid) = ($av->id, $av->outid);
5648 0 $padlistsect->add("$fill, NULL, $id, $outid");
5649 0 $padlist_index = $padlistsect->index;
5650 0 $sym = savesym( $av, "&padlist_list[$padlist_index]" );
5651 }
5652 ▶ elsif ($ispadlist and $] >= 5.017006 and $] < 5.021008) { # id added again with b4db586814
Condition0%0/6
$ispadlist and $] >= "5.017006" and $] < "5.021008"
!ll&&!rl&&r
000
$ispadlist and $] >= "5.017006"
!ll&&!rl&&r
000
MC/DC0%0/3
$ispadlist and $] >= "5.017006" and $] < "5.021008"
$ispadlist $] >= "5.017006" $] < "5.021008"
Truth table0%0/4
A and B and C
A= $ispadlistB= $] >= "5.017006"C= $] < "5.021008"
ABCresult
0XX0
10X0
1100
1111
5653 0 $padlistsect->comment("xpadl_max, xpadl_alloc, xpadl_outid");
5654 0 $padlistsect->add("$fill, NULL, NULL"); # Perl_pad_new(0)
5655 0 $padlist_index = $padlistsect->index;
5656 0 $sym = savesym( $av, "&padlist_list[$padlist_index]" );
5657 0 ▶ if ($cv and $cv->OUTSIDE and ref($cv->OUTSIDE) ne 'B::SPECIAL' and $cv->OUTSIDE->PADLIST) {
Branch: 1 branch
BranchTrueFalseTotal
if ($cv and $cv->OUTSIDE and ref $cv->OUTSIDE ne "B::SPECIAL" and $cv->OUTSIDE->PADLIST) 0 0 0
Condition0%0/9
$cv and $cv->OUTSIDE and ref $cv->OUTSIDE ne "B::SPECIAL" and $cv->OUTSIDE->PADLIST
!ll&&!rl&&r
000
$cv and $cv->OUTSIDE and ref $cv->OUTSIDE ne "B::SPECIAL"
!ll&&!rl&&r
000
$cv and $cv->OUTSIDE
!ll&&!rl&&r
000
MC/DC0%0/4
$cv and $cv->OUTSIDE and ref $cv->OUTSIDE ne "B::SPECIAL" and $cv->OUTSIDE->PADLIST
$cv $cv->OUTSIDE ref $cv->OUTSIDE ne "B::SPECIAL" $cv->OUTSIDE->PADLIST
Truth table0%0/5
A and B and C and D
A= $cvB= $cv->OUTSIDEC= ref $cv->OUTSIDE ne "B::SPECIAL"D= $cv->OUTSIDE->PADLIST
ABCDresult
0XXX0
10XX0
110X0
11100
11111
5658 0 my $outid = $cv->OUTSIDE->PADLIST->save();
5659 0 ▶ $init->add("($sym)->xpadl_outid = (PADNAMELIST*)$outid;") if $outid;
Branch: 1 branch
BranchTrueFalseTotal
if $outid 0 0 0
5660 }
5661 }
5662 ▶ elsif ($ispadlist and $] >= 5.017004) {
Condition0%0/3
$ispadlist and $] >= "5.017004"
!ll&&!rl&&r
000
MC/DC0%0/2
$ispadlist and $] >= "5.017004"
$ispadlist $] >= "5.017004"
Truth table0%0/3
A and B
A= $ispadlistB= $] >= "5.017004"
ABresult
0X0
100
111
5663 0 $padlistsect->comment("xpadl_max, xpadl_alloc, xpadl_id, xpadl_outid");
5664 0 $padlistsect->add("$fill, NULL, 0, 0"); # Perl_pad_new(0)
5665 0 $padlist_index = $padlistsect->index;
5666 0 $sym = savesym( $av, "&padlist_list[$padlist_index]" );
5667 0 ▶ if ($cv and $cv->OUTSIDE and ref($cv->OUTSIDE) ne 'B::SPECIAL' and $cv->OUTSIDE->PADLIST) {
Branch: 1 branch
BranchTrueFalseTotal
if ($cv and $cv->OUTSIDE and ref $cv->OUTSIDE ne "B::SPECIAL" and $cv->OUTSIDE->PADLIST) 0 0 0
Condition0%0/9
$cv and $cv->OUTSIDE and ref $cv->OUTSIDE ne "B::SPECIAL" and $cv->OUTSIDE->PADLIST
!ll&&!rl&&r
000
$cv and $cv->OUTSIDE and ref $cv->OUTSIDE ne "B::SPECIAL"
!ll&&!rl&&r
000
$cv and $cv->OUTSIDE
!ll&&!rl&&r
000
MC/DC0%0/4
$cv and $cv->OUTSIDE and ref $cv->OUTSIDE ne "B::SPECIAL" and $cv->OUTSIDE->PADLIST
$cv $cv->OUTSIDE ref $cv->OUTSIDE ne "B::SPECIAL" $cv->OUTSIDE->PADLIST
Truth table0%0/5
A and B and C and D
A= $cvB= $cv->OUTSIDEC= ref $cv->OUTSIDE ne "B::SPECIAL"D= $cv->OUTSIDE->PADLIST
ABCDresult
0XXX0
10XX0
110X0
11100
11111
5668 0 my $outid = $cv->OUTSIDE->PADLIST->save();
5669 0 ▶ $init->add("($sym)->xpadl_outid = (PADNAMELIST*)$outid;") if $outid;
Branch: 1 branch
BranchTrueFalseTotal
if $outid 0 0 0
5670 }
5671 }
5672 # we set it static, not perl. (c)perl only observes it.
5673 # decide if to store the array static (with run-time cow overhead) or dynamic
5674 ▶ elsif ($CPERL52 and $B::C::av_init and $fill > -1
Condition0%0/12
$CPERL52 and $B::C::av_init and $fill > -1 and &isAvSTATIC($av) || canAvSTATIC($av, $fullname)
!ll&&!rl&&r
000
$CPERL52 and $B::C::av_init and $fill > -1
!ll&&!rl&&r
000
$CPERL52 and $B::C::av_init
!ll&&!rl&&r
000
&isAvSTATIC($av) or canAvSTATIC($av, $fullname)
l!l&&r!l&&!r
000
MC/DC0%0/5
$CPERL52 and $B::C::av_init and $fill > -1 and &isAvSTATIC($av) || canAvSTATIC($av, $fullname)
$CPERL52 $B::C::av_init $fill > -1 &isAvSTATIC($av) canAvSTATIC($av, $fullname)
Truth table0%0/6
A and B and C and D or E
A= $CPERL52B= $B::C::av_initC= $fill > -1D= &isAvSTATIC($av)E= canAvSTATIC($av, $fullname)
ABCDEresult
0XXXX0
10XXX0
110XX0
111000
1111X1
111011
5675 and (isAvSTATIC($av) or canAvSTATIC($av, $fullname)))
5676 {
5677 0 $xpvavsect->comment( "stash, magic, fill, max, static alloc" );
5678 0 my $alloc = "";
5679 0 my $count = 0;
5680 0 my $flags = $av->FLAGS;
5681 # decide upon cow (const array, SVf_READONLY) or just cog (forbid av_extend)
5682 0 ▶ my $av_cow = ($flags & SVf_READONLY or $fullname =~ /(::ISA|::INC|curpad_name)$/) ? 1 : 0;
Branch: 1 branch
BranchTrueFalseTotal
$flags & 134217728 || $fullname =~ /(::ISA|::INC|curpad_name)$/ ? : 0 0 0
Condition0%0/3
$flags & 134217728 or $fullname =~ /(::ISA|::INC|curpad_name)$/
l!l&&r!l&&!r
000
MC/DC0%0/2
$flags & 134217728 or $fullname =~ /(::ISA|::INC|curpad_name)$/
$flags & 134217728 $fullname =~ /(::ISA|::INC|curpad_name)$/
Truth table0%0/3
A or B
A= $flags & 134217728B= $fullname =~ /(::ISA|::INC|curpad_name)$/
ABresult
1X1
011
000
5683 0 my $magic = ''; # need to skip ->ARRAY with 'D' magic, test 90
5684 0 foreach my $mg ($av->MAGIC) {
5685 0 $magic = $mg->TYPE;
5686 0 ▶ if ($magic eq 'D') {
Branch: 1 branch
BranchTrueFalseTotal
if ($magic eq "D") 0 0 0
5687 0 last;
5688 }
5689 }
5690 0 ▶ my @array = $magic eq 'D' ? () : $av->ARRAY;
Branch: 1 branch
BranchTrueFalseTotal
$magic eq 'D' ? : 0 0 0
5691 0 my $n = scalar @array;
5692 0 ▶ my $name = ($av_cow ? "avcow_" : "avcog_") . $n;
Branch: 1 branch
BranchTrueFalseTotal
$av_cow ? : 0 0 0
5693 0 my $avstaticsect;
5694 0 ▶ if ($av_cow) {
Branch: 1 branch
BranchTrueFalseTotal
if ($av_cow) { } 0 0 0
5695 0 ▶ $avcowsect{ $n } = new B::C::Section($name, \%symtable, 0) unless exists $avcowsect{ $n };
Branch: 1 branch
BranchTrueFalseTotal
unless exists $avcowsect{$n} 0 0 0
5696 0 $avstaticsect = $avcowsect{ $n };
5697 } else {
5698 0 ▶ $avcogsect{ $n } = new B::C::Section($name, \%symtable, 0) unless exists $avcogsect{ $n };
Branch: 1 branch
BranchTrueFalseTotal
unless exists $avcogsect{$n} 0 0 0
5699 0 $avstaticsect = $avcogsect{ $n };
5700 }
5701 0 my $sect = sprintf("&%s_list[%u]", $name, $avstaticsect->index + 1);
5702 # protect against duplicates
5703 0 $sym = savesym( $av, sprintf("(AV*)&sv_list[%u]", $svsect->index + 1));
5704  
5705 # $B::C::const_strings = 0 if $flags & 0x40008000 == 0x40008000; # SVp_SCREAM|SVpbm_VALID
5706 0 ▶ my @values = map { $_->save($fullname."[".$count++."]") || () } @array;
Condition0%0/3
$_->save($fullname . '[' . $count++ . ']') || ()
l!l&&r!l&&!r
000
MC/DC0%0/2
$_->save($fullname . '[' . $count++ . ']') || ()
$_->save($fullname . '[' . $count++ . ']') ()
Truth table0%0/3
A || B
A= $_->save($fullname . '[' . $count++ . ']')B= ()
ABresult
1X1
011
000
5707 0 ▶ for (my $i=0; $i <= $#array; $i++) {
Branch: 1 branch
BranchTrueFalseTotal
if ($i <= $#array) 0 0 0
5708 # if any value is non-static (GV), fall back to dynamic AV::save
5709 0 ▶ if (!is_constant($values[$i])) {
Branch: 1 branch
BranchTrueFalseTotal
unless (is_constant($values[$i])) 0 0 0
5710 0 $alloc = '';
5711 0 last;
5712 }
5713 0 $alloc .= $values[$i].", ";
5714 }
5715 0 ▶ if ($alloc and $n) {
Branch: 1 branch
BranchTrueFalseTotal
if ($alloc and $n) { } 0 0 0
Condition0%0/3
$alloc and $n
!ll&&!rl&&r
000
MC/DC0%0/2
$alloc and $n
$alloc $n
Truth table0%0/3
A and B
A= $allocB= $n
ABresult
0X0
100
111
5716 0 $static_av = 1;
5717 warn sprintf("turn on %s %s\n", $av_cow ? "AvIsCOW" : "AvSTATIC", $sym, $fullname)
5718 0 ▶ if $debug{av};
Branch: 2 branches
BranchTrueFalseTotal
if $B::C::debug{"av"} 0 0 0
$av_cow ? : 0 0 0
5719 0 $flags |= SVf_IsCOW; # turn on AvSTATIC
5720 # $flags |= SVf_READONLY if $av_cow; # and turn on COW
5721 0 $alloc = substr($alloc,0,-2);
5722 0 $avstaticsect->add( $alloc );
5723 0 $xpvavsect->add("Nullhv, {0}, $fill, $max, (SV**)$sect");
5724 0 ▶ $svsect->add(sprintf("&xpvav_list[%d], $u32fmt, 0x%x, {%s}",
Branch: 1 branch
BranchTrueFalseTotal
$C99 ? : 0 0 0
5725 $xpvavsect->index, $av->REFCNT, $flags,
5726 ($C99?".svu_array=(SV**)":"(char*)").$sect));
5727 0 $sym = savesym( $av, sprintf("(AV*)&sv_list[%u]", $svsect->index));
5728 } else {
5729 warn sprintf("turn off AvSTATIC %s %s\n", $sym, $fullname)
5730 0 ▶ if $debug{av};
Branch: 1 branch
BranchTrueFalseTotal
if $B::C::debug{"av"} 0 0 0
5731 0 $flags &= ~SVf_IsCOW; # turn off AvSTATIC
5732 0 my $line = "Nullhv, {0}, -1, -1, 0";
5733 0 ▶ $line = "Nullhv, {0}, $fill, $max, 0" if $B::C::av_init or $B::C::av_init2;
Branch: 1 branch
BranchTrueFalseTotal
if $B::C::av_init or $B::C::av_init2 0 0 0
Condition0%0/3
$B::C::av_init or $B::C::av_init2
l!l&&r!l&&!r
000
MC/DC0%0/2
$B::C::av_init or $B::C::av_init2
$B::C::av_init $B::C::av_init2
Truth table0%0/3
A or B
A= $B::C::av_initB= $B::C::av_init2
ABresult
1X1
011
000
5734 0 $xpvavsect->add($line);
5735 0 $svsect->add(sprintf("&xpvav_list[%d], $u32fmt, 0x%x, {0}",
5736 $xpvavsect->index, $av->REFCNT, $flags));
5737 }
5738 }
5739 elsif ($PERL514) {
5740 0 $xpvavsect->comment( "stash, magic, fill, max, alloc" );
5741 # 5.13.3: STASH, MAGIC, fill max ALLOC
5742 0 my $line = "Nullhv, {0}, -1, -1, 0";
5743 0 ▶ $line = "Nullhv, {0}, $fill, $max, 0" if $B::C::av_init or $B::C::av_init2;
Branch: 1 branch
BranchTrueFalseTotal
if $B::C::av_init or $B::C::av_init2 0 0 0
Condition0%0/3
$B::C::av_init or $B::C::av_init2
l!l&&r!l&&!r
000
MC/DC0%0/2
$B::C::av_init or $B::C::av_init2
$B::C::av_init $B::C::av_init2
Truth table0%0/3
A or B
A= $B::C::av_initB= $B::C::av_init2
ABresult
1X1
011
000
5744 0 $xpvavsect->add($line);
5745 0 $svsect->add(sprintf("&xpvav_list[%d], $u32fmt, 0x%x, {%s}",
5746 $xpvavsect->index, $av->REFCNT, $av->FLAGS,
5747 '0'));
5748 #$avreal = $av->FLAGS & 0x40000000; # SVpav_REAL (unused)
5749 }
5750 elsif ($PERL510) {
5751 0 $xpvavsect->comment( "xnv_u, fill, max, xiv_u, magic, stash" );
5752 # 5.9.4+: nvu fill max iv MG STASH
5753 0 my $line = "{0}, -1, -1, {0}, {0}, Nullhv";
5754 0 ▶ $line = "{0}, $fill, $max, {0}, {0}, Nullhv" if $B::C::av_init or $B::C::av_init2;
Branch: 1 branch
BranchTrueFalseTotal
if $B::C::av_init or $B::C::av_init2 0 0 0
Condition0%0/3
$B::C::av_init or $B::C::av_init2
l!l&&r!l&&!r
000
MC/DC0%0/2
$B::C::av_init or $B::C::av_init2
$B::C::av_init $B::C::av_init2
Truth table0%0/3
A or B
A= $B::C::av_initB= $B::C::av_init2
ABresult
1X1
011
000
5755 0 ▶ $line = "Nullhv, {0}, $fill, $max, NULL" if $PERL514;
Branch: 1 branch
BranchTrueFalseTotal
if $PERL514 0 0 0
5756 0 $xpvavsect->add($line);
5757 0 $svsect->add(sprintf("&xpvav_list[%d], $u32fmt, 0x%x, {%s}",
5758 $xpvavsect->index, $av->REFCNT, $av->FLAGS,
5759 '0'));
5760 #$avreal = $av->FLAGS & 0x40000000; # SVpav_REAL (unused)
5761 }
5762 else {
5763 0 $xpvavsect->comment( "array, fill, max, off, nv, magic, stash, alloc, arylen, flags" );
5764 # 5.8: ARRAY fill max off nv MG STASH ALLOC arylen flags
5765 0 my $line = "0, -1, -1, 0, 0.0, 0, Nullhv, 0, 0";
5766 0 ▶ $line = "0, $fill, $max, 0, 0.0, 0, Nullhv, 0, 0" if $B::C::av_init or $B::C::av_init2;
Branch: 1 branch
BranchTrueFalseTotal
if $B::C::av_init or $B::C::av_init2 0 0 0
Condition0%0/3
$B::C::av_init or $B::C::av_init2
l!l&&r!l&&!r
000
MC/DC0%0/2
$B::C::av_init or $B::C::av_init2
$B::C::av_init $B::C::av_init2
Truth table0%0/3
A or B
A= $B::C::av_initB= $B::C::av_init2
ABresult
1X1
011
000
5767 0 ▶ $line .= sprintf( ", 0x%x", $av->AvFLAGS ) if $] < 5.009;
Branch: 1 branch
BranchTrueFalseTotal
if $] < "5.009" 0 0 0
5768 #$avreal = $av->AvFLAGS & 1; # AVf_REAL
5769 0 $xpvavsect->add($line);
5770 0 $svsect->add(sprintf("&xpvav_list[%d], $u32fmt, 0x%x",
5771 $xpvavsect->index, $av->REFCNT, $av->FLAGS));
5772 }
5773  
5774 0 my ($magic, $av_index) = ('');
5775 0 ▶ $svsect->debug($fullname, $av->flagspv) if $debug{flags};
Branch: 1 branch
BranchTrueFalseTotal
if $B::C::debug{"flags"} 0 0 0
5776 0 ▶ if (!$ispadlist and !$ispadnamelist) {
Branch: 1 branch
BranchTrueFalseTotal
unless ($ispadlist or $ispadnamelist) 0 0 0
Condition0%0/3
$ispadlist or $ispadnamelist
l!l&&r!l&&!r
000
MC/DC0%0/2
$ispadlist or $ispadnamelist
$ispadlist $ispadnamelist
Truth table0%0/3
A or B
A= $ispadlistB= $ispadnamelist
ABresult
1X1
011
000
5777 0 my $sv_ix = $svsect->index;
5778 0 $av_index = $xpvavsect->index;
5779 # protect against recursive self-references (Getopt::Long)
5780 0 $sym = savesym( $av, "(AV*)&sv_list[$sv_ix]" );
5781 0 $magic = $av->save_magic($fullname);
5782 0 ▶ push @B::C::static_free, $sym if $PERL518 and $av->FLAGS & SVs_OBJECT;
Branch: 1 branch
BranchTrueFalseTotal
if $PERL518 and $av->FLAGS & 1048576 0 0 0
Condition0%0/3
$PERL518 and $av->FLAGS & 1048576
!ll&&!rl&&r
000
MC/DC0%0/2
$PERL518 and $av->FLAGS & 1048576
$PERL518 $av->FLAGS & 1048576
Truth table0%0/3
A and B
A= $PERL518B= $av->FLAGS & 1048576
ABresult
0X0
100
111
5783 }
5784  
5785 0 ▶ if ( $debug{av} ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($B::C::debug{"av"}) 0 0 0
5786 0 my $line = sprintf( "saving AV %s 0x%x [%s] FILL=%d", $fullname, $$av, B::class($av), $fill);
5787 0 ▶ $line .= sprintf( " AvFLAGS=0x%x", $av->AvFLAGS ) if $] < 5.009;
Branch: 1 branch
BranchTrueFalseTotal
if $] < "5.009" 0 0 0
5788 0 warn "$line\n";
5789 }
5790  
5791 # XXX AVf_REAL is wrong test: need to save comppadlist but not stack
5792 0 ▶ if ($fill > -1 and $magic !~ /D/ and !$static_av) {
Branch: 1 branch
BranchTrueFalseTotal
if ($fill > -1 and not $magic =~ /D/ and not $static_av) { } 0 0 0
Condition0%0/6
$fill > -1 and not $magic =~ /D/ and not $static_av
!ll&&!rl&&r
000
$fill > -1 and not $magic =~ /D/
!ll&&!rl&&r
000
MC/DC0%0/3
$fill > -1 and not $magic =~ /D/ and not $static_av
$fill > -1 not $magic =~ /D/ not $static_av
Truth table0%0/4
A and not(B) and not(C)
A= $fill > -1B= not $magic =~ /D/C= not $static_av
ABCresult
0XX0
10X0
1100
1111
5793 0 my @array = $av->ARRAY; # crashes with D magic (Getopt::Long)
5794 0 ▶ if ( $debug{av} ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($B::C::debug{"av"}) 0 0 0
5795 0 my $i = 0;
5796 0 foreach my $el (@array) {
5797 0 my $val = '';
5798 # if SvIOK print iv, POK pv
5799 0 ▶ if ($el->can('FLAGS')) {
Branch: 1 branch
BranchTrueFalseTotal
if ($el->can("FLAGS")) 0 0 0
5800 0 ▶ $val = $el->IVX if $el->FLAGS & SVf_IOK;
Branch: 1 branch
BranchTrueFalseTotal
if $el->FLAGS & 256 0 0 0
5801 0 ▶ $val = cstring($el->PV) if $el->FLAGS & SVf_POK;
Branch: 1 branch
BranchTrueFalseTotal
if $el->FLAGS & 1024 0 0 0
5802 }
5803 0 warn sprintf( "AV $av \[%d] = %s $val\n", $i++, B::class($el) );
5804 }
5805 }
5806  
5807 # my @names = map($_->save, @array);
5808 # XXX Better ways to write loop?
5809 # Perhaps svp[0] = ...; svp[1] = ...; svp[2] = ...;
5810 # Perhaps I32 i = 0; svp[i++] = ...; svp[i++] = ...; svp[i++] = ...;
5811  
5812 # micro optimization: op/pat.t ( and other code probably )
5813 # has very large pads ( 20k/30k elements ) passing them to
5814 # ->add is a performance bottleneck: passing them as a
5815 # single string cuts runtime from 6min20sec to 40sec
5816  
5817 # you want to keep this out of the no_split/split
5818 # map("\t*svp++ = (SV*)$_;", @names),
5819 0 my $acc = '';
5820 # Init optimization by Nick Koston
5821 # The idea is to create loops so there is less C code. In the real world this seems
5822 # to reduce the memory usage ~ 3% and speed up startup time by about 8%.
5823 0 my ($count, @values);
5824 {
5825 0 local $B::C::const_strings = $B::C::const_strings;
5826 0 ▶ if ($PERL510 and !$ispadlist) { # force dynamic PADNAME strings
Branch: 1 branch
BranchTrueFalseTotal
if ($PERL510 and not $ispadlist) 0 0 0
Condition0%0/3
$PERL510 and not $ispadlist
!ll&&!rl&&r
000
MC/DC0%0/2
$PERL510 and not $ispadlist
$PERL510 not $ispadlist
Truth table0%0/3
A and not(B)
A= $PERL510B= not $ispadlist
ABresult
0X0
100
111
5827 0 ▶ if ($] < 5.016) { $B::C::const_strings = 0 if $av->FLAGS & 0x40000000; } # SVpad_NAME
Branch: 2 branches
BranchTrueFalseTotal
if ($] < 5.016) { } 0 0 0
if $av->FLAGS & 1073741824 0 0 0
5828 0 ▶ else { $B::C::const_strings = 0 if ($av->FLAGS & 0x40008000 == 0x40008000); } # SVp_SCREAM|SVpbm_VALID
Branch: 1 branch
BranchTrueFalseTotal
if 0 0 0
5829 }
5830 0 ▶ @values = map { $_->save($fullname."[".$count++."]") || () } @array;
Condition0%0/3
$_->save($fullname . '[' . $count++ . ']') || ()
l!l&&r!l&&!r
000
MC/DC0%0/2
$_->save($fullname . '[' . $count++ . ']') || ()
$_->save($fullname . '[' . $count++ . ']') ()
Truth table0%0/3
A || B
A= $_->save($fullname . '[' . $count++ . ']')B= ()
ABresult
1X1
011
000
5831 }
5832 0 $count = 0;
5833 0 ▶ for (my $i=0; $i <= $#array; $i++) {
Branch: 1 branch
BranchTrueFalseTotal
if ($i <= $#array) 0 0 0
5834 0 ▶ if ($fullname =~ m/^(INIT|END)$/ and $values[$i] and ref $array[$i] eq 'B::CV') {
Branch: 1 branch
BranchTrueFalseTotal
if ($fullname =~ /^(INIT|END)$/ and $values[$i] and ref $array[$i] eq "B::CV") 0 0 0
Condition0%0/6
$fullname =~ /^(INIT|END)$/ and $values[$i] and ref $array[$i] eq "B::CV"
!ll&&!rl&&r
000
$fullname =~ /^(INIT|END)$/ and $values[$i]
!ll&&!rl&&r
000
MC/DC0%0/3
$fullname =~ /^(INIT|END)$/ and $values[$i] and ref $array[$i] eq "B::CV"
$fullname =~ /^(INIT|END)$/ $values[$i] ref $array[$i] eq "B::CV"
Truth table0%0/4
A and B and C
A= $fullname =~ /^(INIT|END)$/B= $values[$i]C= ref $array[$i] eq "B::CV"
ABCresult
0XX0
10X0
1100
1111
5835 0 ▶ if ($array[$i]->XSUB) {
Branch: 1 branch
BranchTrueFalseTotal
if ($array[$i]->XSUB) 0 0 0
5836 0 $values[$i] =~ s/, 0\)/, GV_ADD\)/; # GvCV filled in later
5837 }
5838 0 $values[$i] = sprintf("SvREFCNT_inc(%s);", $values[$i]);
5839 }
5840 0 ▶ if ( $use_svpop_speedup
Branch: 2 branches
BranchTrueFalseTotal
if ($B::C::use_svpop_speedup and defined $values[$i] and defined $values[$i + 1] and defined $values[$i + 2] and $values[$i] =~ /^\&sv_list\[(\d+)\]/ and $values[$i + 1] eq '&sv_list[' . ($1 + 1) . ']' and $values[$i + 2] eq '&sv_list[' . ($1 + 2) . ']') { } 0 0 0
elsif ($B::C::use_av_undef_speedup and defined $values[$i] and defined $values[$i + 1] and defined $values[$i + 2] and $values[$i] =~ /^ptr_undef|&PL_sv_undef$/ and $values[$i + 1] =~ /^ptr_undef|&PL_sv_undef$/ and $values[$i + 2] =~ /^ptr_undef|&PL_sv_undef$/) { } 0 0 0
Condition0%0/18
$B::C::use_svpop_speedup and defined $values[$i] and defined $values[$i + 1] and defined $values[$i + 2] and $values[$i] =~ /^\&sv_list\[(\d+)\]/ and $values[$i + 1] eq '&sv_list[' . ($1 + 1) . ']' and $values[$i + 2] eq '&sv_list[' . ($1 + 2) . ']'
!ll&&!rl&&r
000
$B::C::use_svpop_speedup and defined $values[$i] and defined $values[$i + 1] and defined $values[$i + 2] and $values[$i] =~ /^\&sv_list\[(\d+)\]/ and $values[$i + 1] eq '&sv_list[' . ($1 + 1) . ']'
!ll&&!rl&&r
000
$B::C::use_svpop_speedup and defined $values[$i] and defined $values[$i + 1] and defined $values[$i + 2] and $values[$i] =~ /^\&sv_list\[(\d+)\]/
!ll&&!rl&&r
000
$B::C::use_svpop_speedup and defined $values[$i] and defined $values[$i + 1] and defined $values[$i + 2]
!ll&&!rl&&r
000
$B::C::use_svpop_speedup and defined $values[$i] and defined $values[$i + 1]
!ll&&!rl&&r
000
$B::C::use_svpop_speedup and defined $values[$i]
!ll&&!rl&&r
000
MC/DC0%0/7
$B::C::use_svpop_speedup and defined $values[$i] and defined $values[$i + 1] and defined $values[$i + 2] and $values[$i] =~ /^\&sv_list\[(\d+)\]/ and $values[$i + 1] eq '&sv_list[' . ($1 + 1) . ']' and $values[$i + 2] eq '&sv_list[' . ($1 + 2) . ']'
$B::C::use_svpop_speedup defined $values[$i] defined $values[$i + 1] defined $values[$i + 2] $values[$i] =~ /^\&sv_list\[(\d+)\]/ $values[$i + 1] eq '&sv_list[' . ($1 + 1) . ']' $values[$i + 2] eq '&sv_list[' . ($1 + 2) . ']'
Truth table0%0/8
A and B and C and D and E and F and G
A= $B::C::use_svpop_speedupB= defined $values[$i]C= defined $values[$i + 1]D= defined $values[$i + 2]E= $values[$i] =~ /^\&sv_list\[(\d+)\]/F= $values[$i + 1] eq '&sv_list[' . ($1 + 1) . ']'G= $values[$i + 2] eq '&sv_list[' . ($1 + 2) . ']'
ABCDEFGresult
0XXXXXX0
10XXXXX0
110XXXX0
1110XXX0
11110XX0
111110X0
11111100
11111111
5841 && defined $values[$i]
5842 && defined $values[$i+1]
5843 && defined $values[$i+2]
5844 && $values[$i] =~ /^\&sv_list\[(\d+)\]/
5845 && $values[$i+1] eq "&sv_list[" . ($1+1) . "]"
5846 && $values[$i+2] eq "&sv_list[" . ($1+2) . "]" )
5847 {
5848 0 $count=0;
5849 0 ▶ while (defined($values[$i+$count+1]) and $values[$i+$count+1] eq "&sv_list[" . ($1+$count+1) . "]") {
Branch: 1 branch
BranchTrueFalseTotal
if (defined $values[$i + $count + 1] and $values[$i + $count + 1] eq '&sv_list[' . ($1 + $count + 1) . ']') 0 0 0
Condition0%0/3
defined $values[$i + $count + 1] and $values[$i + $count + 1] eq '&sv_list[' . ($1 + $count + 1) . ']'
!ll&&!rl&&r
000
MC/DC0%0/2
defined $values[$i + $count + 1] and $values[$i + $count + 1] eq '&sv_list[' . ($1 + $count + 1) . ']'
defined $values[$i + $count + 1] $values[$i + $count + 1] eq '&sv_list[' . ($1 + $count + 1) . ']'
Truth table0%0/3
A and B
A= defined $values[$i + $count + 1]B= $values[$i + $count + 1] eq '&sv_list[' . ($1 + $count + 1) . ']'
ABresult
0X0
100
111
5850 0 $count++;
5851 }
5852 0 $acc .= "\tfor (gcount=" . $1 . "; gcount<" . ($1+$count+1) . "; gcount++) {"
5853 ." *svp++ = $svpcast&sv_list[gcount]; };\n\t";
5854 0 $i += $count;
5855 ▶ } elsif ($use_av_undef_speedup
Condition0%0/18
$B::C::use_av_undef_speedup and defined $values[$i] and defined $values[$i + 1] and defined $values[$i + 2] and $values[$i] =~ /^ptr_undef|&PL_sv_undef$/ and $values[$i + 1] =~ /^ptr_undef|&PL_sv_undef$/ and $values[$i + 2] =~ /^ptr_undef|&PL_sv_undef$/
!ll&&!rl&&r
000
$B::C::use_av_undef_speedup and defined $values[$i] and defined $values[$i + 1] and defined $values[$i + 2] and $values[$i] =~ /^ptr_undef|&PL_sv_undef$/ and $values[$i + 1] =~ /^ptr_undef|&PL_sv_undef$/
!ll&&!rl&&r
000
$B::C::use_av_undef_speedup and defined $values[$i] and defined $values[$i + 1] and defined $values[$i + 2] and $values[$i] =~ /^ptr_undef|&PL_sv_undef$/
!ll&&!rl&&r
000
$B::C::use_av_undef_speedup and defined $values[$i] and defined $values[$i + 1] and defined $values[$i + 2]
!ll&&!rl&&r
000
$B::C::use_av_undef_speedup and defined $values[$i] and defined $values[$i + 1]
!ll&&!rl&&r
000
$B::C::use_av_undef_speedup and defined $values[$i]
!ll&&!rl&&r
000
MC/DC0%0/7
$B::C::use_av_undef_speedup and defined $values[$i] and defined $values[$i + 1] and defined $values[$i + 2] and $values[$i] =~ /^ptr_undef|&PL_sv_undef$/ and $values[$i + 1] =~ /^ptr_undef|&PL_sv_undef$/ and $values[$i + 2] =~ /^ptr_undef|&PL_sv_undef$/
$B::C::use_av_undef_speedup defined $values[$i] defined $values[$i + 1] defined $values[$i + 2] $values[$i] =~ /^ptr_undef|&PL_sv_undef$/ $values[$i + 1] =~ /^ptr_undef|&PL_sv_undef$/ $values[$i + 2] =~ /^ptr_undef|&PL_sv_undef$/
Truth table0%0/8
A and B and C and D and E and F and G
A= $B::C::use_av_undef_speedupB= defined $values[$i]C= defined $values[$i + 1]D= defined $values[$i + 2]E= $values[$i] =~ /^ptr_undef|&PL_sv_undef$/F= $values[$i + 1] =~ /^ptr_undef|&PL_sv_undef$/G= $values[$i + 2] =~ /^ptr_undef|&PL_sv_undef$/
ABCDEFGresult
0XXXXXX0
10XXXXX0
110XXXX0
1110XXX0
11110XX0
111110X0
11111100
11111111
5856 && defined $values[$i]
5857 && defined $values[$i+1]
5858 && defined $values[$i+2]
5859 && $values[$i] =~ /^ptr_undef|&PL_sv_undef$/
5860 && $values[$i+1] =~ /^ptr_undef|&PL_sv_undef$/
5861 && $values[$i+2] =~ /^ptr_undef|&PL_sv_undef$/)
5862 {
5863 0 $count=0;
5864 0 ▶ while (defined $values[$i+$count+1] and $values[$i+$count+1] =~ /^ptr_undef|&PL_sv_undef$/) {
Branch: 1 branch
BranchTrueFalseTotal
if (defined $values[$i + $count + 1] and $values[$i + $count + 1] =~ /^ptr_undef|&PL_sv_undef$/) 0 0 0
Condition0%0/3
defined $values[$i + $count + 1] and $values[$i + $count + 1] =~ /^ptr_undef|&PL_sv_undef$/
!ll&&!rl&&r
000
MC/DC0%0/2
defined $values[$i + $count + 1] and $values[$i + $count + 1] =~ /^ptr_undef|&PL_sv_undef$/
defined $values[$i + $count + 1] $values[$i + $count + 1] =~ /^ptr_undef|&PL_sv_undef$/
Truth table0%0/3
A and B
A= defined $values[$i + $count + 1]B= $values[$i + $count + 1] =~ /^ptr_undef|&PL_sv_undef$/
ABresult
0X0
100
111
5865 0 $count++;
5866 }
5867 0 $acc .= "\tfor (gcount=0; gcount<" . ($count+1) . "; gcount++) {"
5868 ." *svp++ = $svpcast&PL_sv_undef; };\n\t";
5869 0 $i += $count;
5870 } else { # XXX 5.8.9d Test::NoWarnings has empty values
5871 0 ▶ $acc .= "\t*svp++ = $svpcast" . ($values[$i] ? $values[$i] : '&PL_sv_undef') . ";\n\t";
Branch: 1 branch
BranchTrueFalseTotal
$values[$i] ? : 0 0 0
5872 }
5873 }
5874 0 $init->no_split;
5875  
5876 0 ▶ if ($ispadnamelist) {
Branch: 4 branches
BranchTrueFalseTotal
if ($ispadnamelist) { } 0 0 0
elsif ($ispadlist) { } 0 0 0
elsif ($B::C::av_init2) { } 0 0 0
elsif ($B::C::av_init) { } 0 0 0
5877 0 my $fill1 = $fill+1;
5878 0 $init->add("{", "\tPADNAME **svp;");
5879 0 ▶ $init->add("\tregister int gcount;") if $count;
Branch: 1 branch
BranchTrueFalseTotal
if $count 0 0 0
5880 0 $init->add(
5881 "\tPADNAMELIST *padnl = $sym;",
5882 sprintf("\tNewxz(svp, %d, PADNAME *);", $fill+1),
5883 "\tPadnamelistARRAY(padnl) = svp;",
5884 );
5885 0 $init->add( substr( $acc, 0, -2 ) );
5886 0 $init->add("}");
5887 }
5888 elsif ($ispadlist) {
5889 0 my $fill1 = $fill+1;
5890 0 $init->add("{", "\tPAD **svp;");
5891 0 ▶ $init->add("\tregister int gcount;") if $count;
Branch: 1 branch
BranchTrueFalseTotal
if $count 0 0 0
5892 0 $init->add(
5893 "\tPADLIST *padl = $sym;",
5894 sprintf("\tNewxz(svp, %d, PAD *);", $fill+1),
5895 "\tPadlistARRAY(padl) = svp;",
5896 );
5897 0 $init->add( substr( $acc, 0, -2 ) );
5898 0 $init->add("}");
5899 }
5900 # With -fav-init2 use independent_comalloc()
5901 elsif ($B::C::av_init2) {
5902 0 my $i = $av_index;
5903 0 $xpvav_sizes[$i] = $fill;
5904 0 my $init_add = "{ SV **svp = avchunks[$i]; AV *av = $sym;\n";
5905 0 ▶ $init_add .= "\tregister int gcount;\n" if $count;
Branch: 1 branch
BranchTrueFalseTotal
if $count 0 0 0
5906 0 ▶ if ($fill > -1) {
Branch: 1 branch
BranchTrueFalseTotal
if ($fill > -1) 0 0 0
5907 0 ▶ if ($PERL510) {
Branch: 1 branch
BranchTrueFalseTotal
if ($PERL510) { } 0 0 0
5908 0 $init_add .= "\tAvALLOC(av) = svp;\n".
5909 "\tAvARRAY(av) = svp;\n";
5910 } else {
5911 0 $init_add .= "\tAvALLOC(av) = svp;\n" .
5912 # XXX Dirty hack from av.c:Perl_av_extend()
5913 "\tSvPVX(av) = (char*)svp;";
5914 }
5915 }
5916 0 $init_add .= substr( $acc, 0, -2 );
5917 0 $init->add( $init_add . "}" );
5918 }
5919 # With -fav-init faster initialize the array as the initial av_extend()
5920 # is very expensive.
5921 # The problem was calloc, not av_extend.
5922 # Since we are always initializing every single element we don't need
5923 # calloc, only malloc. wmemset'ting the pointer to PL_sv_undef
5924 # might be faster also.
5925 elsif ($B::C::av_init) {
5926 0 $init->add(
5927 "{", "\tSV **svp;",
5928 "\tAV *av = $sym;");
5929 0 ▶ $init->add("\tregister int gcount;") if $count;
Branch: 1 branch
BranchTrueFalseTotal
if $count 0 0 0
5930 0 ▶ my $fill1 = $fill < 3 ? 3 : $fill+1;
Branch: 1 branch
BranchTrueFalseTotal
$fill < 3 ? : 0 0 0
5931 0 ▶ if ($fill > -1) {
Branch: 1 branch
BranchTrueFalseTotal
if ($fill > -1) 0 0 0
5932 0 ▶ $fill1 = $fill+1 if $fullname eq 'END';
Branch: 1 branch
BranchTrueFalseTotal
if $fullname eq "END" 0 0 0
5933 # Perl_safesysmalloc (= calloc => malloc) or Perl_malloc (= mymalloc)?
5934 0 ▶ if ($MYMALLOC) {
Branch: 1 branch
BranchTrueFalseTotal
if ($MYMALLOC) { } 0 0 0
5935 0 $init->add(sprintf("\tNewx(svp, %d, SV*);", $fill1),
5936 "\tAvALLOC(av) = svp;");
5937 } else {
5938 # Bypassing Perl_safesysmalloc on darwin fails with "free from wrong pool", test 25.
5939 # So with DEBUGGING perls we have to track memory and use calloc.
5940 0 $init->add("#ifdef PERL_TRACK_MEMPOOL",
5941 sprintf("\tsvp = (SV**)Perl_safesysmalloc(%d * sizeof(SV*));", $fill1),
5942 "#else",
5943 sprintf("\tsvp = (SV**)malloc(%d * sizeof(SV*));", $fill1),
5944 "#endif",
5945 "\tAvALLOC(av) = svp;");
5946 }
5947 0 ▶ if ($PERL510) {
Branch: 1 branch
BranchTrueFalseTotal
if ($PERL510) { } 0 0 0
5948 0 $init->add("\tAvARRAY(av) = svp;");
5949 } else { # read-only AvARRAY macro
5950 # XXX Dirty hack from av.c:Perl_av_extend()
5951 0 $init->add("\tSvPVX(av) = (char*)svp;");
5952 }
5953 }
5954 0 $init->add( substr( $acc, 0, -2 ) ); # AvFILLp already in XPVAV
5955 0 $init->add( "}" );
5956 }
5957 else { # unoptimized with the full av_extend()
5958 0 ▶ my $fill1 = $fill < 3 ? 3 : $fill+1;
Branch: 1 branch
BranchTrueFalseTotal
$fill < 3 ? : 0 0 0
5959 0 $init->add("{", "\tSV **svp;");
5960 0 ▶ $init->add("\tregister int gcount;") if $count;
Branch: 1 branch
BranchTrueFalseTotal
if $count 0 0 0
5961 0 $init->add("\tAV *av = $sym;\t/* $fullname */",
5962 "\tav_extend(av, $fill1);",
5963 "\tsvp = AvARRAY(av);");
5964 0 $init->add( substr( $acc, 0, -2 ) );
5965 0 $init->add( "\tAvFILLp(av) = $fill;" );
5966 0 $init->add( "}" );
5967 }
5968 0 $init->split;
5969  
5970 # we really added a lot of lines ( B::C::InitSection->add
5971 # should really scan for \n, but that would slow
5972 # it down
5973 0 $init->inc_count($#array);
5974 }
5975 else {
5976 0 my $max = $av->MAX;
5977 0 ▶ $init->add("av_extend($sym, $max);")
Branch: 1 branch
BranchTrueFalseTotal
if $max > -1 and not $static_av 0 0 0
Condition0%0/3
$max > -1 and not $static_av
!ll&&!rl&&r
000
MC/DC0%0/2
$max > -1 and not $static_av
$max > -1 not $static_av
Truth table0%0/3
A and not(B)
A= $max > -1B= not $static_av
ABresult
0X0
100
111
5978 if $max > -1 and !$static_av;
5979 }
5980 0 ▶ $init->add("SvREADONLY_on($sym);") if $av_cow;
Branch: 1 branch
BranchTrueFalseTotal
if $av_cow 0 0 0
5981 0 return $sym;
5982 }
5983  
5984 0 ▶sub B::HV::save {
Subroutine save: not called CC=71 SCAR=85.4
5985 0 my ($hv, $fullname) = @_;
5986 0 ▶ $fullname = '' unless $fullname;
Branch: 1 branch
BranchTrueFalseTotal
unless $fullname 0 0 0
5987 0 my $sym = objsym($hv);
5988 0 ▶ return $sym if defined $sym;
Branch: 1 branch
BranchTrueFalseTotal
if defined $sym 0 0 0
5989 0 my $name = $hv->NAME;
5990 0 my $is_stash = $name;
5991 0 my $magic;
5992 0 ▶ if ($name) {
Branch: 1 branch
BranchTrueFalseTotal
if ($name) 0 0 0
5993 # It's a stash. See issue 79 + test 46
5994 warn sprintf( "Saving stash HV \"%s\" from \"$fullname\" 0x%x MAX=%d\n",
5995 0 ▶ $name, $$hv, $hv->MAX ) if $debug{hv};
Branch: 1 branch
BranchTrueFalseTotal
if $B::C::debug{"hv"} 0 0 0
5996  
5997 # A perl bug means HvPMROOT isn't altered when a PMOP is freed. Usually
5998 # the only symptom is that sv_reset tries to reset the PMf_USED flag of
5999 # a trashed op but we look at the trashed op_type and segfault.
6000 #my $adpmroot = ${$hv->PMROOT}; # XXX When was this fixed?
6001 0 my $adpmroot = 0;
6002 0 $sym = savestashpv($name);
6003 0 savesym( $hv, $sym );
6004 0 ▶ if ($adpmroot) {
Branch: 1 branch
BranchTrueFalseTotal
if ($adpmroot) 0 0 0
6005 0 $init->add(sprintf( "HvPMROOT(hv%d) = (PMOP*)s\\_%x;",
6006 $hv_index, $adpmroot ) );
6007 }
6008 0 ▶ if ($PERL518 and $hv->FLAGS & SVf_AMAGIC and length($name)) {
Branch: 1 branch
BranchTrueFalseTotal
if ($PERL518 and $hv->FLAGS & 268435456 and length $name) 0 0 0
Condition0%0/6
$PERL518 and $hv->FLAGS & 268435456 and length $name
!ll&&!rl&&r
000
$PERL518 and $hv->FLAGS & 268435456
!ll&&!rl&&r
000
MC/DC0%0/3
$PERL518 and $hv->FLAGS & 268435456 and length $name
$PERL518 $hv->FLAGS & 268435456 length $name
Truth table0%0/4
A and B and C
A= $PERL518B= $hv->FLAGS & 268435456C= length $name
ABCresult
0XX0
10X0
1100
1111
6009 # fix overload stringify
6010 0 ▶ if ($hv->Gv_AMG) { # potentially removes the AMG flag
Branch: 1 branch
BranchTrueFalseTotal
if ($hv->Gv_AMG) 0 0 0
6011 0 $init2->add( sprintf("mro_isa_changed_in(%s); /* %s */", $sym, $name));
6012 }
6013 }
6014 # Add aliases if namecount > 1 (GH #331)
6015 # There was no B API for the count or multiple enames, so I added one.
6016 0 ▶ my @enames = ($PERL514 ? $hv->ENAMES : ());
Branch: 1 branch
BranchTrueFalseTotal
$PERL514 ? : 0 0 0
6017 0 ▶ if (@enames > 1) {
Branch: 1 branch
BranchTrueFalseTotal
if (@enames > 1) 0 0 0
6018 0 ▶ warn "Saving for $name multiple enames: ", join(" ",@enames), "\n" if $debug{hv};
Branch: 1 branch
BranchTrueFalseTotal
if $B::C::debug{"hv"} 0 0 0
6019 0 my $name_count = $hv->name_count;
6020 # If the stash name is empty xhv_name_count is negative, and names[0] should
6021 # be already set. but we rather write it.
6022 0 $init->no_split;
6023 0 my $hv_max = $hv->MAX + 1;
6024 # unshift @enames, $name if $name_count < 0; # stashpv has already set names[0]
6025 0 $init->add( "if (!SvOOK($sym)) {", # hv_auxinit is not exported
6026 " HE **a;",
6027 "#ifdef PERL_USE_LARGE_HV_ALLOC",
6028 sprintf( " Newxz(a, PERL_HV_ARRAY_ALLOC_BYTES(%d) + sizeof(struct xpvhv_aux), HE*);",
6029 $hv_max),
6030 "#else",
6031 sprintf( " Newxz(a, %d + sizeof(struct xpvhv_aux), HE*);", $hv_max),
6032 "#endif",
6033 " SvOOK_on($sym);",
6034 "}",
6035 "{",
6036 " struct xpvhv_aux *aux = HvAUX($sym);",
6037 sprintf( " Newx(aux->xhv_name_u.xhvnameu_names, %d, HEK*);", scalar @enames),
6038 sprintf( " aux->xhv_name_count = %d;", $name_count));
6039 0 my $i = 0;
6040 0 ▶ while (@enames) {
Branch: 1 branch
BranchTrueFalseTotal
if (@enames) 0 0 0
6041 0 my ($cstring, $cur, $utf8) = strlen_flags(shift @enames);
6042 0 ▶ $init->add(
Branch: 1 branch
BranchTrueFalseTotal
$utf8 ? : 0 0 0
6043 sprintf( " aux->xhv_name_u.xhvnameu_names[%u] = share_hek(%s, %d);",
6044 $i++, $cstring, $utf8 ? -$cur : $cur));
6045 }
6046 0 $init->add( "}" );
6047 0 $init->split;
6048 }
6049  
6050 # issue 79, test 46: save stashes to check for packages.
6051 # and via B::STASHGV we only save stashes for stashes.
6052 # For efficiency we skip most stash symbols unless -fstash.
6053 # However it should be now safe to save all stash symbols.
6054 # $fullname !~ /::$/ or
6055 0 ▶ if (!$B::C::stash) { # -fno-stash: do not save stashes
Branch: 1 branch
BranchTrueFalseTotal
unless ($B::C::stash) 0 0 0
6056 0 $magic = $hv->save_magic('%'.$name.'::'); #symtab magic set in PMOP #188 (#267)
6057 0 ▶ if ($PERL510 and is_using_mro() && mro::get_mro($name) eq 'c3') {
Branch: 1 branch
BranchTrueFalseTotal
if ($PERL510 and (is_using_mro() and &mro::get_mro($name) eq "c3")) 0 0 0
Condition0%0/6
$PERL510 and (is_using_mro() and &mro::get_mro($name) eq "c3")
!ll&&!rl&&r
000
is_using_mro() and &mro::get_mro($name) eq "c3"
!ll&&!rl&&r
000
MC/DC0%0/3
$PERL510 and (is_using_mro() and &mro::get_mro($name) eq "c3")
$PERL510 is_using_mro() &mro::get_mro($name) eq "c3"
Truth table0%0/4
A and B and C
A= $PERL510B= is_using_mro()C= &mro::get_mro($name) eq "c3"
ABCresult
0XX0
10X0
1100
1111
6058 0 B::C::make_c3($name);
6059 }
6060 0 ▶ if ($magic and $magic =~ /c/) {
Branch: 1 branch
BranchTrueFalseTotal
if ($magic and $magic =~ /c/) 0 0 0
Condition0%0/3
$magic and $magic =~ /c/
!ll&&!rl&&r
000
MC/DC0%0/2
$magic and $magic =~ /c/
$magic $magic =~ /c/
Truth table0%0/3
A and B
A= $magicB= $magic =~ /c/
ABresult
0X0
100
111
6061 0 ▶ warn "defer AMT magic of $name\n" if $debug{mg};
Branch: 1 branch
BranchTrueFalseTotal
if $B::C::debug{"mg"} 0 0 0
6062 # defer AMT magic of XS loaded hashes. #305 Encode::XS with tiehash magic
6063 # $init1->add(qq[$sym = gv_stashpvn($cname, $len, GV_ADDWARN|GV_ADDMULTI);]);
6064 }
6065 0 return $sym;
6066 }
6067 0 ▶ return $sym if skip_pkg($name) or $name eq 'main';
Branch: 1 branch
BranchTrueFalseTotal
if skip_pkg($name) or $name eq "main" 0 0 0
Condition0%0/3
skip_pkg($name) or $name eq "main"
l!l&&r!l&&!r
000
MC/DC0%0/2
skip_pkg($name) or $name eq "main"
skip_pkg($name) $name eq "main"
Truth table0%0/3
A or B
A= skip_pkg($name)B= $name eq "main"
ABresult
1X1
011
000
6068 0 $init->add( "SvREFCNT_inc($sym);" );
6069 0 ▶ warn "Saving stash keys for HV \"$name\" from \"$fullname\"\n" if $debug{hv};
Branch: 1 branch
BranchTrueFalseTotal
if $B::C::debug{"hv"} 0 0 0
6070 }
6071  
6072 # Ordinary HV or Stash
6073 # KEYS = 0, inc. dynamically below with hv_store. TODO: HvSTATIC readonly tables,
6074 # without hv_store
6075 0 ▶ if ($PERL510) {
Branch: 1 branch
BranchTrueFalseTotal
if ($PERL510) { } 0 0 0
6076 0 my $flags = $hv->FLAGS & ~SVf_READONLY;
6077 0 ▶ $flags &= ~SVf_PROTECT if $PERL522;
Branch: 1 branch
BranchTrueFalseTotal
if $PERL522 0 0 0
6078 0 ▶ if ($PERL514) { # fill removed with 5.13.1
Branch: 1 branch
BranchTrueFalseTotal
if ($PERL514) { } 0 0 0
6079 0 $xpvhvsect->comment( "stash mgu max keys" );
6080 0 $xpvhvsect->add(sprintf( "Nullhv, {0}, %u, %d",
6081 $hv->MAX, 0 ));
6082 } else {
6083 0 $xpvhvsect->comment( "GVSTASH fill max keys MG STASH" );
6084 0 $xpvhvsect->add(sprintf( "{0}, %d, %u, {%d}, {0}, Nullhv",
6085 0, $hv->MAX, 0 ));
6086 }
6087 0 $svsect->add(sprintf("&xpvhv_list[%d], $u32fmt, 0x%x, {0}",
6088 $xpvhvsect->index, $hv->REFCNT, $flags));
6089 # XXX failed at 16 (tied magic) for %main::
6090 0 ▶ if (!$is_stash and ($] >= 5.010 and $hv->FLAGS & SVf_OOK)) {
Branch: 1 branch
BranchTrueFalseTotal
if (not $is_stash and ($] >= "5.01" and $hv->FLAGS & SVf_OOK())) 0 0 0
Condition0%0/6
not $is_stash and ($] >= "5.01" and $hv->FLAGS & SVf_OOK())
!ll&&!rl&&r
000
$] >= "5.01" and $hv->FLAGS & SVf_OOK()
!ll&&!rl&&r
000
MC/DC0%0/3
not $is_stash and ($] >= "5.01" and $hv->FLAGS & SVf_OOK())
not $is_stash $] >= "5.01" $hv->FLAGS & SVf_OOK()
Truth table0%0/4
not(A) and B and C
A= not $is_stashB= $] >= "5.01"C= $hv->FLAGS & SVf_OOK()
ABCresult
0XX0
10X0
1100
1111
6091 0 $sym = sprintf("&sv_list[%d]", $svsect->index);
6092 0 my $hv_max = $hv->MAX + 1;
6093 # riter required, new _aux struct at the end of the HvARRAY. allocate ARRAY also.
6094 0 my $riter = ivx($hv->RITER);
6095 0 $init->add("{\tHE **a;",
6096 "#ifdef PERL_USE_LARGE_HV_ALLOC",
6097 sprintf("\tNewxz(a, PERL_HV_ARRAY_ALLOC_BYTES(%d) + sizeof(struct xpvhv_aux), HE*);",
6098 $hv_max),
6099 "#else",
6100 sprintf("\tNewxz(a, %d + sizeof(struct xpvhv_aux), HE*);", $hv_max),
6101 "#endif",
6102 "\tHvARRAY($sym) = a;",
6103 sprintf("\tHvRITER_set($sym, %s);", $riter),"}");
6104 }
6105 } # !5.10
6106 else {
6107 0 $xpvhvsect->comment( "array fill max keys nv mg stash riter eiter pmroot name" );
6108 0 $xpvhvsect->add(sprintf( "0, 0, %d, 0, 0.0, 0, Nullhv, %u, 0, 0, 0",
6109 $hv->MAX, $hv->RITER));
6110 0 $svsect->add(sprintf( "&xpvhv_list[%d], $u32fmt, 0x%x",
6111 $xpvhvsect->index, $hv->REFCNT, $hv->FLAGS));
6112 }
6113 0 ▶ $svsect->debug($fullname, $hv->flagspv) if $debug{flags};
Branch: 1 branch
BranchTrueFalseTotal
if $B::C::debug{"flags"} 0 0 0
6114 0 my $sv_list_index = $svsect->index;
6115 warn sprintf( "saving HV %s &sv_list[%d] 0x%x MAX=%d KEYS=%d\n",
6116 0 ▶ "%".$fullname, $sv_list_index, $$hv, $hv->MAX, $hv->KEYS ) if $debug{hv};
Branch: 1 branch
BranchTrueFalseTotal
if $B::C::debug{"hv"} 0 0 0
6117 # XXX B does not keep the UTF8 flag [RT 120535] #200
6118 # shared heks only since 5.10, our fixed C.xs variant
6119 0 ▶ my @contents = ($PERL510 && $hv->can('ARRAY_utf8')) ? $hv->ARRAY_utf8 : $hv->ARRAY;
Branch: 1 branch
BranchTrueFalseTotal
$PERL510 && $hv->can('ARRAY_utf8') ? : 0 0 0
Condition0%0/3
$PERL510 and $hv->can("ARRAY_utf8")
!ll&&!rl&&r
000
MC/DC0%0/2
$PERL510 and $hv->can("ARRAY_utf8")
$PERL510 $hv->can("ARRAY_utf8")
Truth table0%0/3
A and B
A= $PERL510B= $hv->can("ARRAY_utf8")
ABresult
0X0
100
111
6120 # protect against recursive self-reference
6121 # i.e. with use Moose at stash Class::MOP::Class::Immutable::Trait
6122 # value => rv => cv => ... => rv => same hash
6123 0 ▶ $sym = savesym( $hv, "(HV*)&sv_list[$sv_list_index]" ) unless $is_stash;
Branch: 1 branch
BranchTrueFalseTotal
unless $is_stash 0 0 0
6124 0 ▶ push @B::C::static_free, $sym if $PERL518 and $hv->FLAGS & SVs_OBJECT;
Branch: 1 branch
BranchTrueFalseTotal
if $PERL518 and $hv->FLAGS & 1048576 0 0 0
Condition0%0/3
$PERL518 and $hv->FLAGS & 1048576
!ll&&!rl&&r
000
MC/DC0%0/2
$PERL518 and $hv->FLAGS & 1048576
$PERL518 $hv->FLAGS & 1048576
Truth table0%0/3
A and B
A= $PERL518B= $hv->FLAGS & 1048576
ABresult
0X0
100
111
6125  
6126 0 ▶ if (@contents) {
Branch: 2 branches
BranchTrueFalseTotal
if (@contents) { } 0 0 0
elsif ($PERL514) { } 0 0 0
6127 0 local $B::C::const_strings = $B::C::const_strings;
6128 0 my ($i, $length);
6129 0 $length = scalar(@contents);
6130 0 ▶ for ( $i = 1 ; $i < @contents ; $i += 2 ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($i < @contents) 0 0 0
6131 0 my $key = $contents[$i - 1]; # string only
6132 0 my $sv = $contents[$i];
6133 warn sprintf("HV recursion? with $fullname\{$key\} -> %s\n", $sv->RV)
6134 if ref($sv) eq 'B::RV'
6135 #and $sv->RV->isa('B::CV')
6136 and defined objsym($sv)
6137 0 ▶ and $debug{hv};
Branch: 1 branch
BranchTrueFalseTotal
if ref $sv eq "B::RV" and defined objsym($sv) and $B::C::debug{"hv"} 0 0 0
Condition0%0/6
ref $sv eq "B::RV" and defined objsym($sv) and $B::C::debug{"hv"}
!ll&&!rl&&r
000
ref $sv eq "B::RV" and defined objsym($sv)
!ll&&!rl&&r
000
MC/DC0%0/3
ref $sv eq "B::RV" and defined objsym($sv) and $B::C::debug{"hv"}
ref $sv eq "B::RV" defined objsym($sv) $B::C::debug{"hv"}
Truth table0%0/4
A and B and C
A= ref $sv eq "B::RV"B= defined objsym($sv)C= $B::C::debug{"hv"}
ABCresult
0XX0
10X0
1100
1111
6138 0 ▶ if ($is_stash) {
Branch: 1 branch
BranchTrueFalseTotal
if ($is_stash) { } 0 0 0
6139 0 ▶ if (ref($sv) eq "B::GV" and $sv->NAME =~ /::$/) {
Branch: 1 branch
BranchTrueFalseTotal
if (ref $sv eq 'B::GV' and $sv->NAME =~ /::$/) { } 0 0 0
Condition0%0/3
ref $sv eq "B::GV" and $sv->NAME =~ /::$/
!ll&&!rl&&r
000
MC/DC0%0/2
ref $sv eq "B::GV" and $sv->NAME =~ /::$/
ref $sv eq "B::GV" $sv->NAME =~ /::$/
Truth table0%0/3
A and B
A= ref $sv eq "B::GV"B= $sv->NAME =~ /::$/
ABresult
0X0
100
111
6140 0 $sv = bless $sv, "B::STASHGV"; # do not expand stash GV's only other stashes
6141 0 ▶ warn "saving STASH $fullname".'{'.$key."}\n" if $debug{hv};
Branch: 1 branch
BranchTrueFalseTotal
if $B::C::debug{"hv"} 0 0 0
6142 0 $contents[$i] = $sv->save($fullname.'{'.$key.'}');
6143 } else {
6144 0 ▶ warn "skip STASH symbol *",$fullname.$key,"\n" if $debug{hv};
Branch: 1 branch
BranchTrueFalseTotal
if $B::C::debug{"hv"} 0 0 0
6145 0 $contents[$i] = undef;
6146 0 $length -= 2;
6147 # warn "(length=$length)\n" if $debug{hv};
6148 }
6149 } else {
6150 0 ▶ warn "saving HV \$".$fullname.'{'.$key."} $sv\n" if $debug{hv};
Branch: 1 branch
BranchTrueFalseTotal
if $B::C::debug{"hv"} 0 0 0
6151 0 $contents[$i] = $sv->save($fullname.'{'.$key.'}');
6152 #if ($key eq "" and $] >= 5.010) {
6153 # warn " turn off HvSHAREKEYS with empty keysv\n" if $debug{hv};
6154 # $init->add("HvSHAREKEYS_off(&sv_list[$sv_list_index]);");
6155 #}
6156 }
6157 }
6158 0 ▶ if ($length) { # there may be skipped STASH symbols
Branch: 1 branch
BranchTrueFalseTotal
if ($length) 0 0 0
6159 0 $init->no_split;
6160 0 ▶ $init->add( "{",
Branch: 1 branch
BranchTrueFalseTotal
$sym =~ /^hv|\(HV/ ? : 0 0 0
6161 sprintf("\tHV *hv = %s%s;", $sym=~/^hv|\(HV/ ? '' : '(HV*)', $sym ));
6162 0 ▶ while (@contents) {
Branch: 1 branch
BranchTrueFalseTotal
if (@contents) 0 0 0
6163 0 my ( $key, $value ) = splice( @contents, 0, 2 );
6164 0 ▶ if ($value) {
Branch: 1 branch
BranchTrueFalseTotal
if ($value) 0 0 0
6165 0 ▶ $value = "(SV*)$value" if $value !~ /^&sv_list/ or ($PERL510 and $] < 5.012);
Branch: 1 branch
BranchTrueFalseTotal
if not $value =~ /^&sv_list/ or $PERL510 and $] < "5.012" 0 0 0
Condition0%0/6
not $value =~ /^&sv_list/ or $PERL510 and $] < "5.012"
l!l&&r!l&&!r
000
$PERL510 and $] < "5.012"
!ll&&!rl&&r
000
MC/DC0%0/3
not $value =~ /^&sv_list/ or $PERL510 and $] < "5.012"
not $value =~ /^&sv_list/ $PERL510 $] < "5.012"
Truth table0%0/4
not(A) or B and C
A= not $value =~ /^&sv_list/B= $PERL510C= $] < "5.012"
ABCresult
1XX1
0111
00X0
0100
6166 0 my ($cstring, $cur, $utf8) = strlen_flags($key);
6167 # issue 272: if SvIsCOW(sv) && SvLEN(sv) == 0 => sharedhek (key == "")
6168 # >= 5.10: SvSHARED_HASH: PV offset to hek_hash
6169 0 ▶ $cur = -$cur if $utf8;
Branch: 1 branch
BranchTrueFalseTotal
if $utf8 0 0 0
6170 0 $init->add(sprintf( "\thv_store(hv, %s, %d, %s, 0);",
6171 $cstring, $cur, $value )); # !! randomized hash keys
6172 0 ▶ warn sprintf( " HV key \"%s\" = %s\n", $key, $value) if $debug{hv};
Branch: 1 branch
BranchTrueFalseTotal
if $B::C::debug{"hv"} 0 0 0
6173 0 ▶ if (!$swash_ToCf and $fullname =~ /^utf8::SWASHNEW/
Branch: 1 branch
BranchTrueFalseTotal
if (not $swash_ToCf and $fullname =~ /^utf8::SWASHNEW/ and $cstring eq "\"utf8\\034unicore/To/Cf.pl\\0340\"" and $cur == 23) 0 0 0
Condition0%0/9
not $swash_ToCf and $fullname =~ /^utf8::SWASHNEW/ and $cstring eq "\"utf8\\034unicore/To/Cf.pl\\0340\"" and $cur == 23
!ll&&!rl&&r
000
not $swash_ToCf and $fullname =~ /^utf8::SWASHNEW/ and $cstring eq "\"utf8\\034unicore/To/Cf.pl\\0340\""
!ll&&!rl&&r
000
not $swash_ToCf and $fullname =~ /^utf8::SWASHNEW/
!ll&&!rl&&r
000
MC/DC0%0/4
not $swash_ToCf and $fullname =~ /^utf8::SWASHNEW/ and $cstring eq "\"utf8\\034unicore/To/Cf.pl\\0340\"" and $cur == 23
not $swash_ToCf $fullname =~ /^utf8::SWASHNEW/ $cstring eq "\"utf8\\034unicore/To/Cf.pl\\0340\"" $cur == 23
Truth table0%0/5
not(A) and B and C and D
A= not $swash_ToCfB= $fullname =~ /^utf8::SWASHNEW/C= $cstring eq "\"utf8\\034unicore/To/Cf.pl\\0340\""D= $cur == 23
ABCDresult
0XXX0
10XX0
110X0
11100
11111
6174 and $cstring eq '"utf8\034unicore/To/Cf.pl\0340"' and $cur == 23)
6175 {
6176 0 $swash_ToCf = $value;
6177 0 ▶ warn sprintf( "Found PL_utf8_tofold ToCf swash $value\n") if $verbose;
Branch: 1 branch
BranchTrueFalseTotal
if $B::C::verbose 0 0 0
6178 }
6179 }
6180 }
6181 0 $init->add("}");
6182 0 $init->split;
6183 0 ▶ $init->add( sprintf("HvTOTALKEYS(%s) = %d;", $sym, $length / 2)) if !$PERL56;
Branch: 1 branch
BranchTrueFalseTotal
unless $PERL56 0 0 0
6184 }
6185 } elsif ($PERL514) { # empty contents still needs to set keys=0
6186 # test 36, 140
6187 0 $init->add( "HvTOTALKEYS($sym) = 0;");
6188 }
6189 0 $magic = $hv->save_magic($fullname);
6190 0 ▶ $init->add( "SvREADONLY_on($sym);") if $hv->FLAGS & SVf_READONLY;
Branch: 1 branch
BranchTrueFalseTotal
if $hv->FLAGS & 134217728 0 0 0
6191 0 ▶ if ($magic =~ /c/) {
Branch: 1 branch
BranchTrueFalseTotal
if ($magic =~ /c/) 0 0 0
6192 # defer AMT magic of XS loaded stashes
6193 0 my ($cname, $len, $utf8) = strlen_flags($name);
6194 0 $init2->add(qq[$sym = gv_stashpvn($cname, $len, GV_ADDWARN|GV_ADDMULTI|$utf8);]);
6195 }
6196 0 ▶ if ($PERL510 and $name and is_using_mro() and mro::get_mro($name) eq 'c3') {
Branch: 1 branch
BranchTrueFalseTotal
if ($PERL510 and $name and is_using_mro() and &mro::get_mro($name) eq "c3") 0 0 0
Condition0%0/9
$PERL510 and $name and is_using_mro() and &mro::get_mro($name) eq "c3"
!ll&&!rl&&r
000
$PERL510 and $name and is_using_mro()
!ll&&!rl&&r
000
$PERL510 and $name
!ll&&!rl&&r
000
MC/DC0%0/4
$PERL510 and $name and is_using_mro() and &mro::get_mro($name) eq "c3"
$PERL510 $name is_using_mro() &mro::get_mro($name) eq "c3"
Truth table0%0/5
A and B and C and D
A= $PERL510B= $nameC= is_using_mro()D= &mro::get_mro($name) eq "c3"
ABCDresult
0XXX0
10XX0
110X0
11100
11111
6197 0 B::C::make_c3($name);
6198 }
6199 0 return $sym;
6200 }
6201  
6202 0 ▶sub B::IO::save_data {
Subroutine save_data: not called CC=5 SCAR=34.0
6203 0 my ( $io, $sym, $globname, @data ) = @_;
6204 0 my $data = join '', @data;
6205 # XXX using $DATA might clobber it!
6206 0 my $ref = svref_2object( \\$data )->save;
6207 0 ▶ $init->add("/* save $globname in RV ($ref) */") if $verbose;
Branch: 1 branch
BranchTrueFalseTotal
if $B::C::verbose 0 0 0
6208 0 $init->add( "GvSVn( $sym ) = (SV*)$ref;");
6209  
6210 0 ▶ if ($PERL56) {
Branch: 1 branch
BranchTrueFalseTotal
if ($PERL56) { } 0 0 0
6211 # Pseudo FileHandle
6212 0 $init2->add_eval( sprintf 'open(%s, \'<\', $%s);', $globname, $globname );
6213 } else { # force inclusion of PerlIO::scalar as it was loaded in BEGIN.
6214 0 $init2->add_eval( sprintf 'open(%s, \'<:scalar\', $%s);', $globname, $globname );
6215 # => eval_pv("open(main::DATA, '<:scalar', $main::DATA);",1); DATA being a ref to $data
6216 0 $init->pre_destruct( sprintf 'eval_pv("close %s;", 1);', $globname );
6217 0 $use_xsloader = 1; # layers are not detected as XSUB CV, so force it
6218 0 ▶ require PerlIO unless $savINC{'PerlIO.pm'};
Branch: 1 branch
BranchTrueFalseTotal
unless $B::C::savINC{"PerlIO.pm"} 0 0 0
6219 0 ▶ require PerlIO::scalar unless $savINC{'PerlIO/scalar.pm'};
Branch: 1 branch
BranchTrueFalseTotal
unless $B::C::savINC{"PerlIO/scalar.pm"} 0 0 0
6220 0 mark_package("PerlIO", 1);
6221 0 $curINC{'PerlIO.pm'} = $INC{'PerlIO.pm'}; # as it was loaded from BEGIN
6222 0 mark_package("PerlIO::scalar", 1);
6223 0 $curINC{'PerlIO/scalar.pm'} = $INC{'PerlIO/scalar.pm'};
6224 0 $xsub{'PerlIO::scalar'} = 'Dynamic-'.$INC{'PerlIO/scalar.pm'}; # force dl_init boot
6225 }
6226 }
6227  
6228 0 ▶sub B::IO::save {
Subroutine save: not called CC=54 SCAR=80.0
6229 0 my ($io, $fullname, $is_DATA) = @_;
6230 0 my $sym = objsym($io);
6231 0 ▶ return $sym if defined $sym;
Branch: 1 branch
BranchTrueFalseTotal
if defined $sym 0 0 0
6232 0 my $pv = $io->PV;
6233 0 ▶ $pv = '' unless defined $pv;
Branch: 1 branch
BranchTrueFalseTotal
unless defined $pv 0 0 0
6234 0 my ( $pvsym, $len, $cur );
6235 0 ▶ if ($pv) {
Branch: 1 branch
BranchTrueFalseTotal
if ($pv) { } 0 0 0
6236 0 $pvsym = savepv($pv);
6237 0 $cur = $io->CUR;
6238 } else {
6239 0 $pvsym = 'NULL';
6240 0 $cur = 0;
6241 }
6242 0 ▶ if ($cur) {
Branch: 1 branch
BranchTrueFalseTotal
if ($cur) { } 0 0 0
6243 0 $len = $cur + 1;
6244 0 ▶ $len++ if IsCOW($io) and !$B::C::cow;
Branch: 1 branch
BranchTrueFalseTotal
if IsCOW($io) and not $B::C::cow 0 0 0
Condition0%0/3
IsCOW($io) and not $B::C::cow
!ll&&!rl&&r
000
MC/DC0%0/2
IsCOW($io) and not $B::C::cow
IsCOW($io) not $B::C::cow
Truth table0%0/3
A and not(B)
A= IsCOW($io)B= not $B::C::cow
ABresult
0X0
100
111
6245 } else {
6246 0 $len = 0;
6247 }
6248 warn sprintf( "IO $fullname sv_list[%d] 0x%x (%s) = '%s'\n", $svsect->index+1, $$io, $io->SvTYPE, $pv )
6249 0 ▶ if $debug{sv} and $] > 5.008; # no method "SvTYPE" via package "B::IO"
Branch: 1 branch
BranchTrueFalseTotal
if $B::C::debug{"sv"} and $] > "5.008" 0 0 0
Condition0%0/3
$B::C::debug{"sv"} and $] > "5.008"
!ll&&!rl&&r
000
MC/DC0%0/2
$B::C::debug{"sv"} and $] > "5.008"
$B::C::debug{"sv"} $] > "5.008"
Truth table0%0/3
A and B
A= $B::C::debug{"sv"}B= $] > "5.008"
ABresult
0X0
100
111
6250 0 ▶ if ($PERL514) {
Branch: 3 branches
BranchTrueFalseTotal
if ($PERL514) { } 0 0 0
elsif ($] > 5.011) { } 0 0 0
elsif ($PERL510) { } 0 0 0
6251 # IFP in sv.sv_u.svu_fp
6252 0 $xpviosect->comment("STASH, xmg_u, cur, len, xiv_u, xio_ofp, xio_dirpu, page, page_len, ..., type, flags");
6253 0 my $tmpl = "Nullhv, /*STASH later*/\n\t{0}, /*MAGIC later*/\n\t%u, /*cur*/\n\t%u, /*len*/\n\t{%d}, /*LINES*/\n\t0, /*OFP later*/\n\t{0}, /*dirp_u later*/\n\t%d, /*PAGE*/\n\t%d, /*PAGE_LEN*/\n\t%d, /*LINES_LEFT*/\n\t%s, /*TOP_NAME*/\n\tNullgv, /*top_gv later*/\n\t%s, /*fmt_name*/\n\tNullgv, /*fmt_gv later*/\n\t%s, /*bottom_name*/\n\tNullgv, /*bottom_gv later*/\n\t%s, /*type*/\n\t0x%x /*flags*/";
6254 0 ▶ $tmpl =~ s{ /\*.+?\*/\n\t}{}g unless $verbose;
Branch: 1 branch
BranchTrueFalseTotal
unless $B::C::verbose 0 0 0
6255 0 ▶ $tmpl =~ s{ /\*flags\*/$}{} unless $verbose;
Branch: 1 branch
BranchTrueFalseTotal
unless $B::C::verbose 0 0 0
6256 0 $xpviosect->add(
6257 sprintf($tmpl,
6258 $cur, $len,
6259 $io->LINES, # moved to IVX with 5.11.1
6260 $io->PAGE, $io->PAGE_LEN,
6261 $io->LINES_LEFT, "NULL",
6262 "NULL", "NULL",
6263 cchar( $io->IoTYPE ), $io->IoFLAGS
6264 )
6265 );
6266 0 ▶ $svsect->add(sprintf("&xpvio_list[%d], $u32fmt, 0x%x, {%s}",
Branch: 1 branch
BranchTrueFalseTotal
$B::C::pv_copy_on_grow ? : 0 0 0
6267 $xpviosect->index, $io->REFCNT, $io->FLAGS,
6268 $B::C::pv_copy_on_grow ? $pvsym : 0));
6269 }
6270 elsif ($] > 5.011000) {
6271 0 $xpviosect->comment("xnv_u, cur, len, lines, xmg_u, xmg_stash, xio_ifp, xio_ofp, xio_dirpu, ..., type, flags");
6272 0 my $tmpl = "{0}, /*xnv_u*/\n\t%u, /*cur*/\n\t%u, /*len*/\n\t{%d}, /*LINES*/\n\t{0}, /*MAGIC later*/\n\t(HV*)NULL, /*STASH later*/\n\t0, /*IFP later*/\n\t0, /*OFP later*/\n\t{0}, /*dirp_u later*/\n\t%d, /*PAGE*/\n\t%d, /*PAGE_LEN*/\n\t%d, /*LINES_LEFT*/\n\t%s, /*TOP_NAME*/\n\tNullgv, /*top_gv later*/\n\t%s, /*fmt_name*/\n\tNullgv, /*fmt_gv later*/\n\t%s, /*bottom_name*/\n\tNullgv, /*bottom_gv later*/\n\t%s, /*type*/\n\t0x%x /*flags*/";
6273 0 ▶ $tmpl =~ s{ /\*.+?\*/\n\t}{}g unless $verbose;
Branch: 1 branch
BranchTrueFalseTotal
unless $B::C::verbose 0 0 0
6274 0 ▶ $tmpl =~ s{ /\*flags\*/$}{} unless $verbose;
Branch: 1 branch
BranchTrueFalseTotal
unless $B::C::verbose 0 0 0
6275 0 $xpviosect->add(
6276 sprintf($tmpl,
6277 $cur, $len,
6278 $io->LINES, # moved to IVX with 5.11.1
6279 $io->PAGE, $io->PAGE_LEN,
6280 $io->LINES_LEFT, "NULL",
6281 "NULL", "NULL",
6282 cchar( $io->IoTYPE ), $io->IoFLAGS
6283 )
6284 );
6285 0 ▶ $svsect->add(sprintf("&xpvio_list[%d], $u32fmt, 0x%x, {%s}",
Branch: 1 branch
BranchTrueFalseTotal
$B::C::pv_copy_on_grow ? : 0 0 0
6286 $xpviosect->index, $io->REFCNT, $io->FLAGS,
6287 $B::C::pv_copy_on_grow ? $pvsym : 0));
6288 }
6289 elsif ($PERL510) {
6290 0 $xpviosect->comment("xnv_u, cur, len, xiv_u, xmg_u, xmg_stash, xio_ifp, xio_ofp, xio_dirpu, lines, ..., type, flags");
6291 0 my $tmpl = "{0}, /*xnv_u*/\n\t%u, /*cur*/\n\t%u, /*len*/\n\t{%ld}, /*IVX*/\n\t{0}, /*MAGIC later*/\n\t(HV*)NULL, /*STASH later*/\n\t0, /*IFP later*/\n\t0, /*OFP later*/\n\t{0}, /*dirp_u later*/\n\t%d, /*LINES*/\n\t%d, /*PAGE*/\n\t%d, /*PAGE_LEN*/\n\t%d, /*LINES_LEFT*/\n\t%s, /*TOP_NAME*/\n\tNullgv, /*top_gv later*/\n\t%s, /*fmt_name*/\n\tNullgv, /*fmt_gv later*/\n\t%s, /*bottom_name*/\n\tNullgv, /*bottom_gv later*/\n\t%s, /*type*/\n\t0x%x /*flags*/";
6292 0 ▶ $tmpl =~ s{ /\*[^\*]+?\*/\n\t}{}g unless $verbose;
Branch: 1 branch
BranchTrueFalseTotal
unless $B::C::verbose 0 0 0
6293 0 ▶ $tmpl =~ s{ /\*flags\*/$}{} unless $verbose;
Branch: 1 branch
BranchTrueFalseTotal
unless $B::C::verbose 0 0 0
6294 0 $xpviosect->add(
6295 sprintf($tmpl,
6296 $cur, $len,
6297 $io->IVX,
6298 $io->LINES,
6299 $io->PAGE, $io->PAGE_LEN,
6300 $io->LINES_LEFT, "NULL",
6301 "NULL", "NULL",
6302 cchar( $io->IoTYPE ), $io->IoFLAGS
6303 )
6304 );
6305 0 ▶ $svsect->add(sprintf("&xpvio_list[%d], $u32fmt, 0x%x, {%s}",
Branch: 1 branch
BranchTrueFalseTotal
$B::C::pv_copy_on_grow ? : 0 0 0
6306 $xpviosect->index, $io->REFCNT, $io->FLAGS,
6307 $B::C::pv_copy_on_grow ? $pvsym : 0));
6308 }
6309 else { # 5.6 and 5.8
6310 0 $xpviosect->comment("xpv_pv, cur, len, iv, nv, magic, stash, xio_ifp, xio_ofp, xio_dirpu, ..., subprocess, type, flags");
6311 0 $xpviosect->add(
6312 sprintf("%s, %u, %u, %ld, %s, 0, 0, 0, 0, {0}, %d, %d, %d, %d, %s, Nullgv, %s, Nullgv, %s, Nullgv, %d, %s, 0x%x",
6313 $pvsym, $cur, $len,
6314 $io->IVX, $io->NVX,
6315 $io->LINES, $io->PAGE,
6316 $io->PAGE_LEN, $io->LINES_LEFT,
6317 "NULL", "NULL",
6318 "NULL", $io->SUBPROCESS,
6319 cchar( $io->IoTYPE ), $io->IoFLAGS
6320 )
6321 );
6322 0 $svsect->add(sprintf("&xpvio_list[%d], $u32fmt, 0x%x",
6323 $xpviosect->index, $io->REFCNT, $io->FLAGS));
6324 }
6325 0 ▶ $svsect->debug($fullname, $io->flagspv) if $debug{flags};
Branch: 1 branch
BranchTrueFalseTotal
if $B::C::debug{"flags"} 0 0 0
6326 0 $sym = savesym( $io, sprintf( "(IO*)&sv_list[%d]", $svsect->index ) );
6327  
6328 0 ▶ if ($PERL510 and !$B::C::pv_copy_on_grow and $cur) {
Branch: 1 branch
BranchTrueFalseTotal
if ($PERL510 and not $B::C::pv_copy_on_grow and $cur) 0 0 0
Condition0%0/6
$PERL510 and not $B::C::pv_copy_on_grow and $cur
!ll&&!rl&&r
000
$PERL510 and not $B::C::pv_copy_on_grow
!ll&&!rl&&r
000
MC/DC0%0/3
$PERL510 and not $B::C::pv_copy_on_grow and $cur
$PERL510 not $B::C::pv_copy_on_grow $cur
Truth table0%0/4
A and not(B) and C
A= $PERL510B= not $B::C::pv_copy_on_growC= $cur
ABCresult
0XX0
10X0
1100
1111
6329 0 $init->add(sprintf("SvPVX(sv_list[%d]) = %s;", $svsect->index, $pvsym));
6330 }
6331 0 my ( $field );
6332 0 foreach $field (qw(TOP_GV FMT_GV BOTTOM_GV)) {
6333 0 my $fsym = $io->$field();
6334 0 ▶ if ($$fsym) {
Branch: 1 branch
BranchTrueFalseTotal
if ($$fsym) 0 0 0
6335 0 $init->add( sprintf( "Io%s(%s) = (GV*)s\\_%x;", $field, $sym, $$fsym ) );
6336 0 $fsym->save;
6337 }
6338 }
6339 0 foreach $field (qw(TOP_NAME FMT_NAME BOTTOM_NAME)) {
6340 0 my $fsym = $io->$field;
6341 0 ▶ $init->add(sprintf("Io%s(%s) = savepvn(%s, %u);", $field, $sym,
Branch: 1 branch
BranchTrueFalseTotal
if $fsym 0 0 0
6342 cstring( $fsym ), length $fsym)) if $fsym;
6343 }
6344 0 $io->save_magic($fullname); # This handle the stash also (we need to inc the refcnt)
6345 0 ▶ if (!$PERL56 and !$is_DATA) { # PerlIO
Branch: 1 branch
BranchTrueFalseTotal
unless ($PERL56 or $is_DATA) 0 0 0
Condition0%0/3
$PERL56 or $is_DATA
l!l&&r!l&&!r
000
MC/DC0%0/2
$PERL56 or $is_DATA
$PERL56 $is_DATA
Truth table0%0/3
A or B
A= $PERL56B= $is_DATA
ABresult
1X1
011
000
6346 # deal with $x = *STDIN/STDOUT/STDERR{IO} and aliases
6347 0 my $perlio_func;
6348 # Note: all single-direction fp use IFP, just bi-directional pipes and
6349 # sockets use OFP also. But we need to set both, pp_print checks OFP.
6350 0 my $o = $io->object_2svref();
6351 0 eval "require ".ref($o).";";
6352 0 my $fd = $o->fileno();
6353 # use IO::Handle ();
6354 # my $fd = IO::Handle::fileno($o);
6355 0 my $i = 0;
6356 0 foreach (qw(stdin stdout stderr)) {
6357 0 ▶ if ($io->IsSTD($_) or (defined($fd) and $fd == -$i)) {
Branch: 1 branch
BranchTrueFalseTotal
if ($io->IsSTD($_) or defined $fd and $fd == -$i) 0 0 0
Condition0%0/6
$io->IsSTD($_) or defined $fd and $fd == -$i
l!l&&r!l&&!r
000
defined $fd and $fd == -$i
!ll&&!rl&&r
000
MC/DC0%0/3
$io->IsSTD($_) or defined $fd and $fd == -$i
$io->IsSTD($_) defined $fd $fd == -$i
Truth table0%0/4
A or B and C
A= $io->IsSTD($_)B= defined $fdC= $fd == -$i
ABCresult
1XX1
0111
00X0
0100
6358 0 $perlio_func = $_;
6359 }
6360 0 $i++;
6361 }
6362 0 ▶ if ($perlio_func) {
Branch: 1 branch
BranchTrueFalseTotal
if ($perlio_func) { } 0 0 0
6363 0 $init->add("IoIFP(${sym}) = IoOFP(${sym}) = PerlIO_${perlio_func}();");
6364 #if ($fd < 0) { # fd=-1 signals an error
6365 # XXX print may fail at flush == EOF, wrong init-time?
6366 #}
6367 } else {
6368 0 my $iotype = $io->IoTYPE;
6369 0 my $ioflags = $io->IoFLAGS;
6370 # If an IO handle was opened at BEGIN, we try to re-init it, based on fd and IoTYPE.
6371 # IOTYPE:
6372 # - STDIN/OUT HANDLE IoIOFP alias
6373 # I STDIN/OUT/ERR HANDLE IoIOFP alias
6374 # < read-only HANDLE fdopen
6375 # > write-only HANDLE if fd<3 or IGNORE warn and comment
6376 # a append HANDLE -"-
6377 # + read and write HANDLE fdopen
6378 # s socket DIE
6379 # | pipe DIE
6380 # # NUMERIC HANDLE fdopen
6381 # space closed IGNORE
6382 # \0 ex/closed? IGNORE
6383 0 ▶ if ($iotype eq "\c@" or $iotype eq " ") {
Branch: 3 branches
BranchTrueFalseTotal
if ($iotype eq "\000" or $iotype eq ' ') { } 0 0 0
elsif ($iotype =~ /[a>]/) { } 0 0 0
elsif ($iotype =~ /[<#\+]/) { } 0 0 0
Condition0%0/3
$iotype eq "\0" or $iotype eq " "
l!l&&r!l&&!r
000
MC/DC0%0/2
$iotype eq "\0" or $iotype eq " "
$iotype eq "\0" $iotype eq " "
Truth table0%0/3
A or B
A= $iotype eq "\0"B= $iotype eq " "
ABresult
1X1
011
000
6384 warn sprintf("Ignore closed IO Handle %s %s (%d)\n",
6385 cstring($iotype), $fullname, $ioflags)
6386 0 ▶ if $debug{gv};
Branch: 1 branch
BranchTrueFalseTotal
if $B::C::debug{"gv"} 0 0 0
6387 }
6388 elsif ($iotype =~ /[a>]/) { # write-only
6389 0 ▶ warn "Warning: Write BEGIN-block $fullname to FileHandle $iotype \&$fd\n"
Branch: 1 branch
BranchTrueFalseTotal
if $fd >= 3 or $B::C::verbose 0 0 0
Condition0%0/3
$fd >= 3 or $B::C::verbose
l!l&&r!l&&!r
000
MC/DC0%0/2
$fd >= 3 or $B::C::verbose
$fd >= 3 $B::C::verbose
Truth table0%0/3
A or B
A= $fd >= 3B= $B::C::verbose
ABresult
1X1
011
000
6390 if $fd >= 3 or $verbose;
6391 0 ▶ my $mode = $iotype eq '>' ? 'w' : 'a';
Branch: 1 branch
BranchTrueFalseTotal
$iotype eq '>' ? : 0 0 0
6392 #$init->add( sprintf("IoIFP($sym) = IoOFP($sym) = PerlIO_openn(aTHX_ NULL,%s,%d,0,0,NULL,0,NULL);",
6393 # cstring($mode), $fd));
6394 0 ▶ $init->add(sprintf( "%sIoIFP(%s) = IoOFP(%s) = PerlIO_fdopen(%d, %s);%s",
Branch: 2 branches
BranchTrueFalseTotal
$fd < 3 ? : 0 0 0
$fd < 3 ? : 0 0 0
6395 $fd<3?'':'/*', $sym, $sym, $fd, cstring($mode), $fd<3?'':'*/'));
6396 }
6397 elsif ($iotype =~ /[<#\+]/) {
6398 # skips warning if it's one of our PerlIO::scalar __DATA__ handles
6399 0 ▶ warn "Warning: Read BEGIN-block $fullname from FileHandle $iotype \&$fd\n"
Branch: 1 branch
BranchTrueFalseTotal
if $fd >= 3 or $B::C::verbose 0 0 0
Condition0%0/3
$fd >= 3 or $B::C::verbose
l!l&&r!l&&!r
000
MC/DC0%0/2
$fd >= 3 or $B::C::verbose
$fd >= 3 $B::C::verbose
Truth table0%0/3
A or B
A= $fd >= 3B= $B::C::verbose
ABresult
1X1
011
000
6400 if $fd >= 3 or $verbose; # need to setup it up before
6401 0 $init->add("/* XXX WARNING: Read BEGIN-block $fullname from FileHandle */",
6402 "IoIFP($sym) = IoOFP($sym) = PerlIO_fdopen($fd, \"r\");");
6403 0 my $tell;
6404 0 ▶ if ($io->can("tell") and $tell = $io->tell()) {
Branch: 1 branch
BranchTrueFalseTotal
if ($io->can("tell") and $tell = $io->tell) 0 0 0
Condition0%0/3
$io->can("tell") and $tell = $io->tell
!ll&&!rl&&r
000
MC/DC0%0/2
$io->can("tell") and $tell = $io->tell
$io->can("tell") $tell = $io->tell
Truth table0%0/3
A and B
A= $io->can("tell")B= $tell = $io->tell
ABresult
0X0
100
111
6405 0 $init->add("PerlIO_seek(IoIFP($sym), $tell, SEEK_SET);")
6406 }
6407 } else {
6408 # XXX We should really die here
6409 0 warn sprintf("ERROR: Unhandled BEGIN-block IO Handle %s\&%d (%d) from %s\n",
6410 cstring($iotype), $fd, $ioflags, $fullname);
6411 0 $init->add("/* XXX WARNING: Unhandled BEGIN-block IO Handle ",
6412 "IoTYPE=$iotype SYMBOL=$fullname, IoFLAGS=$ioflags */",
6413 "IoIFP($sym) = IoOFP($sym) = PerlIO_fdopen($fd, \"$iotype\");");
6414 }
6415 }
6416 }
6417  
6418 0 ▶ if ( $PERL518 ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($PERL518) 0 0 0
6419 0 my $stash = $io->SvSTASH;
6420 0 ▶ if ($stash and $$stash) {
Branch: 1 branch
BranchTrueFalseTotal
if ($stash and $$stash) 0 0 0
Condition0%0/3
$stash and $$stash
!ll&&!rl&&r
000
MC/DC0%0/2
$stash and $$stash
$stash $$stash
Truth table0%0/3
A and B
A= $stashB= $$stash
ABresult
0X0
100
111
6421 0 my $stsym = $stash->save("%".$stash->NAME);
6422 0 $init->add(
6423 sprintf( "SvREFCNT(%s) += 1;", $stsym ),
6424 sprintf( "SvSTASH_set(%s, %s);", $sym, $stsym )
6425 );
6426 warn sprintf( "done saving STASH %s %s for IO %s\n", $stash->NAME, $stsym, $sym )
6427 0 ▶ if $debug{gv};
Branch: 1 branch
BranchTrueFalseTotal
if $B::C::debug{"gv"} 0 0 0
6428 }
6429 }
6430  
6431 0 return $sym;
6432 }
6433  
6434 0 ▶sub B::SV::save {
Subroutine save: not called CC=2 SCAR=17.9
6435 0 my $sv = shift;
6436  
6437 # This is where we catch an honest-to-goodness Nullsv (which gets
6438 # blessed into B::SV explicitly) and any stray erroneous SVs.
6439 0 ▶ return 0 unless $$sv;
Branch: 1 branch
BranchTrueFalseTotal
unless $$sv 0 0 0
6440 0 warn sprintf( "cannot save that type of SV: %s (0x%x)\n", B::class($sv), $$sv );
6441 }
6442  
6443 0 ▶sub output_all {
Subroutine output_all: not called CC=57 SCAR=81.0
Pod undocumented
6444 0 my $init_name = shift;
6445 0 my $section;
6446 0 ▶ return if $check;
Branch: 1 branch
BranchTrueFalseTotal
if $B::C::check 0 0 0
6447  
6448 0 my @sections =
6449 (
6450 $copsect, $opsect, $unopsect, $binopsect, $logopsect, $condopsect,
6451 $listopsect, $pmopsect, $svopsect, $padopsect, $pvopsect, $loopsect,
6452 $methopsect, $unopauxsect,
6453 $xpvsect, $xpvavsect, $xpvhvsect, $xpvcvsect, $padlistsect,
6454 $padnlsect, $xpvivsect, $xpvuvsect, $xpvnvsect, $xpvmgsect, $xpvlvsect,
6455 $xrvsect, $xpvbmsect, $xpviosect, $svsect, $padnamesect,
6456 );
6457 0 ▶ if ($PERL522) {
Branch: 1 branch
BranchTrueFalseTotal
if ($PERL522) 0 0 0
6458 0 pop @sections;
6459 0 for my $n (sort keys %padnamesect) {
6460 0 push @sections, $padnamesect{$n};
6461 }
6462 }
6463 0 ▶ if ($CPERL52) {
Branch: 1 branch
BranchTrueFalseTotal
if ($CPERL52) 0 0 0
6464 0 for my $n (sort keys %avcowsect) {
6465 0 push @sections, $avcowsect{$n};
6466 }
6467 0 for my $n (sort keys %avcogsect) {
6468 0 push @sections, $avcogsect{$n};
6469 }
6470 }
6471 0 ▶ printf "\t/* %s */", $symsect->comment if $symsect->comment and $verbose;
Branch: 1 branch
BranchTrueFalseTotal
if $symsect->comment and $B::C::verbose 0 0 0
Condition0%0/3
$symsect->comment and $B::C::verbose
!ll&&!rl&&r
000
MC/DC0%0/2
$symsect->comment and $B::C::verbose
$symsect->comment $B::C::verbose
Truth table0%0/3
A and B
A= $symsect->commentB= $B::C::verbose
ABresult
0X0
100
111
6472 0 $symsect->output( \*STDOUT, "#define %s\n" );
6473 0 print "\n";
6474 0 output_declarations();
6475 # XXX add debug versions with ix=opindex if $debug{flags}
6476 0 foreach $section (@sections) {
6477 0 my $lines = $section->index + 1;
6478 0 ▶ if ($lines) {
Branch: 1 branch
BranchTrueFalseTotal
if ($lines) 0 0 0
6479 0 my $name = $section->name;
6480 0 my $typename = $section->typename;
6481 # static SV** arrays for AvSTATIC, HvSTATIC, ...
6482 0 ▶ if ($typename eq 'SV*' and $name =~ /^(?:avco[gw])_(\d+)$/) {
Branch: 1 branch
BranchTrueFalseTotal
if ($typename eq 'SV*' and $name =~ /^(?:avco[gw])_(\d+)$/) { } 0 0 0
Condition0%0/3
$typename eq "SV*" and $name =~ /^(?:avco[gw])_(\d+)$/
!ll&&!rl&&r
000
MC/DC0%0/2
$typename eq "SV*" and $name =~ /^(?:avco[gw])_(\d+)$/
$typename eq "SV*" $name =~ /^(?:avco[gw])_(\d+)$/
Truth table0%0/3
A and B
A= $typename eq "SV*"B= $name =~ /^(?:avco[gw])_(\d+)$/
ABresult
0X0
100
111
6483 0 my $n = $1;
6484 0 ▶ $typename = 'const SV*' if $name =~ /^avcow_/;
Branch: 1 branch
BranchTrueFalseTotal
if $name =~ /^avcow_/ 0 0 0
6485 0 print "Static $typename ${name}_list[$lines][$n];\n";
6486 } else {
6487 0 print "Static $typename ${name}_list[$lines];\n";
6488 }
6489 }
6490 }
6491 # avoid stack allocation of the cur_env chain, esp. for CC. use only one global PL_top_env
6492 0 print "dJMPENV;\n";
6493 # hack for when Perl accesses PVX of GVs
6494 0 print 'Static const char emptystring[] = "\0";',"\n";
6495 # newXS for core XS needs a filename
6496 0 print 'Static const char xsfile[] = "universal.c";',"\n";
6497 0 ▶ if ($MULTI) {
Branch: 1 branch
BranchTrueFalseTotal
if ($MULTI) { } 0 0 0
6498 0 print "#define ptr_undef 0\n";
6499 } else {
6500 0 ▶ if ($] > 5.01903) {
Branch: 1 branch
BranchTrueFalseTotal
if ($] > 5.01903) { } 0 0 0
6501 0 print "#define ptr_undef NULL\n";
6502 } else {
6503 0 print "#define ptr_undef &PL_sv_undef\n";
6504 }
6505 0 ▶ if ($PERL510) { # XXX const sv SIGSEGV
Branch: 1 branch
BranchTrueFalseTotal
if ($PERL510) 0 0 0
6506 0 print "#undef CopFILE_set\n";
6507 0 print "#define CopFILE_set(c,pv) CopFILEGV_set((c), gv_fetchfile(pv))\n";
6508 }
6509 }
6510 # print "#define MyPVX(sv) ".($] < 5.010 ? "SvPVX(sv)" : "((sv)->sv_u.svu_pv)")."\n";
6511 0 ▶ if ($] < 5.008008 ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($] < "5.008008") 0 0 0
6512 0 print <<'EOT';
6513 #ifndef SvSTASH_set
6514 # define SvSTASH_set(sv,hv) SvSTASH((sv)) = (hv)
6515 #endif
6516 #ifndef Newxz
6517 # define Newxz(v,n,t) Newz(0,v,n,t)
6518 #endif
6519 EOT
6520 }
6521 0 ▶ if ($] < 5.008009 ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($] < "5.008009") 0 0 0
6522 0 print <<'EOT';
6523 #ifndef SvREFCNT_inc_simple_NN
6524 # define SvREFCNT_inc_simple_NN(sv) (++SvREFCNT(sv), (SV*)(sv))
6525 #endif
6526 #ifndef STR_WITH_LEN
6527 #define STR_WITH_LEN(s) ("" s ""), (sizeof(s)-1)
6528 #endif
6529 EOT
6530 }
6531 0 ▶ if ($] < 5.013007 ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($] < "5.013007") 0 0 0
6532 0 print <<'EOT';
6533 #ifndef CvSTASH_set
6534 # define CvSTASH_set(cv,hv) CvSTASH((cv)) = (hv)
6535 #endif
6536 EOT
6537 }
6538 0 ▶ if ($] < 5.013010 ) { # added with c43ae56ff9cd before 5.13.10 at 2011-01-21
Branch: 1 branch
BranchTrueFalseTotal
if ($] < "5.01301") 0 0 0
6539 0 print <<'EOT';
6540 #ifndef GvCV_set
6541 # define GvCV_set(gv,cv) (GvCV(gv) = (cv))
6542 #endif
6543 #ifndef GvGP_set
6544 # define GvGP_set(gv,gp) (GvGP(gv) = (gp))
6545 #endif
6546 EOT
6547 }
6548 0 ▶ if ($] >= 5.021005 and $] < 5.023) {
Branch: 1 branch
BranchTrueFalseTotal
if ($] >= "5.021005" and $] < "5.023") 0 0 0
Condition0%0/3
$] >= "5.021005" and $] < "5.023"
!ll&&!rl&&r
000
MC/DC0%0/2
$] >= "5.021005" and $] < "5.023"
$] >= "5.021005" $] < "5.023"
Truth table0%0/3
A and B
A= $] >= "5.021005"B= $] < "5.023"
ABresult
0X0
100
111
6549 0 print <<'EOT';
6550 /* PadlistNAMES broken as lvalue with v5.21.6-197-g0f94cb1,
6551 fixed with 5.22.1 and 5.23.0 */
6552 #if (PERL_VERSION == 22) || ( PERL_VERSION == 21 && PERL_SUBVERSION > 5)
6553 # undef PadlistNAMES
6554 # define PadlistNAMES(pl) *((PADNAMELIST **)PadlistARRAY(pl))
6555 #endif
6556 EOT
6557 }
6558 # handy accessors only in cperl for now:
6559 0 print <<'EOT';
6560 #ifndef get_svs
6561 # define get_svs(str, flags) get_sv((str), (flags))
6562 # define get_avs(str, flags) get_av((str), (flags))
6563 # define get_hvs(str, flags) get_hv((str), (flags))
6564 #endif
6565 EOT
6566 0 ▶ if (%init2_remap and !$HAVE_DLFCN_DLOPEN) {
Branch: 1 branch
BranchTrueFalseTotal
if (%init2_remap and not $HAVE_DLFCN_DLOPEN) 0 0 0
Condition0%0/3
%init2_remap and not $HAVE_DLFCN_DLOPEN
!ll&&!rl&&r
000
MC/DC0%0/2
%init2_remap and not $HAVE_DLFCN_DLOPEN
%init2_remap not $HAVE_DLFCN_DLOPEN
Truth table0%0/3
A and not(B)
A= %init2_remapB= not $HAVE_DLFCN_DLOPEN
ABresult
0X0
100
111
6567 0 print <<'EOT';
6568 XS(XS_DynaLoader_dl_load_file);
6569 XS(XS_DynaLoader_dl_find_symbol);
6570 EOT
6571 }
6572 0 ▶ printf "\t/* %s */\n", $decl->comment if $decl->comment and $verbose;
Branch: 1 branch
BranchTrueFalseTotal
if $decl->comment and $B::C::verbose 0 0 0
Condition0%0/3
$decl->comment and $B::C::verbose
!ll&&!rl&&r
000
MC/DC0%0/2
$decl->comment and $B::C::verbose
$decl->comment $B::C::verbose
Truth table0%0/3
A and B
A= $decl->commentB= $B::C::verbose
ABresult
0X0
100
111
6573 0 $decl->output( \*STDOUT, "%s\n" );
6574 0 print "\n";
6575  
6576 0 foreach $section (@sections) {
6577 0 my $lines = $section->index + 1;
6578 0 ▶ if ($lines) {
Branch: 1 branch
BranchTrueFalseTotal
if ($lines) 0 0 0
6579 0 my $name = $section->name;
6580 0 my $typename = $section->typename;
6581 # static SV** arrays for AvSTATIC, HvSTATIC, ...
6582 0 ▶ if ($typename eq 'SV*' and $name =~ /^(?:avco[wg])_(\d+)$/) {
Branch: 1 branch
BranchTrueFalseTotal
if ($typename eq 'SV*' and $name =~ /^(?:avco[wg])_(\d+)$/) { } 0 0 0
Condition0%0/3
$typename eq "SV*" and $name =~ /^(?:avco[wg])_(\d+)$/
!ll&&!rl&&r
000
MC/DC0%0/2
$typename eq "SV*" and $name =~ /^(?:avco[wg])_(\d+)$/
$typename eq "SV*" $name =~ /^(?:avco[wg])_(\d+)$/
Truth table0%0/3
A and B
A= $typename eq "SV*"B= $name =~ /^(?:avco[wg])_(\d+)$/
ABresult
0X0
100
111
6583 0 my $n = $1;
6584 0 ▶ $typename = 'const SV*' if $name =~ /^avcow_/;
Branch: 1 branch
BranchTrueFalseTotal
if $name =~ /^avcow_/ 0 0 0
6585 0 printf "Static %s %s_list[%u][%u] = {\n", $typename, $name, $lines, $n;
6586 } else {
6587 0 printf "Static %s %s_list[%u] = {\n", $typename, $name, $lines;
6588 }
6589 0 ▶ printf "\t/* %s */\n", $section->comment
Branch: 1 branch
BranchTrueFalseTotal
if $section->comment and $B::C::verbose 0 0 0
Condition0%0/3
$section->comment and $B::C::verbose
!ll&&!rl&&r
000
MC/DC0%0/2
$section->comment and $B::C::verbose
$section->comment $B::C::verbose
Truth table0%0/3
A and B
A= $section->commentB= $B::C::verbose
ABresult
0X0
100
111
6590 if $section->comment and $verbose;
6591 0 $section->output( \*STDOUT, "\t{ %s }, /* %s_list[%d] %s */%s\n" );
6592 0 print "};\n\n";
6593 }
6594 }
6595  
6596 0 output_functions();
6597 0 fixup_ppaddr();
6598 0 print "static void perl_init0(pTHX) /* fixup_ppaddr */\n{\n\t";
6599 0 ▶ print "dVAR; register int i;\n" if @{ $init0->[-1]{values} };
Branch: 1 branch
BranchTrueFalseTotal
if @{$init0->[-1]{"values"};} 0 0 0
6600 0 $init0->output( \*STDOUT, "\t%s\n" );
6601 0 print "};\n\n";
6602  
6603 0 ▶ printf "\t/* %s */\n", $init->comment if $init->comment and $verbose;
Branch: 1 branch
BranchTrueFalseTotal
if $init->comment and $B::C::verbose 0 0 0
Condition0%0/3
$init->comment and $B::C::verbose
!ll&&!rl&&r
000
MC/DC0%0/2
$init->comment and $B::C::verbose
$init->comment $B::C::verbose
Truth table0%0/3
A and B
A= $init->commentB= $B::C::verbose
ABresult
0X0
100
111
6604 0 $init->output( \*STDOUT, "\t%s\n", $init_name );
6605 0 ▶ printf "/* deferred init1 of regexp */\n" if $verbose;
Branch: 1 branch
BranchTrueFalseTotal
if $B::C::verbose 0 0 0
6606 0 ▶ printf "/* %s */\n", $init1->comment if $init1->comment and $verbose;
Branch: 1 branch
BranchTrueFalseTotal
if $init1->comment and $B::C::verbose 0 0 0
Condition0%0/3
$init1->comment and $B::C::verbose
!ll&&!rl&&r
000
MC/DC0%0/2
$init1->comment and $B::C::verbose
$init1->comment $B::C::verbose
Truth table0%0/3
A and B
A= $init1->commentB= $B::C::verbose
ABresult
0X0
100
111
6607 0 $init1->output( \*STDOUT, "\t%s\n", 'perl_init1' );
6608 0 my $init2_name = 'perl_init2';
6609 0 ▶ printf "/* deferred init of XS/Dyna loaded modules */\n" if $verbose;
Branch: 1 branch
BranchTrueFalseTotal
if $B::C::verbose 0 0 0
6610 0 ▶ printf "/* %s */\n", $init2->comment if $init2->comment and $verbose;
Branch: 1 branch
BranchTrueFalseTotal
if $init2->comment and $B::C::verbose 0 0 0
Condition0%0/3
$init2->comment and $B::C::verbose
!ll&&!rl&&r
000
MC/DC0%0/2
$init2->comment and $B::C::verbose
$init2->comment $B::C::verbose
Truth table0%0/3
A and B
A= $init2->commentB= $B::C::verbose
ABresult
0X0
100
111
6611 0 my $remap = 0;
6612 0 for my $pkg (sort keys %init2_remap) {
6613 0 ▶ if (exists $xsub{$pkg}) { # check if not removed in between
Branch: 1 branch
BranchTrueFalseTotal
if (exists $xsub{$pkg}) 0 0 0
6614 0 my ($stashfile) = $xsub{$pkg} =~ /^Dynamic-(.+)$/;
6615 # get so file from pm. Note: could switch prefix from vendor/site//
6616 0 ▶ if ($stashfile) {
Branch: 1 branch
BranchTrueFalseTotal
if ($stashfile) 0 0 0
6617 0 $init2_remap{$pkg}{FILE} = dl_module_to_sofile($pkg, $stashfile);
6618 0 $remap++;
6619 }
6620 }
6621 }
6622 0 ▶ if ($remap) {
Branch: 1 branch
BranchTrueFalseTotal
if ($remap) 0 0 0
6623 # XXX now emit arch-specific dlsym code
6624 0 $init2->no_split;
6625 0 $init2->add("{");
6626 0 ▶ if ($HAVE_DLFCN_DLOPEN) {
Branch: 1 branch
BranchTrueFalseTotal
if ($HAVE_DLFCN_DLOPEN) { } 0 0 0
6627 0 $init2->add(" #include <dlfcn.h>");
6628 0 $init2->add(" void *handle;");
6629 } else {
6630 0 $init2->add(" void *handle;");
6631 0 $init2->add(" dTARG; dSP;",
6632 " targ=sv_newmortal();");
6633 }
6634 0 for my $pkg (sort keys %init2_remap) {
6635 0 ▶ if (exists $xsub{$pkg}) {
Branch: 1 branch
BranchTrueFalseTotal
if (exists $xsub{$pkg}) 0 0 0
6636 0 ▶ if ($HAVE_DLFCN_DLOPEN) {
Branch: 1 branch
BranchTrueFalseTotal
if ($HAVE_DLFCN_DLOPEN) { } 0 0 0
6637 0 my $ldopt = 'RTLD_NOW|RTLD_NOLOAD';
6638 0 ▶ $ldopt = 'RTLD_NOW' if $Config{osname} =~ /bsd/i; # 351 (only on solaris and linux, not any bsd)
Branch: 1 branch
BranchTrueFalseTotal
if $B::C::Config{"osname"} =~ /bsd/i 0 0 0
6639 0 $init2->add( "", sprintf(" handle = dlopen(%s, %s);", cstring($init2_remap{$pkg}{FILE}), $ldopt));
6640 }
6641 else {
6642 $init2->add(" PUSHMARK(SP);",
6643 0 sprintf(" XPUSHs(newSVpvs(%s));", cstring($init2_remap{$pkg}{FILE})),
6644 " PUTBACK;",
6645 " XS_DynaLoader_dl_load_file(aTHX_ NULL);",
6646 " SPAGAIN;",
6647 " handle = INT2PTR(void*,POPi);",
6648 " PUTBACK;",
6649 );
6650 }
6651 0 for my $mg (@{$init2_remap{$pkg}{MG}}) {
6652 0 ▶ warn "init2 remap xpvmg_list[$mg->{ID}].xiv_iv to dlsym of $pkg\: $mg->{NAME}\n"
Branch: 1 branch
BranchTrueFalseTotal
if $B::C::verbose 0 0 0
6653 if $verbose;
6654 0 ▶ if ($HAVE_DLFCN_DLOPEN) {
Branch: 1 branch
BranchTrueFalseTotal
if ($HAVE_DLFCN_DLOPEN) { } 0 0 0
6655 $init2->add(sprintf(" xpvmg_list[%d].xiv_iv = PTR2IV( dlsym(handle, %s) );",
6656 0 $mg->{ID}, cstring($mg->{NAME})));
6657 } else {
6658 $init2->add(" PUSHMARK(SP);",
6659 " XPUSHi(PTR2IV(handle));",
6660 sprintf(" XPUSHs(newSVpvs(%s));", cstring($mg->{NAME})),
6661 " PUTBACK;",
6662 " XS_DynaLoader_dl_find_symbol(aTHX_ NULL);",
6663 " SPAGAIN;",
6664 0 sprintf(" xpvmg_list[%d].xiv_iv = POPi;", $mg->{ID}),
6665 " PUTBACK;",
6666 );
6667 }
6668 }
6669 }
6670 }
6671 0 $init2->add("}");
6672 0 $init2->split;
6673 }
6674 0 $init2->output( \*STDOUT, "\t%s\n", $init2_name );
6675 0 ▶ if ($verbose) {
Branch: 1 branch
BranchTrueFalseTotal
if ($B::C::verbose) 0 0 0
6676 0 my $caller = caller;
6677 0 ▶ warn $caller eq 'B::CC' ? B::CC::compile_stats() : compile_stats();
Branch: 1 branch
BranchTrueFalseTotal
$caller eq 'B::CC' ? : 0 0 0
6678 0 warn "NULLOP count: $nullop_count\n";
6679 }
6680 }
6681  
6682 0 ▶sub output_declarations {
Subroutine output_declarations: not called CC=19 SCAR=59.4
Pod undocumented
6683 0 print <<'EOT';
6684 #define UNUSED 0
6685 #define sym_0 0
6686  
6687 static void
6688 my_mg_RC_off(pTHX_ SV* sv, int type) {
6689 MAGIC *mg;
6690 for (mg = SvMAGIC(sv); mg; mg = mg->mg_moremagic) {
6691 if (mg->mg_type == type && (mg->mg_flags | MGf_REFCOUNTED))
6692 mg->mg_flags &= ~MGf_REFCOUNTED;
6693 }
6694 }
6695  
6696 EOT
6697 0 ▶ if ($PERL510 and IS_MSVC) {
Branch: 1 branch
BranchTrueFalseTotal
if ($PERL510 and &IS_MSVC()) 0 0 0
Condition0%0/3
$PERL510 and &IS_MSVC()
!ll&&!rl&&r
000
MC/DC0%0/2
$PERL510 and &IS_MSVC()
$PERL510 &IS_MSVC()
Truth table0%0/3
A and B
A= $PERL510B= &IS_MSVC()
ABresult
0X0
100
111
6698 # initializing char * differs in levels of indirection from int
6699 0 print "#pragma warning( disable : 4047 )\n";
6700 # targ: unreferenced local variable
6701 0 print "#pragma warning( disable : 4101 )\n";
6702 }
6703  
6704 # Need fresh re-hash of strtab. share_hek does not allow hash = 0
6705 0 ▶ if ( $PERL510 ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($PERL510) 0 0 0
6706 0 print <<'_EOT0';
6707 PERL_STATIC_INLINE HEK *
6708 my_share_hek( pTHX_ const char *str, I32 len );
6709 #undef share_hek
6710 #define share_hek(str, len) my_share_hek( aTHX_ str, len );
6711  
6712 PERL_STATIC_INLINE HEK *
6713 my_share_hek_0( pTHX_ const char *str, I32 len);
6714  
6715 #define HEK_HE(hek) \
6716 ((struct shared_he *)(((char *)(hek)) \
6717 - STRUCT_OFFSET(struct shared_he, \
6718 shared_he_hek)))
6719 #define HEK_shared_he(hek) \
6720 ((struct shared_he *)(((char *)(hek)) \
6721 - STRUCT_OFFSET(struct shared_he, \
6722 shared_he_hek))) \
6723 ->shared_he_he
6724  
6725 #define hek_hek_refcount(hek) \
6726 HEK_shared_he(hek).he_valu.hent_refcount
6727  
6728 #define unshare_hek_hek(hek) --(hek_hek_refcount(hek))
6729  
6730 _EOT0
6731  
6732 }
6733 0 ▶ if ($PERL522) {
Branch: 1 branch
BranchTrueFalseTotal
if ($PERL522) 0 0 0
6734 0 print <<'EOF';
6735 /* unfortunately we have to override this perl5.22 struct.
6736 The Padname string buffer in xpadn_str is pointed by xpadn_pv.
6737 */
6738 #define _PADNAME_BASE \
6739 char * xpadn_pv; \
6740 HV * xpadn_ourstash; \
6741 union { \
6742 HV * xpadn_typestash; \
6743 CV * xpadn_protocv; \
6744 } xpadn_type_u; \
6745 U32 xpadn_low; \
6746 U32 xpadn_high; \
6747 U32 xpadn_refcnt; \
6748 int xpadn_gen; \
6749 U8 xpadn_len; \
6750 U8 xpadn_flags
6751  
6752 #ifdef PERL_PADNAME_MINIMAL
6753 #define MY_PADNAME_BASE _PADNAME_BASE
6754 #else
6755 #define MY_PADNAME_BASE struct padname xpadn_padname
6756 #endif
6757  
6758 EOF
6759  
6760 0 for my $s (sort keys %padnamesect) {
6761 0 ▶ if ($padnamesect{$s}->index >= 0) {
Branch: 1 branch
BranchTrueFalseTotal
if ($padnamesect{$s}->index >= 0) 0 0 0
6762 0 print <<"EOF";
6763 struct my_padname_with_str_$s {
6764 MY_PADNAME_BASE;
6765 char xpadn_str[$s];
6766 };
6767 typedef struct my_padname_with_str_$s PADNAME_$s;
6768 EOF
6769 }
6770 }
6771 #} elsif ($PERL518) {
6772 # print "typedef PADNAME MyPADNAME;\n";
6773 }
6774 0 ▶ if ($PERL510 and !$PERL514) {
Branch: 1 branch
BranchTrueFalseTotal
if ($PERL510 and not $PERL514) 0 0 0
Condition0%0/3
$PERL510 and not $PERL514
!ll&&!rl&&r
000
MC/DC0%0/2
$PERL510 and not $PERL514
$PERL510 not $PERL514
Truth table0%0/3
A and not(B)
A= $PERL510B= not $PERL514
ABresult
0X0
100
111
6775 0 print "typedef struct refcounted_he COPHH;\n";
6776 0 print <<'EOF';
6777 #define cophh_store_pvn(cophh, keypv, keylen, hash, value, flags) \
6778 Perl_refcounted_he_new(aTHX_ cophh, newSVpvn_flags(keypv, keylen, flags), value)
6779 #define cophh_store_pvs(cophh, key, value, flags) \
6780 Perl_refcounted_he_new(aTHX_ cophh, Perl_newSVpvn_flags(aTHX_ STR_WITH_LEN(key), SVs_TEMP), value)
6781 #define CopHINTHASH_set(c,h) ((c)->cop_hints_hash = (h))
6782 EOF
6783 }
6784 0 ▶ if ($B::C::Config::have_HEK_STATIC) {
Branch: 1 branch
BranchTrueFalseTotal
if ($B::C::Config::have_HEK_STATIC) 0 0 0
6785 0 print "/* store full char[] to avoid excess elements in array\n";
6786 0 print " (HEK only declared as char[1]) */\n";
6787 0 print "struct hek_ptr { U32 hek_hash; I32 hek_len; char hek_key[]; };\n";
6788 }
6789 # Tricky hack for -fcog since 5.10 on !c99 compilers required. We need a char* as
6790 # *first* sv_u element to be able to statically initialize it. A int does not allow it.
6791 # gcc error: initializer element is not computable at load time
6792 # We introduce a SVPV as SV.
6793 # In core since 5.12
6794 0 ▶ if ($PERL510 and $] < 5.012 and !$C99) {
Branch: 1 branch
BranchTrueFalseTotal
if ($PERL510 and $] < "5.012" and not $C99) 0 0 0
Condition0%0/6
$PERL510 and $] < "5.012" and not $C99
!ll&&!rl&&r
000
$PERL510 and $] < "5.012"
!ll&&!rl&&r
000
MC/DC0%0/3
$PERL510 and $] < "5.012" and not $C99
$PERL510 $] < "5.012" not $C99
Truth table0%0/4
A and B and not(C)
A= $PERL510B= $] < "5.012"C= not $C99
ABCresult
0XX0
10X0
1100
1111
6795 0 print <<'EOT0';
6796 typedef struct svpv {
6797 void * sv_any;
6798 U32 sv_refcnt;
6799 U32 sv_flags;
6800 union {
6801 char* svu_pv;
6802 IV svu_iv;
6803 UV svu_uv;
6804 SV* svu_rv;
6805 SV** svu_array;
6806 HE** svu_hash;
6807 GP* svu_gp;
6808 } sv_u;
6809 #ifdef DEBUG_LEAKING_SCALARS
6810 PERL_BITFIELD32 sv_debug_optype:9;
6811 PERL_BITFIELD32 sv_debug_inpad:1;
6812 PERL_BITFIELD32 sv_debug_cloned:1;
6813 PERL_BITFIELD32 sv_debug_line:16;
6814 # if PERL_VERSION < 11
6815 U32 sv_debug_serial; /* 5.10 only */
6816 # endif
6817 # if PERL_VERSION > 8
6818 char * sv_debug_file;
6819 # endif
6820 #endif
6821 } SVPV;
6822 EOT0
6823  
6824 }
6825 0 ▶ if ($PERL512) {
Branch: 2 branches
BranchTrueFalseTotal
if ($PERL512) { } 0 0 0
elsif ($PERL510) { } 0 0 0
6826 0 print "typedef struct p5rx RE;\n";
6827 }
6828 elsif ($PERL510) {
6829 0 print "typedef SV * RE;\n";
6830 }
6831 else {
6832 0 print "typedef char * RE;\n";
6833 }
6834 0 ▶ if ($] == 5.010000) {
Branch: 1 branch
BranchTrueFalseTotal
if ($] == "5.01") 0 0 0
6835 0 print "#ifndef RX_EXTFLAGS\n";
6836 0 print "# define RX_EXTFLAGS(rx) ((rx)->extflags)\n";
6837 0 print "#endif\n";
6838 }
6839 0 ▶ if ($] >= 5.021001 and !$CPERL52) {
Branch: 1 branch
BranchTrueFalseTotal
if ($] >= "5.021001" and not $CPERL52) 0 0 0
Condition0%0/3
$] >= "5.021001" and not $CPERL52
!ll&&!rl&&r
000
MC/DC0%0/2
$] >= "5.021001" and not $CPERL52
$] >= "5.021001" not $CPERL52
Truth table0%0/3
A and not(B)
A= $] >= "5.021001"B= not $CPERL52
ABresult
0X0
100
111
6840 0 print "Static IV PL_sv_objcount = 0; /* deprecated with 5.21.1 but still needed and used */\n";
6841 }
6842 0 print "SV* sv;\n";
6843 0 ▶ print "Static GV *gv_list[$gv_index];\n" if $gv_index;
Branch: 1 branch
BranchTrueFalseTotal
if $gv_index 0 0 0
6844 }
6845  
6846 0 ▶sub output_boilerplate {
Subroutine output_boilerplate: not called CC=22 SCAR=62.3
Pod undocumented
6847 0 my $name = shift;
6848 0 ▶ $name = 'main' unless defined $name;
Branch: 1 branch
BranchTrueFalseTotal
unless defined $name 0 0 0
6849 0 my $creator = "created at ".scalar localtime()." with B::C $B::C::VERSION";
6850 0 ▶ $creator .= $B::C::REVISION if $B::C::REVISION;
Branch: 1 branch
BranchTrueFalseTotal
if $B::C::REVISION 0 0 0
6851 0 $creator .= " for $Config{perlpath}";
6852 0 ▶ $creator .= " for cross target $Config{archname}" if $cross;
Branch: 1 branch
BranchTrueFalseTotal
if $B::C::cross 0 0 0
6853 0 print "/* $creator */\n";
6854 # Store the sv_list index in sv_debug_file when debugging
6855 0 ▶ print "#define DEBUG_LEAKING_SCALARS 1\n" if $debug{flags} and $DEBUG_LEAKING_SCALARS;
Branch: 1 branch
BranchTrueFalseTotal
if $B::C::debug{"flags"} and $DEBUG_LEAKING_SCALARS 0 0 0
Condition0%0/3
$B::C::debug{"flags"} and $DEBUG_LEAKING_SCALARS
!ll&&!rl&&r
000
MC/DC0%0/2
$B::C::debug{"flags"} and $DEBUG_LEAKING_SCALARS
$B::C::debug{"flags"} $DEBUG_LEAKING_SCALARS
Truth table0%0/3
A and B
A= $B::C::debug{"flags"}B= $DEBUG_LEAKING_SCALARS
ABresult
0X0
100
111
6856 0 ▶ if ($B::C::Config::have_independent_comalloc) {
Branch: 1 branch
BranchTrueFalseTotal
if ($B::C::Config::have_independent_comalloc) 0 0 0
6857 0 print <<'_EOT1';
6858 #ifdef NEED_MALLOC_283
6859 # include "malloc-2.8.3.h"
6860 #endif
6861 _EOT1
6862  
6863 }
6864 0 print <<'_EOT2';
6865 #define PERL_CORE
6866 #include "EXTERN.h"
6867 #include "perl.h"
6868 #include "XSUB.h"
6869  
6870 /* Workaround for mapstart: the only op which needs a different ppaddr */
6871 #undef Perl_pp_mapstart
6872 #define Perl_pp_mapstart Perl_pp_grepstart
6873 #undef OP_MAPSTART
6874 #define OP_MAPSTART OP_GREPSTART
6875  
6876 #ifdef BROKEN_STATIC_REDECL
6877 #define Static extern
6878 #else
6879 #define Static static
6880 #endif /* BROKEN_STATIC_REDECL */
6881  
6882 #ifdef BROKEN_UNION_INIT
6883 #error BROKEN_UNION_INIT no longer needed, as Perl requires an ANSI compiler
6884 #endif
6885  
6886 /* No longer available when C<PERL_CORE> is defined. */
6887 #ifndef Nullsv
6888 # define Null(type) ((type)NULL)
6889 # define Nullsv Null(SV*)
6890 # define Nullhv Null(HV*)
6891 # define Nullgv Null(GV*)
6892 # define Nullop Null(OP*)
6893 #endif
6894 #ifndef GV_NOTQUAL
6895 # define GV_NOTQUAL 0
6896 #endif
6897 /* Since 5.8.8 */
6898 #ifndef Newx
6899 # define Newx(v,n,t) New(0,v,n,t)
6900 #endif
6901 /* Since 5.14 */
6902 #if !defined(PERL_STATIC_INLINE)
6903 # ifdef HAS_STATIC_INLINE
6904 # define PERL_STATIC_INLINE static inline
6905 # else
6906 # define PERL_STATIC_INLINE static
6907 # endif
6908 #endif
6909 /* cperl compat */
6910 #ifndef HEK_STATIC
6911 # define HEK_STATIC(hek) 0
6912 #endif
6913  
6914 #if defined(PERL_GLOBAL_STRUCT_PRIVATE)
6915 static struct perl_vars* my_plvarsp;
6916 struct perl_vars* Perl_GetVarsPrivate(void) { return my_plvarsp; }
6917 #endif
6918  
6919 _EOT2
6920  
6921 0 ▶ if ($] < 5.008008) {
Branch: 1 branch
BranchTrueFalseTotal
if ($] < "5.008008") 0 0 0
6922 0 print "#define GvSVn(s) GvSV(s)\n";
6923 }
6924  
6925 # XXX boot_DynaLoader is exported only >=5.8.9
6926 # does not compile on darwin with EXTERN_C declaration
6927 # See branch `boot_DynaLoader`
6928 0 print <<'_EOT4';
6929  
6930 #define XS_DynaLoader_boot_DynaLoader boot_DynaLoader
6931 EXTERN_C void boot_DynaLoader (pTHX_ CV* cv);
6932  
6933 static void xs_init (pTHX);
6934 static void dl_init (pTHX);
6935 _EOT4
6936  
6937 0 ▶ print <<'_EOT' if $CPERL51 and $^O ne 'MSWin32';
Branch: 1 branch
BranchTrueFalseTotal
if $CPERL51 and $^O ne "MSWin32" 0 0 0
Condition0%0/3
$CPERL51 and $^O ne "MSWin32"
!ll&&!rl&&r
000
MC/DC0%0/2
$CPERL51 and $^O ne "MSWin32"
$CPERL51 $^O ne "MSWin32"
Truth table0%0/3
A and B
A= $CPERL51B= $^O ne "MSWin32"
ABresult
0X0
100
111
6938 EXTERN_C void dl_boot (pTHX);
6939 _EOT
6940  
6941 0 ▶ if ($B::C::av_init2 and $B::C::Config::use_declare_independent_comalloc) {
Branch: 1 branch
BranchTrueFalseTotal
if ($B::C::av_init2 and $B::C::Config::use_declare_independent_comalloc) 0 0 0
Condition0%0/3
$B::C::av_init2 and $B::C::Config::use_declare_independent_comalloc
!ll&&!rl&&r
000
MC/DC0%0/2
$B::C::av_init2 and $B::C::Config::use_declare_independent_comalloc
$B::C::av_init2 $B::C::Config::use_declare_independent_comalloc
Truth table0%0/3
A and B
A= $B::C::av_init2B= $B::C::Config::use_declare_independent_comalloc
ABresult
0X0
100
111
6942 0 print "void** dlindependent_comalloc(size_t, size_t*, void**);\n";
6943 }
6944 0 ▶ if ($B::C::av_init2) {
Branch: 1 branch
BranchTrueFalseTotal
if ($B::C::av_init2) 0 0 0
6945 0 my $last = $xpvavsect->index;
6946 0 my $size = $last + 1;
6947 0 ▶ if ($last) {
Branch: 1 branch
BranchTrueFalseTotal
if ($last) 0 0 0
6948 0 $decl->add("Static void* avchunks[$size];");
6949 0 $decl->add("Static size_t avsizes[$size] = ");
6950 0 my $ptrsize = $Config{ptrsize};
6951 0 my $acc = "";
6952 0 for (0..$last) {
6953 0 ▶ if ($xpvav_sizes[$_] > 0) {
Branch: 1 branch
BranchTrueFalseTotal
if ($xpvav_sizes[$_] > 0) { } 0 0 0
6954 0 $acc .= $xpvav_sizes[$_] * $ptrsize;
6955 } else {
6956 0 $acc .= 3 * $ptrsize;
6957 }
6958 0 ▶ $acc .= "," if $_ != $last;
Branch: 1 branch
BranchTrueFalseTotal
if $_ != $last 0 0 0
6959 0 ▶ $acc .= "\n\t" unless ($_+1) % 30;
Branch: 1 branch
BranchTrueFalseTotal
unless ($_ + 1) % 30 0 0 0
6960 }
6961 0 $decl->add("\t{$acc};");
6962 0 $init->add_initav("if (!independent_comalloc( $size, avsizes, avchunks ))");
6963 0 $init->add_initav(" Perl_die(aTHX_ \"panic: AV alloc failed\");");
6964 }
6965 }
6966 # XXX boot_DynaLoader is exported only >=5.8.9
6967 # does not compile on darwin with EXTERN_C declaration
6968 # See branch `boot_DynaLoader`
6969 0 print <<'_EOT4';
6970 #define XS_DynaLoader_boot_DynaLoader boot_DynaLoader
6971 EXTERN_C void boot_DynaLoader (pTHX_ CV* cv);
6972  
6973 static void xs_init (pTHX);
6974 static void dl_init (pTHX);
6975  
6976 _EOT4
6977  
6978 0 ▶ print <<'_EOT' if $CPERL51;
Branch: 1 branch
BranchTrueFalseTotal
if $CPERL51 0 0 0
6979 EXTERN_C void dl_boot (pTHX);
6980 _EOT
6981  
6982 0 ▶ if ( !$B::C::destruct ) {
Branch: 1 branch
BranchTrueFalseTotal
if (not $B::C::destruct) { } 0 0 0
6983 0 print <<'_EOT4';
6984 static int fast_perl_destruct( PerlInterpreter *my_perl );
6985 static void my_curse( pTHX_ SV* const sv );
6986  
6987 #ifndef dVAR
6988 # if defined(PERL_GLOBAL_STRUCT) || defined(PERL_GLOBAL_STRUCT_PRIVATE)
6989 # define dVAR pVAR = (struct perl_vars*)PERL_GET_VARS()
6990 # else
6991 # define dVAR dNOOP
6992 # endif
6993 #endif
6994 _EOT4
6995  
6996 } else {
6997 0 ▶ if (defined $module and !$ITHREADS) {
Branch: 1 branch
BranchTrueFalseTotal
if (defined $B::C::module and not $ITHREADS) { } 0 0 0
Condition0%0/3
defined $B::C::module and not $ITHREADS
!ll&&!rl&&r
000
MC/DC0%0/2
defined $B::C::module and not $ITHREADS
defined $B::C::module not $ITHREADS
Truth table0%0/3
A and not(B)
A= defined $B::C::moduleB= not $ITHREADS
ABresult
0X0
100
111
6998 0 print "EXTERN_C void destruct_$name( );\n";
6999 } else {
7000 0 print "EXTERN_C void destruct_$name( PerlInterpreter *my_perl );\n";
7001 }
7002 }
7003 }
7004  
7005 0 ▶sub output_functions {
Subroutine output_functions: not called CC=8 SCAR=42.8
Pod undocumented
7006  
7007 0 ▶ if ($] < 5.008009) {
Branch: 1 branch
BranchTrueFalseTotal
if ($] < "5.008009") 0 0 0
7008 0 print <<'_EOT3';
7009  
7010 #ifndef savesharedpvn
7011 PERL_STATIC_INLINE char *savesharedpvn(const char *const s, const STRLEN len);
7012  
7013 PERL_STATIC_INLINE char *
7014 savesharedpvn(const char *const s, const STRLEN len) {
7015 char *const d = (char*)PerlMemShared_malloc(len + 1);
7016 if (!d) { exit(1); }
7017 d[len] = '\0';
7018 return (char *)memcpy(d, s, len);
7019 }
7020 #endif
7021 _EOT3
7022  
7023 }
7024  
7025 # Need fresh re-hash of strtab. share_hek does not allow hash = 0
7026 0 ▶ if ( $PERL510 ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($PERL510) 0 0 0
7027 0 print <<'_EOT7';
7028 /* The first assignment got already refcount bumped */
7029 PERL_STATIC_INLINE HEK *
7030 my_share_hek( pTHX_ const char *str, I32 len) {
7031 U32 hash;
7032 dVAR;
7033 PERL_HASH(hash, str, abs(len));
7034 return share_hek_hek(Perl_share_hek(aTHX_ str, len, hash));
7035 }
7036  
7037 _EOT7
7038 }
7039 0 ▶ if ( $PERL510 ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($PERL510) 0 0 0
7040 0 print <<'_EOT7';
7041 PERL_STATIC_INLINE HEK *
7042 my_share_hek_0( pTHX_ const char *str, I32 len) {
7043 U32 hash;
7044 dVAR;
7045 PERL_HASH(hash, str, abs(len));
7046 return Perl_share_hek(aTHX_ str, len, hash);
7047 }
7048  
7049 _EOT7
7050 }
7051  
7052 # -fno-destruct only >=5.8
7053 0 ▶ if ( !$module and !$B::C::destruct ) {
Branch: 1 branch
BranchTrueFalseTotal
if (not $B::C::module || $B::C::destruct) 0 0 0
Condition0%0/3
$B::C::module || $B::C::destruct
l!l&&r!l&&!r
000
MC/DC0%0/2
$B::C::module || $B::C::destruct
$B::C::module $B::C::destruct
Truth table0%0/3
A || B
A= $B::C::moduleB= $B::C::destruct
ABresult
1X1
011
000
7054 0 print <<'_EOT8';
7055  
7056 #ifndef SvDESTROYABLE
7057 #define SvDESTROYABLE(sv) 1
7058 #endif
7059 /* 5.8 */
7060 #ifndef CvISXSUB
7061 #define CvISXSUB(sv) CvXSUB(sv)
7062 #endif
7063 #ifndef SvRV_set
7064 #define SvRV_set(a,b) SvRV(a) = (b)
7065 #endif
7066 /* 5.6 */
7067 #ifndef PERL_EXIT_DESTRUCT_END
7068 #define PERL_EXIT_DESTRUCT_END 2
7069 #endif
7070  
7071 static void
7072 my_curse( pTHX_ SV* const sv ) {
7073 dSP;
7074 dVAR;
7075 HV* stash;
7076  
7077 #if PERL_VERSION > 7
7078 assert(SvOBJECT(sv));
7079 do {
7080 stash = SvSTASH(sv);
7081 assert(SvTYPE(stash) == SVt_PVHV);
7082 if (HvNAME(stash)) {
7083 CV* destructor = NULL;
7084 if (!SvOBJECT(stash)) destructor = (CV *)SvSTASH(stash);
7085 if (!destructor
7086 #if (PERL_VERSION > 18) || (PERL_VERSION == 18 && PERL_SUBVERSION > 1)
7087 || HvMROMETA(stash)->destroy_gen != PL_sub_generation
7088 #endif
7089 ) {
7090 GV * const gv = gv_fetchmeth_autoload(stash, "DESTROY", 7, 0);
7091 if (gv) {
7092 destructor = GvCV(gv);
7093 if (!SvOBJECT(stash)) {
7094 SvSTASH(stash) =
7095 destructor ? (HV *)destructor : ((HV *)0)+1;
7096 #if (PERL_VERSION > 18) || (PERL_VERSION == 18 && PERL_SUBVERSION > 1)
7097 HvAUX(stash)->xhv_mro_meta->destroy_gen = PL_sub_generation;
7098 #endif
7099 }
7100 }
7101 }
7102 assert(!destructor || destructor == ((CV *)0)+1
7103 || SvTYPE(destructor) == SVt_PVCV);
7104 if (destructor && destructor != ((CV *)0)+1
7105 /* A constant subroutine can have no side effects, so
7106 don't bother calling it. */
7107 && !CvCONST(destructor)
7108 /* Don't bother calling an empty destructor or one that
7109 returns immediately. */
7110 && (CvISXSUB(destructor)
7111 || (CvSTART(destructor)
7112 && (CvSTART(destructor)->op_next->op_type != OP_LEAVESUB)
7113 && (CvSTART(destructor)->op_next->op_type != OP_PUSHMARK
7114 || CvSTART(destructor)->op_next->op_next->op_type != OP_RETURN
7115 )
7116 ))
7117 )
7118 {
7119 SV* const tmpref = newRV(sv);
7120 DEBUG_D(PerlIO_printf(Perl_debug_log, "Calling %s::DESTROY\n", HvNAME(stash)));
7121 SvREADONLY_on(tmpref); /* DESTROY() could be naughty */
7122 ENTER;
7123 PUSHSTACKi(PERLSI_DESTROY);
7124 EXTEND(SP, 2);
7125 PUSHMARK(SP);
7126 PUSHs(tmpref);
7127 PUTBACK;
7128 call_sv((SV*)destructor, G_DISCARD|G_EVAL|G_KEEPERR|G_VOID);
7129 POPSTACK;
7130 SPAGAIN;
7131 LEAVE;
7132 if(SvREFCNT(tmpref) < 2) {
7133 /* tmpref is not kept alive! */
7134 SvREFCNT(sv)--;
7135 SvRV_set(tmpref, NULL);
7136 SvROK_off(tmpref);
7137 }
7138 SvREFCNT_dec(tmpref);
7139 }
7140 }
7141 } while (SvOBJECT(sv) && SvSTASH(sv) != stash);
7142  
7143 if (SvOBJECT(sv)) {
7144 /* Curse before freeing the stash, as freeing the stash could cause
7145 a recursive call into S_curse. */
7146 SvOBJECT_off(sv); /* Curse the object. */
7147 SvSTASH_set(sv,0); /* SvREFCNT_dec may try to read this */
7148 }
7149 #endif
7150 }
7151  
7152 static int fast_perl_destruct( PerlInterpreter *my_perl ) {
7153 dVAR;
7154 volatile signed char destruct_level; /* see possible values in intrpvar.h */
7155 HV *hv;
7156 #ifdef DEBUG_LEAKING_SCALARS_FORK_DUMP
7157 pid_t child;
7158 #endif
7159  
7160 #ifndef MULTIPLICITY
7161 # ifndef PERL_UNUSED_ARG
7162 # define PERL_UNUSED_ARG(x) ((void)x)
7163 # endif
7164 PERL_UNUSED_ARG(my_perl);
7165 #endif
7166  
7167 assert(PL_scopestack_ix == 1);
7168  
7169 /* wait for all pseudo-forked children to finish */
7170 #if !defined(WIN32) || (defined(USE_CPERL) && PERL_VERSION >= 24)
7171 PERL_WAIT_FOR_CHILDREN;
7172 #endif
7173  
7174 destruct_level = PL_perl_destruct_level;
7175 #ifdef DEBUGGING
7176 {
7177 const char * const s = PerlEnv_getenv("PERL_DESTRUCT_LEVEL");
7178 if (s) {
7179 const int i = atoi(s);
7180 #ifdef DEBUGGING
7181 if (destruct_level < i) destruct_level = i;
7182 #endif
7183 #ifdef PERL_TRACK_MEMPOOL
7184 /* RT #114496, for perl_free */
7185 PL_perl_destruct_level = i;
7186 #endif
7187 }
7188 }
7189 #endif
7190  
7191 if (PL_exit_flags & PERL_EXIT_DESTRUCT_END) {
7192 int x = 0;
7193  
7194 JMPENV_PUSH(x);
7195 if (PL_endav && !PL_minus_c) {
7196 #if PERL_VERSION > 13
7197 PL_phase = PERL_PHASE_END;
7198 #endif
7199 call_list(PL_scopestack_ix, PL_endav);
7200 }
7201 JMPENV_POP;
7202 }
7203 _EOT8
7204  
7205 0 for (0 .. $#B::C::static_free) {
7206 # set static op members to NULL
7207 0 my $s = $B::C::static_free[$_];
7208 0 ▶ if ($s =~ /\(OP\*\)&unopaux_list/) {
Branch: 1 branch
BranchTrueFalseTotal
if ($s =~ /\(OP\*\)&unopaux_list/) 0 0 0
7209 0 print " ($s)->op_type = OP_NULL;\n";
7210 }
7211 }
7212  
7213 0 print <<'_EOT9';
7214 LEAVE;
7215 FREETMPS;
7216 assert(PL_scopestack_ix == 0);
7217  
7218 /* Need to flush since END blocks can produce output */
7219 my_fflush_all();
7220  
7221 PL_main_start = NULL;
7222 PL_main_cv = NULL;
7223 PL_curcop = &PL_compiling;
7224 #if PERL_VERSION >= 13
7225 PL_phase = PERL_PHASE_DESTRUCT;
7226 #endif
7227  
7228 #if PERL_VERSION > 7
7229 if (PL_threadhook(aTHX)) {
7230 /* Threads hook has vetoed further cleanup */
7231 #if (PERL_VERSION > 8) || ((PERL_VERSION == 8) && (PERL_SUBVERSION > 8))
7232 PL_veto_cleanup = TRUE;
7233 return STATUS_EXIT;
7234 #else
7235 return STATUS_NATIVE_EXPORT;
7236 #endif
7237 }
7238 #if defined(PERLIO_LAYERS)
7239 # if !defined(WIN32) || (defined(USE_CPERL) && PERL_VERSION >= 24)
7240 PerlIO_destruct(aTHX);
7241 # endif
7242 #endif
7243  
7244 /* B::C -O3 specific: first curse (i.e. call DESTROY) all our static SVs */
7245 if (PL_sv_objcount) {
7246 int i = 1;
7247 DEBUG_D(PerlIO_printf(Perl_debug_log, "\nCursing named global static sv_arena:\n"));
7248 PL_in_clean_all = 1;
7249 for (; i < SvREFCNT(&sv_list[0]); i++) {
7250 SV *sv = &sv_list[i];
7251 if (SvREFCNT(sv)) {
7252 #if PERL_VERSION > 11
7253 if (SvTYPE(sv) == SVt_IV && SvROK(sv))
7254 #else
7255 if (SvTYPE(sv) == SVt_RV)
7256 #endif
7257 sv = SvRV(sv);
7258 if (sv && SvOBJECT(sv) && SvTYPE(sv) >= SVt_PVMG && SvSTASH(sv)
7259 && SvTYPE(sv) != SVt_PVCV && SvTYPE(sv) != SVt_PVIO
7260 && PL_defstash /* Still have a symbol table? */
7261 && SvDESTROYABLE(sv))
7262 {
7263 SvREFCNT(sv) = 0;
7264 my_curse(aTHX_ sv);
7265 }
7266 }
7267 }
7268 }
7269 if (DEBUG_D_TEST) {
7270 SV* sva;
7271 PerlIO_printf(Perl_debug_log, "sv[0]: 0x%p, sv_arenaroot: 0x%p, sva->any: 0x%p\n",
7272 SvANY(&sv_list[0]), PL_sv_arenaroot, SvANY(PL_sv_arenaroot));
7273 for (sva = PL_sv_arenaroot;
7274 sva;
7275 sva = (sva == (SV*)SvANY(sva)) ? NULL : (SV*)SvANY(sva))
7276 {
7277 PerlIO_printf(Perl_debug_log, "sv_arena: 0x%p - 0x%p (%lu)\n",
7278 sva, sva+SvREFCNT(sva), (long)SvREFCNT(sva));
7279 }
7280 }
7281 #endif
7282  
7283 #if PERL_VERSION > 7
7284 PL_stashcache = (HV*)&PL_sv_undef; /* sometimes corrupted */
7285 #endif
7286 #if !defined(WIN32) || (defined(USE_CPERL) && PERL_VERSION >= 24)
7287 if (PL_sv_objcount) {
7288 # if PERL_VERSION > 7
7289 PL_stashcache = newHV(); /* Hack: sometimes corrupted, holding a GV */
7290 # endif
7291 PL_in_clean_all = 1;
7292 sv_clean_objs(); /* and now curse the rest */
7293 PL_sv_objcount = 0;
7294 }
7295 #endif
7296  
7297 PL_warnhook = NULL;
7298 PL_diehook = NULL;
7299 /* call exit list functions */
7300 while (PL_exitlistlen-- > 0)
7301 PL_exitlist[PL_exitlistlen].fn(aTHX_ PL_exitlist[PL_exitlistlen].ptr);
7302 PL_exitlist = NULL;
7303  
7304 #if defined(PERLIO_LAYERS)
7305 # if !defined(WIN32) || (defined(USE_CPERL) && PERL_VERSION >= 24)
7306 PerlIO_cleanup(aTHX);
7307 # endif
7308 #endif
7309  
7310 #if PERL_VERSION > 7
7311 PL_stashcache = (HV*)&PL_sv_undef;
7312 #endif
7313 /* Silence strtab refcnt warnings during global destruction */
7314 Zero(HvARRAY(PL_strtab), HvMAX(PL_strtab), HE*);
7315 /* NULL the HEK "dfs" */
7316 #if PERL_VERSION > 10
7317 PL_registered_mros = (HV*)&PL_sv_undef;
7318 CopHINTHASH_set(&PL_compiling, NULL);
7319 #endif
7320  
7321 return 0;
7322 }
7323 _EOT9
7324  
7325 }
7326 }
7327  
7328 0 ▶sub init_op_addr {
Subroutine init_op_addr: not called CC=1 SCAR=6.9
Pod undocumented
7329 0 my ( $op_type, $num ) = @_;
7330 0 my $op_list = $op_type . "_list";
7331  
7332 0 $init0->add( split /\n/, <<_EOT6 );
7333 for (i = 0; i < ${num}; ++i) {
7334 ${op_list}\[i].op_ppaddr = PL_ppaddr[PTR2IV(${op_list}\[i].op_ppaddr)];
7335 }
7336 _EOT6
7337  
7338 }
7339  
7340 # local destruction code
7341 0 ▶sub save_destruct {
Subroutine save_destruct: not called CC=21 SCAR=61.4
Pod undocumented
7342 0 my $name = shift;
7343 0 ▶ $name = 'main' unless defined $name;
Branch: 1 branch
BranchTrueFalseTotal
unless defined $name 0 0 0
7344 # special COW handling for 5.10 because of S_unshare_hek_or_pvn limitations
7345 # XXX This fails in S_doeval SAVEFREEOP(PL_eval_root): test 15
7346 # if ( $PERL510 and (@B::C::static_free or $free->index > -1))
7347 0 ▶ if ( $B::C::destruct ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($B::C::destruct) 0 0 0
7348 0 print "
7349 EXTERN_C void destruct_${name} ( PerlInterpreter *my_perl ) {
7350 ";
7351 0 print <<'_EOT7';
7352 volatile signed char destruct_level = PL_perl_destruct_level;
7353 const char * const s = PerlEnv_getenv("PERL_DESTRUCT_LEVEL");
7354 dVAR;
7355  
7356 /* set all our static pv and hek to &PL_sv_undef for perl_destruct() */
7357 _EOT7
7358  
7359 #for (0 .. $hek_index-1) {
7360 # # TODO: non-static only, seperate data structures please
7361 # printf " memset(HEK_HE(hek%d), 0, sizeof(struct shared_he));\n", $_;
7362 #}
7363 0 for (0 .. $#B::C::static_free) {
7364 # set the sv/xpv to &PL_sv_undef, not the pv itself.
7365 # If set to NULL pad_undef will fail in SvPVX_const(namesv) == '&'
7366 # XXX Another idea >5.10 is SvFLAGS(pv) = SVTYPEMASK
7367 0 my $s = $B::C::static_free[$_];
7368 0 ▶ if ($s =~ /^sv_list\[\d+\]\./) { # pv directly (unused)
Branch: 10 branches
BranchTrueFalseTotal
if ($s =~ /^sv_list\[\d+\]\./) { } 0 0 0
elsif ($s =~ /^sv_list/) { } 0 0 0
elsif ($s =~ /^&sv_list/) { } 0 0 0
elsif ($s =~ /^\(HV\*\)&sv_list/) { } 0 0 0
elsif ($s =~ /^\(AV\*\)&sv_list/) { } 0 0 0
elsif ($s =~ /^&padnamelist_list/) { } 0 0 0
elsif ($s =~ /^&padname(_\d+)?_list/) { } 0 0 0
elsif ($s =~ /^cop_list/) { } 0 0 0
elsif ($s =~ /\(OP\*\)&unopaux_list/) { } 0 0 0
elsif ($s ne 'ptr_undef') { } 0 0 0
7369 0 print " $s = NULL;\n";
7370 } elsif ($s =~ /^sv_list/) {
7371 0 print " SvLEN(&$s) = 0;\n";
7372 0 print " SvPV_set(&$s, (char*)&PL_sv_undef);\n";
7373 } elsif ($s =~ /^&sv_list/) {
7374 0 print " SvLEN($s) = 0;\n";
7375 0 print " SvPV_set($s, (char*)&PL_sv_undef);\n";
7376 } elsif ($s =~ /^\(HV\*\)&sv_list/) {
7377 0 print " SvREADONLY_on((SV*)$s);\n";
7378 0 print " SvREFCNT($s) = SvREFCNT_IMMORTAL;\n";
7379 } elsif ($s =~ /^\(AV\*\)&sv_list/) { # SVs_OBJECT flag, as the HV
7380 #print " SvREADONLY_on((SV*)$s);\n";
7381 #print " SvREFCNT($s) = SvREFCNT_IMMORTAL;\n";
7382 } elsif ($s =~ /^&padnamelist_list/) {
7383 0 print " Safefree(PadnamelistARRAY($s));\n";
7384 0 print " PadnamelistMAX($s) = 0;\n";
7385 0 print " PadnamelistREFCNT($s) = 0;\n";
7386 } elsif ($s =~ /^&padname(_\d+)?_list/) {
7387 0 print " PadnameREFCNT($s) = 0;\n";
7388 # dead code ---
7389 } elsif ($s =~ /^cop_list/) {
7390 0 ▶ if ($ITHREADS or !$MULTI) {
Branch: 1 branch
BranchTrueFalseTotal
if ($ITHREADS or not $MULTI) 0 0 0
Condition0%0/3
$ITHREADS or not $MULTI
l!l&&r!l&&!r
000
MC/DC0%0/2
$ITHREADS or not $MULTI
$ITHREADS not $MULTI
Truth table0%0/3
A or not(B)
A= $ITHREADSB= not $MULTI
ABresult
1X1
011
000
7391 0 print " CopFILE_set(&$s, NULL);";
7392 }
7393 0 ▶ if ($] >= 5.017) {
Branch: 3 branches
BranchTrueFalseTotal
if ($] >= 5.017) { } 0 0 0
elsif ($] < 5.016 and $ITHREADS) { } 0 0 0
elsif ($] < 5.016 and not $ITHREADS) { } 0 0 0
7394 0 print " CopSTASH_set(&$s, NULL);\n";
7395 ▶ } elsif ($] < 5.016 and $ITHREADS) {
Condition0%0/3
$] < "5.016" and $ITHREADS
!ll&&!rl&&r
000
MC/DC0%0/2
$] < "5.016" and $ITHREADS
$] < "5.016" $ITHREADS
Truth table0%0/3
A and B
A= $] < "5.016"B= $ITHREADS
ABresult
0X0
100
111
7396 0 print " CopSTASHPV(&$s) = NULL;\n";
7397 ▶ } elsif ($] < 5.016 and !$ITHREADS) {
Condition0%0/3
$] < "5.016" and not $ITHREADS
!ll&&!rl&&r
000
MC/DC0%0/2
$] < "5.016" and not $ITHREADS
$] < "5.016" not $ITHREADS
Truth table0%0/3
A and not(B)
A= $] < "5.016"B= not $ITHREADS
ABresult
0X0
100
111
7398 0 print " CopSTASH(&$s) = NULL;\n";
7399 } else { # 5.16 experiment
7400 0 print " CopSTASHPV_set(&$s, NULL, 0);\n";
7401 }
7402 } elsif ($s =~ /\(OP\*\)&unopaux_list/) {
7403 0 print " ($s)->op_type = OP_NULL;\n";
7404 # end dead code ---
7405 #} elsif ($s =~ /^pv\d/) {
7406 # print " $s = \"\";\n";
7407 } elsif ($s ne 'ptr_undef') {
7408 0 warn("unknown $s at \@static_free[$_]");
7409 }
7410 }
7411 0 $free->output( \*STDOUT, "%s\n" );
7412  
7413 0 print "}\n";
7414 }
7415 }
7416  
7417 0 ▶sub output_main_rest {
Subroutine output_main_rest: not called CC=101 SCAR=92.0
Pod undocumented
7418 0 save_destruct("main");
7419 0 print <<'_EOT8';
7420  
7421 /* yanked from perl.c */
7422 static void
7423 xs_init(pTHX)
7424 {
7425 char *file = __FILE__;
7426 dTARG; dSP; dVAR; CV * cv;
7427 _EOT8
7428 0 ▶ if ($CPERL51 and $debug{cv}) {
Branch: 1 branch
BranchTrueFalseTotal
if ($CPERL51 and $B::C::debug{"cv"}) 0 0 0
Condition0%0/3
$CPERL51 and $B::C::debug{"cv"}
!ll&&!rl&&r
000
MC/DC0%0/2
$CPERL51 and $B::C::debug{"cv"}
$CPERL51 $B::C::debug{"cv"}
Truth table0%0/3
A and B
A= $CPERL51B= $B::C::debug{"cv"}
ABresult
0X0
100
111
7429 0 print q{
7430 /* -DC set dl_debug to 3 */
7431 SV* sv = get_svs("DynaLoader::dl_debug", GV_ADD);
7432 sv_upgrade(sv, SVt_IV);
7433 SvIV_set(sv, 3);};
7434 }
7435 #if ($staticxs) { #FIXME!
7436 # print "\n#undef USE_DYNAMIC_LOADING
7437 #}
7438  
7439 0 delete $xsub{'DynaLoader'};
7440 0 delete $xsub{'UNIVERSAL'};
7441 0 print("/* XS bootstrapping code*/\n");
7442 0 print("\tSAVETMPS;\n");
7443 0 print("\ttarg=sv_newmortal();\n");
7444 0 foreach my $stashname ( sort keys %static_ext ) {
7445 0 my $stashxsub = $stashname;
7446 0 $stashxsub =~ s/::/__/g;
7447 #if ($stashxsub =~ m/\/(\w+)\.\w+$/ {$stashxsub = $1;}
7448 # cygwin has Win32CORE in static_ext
7449 0 ▶ warn "bootstrapping static $stashname added to xs_init\n" if $verbose;
Branch: 1 branch
BranchTrueFalseTotal
if $B::C::verbose 0 0 0
7450 0 print "\tnewXS(\"$stashname\::bootstrap\", boot_$stashxsub, file);\n";
7451 }
7452 0 print "#ifdef USE_DYNAMIC_LOADING\n";
7453 0 print "\tPUSHMARK(sp);\n";
7454 0 printf "\tXPUSHp(\"DynaLoader\", %d);\n", length("DynaLoader");
7455 0 print "\tPUTBACK;\n";
7456 0 ▶ warn "bootstrapping DynaLoader added to xs_init\n" if $verbose;
Branch: 1 branch
BranchTrueFalseTotal
if $B::C::verbose 0 0 0
7457 0 print "\tcv = newXS(\"DynaLoader::boot_DynaLoader\", boot_DynaLoader, file);\n";
7458 0 print "\tboot_DynaLoader(aTHX_ cv);\n";
7459 0 print "\tSPAGAIN;\n";
7460 0 ▶ if ($CPERL51 and $^O ne 'MSWin32') {
Branch: 1 branch
BranchTrueFalseTotal
if ($CPERL51 and $^O ne "MSWin32") 0 0 0
Condition0%0/3
$CPERL51 and $^O ne "MSWin32"
!ll&&!rl&&r
000
MC/DC0%0/2
$CPERL51 and $^O ne "MSWin32"
$CPERL51 $^O ne "MSWin32"
Truth table0%0/3
A and B
A= $CPERL51B= $^O ne "MSWin32"
ABresult
0X0
100
111
7461 0 print "\tdl_boot(aTHX);\n";
7462 }
7463 0 print "#endif\n";
7464  
7465 # my %core = map{$_ => 1} core_packages();
7466 0 foreach my $stashname ( sort keys %xsub ) {
7467 0 my $incpack = inc_packname($stashname);
7468 0 ▶ unless (exists $curINC{$incpack}) { # skip deleted packages
Branch: 1 branch
BranchTrueFalseTotal
unless (exists $B::C::curINC{$incpack}) 0 0 0
7469 0 ▶ warn "skip xs_init for $stashname !\$INC{$incpack}\n" if $debug{pkg};
Branch: 1 branch
BranchTrueFalseTotal
if $B::C::debug{"pkg"} 0 0 0
7470 0 delete $include_package{$stashname};
7471 0 ▶ delete $xsub{$stashname} unless $static_ext{$stashname};
Branch: 1 branch
BranchTrueFalseTotal
unless $static_ext{$stashname} 0 0 0
7472 0 next;
7473 }
7474 0 ▶ if ( $xsub{$stashname} !~ m/^Dynamic/ and !$static_ext{$stashname}) {
Branch: 1 branch
BranchTrueFalseTotal
unless ($xsub{$stashname} =~ /^Dynamic/ or $static_ext{$stashname}) 0 0 0
Condition0%0/3
$xsub{$stashname} =~ /^Dynamic/ or $static_ext{$stashname}
l!l&&r!l&&!r
000
MC/DC0%0/2
$xsub{$stashname} =~ /^Dynamic/ or $static_ext{$stashname}
$xsub{$stashname} =~ /^Dynamic/ $static_ext{$stashname}
Truth table0%0/3
A or B
A= $xsub{$stashname} =~ /^Dynamic/B= $static_ext{$stashname}
ABresult
1X1
011
000
7475 0 my $stashxsub = $stashname;
7476 0 ▶ warn "bootstrapping $stashname added to xs_init\n" if $verbose;
Branch: 1 branch
BranchTrueFalseTotal
if $B::C::verbose 0 0 0
7477 0 $stashxsub =~ s/::/__/g;
7478 0 print "\tPUSHMARK(sp);\n";
7479 0 printf "\tXPUSHp(\"%s\", %d);\n", # "::bootstrap" gets appended, TODO
7480 0 ? "strdup($stashname)" : $stashname, length($stashname);
7481 0 print "\tPUTBACK;\n";
7482 0 print "\tboot_$stashxsub(aTHX_ NULL);\n";
7483 0 print "\tSPAGAIN;\n";
7484 }
7485 }
7486 0 print "\tFREETMPS;\n/* end XS bootstrapping code */\n";
7487 0 print "}\n\n";
7488  
7489 0 my ($dl, $xs);
7490 0 my @dl_modules = @DynaLoader::dl_modules;
7491 0 ▶ my @PERLMODS = split(/\,/, $ENV{'PERLMODS'}) if $ENV{'PERLMODS'}; # from cpanel
Branch: 1 branch
BranchTrueFalseTotal
if $ENV{"PERLMODS"} 0 0 0
7492 0 foreach my $perlmod (@PERLMODS) {
7493 0 warn "Extra module ${perlmod}\n";
7494 0 ▶ push @dl_modules, $perlmod unless grep { $_ ne $perlmod } @dl_modules;
Branch: 1 branch
BranchTrueFalseTotal
unless grep {$_ ne $perlmod;} @dl_modules 0 0 0
7495 }
7496 # filter out unused dynaloaded B modules, used within the compiler only.
7497 0 for my $c (qw(B B::C)) {
7498 0 ▶ if (!$xsub{$c} and !$include_package{$c}) {
Branch: 1 branch
BranchTrueFalseTotal
unless ($xsub{$c} or $include_package{$c}) 0 0 0
Condition0%0/3
$xsub{$c} or $include_package{$c}
l!l&&r!l&&!r
000
MC/DC0%0/2
$xsub{$c} or $include_package{$c}
$xsub{$c} $include_package{$c}
Truth table0%0/3
A or B
A= $xsub{$c}B= $include_package{$c}
ABresult
1X1
011
000
7499 # (hopefully, see test 103)
7500 0 ▶ warn "no dl_init for $c, not marked\n" if $verbose and !$skip_package{$c};
Branch: 1 branch
BranchTrueFalseTotal
if $B::C::verbose and not $skip_package{$c} 0 0 0
Condition0%0/3
$B::C::verbose and not $skip_package{$c}
!ll&&!rl&&r
000
MC/DC0%0/2
$B::C::verbose and not $skip_package{$c}
$B::C::verbose not $skip_package{$c}
Truth table0%0/3
A and not(B)
A= $B::C::verboseB= not $skip_package{$c}
ABresult
0X0
100
111
7501 # RT81332 pollute
7502 0 @dl_modules = grep { $_ ne $c } @dl_modules;
7503 # XXX Be sure to store the new @dl_modules
7504 }
7505 }
7506 0 for my $c (sort keys %skip_package) {
7507 0 ▶ warn "no dl_init for $c, skipped\n" if $verbose and $xsub{$c};
Branch: 1 branch
BranchTrueFalseTotal
if $B::C::verbose and $xsub{$c} 0 0 0
Condition0%0/3
$B::C::verbose and $xsub{$c}
!ll&&!rl&&r
000
MC/DC0%0/2
$B::C::verbose and $xsub{$c}
$B::C::verbose $xsub{$c}
Truth table0%0/3
A and B
A= $B::C::verboseB= $xsub{$c}
ABresult
0X0
100
111
7508 0 delete $xsub{$c};
7509 0 $include_package{$c} = undef;
7510 0 @dl_modules = grep { $_ ne $c } @dl_modules;
7511 }
7512 0 @DynaLoader::dl_modules = @dl_modules;
7513 0 ▶ warn "\@dl_modules: ",join(" ",@dl_modules),"\n" if $verbose;
Branch: 1 branch
BranchTrueFalseTotal
if $B::C::verbose 0 0 0
7514 0 foreach my $stashname (@dl_modules) {
7515 0 my $incpack = inc_packname($stashname);
7516 #unless (exists $INC{$incpack}) { # skip deleted packages
7517 # warn "XXX skip dl_init for $stashname !\$INC{$incpack}\n" if $debug{pkg};
7518 # delete $xsub{$stashname};
7519 # @dl_modules = grep { $_ ne $stashname } @dl_modules;
7520 #}
7521 0 ▶ if ($stashname eq 'attributes' and $] > 5.011) {
Branch: 1 branch
BranchTrueFalseTotal
if ($stashname eq "attributes" and $] > "5.011") 0 0 0
Condition0%0/3
$stashname eq "attributes" and $] > "5.011"
!ll&&!rl&&r
000
MC/DC0%0/2
$stashname eq "attributes" and $] > "5.011"
$stashname eq "attributes" $] > "5.011"
Truth table0%0/3
A and B
A= $stashname eq "attributes"B= $] > "5.011"
ABresult
0X0
100
111
7522 0 $xsub{$stashname} = 'Dynamic-' . $INC{'attributes.pm'};
7523 }
7524 # actually boot all non-b-c dependent modules here. we assume XSLoader (Moose, List::MoreUtils)
7525 0 ▶ if (!exists( $xsub{$stashname} ) and $include_package{$stashname}) {
Branch: 1 branch
BranchTrueFalseTotal
if (not exists $xsub{$stashname} and $include_package{$stashname}) 0 0 0
Condition0%0/3
not exists $xsub{$stashname} and $include_package{$stashname}
!ll&&!rl&&r
000
MC/DC0%0/2
not exists $xsub{$stashname} and $include_package{$stashname}
not exists $xsub{$stashname} $include_package{$stashname}
Truth table0%0/3
not(A) and B
A= not exists $xsub{$stashname}B= $include_package{$stashname}
ABresult
0X0
100
111
7526 0 $xsub{$stashname} = 'Dynamic-' . $INC{$incpack};
7527 # Class::MOP without Moose: find Moose.pm
7528 0 ▶ $xsub{$stashname} = 'Dynamic-' . $savINC{$incpack} unless $INC{$incpack};
Branch: 1 branch
BranchTrueFalseTotal
unless $INC{$incpack} 0 0 0
7529 0 ▶ if (!$savINC{$incpack}) {
Branch: 1 branch
BranchTrueFalseTotal
unless ($B::C::savINC{$incpack}) 0 0 0
7530 0 eval "require $stashname;";
7531 0 $xsub{$stashname} = 'Dynamic-' . $INC{$incpack};
7532 }
7533 0 ▶ warn "Assuming xs loaded $stashname with $xsub{$stashname}\n" if $verbose;
Branch: 1 branch
BranchTrueFalseTotal
if $B::C::verbose 0 0 0
7534 }
7535 0 ▶ if ( exists( $xsub{$stashname} ) && $xsub{$stashname} =~ m/^Dynamic/ ) {
Branch: 1 branch
BranchTrueFalseTotal
if (exists $xsub{$stashname} and $xsub{$stashname} =~ /^Dynamic/) 0 0 0
Condition0%0/3
exists $xsub{$stashname} and $xsub{$stashname} =~ /^Dynamic/
!ll&&!rl&&r
000
MC/DC0%0/2
exists $xsub{$stashname} and $xsub{$stashname} =~ /^Dynamic/
exists $xsub{$stashname} $xsub{$stashname} =~ /^Dynamic/
Truth table0%0/3
A and B
A= exists $xsub{$stashname}B= $xsub{$stashname} =~ /^Dynamic/
ABresult
0X0
100
111
7536 # XSLoader.pm: $modlibname = (caller())[1]; needs a path at caller[1] to find auto,
7537 # otherwise we only have -e
7538 0 ▶ $xs++ if $xsub{$stashname} ne 'Dynamic';
Branch: 1 branch
BranchTrueFalseTotal
if $xsub{$stashname} ne "Dynamic" 0 0 0
7539 0 $dl++;
7540 }
7541 0 my $stashxsub = $stashname;
7542 0 $stashxsub =~ s/::/__/g;
7543 0 ▶ if ( exists( $xsub{$stashname} ) && $xsub{$stashname} =~ m/^Dynamic-/
Branch: 1 branch
BranchTrueFalseTotal
if (exists $xsub{$stashname} and $xsub{$stashname} =~ /^Dynamic-/ and $PERL522 || $staticxs) 0 0 0
Condition0%0/9
exists $xsub{$stashname} and $xsub{$stashname} =~ /^Dynamic-/ and $PERL522 || $staticxs
!ll&&!rl&&r
000
exists $xsub{$stashname} and $xsub{$stashname} =~ /^Dynamic-/
!ll&&!rl&&r
000
$PERL522 or $staticxs
l!l&&r!l&&!r
000
MC/DC0%0/4
exists $xsub{$stashname} and $xsub{$stashname} =~ /^Dynamic-/ and $PERL522 || $staticxs
exists $xsub{$stashname} $xsub{$stashname} =~ /^Dynamic-/ $PERL522 $staticxs
Truth table0%0/5
A and B and C or D
A= exists $xsub{$stashname}B= $xsub{$stashname} =~ /^Dynamic-/C= $PERL522D= $staticxs
ABCDresult
0XXX0
10XX0
11000
111X1
11011
7544 and ($PERL522 or $staticxs)) {
7545 0 print "EXTERN_C void boot_$stashxsub(pTHX_ CV* cv);\n";
7546 }
7547 }
7548 0 ▶ warn "\%xsub: ",join(" ",sort keys %xsub),"\n" if $verbose and $debug{cv};
Branch: 1 branch
BranchTrueFalseTotal
if $B::C::verbose and $B::C::debug{"cv"} 0 0 0
Condition0%0/3
$B::C::verbose and $B::C::debug{"cv"}
!ll&&!rl&&r
000
MC/DC0%0/2
$B::C::verbose and $B::C::debug{"cv"}
$B::C::verbose $B::C::debug{"cv"}
Truth table0%0/3
A and B
A= $B::C::verboseB= $B::C::debug{"cv"}
ABresult
0X0
100
111
7549 # XXX Adding DynaLoader is too late here! The sections like $init are already dumped (#125)
7550 0 ▶ if ($dl and ! $curINC{'DynaLoader.pm'}) {
Branch: 2 branches
BranchTrueFalseTotal
if ($dl and not $B::C::curINC{'DynaLoader.pm'}) { } 0 0 0
elsif ($xs and not $B::C::curINC{'XSLoader.pm'}) { } 0 0 0
Condition0%0/3
$dl and not $B::C::curINC{"DynaLoader.pm"}
!ll&&!rl&&r
000
MC/DC0%0/2
$dl and not $B::C::curINC{"DynaLoader.pm"}
$dl not $B::C::curINC{"DynaLoader.pm"}
Truth table0%0/3
A and not(B)
A= $dlB= not $B::C::curINC{"DynaLoader.pm"}
ABresult
0X0
100
111
7551 0 die "Error: DynaLoader required but not dumped. Too late to add it.\n";
7552 ▶ } elsif ($xs and ! $curINC{'XSLoader.pm'}) {
Condition0%0/3
$xs and not $B::C::curINC{"XSLoader.pm"}
!ll&&!rl&&r
000
MC/DC0%0/2
$xs and not $B::C::curINC{"XSLoader.pm"}
$xs not $B::C::curINC{"XSLoader.pm"}
Truth table0%0/3
A and not(B)
A= $xsB= not $B::C::curINC{"XSLoader.pm"}
ABresult
0X0
100
111
7553 0 die "Error: XSLoader required but not dumped. Too late to add it.\n";
7554 }
7555 0 print <<'_EOT9';
7556  
7557 static void
7558 dl_init(pTHX)
7559 {
7560 char *file = __FILE__;
7561 _EOT9
7562  
7563 0 ▶ if ($dl) {
Branch: 1 branch
BranchTrueFalseTotal
if ($dl) 0 0 0
7564 # enforce attributes at the front of dl_init, #259
7565 # also Encode should be booted before PerlIO::encoding
7566 0 for my $front (qw(Encode attributes)) {
7567 0 ▶ if (grep { $_ eq $front } @dl_modules) {
Branch: 1 branch
BranchTrueFalseTotal
if (grep {$_ eq $front;} @dl_modules) 0 0 0
7568 0 @dl_modules = grep { $_ ne $front } @dl_modules;
7569 0 unshift @dl_modules, $front;
7570 }
7571 }
7572 0 ▶ if ($staticxs) {open( XS, ">", $outfile.".lst" ) or return "$outfile.lst: $!\n"}
Branch: 2 branches
BranchTrueFalseTotal
if ($staticxs) 0 0 0
open XS, ">", $outfile . '.lst' or return "$outfile.lst: $!\n" 0 0 0
7573 0 print "\tdTARG; dSP; dVAR;\n";
7574 0 print "/* DynaLoader bootstrapping */\n";
7575 0 print "\tENTER;\n";
7576 0 ▶ print "\t++cxstack_ix; cxstack[cxstack_ix].blk_oldcop = PL_curcop;\n" if $xs;
Branch: 1 branch
BranchTrueFalseTotal
if $xs 0 0 0
7577 0 ▶ print "\t/* assert(cxstack_ix == 0); */\n" if $xs;
Branch: 1 branch
BranchTrueFalseTotal
if $xs 0 0 0
7578 0 print "\tSAVETMPS;\n";
7579 0 ▶ print "\ttarg = sv_newmortal();\n" if $] < 5.008008;
Branch: 1 branch
BranchTrueFalseTotal
if $] < "5.008008" 0 0 0
7580  
7581 0 ▶ if (exists $xsub{"Coro::State"} and grep { $_ eq "Coro::State" } @dl_modules) {
Branch: 1 branch
BranchTrueFalseTotal
if (exists $xsub{"Coro::State"} and grep {$_ eq "Coro::State";} @dl_modules) 0 0 0
Condition0%0/3
exists $xsub{"Coro::State"} and grep {$_ eq "Coro::State";} @dl_modules
!ll&&!rl&&r
000
MC/DC0%0/2
exists $xsub{"Coro::State"} and grep {$_ eq "Coro::State";} @dl_modules
exists $xsub{"Coro::State"} grep {$_ eq "Coro::State";} @dl_modules
Truth table0%0/3
A and B
A= exists $xsub{"Coro::State"}B= grep {$_ eq "Coro::State";} @dl_modules
ABresult
0X0
100
111
7582 # Coro readonly symbols in BOOT (#293)
7583 # needed before dl_init, and after init
7584 0 print "\t{\n\t GV *sym;\n";
7585 0 for my $s (qw(Coro Coro::API Coro::current)) {
7586 0 print "\t sym = gv_fetchpv(\"$s\",0,SVt_PV);\n";
7587 0 print "\t if (sym && GvSVn(sym)) SvREADONLY_off(GvSVn(sym));\n";
7588 }
7589 0 print "\t sym = gv_fetchpv(\"Coro::pool_handler)\",0,SVt_PVCV);\n";
7590 0 print "\t if (sym && GvCV(sym)) SvREADONLY_off(GvCV(sym));\n";
7591 0 print "\t}\n";
7592 }
7593 0 ▶ if (exists $xsub{"EV"} and grep { $_ eq "EV" } @dl_modules) {
Branch: 1 branch
BranchTrueFalseTotal
if (exists $xsub{"EV"} and grep {$_ eq "EV";} @dl_modules) 0 0 0
Condition0%0/3
exists $xsub{"EV"} and grep {$_ eq "EV";} @dl_modules
!ll&&!rl&&r
000
MC/DC0%0/2
exists $xsub{"EV"} and grep {$_ eq "EV";} @dl_modules
exists $xsub{"EV"} grep {$_ eq "EV";} @dl_modules
Truth table0%0/3
A and B
A= exists $xsub{"EV"}B= grep {$_ eq "EV";} @dl_modules
ABresult
0X0
100
111
7594 # EV readonly symbols in BOOT (#368)
7595 0 print "\t{\n\t GV *sym;\n";
7596 0 for my $s (qw(EV::API)) {
7597 0 print "\t sym = gv_fetchpv(\"$s\",0,SVt_PV);\n";
7598 0 print "\t if (sym && GvSVn(sym)) SvREADONLY_off(GvSVn(sym));\n";
7599 }
7600 0 print "\t}\n";
7601 }
7602 0 foreach my $stashname (@dl_modules) {
7603 0 ▶ if ( exists( $xsub{$stashname} ) && $xsub{$stashname} =~ m/^Dynamic/ ) {
Branch: 1 branch
BranchTrueFalseTotal
if (exists $xsub{$stashname} and $xsub{$stashname} =~ /^Dynamic/) { } 0 0 0
Condition0%0/3
exists $xsub{$stashname} and $xsub{$stashname} =~ /^Dynamic/
!ll&&!rl&&r
000
MC/DC0%0/2
exists $xsub{$stashname} and $xsub{$stashname} =~ /^Dynamic/
exists $xsub{$stashname} $xsub{$stashname} =~ /^Dynamic/
Truth table0%0/3
A and B
A= exists $xsub{$stashname}B= $xsub{$stashname} =~ /^Dynamic/
ABresult
0X0
100
111
7604 0 $use_xsloader = 1;
7605 0 print "\n\tPUSHMARK(sp);\n";
7606 # XXX -O1 or -O2 needs XPUSHs with dynamic pv
7607 0 ▶ printf "\t%s(%s, %d);\n", # "::bootstrap" gets appended
Branch: 1 branch
BranchTrueFalseTotal
$] < 5.008008 ? : 0 0 0
7608 $] < 5.008008 ? "XPUSHp" : "mXPUSHp", "\"$stashname\"", length($stashname);
7609 0 ▶ if ( $xsub{$stashname} eq 'Dynamic' ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($xsub{$stashname} eq 'Dynamic') { } 0 0 0
7610 41 ▶ no strict 'refs';
Subroutine BEGIN: called CC=1 SCAR=0.0
7611 0 ▶ warn "dl_init $stashname\n" if $verbose;
Branch: 1 branch
BranchTrueFalseTotal
if $B::C::verbose 0 0 0
7612 # just in case we missed it. DynaLoader really needs the @ISA (#308)
7613 0 B::svref_2object( \@{$stashname."::ISA"} ) ->save;
7614 0 print "#ifndef STATICXS\n";
7615 0 print "\tPUTBACK;\n";
7616 0 print qq/\tcall_method("DynaLoader::bootstrap_inherit", G_VOID|G_DISCARD);\n/;
7617 }
7618 else { # XS: need to fix cx for caller[1] to find auto/...
7619 0 my ($stashfile) = $xsub{$stashname} =~ /^Dynamic-(.+)$/;
7620 0 print "#ifndef STATICXS\n";
7621 0 ▶ if ($] >= 5.015003 and $stashfile) {
Branch: 1 branch
BranchTrueFalseTotal
if ($] >= "5.015003" and $stashfile) 0 0 0
Condition0%0/3
$] >= "5.015003" and $stashfile
!ll&&!rl&&r
000
MC/DC0%0/2
$] >= "5.015003" and $stashfile
$] >= "5.015003" $stashfile
Truth table0%0/3
A and B
A= $] >= "5.015003"B= $stashfile
ABresult
0X0
100
111
7622 0 ▶ if ($CPERL51) {
Branch: 1 branch
BranchTrueFalseTotal
if ($CPERL51) 0 0 0
7623 0 my $sofile;
7624 # search stashname in loaded sofiles
7625 0 my @modparts = split(/::/,$stashname);
7626 0 my $modfname = $modparts[-1];
7627 0 my $modpname = join('/',@modparts);
7628 0 my $needle = "auto/$modpname/$modfname\\.".$Config{dlext};
7629 #warn " load_file: @DynaLoader::dl_shared_objects";
7630 #warn " sofile?: $needle";
7631 0 for (@DynaLoader::dl_shared_objects) {
7632 0 ▶ if (m{$needle}) {
Branch: 1 branch
BranchTrueFalseTotal
if (/$needle/) 0 0 0
7633 #warn " load_file: found $_";
7634 0 $sofile = $_; last;
7635 }
7636 }
7637 0 ▶ unless ($sofile) {
Branch: 1 branch
BranchTrueFalseTotal
unless ($sofile) 0 0 0
7638 0 my $modlibname = $stashfile;
7639 0 my $c = scalar @modparts;
7640 0 ▶ if ($stashname eq 'Cwd' and $stashfile !~ /Cwd/) {
Branch: 1 branch
BranchTrueFalseTotal
if ($stashname eq "Cwd" and not $stashfile =~ /Cwd/) 0 0 0
Condition0%0/3
$stashname eq "Cwd" and not $stashfile =~ /Cwd/
!ll&&!rl&&r
000
MC/DC0%0/2
$stashname eq "Cwd" and not $stashfile =~ /Cwd/
$stashname eq "Cwd" not $stashfile =~ /Cwd/
Truth table0%0/3
A and not(B)
A= $stashname eq "Cwd"B= not $stashfile =~ /Cwd/
ABresult
0X0
100
111
7641 0 warn "load_file: fixup Cwd vs $stashfile";
7642 0 $c = 3;
7643 }
7644 0 ▶ $modlibname =~ s,[\\/][^\\/]+$,, while $c--; # Q&D basename
Branch: 1 branch
BranchTrueFalseTotal
$c-- and do { $modlibname =~ s[[\\/][^\\/]+$][] } 0 0 0
7645 0 $sofile = "$modlibname/auto/$modpname/$modfname.".$Config{dlext};
7646 }
7647 #warn "load_file: $stashname, $stashfile, $sofile";
7648 0 $stashfile = $sofile;
7649 }
7650 0 my $stashfile_len = length($stashfile);
7651 0 $stashfile =~ s/(\\[^nrftacx"' ])/\\$1/g; # windows paths: \\ => \\\\
7652 0 printf "\tmXPUSHp(\"%s\", %d);\n", $stashfile, $stashfile_len;
7653 }
7654 0 print "\tPUTBACK;\n";
7655 0 ▶ warn "bootstrapping $stashname added to XSLoader dl_init\n" if $verbose;
Branch: 1 branch
BranchTrueFalseTotal
if $B::C::verbose 0 0 0
7656 # XSLoader has the 2nd insanest API in whole Perl, right after make_warnings_object()
7657 # 5.15.3 workaround for [perl #101336]
7658 0 ▶ if ($] >= 5.015003) {
Branch: 1 branch
BranchTrueFalseTotal
if ($] >= 5.015003) { } 0 0 0
7659 41 ▶ no strict 'refs';
Subroutine BEGIN: called CC=1 SCAR=0.0
7660 0 ▶ unless (grep /^DynaLoader$/, get_isa($stashname)) {
Branch: 1 branch
BranchTrueFalseTotal
unless (grep /^DynaLoader$/, &get_isa($stashname)) 0 0 0
7661 0 my $ro = Internals::SvREADONLY(@{$stashname."::ISA"});
7662 0 ▶ Internals::SvREADONLY(@{$stashname."::ISA"}, 0) if $ro;
Branch: 1 branch
BranchTrueFalseTotal
if $ro 0 0 0
7663 0 push @{$stashname."::ISA"}, 'DynaLoader';
7664 0 ▶ Internals::SvREADONLY(@{$stashname."::ISA"}, 1) if $ro;
Branch: 1 branch
BranchTrueFalseTotal
if $ro 0 0 0
7665 0 svref_2object( \@{$stashname."::ISA"} ) ->save;
7666 }
7667 0 ▶ warn '@',$stashname,"::ISA=(",join(",",@{$stashname."::ISA"}),")\n" if $debug{gv};
Branch: 1 branch
BranchTrueFalseTotal
if $B::C::debug{"gv"} 0 0 0
7668 # TODO #364: if a VERSION was provided need to add it here
7669 0 print qq/\tcall_pv("XSLoader::load_file", G_VOID|G_DISCARD);\n/;
7670 } else {
7671 0 ▶ printf qq/\tCopFILE_set(cxstack[cxstack_ix].blk_oldcop, "%s");\n/,
Branch: 1 branch
BranchTrueFalseTotal
if $stashfile 0 0 0
7672 $stashfile if $stashfile;
7673 # TODO #364: if a VERSION was provided need to add it here
7674 0 print qq/\tcall_pv("XSLoader::load", G_VOID|G_DISCARD);\n/;
7675 }
7676 }
7677 0 ▶ if ($staticxs) {
Branch: 1 branch
BranchTrueFalseTotal
if ($staticxs) 0 0 0
7678 0 my ($laststash) = $stashname =~ /::([^:]+)$/;
7679 0 my $path = $stashname;
7680 0 $path =~ s/::/\//g;
7681 0 ▶ $path .= "/" if $path; # can be empty
Branch: 1 branch
BranchTrueFalseTotal
if $path 0 0 0
7682 0 ▶ $laststash = $stashname unless $laststash; # without ::
Branch: 1 branch
BranchTrueFalseTotal
unless $laststash 0 0 0
7683 0 my $sofile = "auto/" . $path . $laststash . '\.' . $Config{dlext};
7684 #warn "staticxs search $sofile in @DynaLoader::dl_shared_objects\n"
7685 # if $verbose and $debug{pkg};
7686 0 for (@DynaLoader::dl_shared_objects) {
7687 0 ▶ if (m{^(.+/)$sofile$}) {
Branch: 1 branch
BranchTrueFalseTotal
if (m[^(.+/)$sofile$]) 0 0 0
7688 0 print XS $stashname,"\t",$_,"\n";
7689 0 ▶ warn "staticxs $stashname\t$_\n" if $verbose;
Branch: 1 branch
BranchTrueFalseTotal
if $B::C::verbose 0 0 0
7690 0 $sofile = '';
7691 0 last;
7692 }
7693 }
7694 0 ▶ print XS $stashname,"\n" if $sofile; # error case
Branch: 1 branch
BranchTrueFalseTotal
if $sofile 0 0 0
7695 0 ▶ warn "staticxs $stashname\t - $sofile not loaded\n" if $sofile and $verbose;
Branch: 1 branch
BranchTrueFalseTotal
if $sofile and $B::C::verbose 0 0 0
Condition0%0/3
$sofile and $B::C::verbose
!ll&&!rl&&r
000
MC/DC0%0/2
$sofile and $B::C::verbose
$sofile $B::C::verbose
Truth table0%0/3
A and B
A= $sofileB= $B::C::verbose
ABresult
0X0
100
111
7696 }
7697 0 print "#else\n";
7698 0 print "\tPUTBACK;\n";
7699 0 my $stashxsub = $stashname;
7700 0 $stashxsub =~ s/::/__/g;
7701 0 ▶ if ($PERL522 or $staticxs) {
Branch: 1 branch
BranchTrueFalseTotal
if ($PERL522 or $staticxs) { } 0 0 0
Condition0%0/3
$PERL522 or $staticxs
l!l&&r!l&&!r
000
MC/DC0%0/2
$PERL522 or $staticxs
$PERL522 $staticxs
Truth table0%0/3
A or B
A= $PERL522B= $staticxs
ABresult
1X1
011
000
7702 # CvSTASH(CvGV(cv)) is invalid without (issue 86)
7703 # TODO: utf8 stashname (does make sense when loading from the fs?)
7704 0 ▶ if ($PERL522 and $staticxs) { # GH 333
Branch: 1 branch
BranchTrueFalseTotal
if ($PERL522 and $staticxs) { } 0 0 0
Condition0%0/3
$PERL522 and $staticxs
!ll&&!rl&&r
000
MC/DC0%0/2
$PERL522 and $staticxs
$PERL522 $staticxs
Truth table0%0/3
A and B
A= $PERL522B= $staticxs
ABresult
0X0
100
111
7705 0 print "\t{
7706 CV* cv = (CV*)SvREFCNT_inc_simple_NN(get_cv(\"$stashname\::bootstrap\", GV_ADD));
7707 CvISXSUB_on(cv); /* otherwise a perl assertion fails. */
7708 cv->sv_any->xcv_padlist_u.xcv_hscxt = &PL_stack_sp; /* xs_handshake */
7709 boot_$stashxsub(aTHX_ cv);
7710 }\n";
7711 } else {
7712 0 print "\tboot_$stashxsub(aTHX_ get_cv(\"$stashname\::bootstrap\", GV_ADD));\n";
7713 }
7714 } else {
7715 0 print "\tboot_$stashxsub(aTHX_ NULL);\n";
7716 }
7717 0 print "#endif\n";
7718 0 print "\tSPAGAIN;\n";
7719 #print "\tPUTBACK;\n";
7720 } else {
7721 warn "no dl_init for $stashname, ".
7722 0 ▶ (!$xsub{$stashname} ? "not bootstrapped\n" : "bootstrapped as $xsub{$stashname}\n")
Branch: 2 branches
BranchTrueFalseTotal
if $B::C::verbose 0 0 0
!$xsub{$stashname} ? : 0 0 0
7723 if $verbose;
7724 # XXX Too late. This might fool run-time DynaLoading.
7725 # We really should remove this via init from @DynaLoader::dl_modules
7726 0 @DynaLoader::dl_modules = grep { $_ ne $stashname } @DynaLoader::dl_modules;
7727  
7728 }
7729 }
7730 0 print "\tFREETMPS;\n";
7731 0 ▶ print "\tcxstack_ix--;\n" if $xs; # i.e. POPBLOCK
Branch: 1 branch
BranchTrueFalseTotal
if $xs 0 0 0
7732 0 print "\tLEAVE;\n";
7733 0 print "/* end DynaLoader bootstrapping */\n";
7734 0 ▶ close XS if $staticxs;
Branch: 1 branch
BranchTrueFalseTotal
if $staticxs 0 0 0
7735 }
7736 0 print "}\n";
7737 }
7738  
7739 0 ▶sub output_main {
Subroutine output_main: not called CC=32 SCAR=69.6
Pod undocumented
7740 0 ▶ return if defined $module;
Branch: 1 branch
BranchTrueFalseTotal
if defined $B::C::module 0 0 0
7741 0 print <<'_EOT10';
7742  
7743 /* if USE_IMPLICIT_SYS, we need a 'real' exit */
7744 #if defined(exit)
7745 #undef exit
7746 #endif
7747  
7748 int
7749 main(int argc, char **argv, char **env)
7750 {
7751 int exitstatus;
7752 int i;
7753 char **fakeargv;
7754 int options_count;
7755 PerlInterpreter *my_perl;
7756  
7757 #ifdef PERL_GLOBAL_STRUCT
7758 struct perl_vars *my_vars = Perl_init_global_struct(aTHX);
7759 # ifdef PERL_GLOBAL_STRUCT_PRIVATE
7760 int veto;
7761 my_plvarsp = my_vars;
7762 # endif
7763 #endif
7764  
7765 PERL_SYS_INIT3(&argc,&argv,&env);
7766  
7767 #ifdef WIN32
7768 #define PL_do_undump 0
7769 #endif
7770 if (!PL_do_undump) {
7771 my_perl = perl_alloc();
7772 if (!my_perl)
7773 exit(1);
7774 perl_construct( my_perl );
7775 PL_perl_destruct_level = 0;
7776 }
7777 _EOT10
7778 0 ▶ if ($ITHREADS and $] > 5.007) {
Branch: 1 branch
BranchTrueFalseTotal
if ($ITHREADS and $] > "5.007") 0 0 0
Condition0%0/3
$ITHREADS and $] > "5.007"
!ll&&!rl&&r
000
MC/DC0%0/2
$ITHREADS and $] > "5.007"
$ITHREADS $] > "5.007"
Truth table0%0/3
A and B
A= $ITHREADSB= $] > "5.007"
ABresult
0X0
100
111
7779 # XXX init free elems!
7780 0 my $pad_len = regex_padav->FILL; # first is an empty avref
7781 0 print <<_EOT11;
7782 #ifdef USE_ITHREADS
7783 if (!*PL_regex_pad) {
7784 /* Someone is overwriting regex_pad since 5.15, but not on -fno-warnings */
7785 PL_regex_padav = newAV();
7786 #if PERL_VERSION > 10
7787 av_push(PL_regex_padav, newSVpvs("")); /* First entry is empty */
7788 #else
7789 av_push(PL_regex_padav, newSViv(0));
7790 #endif
7791 PL_regex_pad = AvARRAY(PL_regex_padav);
7792 }
7793 for( i = 0; i < $pad_len; ++i ) {
7794 av_push( PL_regex_padav, newSViv(0) );
7795 }
7796 PL_regex_pad = AvARRAY( PL_regex_padav );
7797 #endif
7798 _EOT11
7799  
7800 }
7801 0 ▶ print " PL_exit_flags |= PERL_EXIT_DESTRUCT_END;\n" unless $PERL56;
Branch: 1 branch
BranchTrueFalseTotal
unless $PERL56 0 0 0
7802 0 ▶ if ($] >= 5.008009) {
Branch: 1 branch
BranchTrueFalseTotal
if ($] >= "5.008009") 0 0 0
7803 0 print <<'_SAFE_PUTENV';
7804 #ifndef PERL_USE_SAFE_PUTENV
7805 PL_use_safe_putenv = 0;
7806 #endif
7807 _SAFE_PUTENV
7808 }
7809 0 ▶ if (!$PERL510) {
Branch: 1 branch
BranchTrueFalseTotal
unless ($PERL510) 0 0 0
7810 0 print <<'_EOT12';
7811 #if defined(CSH)
7812 if (!PL_cshlen)
7813 PL_cshlen = strlen(PL_cshname);
7814 #endif
7815 _EOT12
7816 }
7817  
7818 # XXX With -e "" we need to fake parse_body() scriptname = BIT_BUCKET
7819 0 print <<'_EOT13';
7820 #ifdef ALLOW_PERL_OPTIONS
7821 #define EXTRA_OPTIONS 3
7822 #else
7823 #define EXTRA_OPTIONS 4
7824 #endif /* ALLOW_PERL_OPTIONS */
7825 Newx(fakeargv, argc + EXTRA_OPTIONS + 1, char *);
7826 fakeargv[0] = argv[0];
7827 fakeargv[1] = "-e";
7828 fakeargv[2] = "";
7829 options_count = 3;
7830 _EOT13
7831  
7832 # honour -T
7833 0 ▶ if (!$PERL56 and ${^TAINT}) {
Branch: 1 branch
BranchTrueFalseTotal
if (not $PERL56 and ${^TAINT}) 0 0 0
Condition0%0/3
not $PERL56 and ${^TAINT}
!ll&&!rl&&r
000
MC/DC0%0/2
not $PERL56 and ${^TAINT}
not $PERL56 ${^TAINT}
Truth table0%0/3
not(A) and B
A= not $PERL56B= ${^TAINT}
ABresult
0X0
100
111
7834 0 print <<'_EOT14';
7835 fakeargv[options_count] = "-T";
7836 ++options_count;
7837 _EOT14
7838  
7839 }
7840 0 print <<'_EOT15';
7841 #ifndef ALLOW_PERL_OPTIONS
7842 fakeargv[options_count] = "--";
7843 ++options_count;
7844 #endif /* ALLOW_PERL_OPTIONS */
7845 for (i = 1; i < argc; i++)
7846 fakeargv[i + options_count - 1] = argv[i];
7847 fakeargv[argc + options_count - 1] = 0;
7848  
7849 exitstatus = perl_parse(my_perl, xs_init, argc + options_count - 1,
7850 fakeargv, env);
7851 if (exitstatus)
7852 exit( exitstatus );
7853  
7854 TAINT;
7855 _EOT15
7856  
7857 0 ▶ if ($use_perl_script_name) {
Branch: 1 branch
BranchTrueFalseTotal
if ($B::C::use_perl_script_name) { } 0 0 0
7858 0 my $dollar_0 = cstring($0);
7859 0 print sprintf(qq{ sv_setpv_mg(get_svs("0", GV_ADD|GV_NOTQUAL), %s);\n}, $dollar_0);
7860 0 print sprintf(qq{ CopFILE_set(&PL_compiling, %s);\n}, $dollar_0);
7861 }
7862 else {
7863 #print q{ warn("PL_origalen=%d\n", PL_origalen);},"\n";
7864 0 print qq{ sv_setpv_mg(get_svs("0", GV_ADD|GV_NOTQUAL), argv[0]);\n};
7865 0 print qq{ CopFILE_set(&PL_compiling, argv[0]);\n};
7866 }
7867 # more global vars
7868 0 ▶ print " PL_hints = $^H;\n" if $^H;
Branch: 1 branch
BranchTrueFalseTotal
if $^H 0 0 0
7869 0 ▶ print " PL_unicode = ${^UNICODE};\n" if ${^UNICODE};
Branch: 1 branch
BranchTrueFalseTotal
if ${^UNICODE} 0 0 0
7870 # system-specific needs to be skipped: is set during init_i18nl10n if PerlIO
7871 # is compiled in and on a utf8 locale.
7872 #print " PL_utf8locale = ${^UTF8LOCALE};\n" if ${^UTF8LOCALE};
7873 #print " PL_utf8cache = ${^UTF8CACHE};\n" if ${^UTF8CACHE};
7874 # nomg
7875 0 ▶ print sprintf(qq{ sv_setpv(get_svs(";", GV_ADD|GV_NOTQUAL), %s);\n}, cstring($;)) if $; ne "\34";
Branch: 1 branch
BranchTrueFalseTotal
if $; ne "\34" 0 0 0
7876 0 ▶ print sprintf(qq{ sv_setpv(get_svs("\\"", GV_NOTQUAL), %s); /* \$" */\n}, cstring($")) if $" ne " ";
Branch: 1 branch
BranchTrueFalseTotal
if $" ne " " 0 0 0
7877 # global IO vars
7878 0 ▶ if ($PERL56) {
Branch: 1 branch
BranchTrueFalseTotal
if ($PERL56) { } 0 0 0
7879 0 ▶ print sprintf(qq{ PL_ofs = %s; PL_ofslen = %u; /* \$, */\n}, cstring($,), length $,) if $,;
Branch: 1 branch
BranchTrueFalseTotal
if $, 0 0 0
7880 0 ▶ print sprintf(qq{ PL_ors = %s; PL_orslen = %u; /* \$\\ */\n}, cstring($\), length $\) if $\;
Branch: 1 branch
BranchTrueFalseTotal
if $\ 0 0 0
7881 } else {
7882 0 ▶ print sprintf(qq{ sv_setpv_mg(GvSVn(PL_ofsgv), %s); /* \$, */\n}, cstring($,)) if $,;
Branch: 1 branch
BranchTrueFalseTotal
if $, 0 0 0
7883 0 ▶ print sprintf(qq{ sv_setpv_mg(get_svs("\\\\", GV_ADD|GV_NOTQUAL), %s); /* \$\\ */\n}, cstring($\)) if $\; #ORS
Branch: 1 branch
BranchTrueFalseTotal
if $\ 0 0 0
7884 }
7885 0 ▶ print sprintf(qq{ sv_setpv_mg(get_svs("/", GV_NOTQUAL), %s);\n}, cstring($/)) if $/ ne "\n"; #RS
Branch: 1 branch
BranchTrueFalseTotal
if $/ ne "\n" 0 0 0
7886 0 ▶ print qq{ sv_setiv_mg(get_svs("|", GV_ADD|GV_NOTQUAL), $|);\n} if $|; #OUTPUT_AUTOFLUSH
Branch: 1 branch
BranchTrueFalseTotal
if $| 0 0 0
7887 # global format vars
7888 0 ▶ print sprintf(qq{ sv_setpv_mg(get_svs("^A", GV_ADD|GV_NOTQUAL), %s);\n}, cstring($^A)) if $^A; #ACCUMULATOR
Branch: 1 branch
BranchTrueFalseTotal
if $^A 0 0 0
7889 0 ▶ print sprintf(qq{ sv_setpv_mg(get_svs("^L", GV_ADD|GV_NOTQUAL), %s);\n}, cstring($^L)) if $^L ne "\f"; #FORMFEED
Branch: 1 branch
BranchTrueFalseTotal
if $^L ne "\f" 0 0 0
7890 0 ▶ print sprintf(qq{ sv_setpv_mg(get_svs(":", GV_ADD|GV_NOTQUAL), %s);\n}, cstring($:)) if $: ne " \n-"; #LINE_BREAK_CHARACTERS
Branch: 1 branch
BranchTrueFalseTotal
if $main::: ne " \n-" 0 0 0
7891 0 ▶ print sprintf(qq/ sv_setpv_mg(get_svs("^", GV_ADD|GV_NOTQUAL), savepvn(%s, %u));\n/, cstring($^), length($^))
Branch: 1 branch
BranchTrueFalseTotal
if $^ ne "STDOUT_TOP" 0 0 0
7892 if $^ ne "STDOUT_TOP";
7893 0 ▶ print sprintf(qq/ sv_setpv_mg(get_svs("~", GV_ADD|GV_NOTQUAL), savepvn(%s, %u));\n/, cstring($~), length($~))
Branch: 1 branch
BranchTrueFalseTotal
if $~ ne "STDOUT" 0 0 0
7894 if $~ ne "STDOUT";
7895 0 ▶ print qq{ sv_setiv_mg(get_svs("%", GV_ADD|GV_NOTQUAL), $%);\n} if $%; #PAGE_NUMBER
Branch: 1 branch
BranchTrueFalseTotal
if $% 0 0 0
7896 0 ▶ print qq{ sv_setiv_mg(get_svs("-", GV_ADD|GV_NOTQUAL), $-);\n} unless ($- == 0 or $- == 60); #LINES_LEFT
Branch: 1 branch
BranchTrueFalseTotal
unless $- == 0 or $- == 60 0 0 0
Condition0%0/3
$- == 0 or $- == 60
l!l&&r!l&&!r
000
MC/DC0%0/2
$- == 0 or $- == 60
$- == 0 $- == 60
Truth table0%0/3
A or B
A= $- == 0B= $- == 60
ABresult
1X1
011
000
7897 0 ▶ print qq{ sv_setiv_mg(get_svs("=", GV_ADD|GV_NOTQUAL), $=);\n} if $= != 60; #LINES_PER_PAGE
Branch: 1 branch
BranchTrueFalseTotal
if $= != 60 0 0 0
7898  
7899 # deprecated global vars
7900 0 ▶ print qq{ {SV* s = get_svs("[",GV_NOTQUAL); sv_setiv(s, $[); mg_set(s);}\n} if $[; #ARRAY_BASE
Branch: 1 branch
BranchTrueFalseTotal
if $[ 0 0 0
7901 0 ▶ if ($] < 5.010) { # OFMT and multiline matching
Branch: 1 branch
BranchTrueFalseTotal
if ($] < "5.01") 0 0 0
7902 0 eval q[
7903 print sprintf(qq{ sv_setpv(GvSVn(gv_fetchpv("\$#", GV_ADD|GV_NOTQUAL, SVt_PV)), %s);\n},
7904 cstring($#)) if $#;
7905 print sprintf(qq{ sv_setiv(GvSVn(gv_fetchpv("\$*", GV_ADD|GV_NOTQUAL, SVt_IV)), %d);\n}, $*) if $*;
7906 ];
7907 }
7908  
7909 print sprintf(qq{ sv_setpv_mg(get_svs("\030", GV_ADD|GV_NOTQUAL), %s); /* \$^X */\n},
7910 0 cstring($Config{perlpath}));
7911 0 print <<'EOT';
7912 TAINT_NOT;
7913  
7914 #if PERL_VERSION < 10 || ((PERL_VERSION == 10) && (PERL_SUBVERSION < 1))
7915 PL_compcv = 0;
7916 #else
7917 PL_compcv = MUTABLE_CV(newSV_type(SVt_PVCV));
7918 CvUNIQUE_on(PL_compcv);
7919 CvPADLIST(PL_compcv) = pad_new(0);
7920 #endif
7921 EOT
7922  
7923 0 output_init();
7924 0 print " exitstatus = perl_run( my_perl );\n";
7925 0 output_local_destruct("main");
7926 0 output_global_destruct();
7927  
7928 # XXX endav is called via call_list and so it is freed right after usage.
7929 # Setting dirty here is useless.
7930 # Protect against pad undef in END block
7931 #print " PL_dirty = 1;\n" unless $B::C::pv_copy_on_grow;
7932  
7933 0 print <<'EOT1';
7934 perl_free( my_perl );
7935  
7936 PERL_SYS_TERM();
7937  
7938 exit( exitstatus );
7939 }
7940 EOT1
7941  
7942 }
7943  
7944 0 ▶sub output_init {
Subroutine output_init: not called CC=3 SCAR=24.8
Pod undocumented
7945 0 print <<'EOT';
7946 /* our special compiled init */
7947 perl_init(aTHX);
7948 EOT
7949  
7950 0 ▶ print " perl_init1(aTHX);\n" if $init1->index >= 0;
Branch: 1 branch
BranchTrueFalseTotal
if $init1->index >= 0 0 0 0
7951 # XXX maybe we need dl_init for a module, esp. when it's XS loading.
7952 0 print " dl_init(aTHX);\n";
7953 0 ▶ print " perl_init2(aTHX);\n" if $init2->index >= 0;
Branch: 1 branch
BranchTrueFalseTotal
if $init2->index >= 0 0 0 0
7954 }
7955  
7956 0 ▶sub output_local_destruct {
Subroutine output_local_destruct: not called CC=6 SCAR=37.4
Pod undocumented
7957 0 my $name = shift;
7958 0 ▶ $name = 'main' unless defined $name;
Branch: 1 branch
BranchTrueFalseTotal
unless defined $name 0 0 0
7959 0 foreach my $s ( @{ $init->[-1]{pre_destruct} } ) {
7960 0 print " ".$s."\n";
7961 }
7962 0 ▶ if ( $B::C::destruct ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($B::C::destruct) 0 0 0
7963 0 ▶ if (defined $module and !$ITHREADS) {
Branch: 1 branch
BranchTrueFalseTotal
if (defined $B::C::module and not $ITHREADS) { } 0 0 0
Condition0%0/3
defined $B::C::module and not $ITHREADS
!ll&&!rl&&r
000
MC/DC0%0/2
defined $B::C::module and not $ITHREADS
defined $B::C::module not $ITHREADS
Truth table0%0/3
A and not(B)
A= defined $B::C::moduleB= not $ITHREADS
ABresult
0X0
100
111
7964 0 print " destruct_$name( NULL );\n";
7965 } else {
7966 0 print " destruct_$name( my_perl );\n";
7967 }
7968 }
7969 }
7970  
7971 0 ▶sub output_global_destruct {
Subroutine output_global_destruct: not called CC=9 SCAR=45.0
Pod undocumented
7972 0 ▶ if ( !$B::C::destruct ) {
Branch: 1 branch
BranchTrueFalseTotal
if (not $B::C::destruct) { } 0 0 0
7973 0 ▶ warn "fast_perl_destruct (-fno-destruct)\n" if $verbose;
Branch: 1 branch
BranchTrueFalseTotal
if $B::C::verbose 0 0 0
7974 0 print " fast_perl_destruct( my_perl );\n";
7975 }
7976 else {
7977  
7978 0 print <<'_EOT7';
7979 {
7980 volatile signed char destruct_level = PL_perl_destruct_level;
7981 const char * const s = PerlEnv_getenv("PERL_DESTRUCT_LEVEL");
7982 _EOT7
7983  
7984 0 my $riter_type = "I32";
7985 0 ▶ if ($CPERL51) {
Branch: 1 branch
BranchTrueFalseTotal
if ($CPERL51) 0 0 0
7986 0 ▶ $riter_type = $CPERL55 ? "U32" : "SSize_t";
Branch: 1 branch
BranchTrueFalseTotal
$CPERL55 ? : 0 0 0
7987 }
7988 0 my $hvmax_type = "STRLEN";
7989 0 ▶ if ($CPERL51) {
Branch: 1 branch
BranchTrueFalseTotal
if ($CPERL51) 0 0 0
7990 0 ▶ $hvmax_type = $CPERL55 ? "U32" : "SSize_t";
Branch: 1 branch
BranchTrueFalseTotal
$CPERL55 ? : 0 0 0
7991 }
7992 0 print "#define RITER_T $riter_type\n";
7993 0 print "#define HVMAX_T $hvmax_type\n";
7994  
7995 0 print <<'_EOT7a';
7996 /* Avoid Unbalanced string table refcount warning with PERL_DESTRUCT_LEVEL=2 */
7997 if (s) {
7998 const int i = atoi(s);
7999 if (destruct_level < i) destruct_level = i;
8000 }
8001 if (destruct_level >= 1) {
8002 const HVMAX_T max = HvMAX(PL_strtab);
8003 HE * const * const array = HvARRAY(PL_strtab);
8004 RITER_T riter = 0;
8005 HE *hent = array[0];
8006 for (;;) {
8007 if (hent) {
8008 HE * const next = HeNEXT(hent);
8009 if (!HEK_STATIC(&((struct shared_he*)hent)->shared_he_hek))
8010 Safefree(hent);
8011 hent = next;
8012 }
8013 if (!hent) {
8014 if (++riter > max)
8015 break;
8016 hent = array[riter];
8017 }
8018 }
8019 /* Silence strtab refcnt warnings during global destruction */
8020 Zero(HvARRAY(PL_strtab), max, HE*);
8021 /* NULL the HEK "dfs" */
8022 #if PERL_VERSION > 10
8023 PL_registered_mros = (HV*)&PL_sv_undef;
8024 CopHINTHASH_set(&PL_compiling, NULL);
8025 #endif
8026 }
8027  
8028 #if PERL_VERSION > 7
8029 if (DEBUG_D_TEST) {
8030 SV* sva;
8031 PerlIO_printf(Perl_debug_log, "sv[0]: 0x%p, sv_arenaroot: 0x%p, sva->any: 0x%p\n",
8032 SvANY(&sv_list[0]), PL_sv_arenaroot, SvANY(PL_sv_arenaroot));
8033 for (sva = PL_sv_arenaroot;
8034 sva;
8035 /* avoid cycles */
8036 sva = (sva == (SV*)SvANY(sva)) ? NULL : (SV*)SvANY(sva))
8037 {
8038 PerlIO_printf(Perl_debug_log, "sv_arena: 0x%p - 0x%p (%lu)\n",
8039 sva, sva+SvREFCNT(sva), (long)SvREFCNT(sva));
8040 }
8041 }
8042 #endif
8043 }
8044 _EOT7a
8045 0 ▶ if (defined $module and !$ITHREADS) {
Branch: 1 branch
BranchTrueFalseTotal
if (defined $B::C::module and not $ITHREADS) { } 0 0 0
Condition0%0/3
defined $B::C::module and not $ITHREADS
!ll&&!rl&&r
000
MC/DC0%0/2
defined $B::C::module and not $ITHREADS
defined $B::C::module not $ITHREADS
Truth table0%0/3
A and not(B)
A= defined $B::C::moduleB= not $ITHREADS
ABresult
0X0
100
111
8046 0 print " perl_destruct( NULL );\n";
8047 } else {
8048 0 print " perl_destruct( my_perl );\n";
8049 }
8050 }
8051 }
8052  
8053 0 ▶sub dump_symtable {
Subroutine dump_symtable: not called CC=2 SCAR=17.9
Pod undocumented
8054 # For debugging
8055 0 my ( $sym, $val );
8056 0 warn "----Symbol table:\n";
8057 #while ( ( $sym, $val ) = each %symtable )
8058 0 for $sym (sort keys %symtable) {
8059 0 $val = $symtable{$sym};
8060 0 warn "$sym => $val\n";
8061 }
8062 0 warn "---End of symbol table\n";
8063 }
8064  
8065 0 ▶sub save_object {
Subroutine save_object: not called CC=2 SCAR=17.9
Pod undocumented
8066 0 my $sv;
8067 0 foreach $sv (@_) {
8068 0 svref_2object($sv)->save;
8069 }
8070 }
8071  
8072 0 ▶sub Dummy_BootStrap { }
Subroutine Dummy_BootStrap: not called CC=1 SCAR=0.0
Pod undocumented
8073  
8074 #ignore nullified cv
8075 0 ▶sub B::SPECIAL::savecv {}
Subroutine savecv: not called CC=1 SCAR=0.0
8076  
8077 0 ▶sub B::GV::savecv {
Subroutine savecv: not called CC=34 SCAR=70.8
8078 0 my $gv = shift;
8079 0 my $package = $gv->STASH->NAME;
8080 0 my $name = $gv->NAME;
8081 0 my $cv = $gv->CV;
8082 0 my $sv = $gv->SV;
8083 0 my $av = $gv->AV;
8084 0 my $hv = $gv->HV;
8085  
8086 0 my $fullname = $package . "::" . $name;
8087 warn sprintf( "Checking GV *%s 0x%x\n", cstring($fullname), $$gv )
8088 0 ▶ if $debug{gv} and $verbose;
Branch: 1 branch
BranchTrueFalseTotal
if $B::C::debug{"gv"} and $B::C::verbose 0 0 0
Condition0%0/3
$B::C::debug{"gv"} and $B::C::verbose
!ll&&!rl&&r
000
MC/DC0%0/2
$B::C::debug{"gv"} and $B::C::verbose
$B::C::debug{"gv"} $B::C::verbose
Truth table0%0/3
A and B
A= $B::C::debug{"gv"}B= $B::C::verbose
ABresult
0X0
100
111
8089 # We may be looking at this package just because it is a branch in the
8090 # symbol table which is on the path to a package which we need to save
8091 # e.g. this is 'Getopt' and we need to save 'Getopt::Long'
8092 #
8093 0 ▶ return if ( $package ne 'main' and !$include_package{$package} );
Branch: 1 branch
BranchTrueFalseTotal
if $package ne "main" and not $include_package{$package} 0 0 0
Condition0%0/3
$package ne "main" and not $include_package{$package}
!ll&&!rl&&r
000
MC/DC0%0/2
$package ne "main" and not $include_package{$package}
$package ne "main" not $include_package{$package}
Truth table0%0/3
A and not(B)
A= $package ne "main"B= not $include_package{$package}
ABresult
0X0
100
111
8094 0 ▶ return if ( $package eq 'main' and
Branch: 1 branch
BranchTrueFalseTotal
if $package eq "main" and $name =~ /^([^\w].*|_\<.*|INC|ARGV|SIG|ENV|BEGIN|main::|!)$/ 0 0 0
Condition0%0/3
$package eq "main" and $name =~ /^([^\w].*|_\<.*|INC|ARGV|SIG|ENV|BEGIN|main::|!)$/
!ll&&!rl&&r
000
MC/DC0%0/2
$package eq "main" and $name =~ /^([^\w].*|_\<.*|INC|ARGV|SIG|ENV|BEGIN|main::|!)$/
$package eq "main" $name =~ /^([^\w].*|_\<.*|INC|ARGV|SIG|ENV|BEGIN|main::|!)$/
Truth table0%0/3
A and B
A= $package eq "main"B= $name =~ /^([^\w].*|_\<.*|INC|ARGV|SIG|ENV|BEGIN|main::|!)$/
ABresult
0X0
100
111
8095 $name =~ /^([^\w].*|_\<.*|INC|ARGV|SIG|ENV|BEGIN|main::|!)$/ );
8096  
8097 0 ▶ warn sprintf( "Used GV \*$fullname 0x%x\n", $$gv ) if $debug{gv};
Branch: 1 branch
BranchTrueFalseTotal
if $B::C::debug{"gv"} 0 0 0
8098 0 ▶ return unless ( $$cv || $$av || $$sv || $$hv || $gv->IO || $gv->FORM );
Branch: 1 branch
BranchTrueFalseTotal
unless $$cv or $$av or $$sv or $$hv or $gv->IO or $gv->FORM 0 0 0
Condition0%0/15
$$cv or $$av or $$sv or $$hv or $gv->IO or $gv->FORM
l!l&&r!l&&!r
000
$$cv or $$av or $$sv or $$hv or $gv->IO
l!l&&r!l&&!r
000
$$cv or $$av or $$sv or $$hv
l!l&&r!l&&!r
000
$$cv or $$av or $$sv
l!l&&r!l&&!r
000
$$cv or $$av
l!l&&r!l&&!r
000
MC/DC0%0/6
$$cv or $$av or $$sv or $$hv or $gv->IO or $gv->FORM
$$cv $$av $$sv $$hv $gv->IO $gv->FORM
Truth table0%0/7
A or B or C or D or E or F
A= $$cvB= $$avC= $$svD= $$hvE= $gv->IOF= $gv->FORM
ABCDEFresult
1XXXXX1
01XXXX1
001XXX1
0001XX1
00001X1
0000011
0000000
8099 0 ▶ if ($$cv and $name eq 'bootstrap' and $cv->XSUB) {
Branch: 1 branch
BranchTrueFalseTotal
if ($$cv and $name eq "bootstrap" and $cv->XSUB) 0 0 0
Condition0%0/6
$$cv and $name eq "bootstrap" and $cv->XSUB
!ll&&!rl&&r
000
$$cv and $name eq "bootstrap"
!ll&&!rl&&r
000
MC/DC0%0/3
$$cv and $name eq "bootstrap" and $cv->XSUB
$$cv $name eq "bootstrap" $cv->XSUB
Truth table0%0/4
A and B and C
A= $$cvB= $name eq "bootstrap"C= $cv->XSUB
ABCresult
0XX0
10X0
1100
1111
8100 #return $cv->save($fullname);
8101 0 ▶ warn sprintf( "Skip XS \&$fullname 0x%x\n", $$cv ) if $debug{gv};
Branch: 1 branch
BranchTrueFalseTotal
if $B::C::debug{"gv"} 0 0 0
8102 0 return;
8103 }
8104 0 ▶ if ( $$cv and in_static_core($package, $name) and ref($cv) eq 'B::CV' # 5.8,4 issue32
Branch: 1 branch
BranchTrueFalseTotal
if ($$cv and in_static_core($package, $name) and ref $cv eq "B::CV" and $cv->XSUB) 0 0 0
Condition0%0/9
$$cv and in_static_core($package, $name) and ref $cv eq "B::CV" and $cv->XSUB
!ll&&!rl&&r
000
$$cv and in_static_core($package, $name) and ref $cv eq "B::CV"
!ll&&!rl&&r
000
$$cv and in_static_core($package, $name)
!ll&&!rl&&r
000
MC/DC0%0/4
$$cv and in_static_core($package, $name) and ref $cv eq "B::CV" and $cv->XSUB
$$cv in_static_core($package, $name) ref $cv eq "B::CV" $cv->XSUB
Truth table0%0/5
A and B and C and D
A= $$cvB= in_static_core($package, $name)C= ref $cv eq "B::CV"D= $cv->XSUB
ABCDresult
0XXX0
10XX0
110X0
11100
11111
8105 and $cv->XSUB ) {
8106 0 ▶ warn("Skip internal XS $fullname\n") if $debug{gv};
Branch: 1 branch
BranchTrueFalseTotal
if $B::C::debug{"gv"} 0 0 0
8107 # but prevent it from being deleted
8108 0 ▶ unless ($dumped_package{$package}) {
Branch: 1 branch
BranchTrueFalseTotal
unless ($dumped_package{$package}) 0 0 0
8109 #$dumped_package{$package} = 1;
8110 0 mark_package($package, 1);
8111 }
8112 0 return;
8113 }
8114 0 ▶ if ($package eq 'B::C') {
Branch: 1 branch
BranchTrueFalseTotal
if ($package eq "B::C") 0 0 0
8115 0 ▶ warn sprintf( "Skip XS \&$fullname 0x%x\n", $$cv ) if $debug{gv};
Branch: 1 branch
BranchTrueFalseTotal
if $B::C::debug{"gv"} 0 0 0
8116 0 return;
8117 }
8118 0 ▶ if ($fullname =~ /^(bytes|utf8)::AUTOLOAD$/) {
Branch: 1 branch
BranchTrueFalseTotal
if ($fullname =~ /^(bytes|utf8)::AUTOLOAD$/) 0 0 0
8119 0 $gv = force_heavy($package);
8120 }
8121 # XXX fails and should not be needed. The B::C part should be skipped 9 lines above, but be defensive
8122 0 ▶ return if $fullname eq 'B::walksymtable' or $fullname eq 'B::C::walksymtable';
Branch: 1 branch
BranchTrueFalseTotal
if $fullname eq "B::walksymtable" or $fullname eq "B::C::walksymtable" 0 0 0
Condition0%0/3
$fullname eq "B::walksymtable" or $fullname eq "B::C::walksymtable"
l!l&&r!l&&!r
000
MC/DC0%0/2
$fullname eq "B::walksymtable" or $fullname eq "B::C::walksymtable"
$fullname eq "B::walksymtable" $fullname eq "B::C::walksymtable"
Truth table0%0/3
A or B
A= $fullname eq "B::walksymtable"B= $fullname eq "B::C::walksymtable"
ABresult
1X1
011
000
8123 # Config is marked on any Config symbol. TIE and DESTROY are exceptions,
8124 # used by the compiler itself
8125 0 ▶ if ($name eq 'Config') {
Branch: 1 branch
BranchTrueFalseTotal
if ($name eq "Config") 0 0 0
8126 0 ▶ mark_package('Config', 1) if !$include_package{'Config'};
Branch: 1 branch
BranchTrueFalseTotal
unless $include_package{"Config"} 0 0 0
8127 }
8128 0 ▶ $dumped_package{$package} = 1 if !exists $dumped_package{$package} and $package !~ /::$/;
Branch: 1 branch
BranchTrueFalseTotal
unless exists $dumped_package{$package} or $package =~ /::$/ 0 0 0
Condition0%0/3
exists $dumped_package{$package} or $package =~ /::$/
l!l&&r!l&&!r
000
MC/DC0%0/2
exists $dumped_package{$package} or $package =~ /::$/
exists $dumped_package{$package} $package =~ /::$/
Truth table0%0/3
A or B
A= exists $dumped_package{$package}B= $package =~ /::$/
ABresult
1X1
011
000
8129 0 ▶ warn sprintf( "Saving GV \*$fullname 0x%x\n", $$gv ) if $debug{gv};
Branch: 1 branch
BranchTrueFalseTotal
if $B::C::debug{"gv"} 0 0 0
8130 0 $gv->save($fullname);
8131 }
8132  
8133 # Fixes bug #307: use foreach, not each
8134 # each is not safe to use (at all). walksymtable is called recursively which might add
8135 # symbols to the stash, which might cause re-ordered rehashes, which will fool the hash
8136 # iterator, leading to missing symbols in the binary.
8137 # Old perl5 bug: The iterator should really be stored in the op, not the hash.
8138 0 ▶sub walksymtable {
Subroutine walksymtable: not called CC=12 SCAR=48.4
Pod undocumented
8139 0 my ($symref, $method, $recurse, $prefix) = @_;
8140 0 my ($sym, $ref, $fullname);
8141 0 ▶ $prefix = '' unless defined $prefix;
Branch: 1 branch
BranchTrueFalseTotal
unless defined $prefix 0 0 0
8142  
8143 # If load_utf8_heavy doesn't happen before we walk utf8::
8144 # (when utf8_heavy has already been called) then the stored CV for utf8::S
8145 # WASHNEW could be wrong.
8146 0 ▶ load_utf8_heavy() if ( $prefix eq 'utf8::' && defined $symref->{'SWASHNEW'} );
Branch: 1 branch
BranchTrueFalseTotal
if $prefix eq "utf8::" and defined $symref->{"SWASHNEW"} 0 0 0
Condition0%0/3
$prefix eq "utf8::" and defined $symref->{"SWASHNEW"}
!ll&&!rl&&r
000
MC/DC0%0/2
$prefix eq "utf8::" and defined $symref->{"SWASHNEW"}
$prefix eq "utf8::" defined $symref->{"SWASHNEW"}
Truth table0%0/3
A and B
A= $prefix eq "utf8::"B= defined $symref->{"SWASHNEW"}
ABresult
0X0
100
111
8147  
8148 my @list = sort {
8149 # we want these symbols to be saved last to avoid incomplete saves
8150 # +/- reverse is to defer + - to fix Tie::Hash::NamedCapturespecial cases. GH #247
8151 # _loose_name redefined from utf8_heavy.pl GH #364
8152 0 foreach my $v (qw{- + utf8:: bytes::}) {
8153 0 ▶ $a eq $v and return 1;
Branch: 1 branch
BranchTrueFalseTotal
$a eq $v and return 1 0 0 0
8154 0 ▶ $b eq $v and return -1;
Branch: 1 branch
BranchTrueFalseTotal
$b eq $v and return -1 0 0 0
8155 }
8156 # reverse order for now to preserve original behavior before improved patch
8157 0 $b cmp $a
8158 } keys %$symref;
8159  
8160 0 foreach my $sym ( @list ) {
8161 41 ▶ no strict 'refs';
Subroutine BEGIN: called CC=1 SCAR=0.0
8162 0 $ref = $symref->{$sym};
8163 0 $fullname = "*main::".$prefix.$sym;
8164 0 ▶ if ($sym =~ /::$/) {
Branch: 1 branch
BranchTrueFalseTotal
if ($sym =~ /::$/) { } 0 0 0
8165 0 $sym = $prefix . $sym;
8166 0 ▶ if (svref_2object(\*$sym)->NAME ne "main::" && $sym ne "<none>::" && &$recurse($sym)) {
Branch: 1 branch
BranchTrueFalseTotal
if (svref_2object(\*$sym)->NAME ne "main::" and $sym ne "<none>::" and &$recurse($sym)) 0 0 0
Condition0%0/6
svref_2object(\*$sym)->NAME ne "main::" and $sym ne "<none>::" and &$recurse($sym)
!ll&&!rl&&r
000
svref_2object(\*$sym)->NAME ne "main::" and $sym ne "<none>::"
!ll&&!rl&&r
000
MC/DC0%0/3
svref_2object(\*$sym)->NAME ne "main::" and $sym ne "<none>::" and &$recurse($sym)
svref_2object(\*$sym)->NAME ne "main::" $sym ne "<none>::" &$recurse($sym)
Truth table0%0/4
A and B and C
A= svref_2object(\*$sym)->NAME ne "main::"B= $sym ne "<none>::"C= &$recurse($sym)
ABCresult
0XX0
10X0
1100
1111
8167 0 walksymtable(\%$fullname, $method, $recurse, $sym);
8168 }
8169 } else {
8170 0 svref_2object(\*$fullname)->$method();
8171 }
8172 }
8173 }
8174  
8175 0 ▶sub walk_syms {
Subroutine walk_syms: not called CC=4 SCAR=25.6
Pod undocumented
8176 0 my $package = shift;
8177 41 ▶ no strict 'refs';
Subroutine BEGIN: called CC=1 SCAR=0.0
8178 0 ▶ return if $dumped_package{$package};
Branch: 1 branch
BranchTrueFalseTotal
if $dumped_package{$package} 0 0 0
8179 0 ▶ warn "walk_syms $package\n" if $debug{pkg} and $verbose;
Branch: 1 branch
BranchTrueFalseTotal
if $B::C::debug{"pkg"} and $B::C::verbose 0 0 0
Condition0%0/3
$B::C::debug{"pkg"} and $B::C::verbose
!ll&&!rl&&r
000
MC/DC0%0/2
$B::C::debug{"pkg"} and $B::C::verbose
$B::C::debug{"pkg"} $B::C::verbose
Truth table0%0/3
A and B
A= $B::C::debug{"pkg"}B= $B::C::verbose
ABresult
0X0
100
111
8180 0 $dumped_package{$package} = 1;
8181 0 ▶ walksymtable( \%{$package.'::'}, "savecv", sub { 1 }, $package.'::' );
Subroutine __ANON__: not called CC=1 SCAR=6.9
8182 }
8183  
8184 # simplified walk_syms
8185 # needed to populate @B::C::Config::deps from Makefile.PL from within this %INC context
8186 0 ▶sub walk_stashes {
Subroutine walk_stashes: not called CC=6 SCAR=33.4
Pod undocumented
8187 0 my ($symref, $prefix) = @_;
8188 41 ▶ no strict 'refs';
Subroutine BEGIN: called CC=1 SCAR=0.0
8189 0 ▶ $prefix = '' unless defined $prefix;
Branch: 1 branch
BranchTrueFalseTotal
unless defined $prefix 0 0 0
8190 0 foreach my $sym ( sort keys %$symref ) {
8191 0 ▶ if ($sym =~ /::$/) {
Branch: 1 branch
BranchTrueFalseTotal
if ($sym =~ /::$/) 0 0 0
8192 0 $sym = $prefix . $sym;
8193 0 $B::C::deps{ substr($sym,0,-2) }++;
8194 0 ▶ if ($sym ne "main::" && $sym ne "<none>::") {
Branch: 1 branch
BranchTrueFalseTotal
if ($sym ne "main::" and $sym ne "<none>::") 0 0 0
Condition0%0/3
$sym ne "main::" and $sym ne "<none>::"
!ll&&!rl&&r
000
MC/DC0%0/2
$sym ne "main::" and $sym ne "<none>::"
$sym ne "main::" $sym ne "<none>::"
Truth table0%0/3
A and B
A= $sym ne "main::"B= $sym ne "<none>::"
ABresult
0X0
100
111
8195 0 walk_stashes(\%$sym, $sym);
8196 }
8197 }
8198 }
8199 }
8200  
8201 0 ▶sub collect_deps {
Subroutine collect_deps: not called CC=1 SCAR=6.9
Pod undocumented
8202 0 %B::C::deps = ();
8203 0 walk_stashes(\%main::);
8204 0 print join " ",(sort keys %B::C::deps);
8205 }
8206  
8207 0 ▶sub mark_package {
Subroutine mark_package: not called CC=33 SCAR=68.7
Pod undocumented
8208 0 my $package = shift;
8209 0 my $force = shift;
8210 0 ▶ $force = 0 if $] < 5.010;
Branch: 1 branch
BranchTrueFalseTotal
if $] < "5.01" 0 0 0
8211 0 ▶ return if $module or skip_pkg($package); # or $package =~ /^B::C(C?)::/;
Branch: 1 branch
BranchTrueFalseTotal
if $B::C::module or skip_pkg($package) 0 0 0
Condition0%0/3
$B::C::module or skip_pkg($package)
l!l&&r!l&&!r
000
MC/DC0%0/2
$B::C::module or skip_pkg($package)
$B::C::module skip_pkg($package)
Truth table0%0/3
A or B
A= $B::C::moduleB= skip_pkg($package)
ABresult
1X1
011
000
8212 0 ▶ if ( !$include_package{$package} or $force ) {
Branch: 1 branch
BranchTrueFalseTotal
if (not $include_package{$package} or $force) 0 0 0
Condition0%0/3
not $include_package{$package} or $force
l!l&&r!l&&!r
000
MC/DC0%0/2
not $include_package{$package} or $force
not $include_package{$package} $force
Truth table0%0/3
not(A) or B
A= not $include_package{$package}B= $force
ABresult
1X1
011
000
8213 41 ▶ no strict 'refs';
Subroutine BEGIN: called CC=1 SCAR=0.0
8214 0 ▶ warn "mark_package($package, $force)\n" if $verbose and $debug{pkg};
Branch: 1 branch
BranchTrueFalseTotal
if $B::C::verbose and $B::C::debug{"pkg"} 0 0 0
Condition0%0/3
$B::C::verbose and $B::C::debug{"pkg"}
!ll&&!rl&&r
000
MC/DC0%0/2
$B::C::verbose and $B::C::debug{"pkg"}
$B::C::verbose $B::C::debug{"pkg"}
Truth table0%0/3
A and B
A= $B::C::verboseB= $B::C::debug{"pkg"}
ABresult
0X0
100
111
8215 0 my @IO = qw(IO::File IO::Handle IO::Socket IO::Seekable IO::Poll);
8216 0 ▶ mark_package('IO') if grep { $package eq $_ } @IO;
Branch: 1 branch
BranchTrueFalseTotal
if grep {$package eq $_;} @IO 0 0 0
8217 0 ▶ mark_package("DynaLoader") if $package eq 'XSLoader';
Branch: 1 branch
BranchTrueFalseTotal
if $package eq "XSLoader" 0 0 0
8218 0 ▶ $use_xsloader = 1 if $package =~ /^B|Carp$/; # to help CC a bit (49)
Branch: 1 branch
BranchTrueFalseTotal
if $package =~ /^B|Carp$/ 0 0 0
8219 # i.e. if force
8220 0 ▶ if (exists $include_package{$package}
Branch: 1 branch
BranchTrueFalseTotal
if (exists $include_package{$package} and not $include_package{$package} and $B::C::savINC{inc_packname($package)}) { } 0 0 0
Condition0%0/6
exists $include_package{$package} and not $include_package{$package} and $B::C::savINC{inc_packname($package)}
!ll&&!rl&&r
000
exists $include_package{$package} and not $include_package{$package}
!ll&&!rl&&r
000
MC/DC0%0/3
exists $include_package{$package} and not $include_package{$package} and $B::C::savINC{inc_packname($package)}
exists $include_package{$package} not $include_package{$package} $B::C::savINC{inc_packname($package)}
Truth table0%0/4
A and not(B) and C
A= exists $include_package{$package}B= not $include_package{$package}C= $B::C::savINC{inc_packname($package)}
ABCresult
0XX0
10X0
1100
1111
8221 and !$include_package{$package}
8222 and $savINC{inc_packname($package)})
8223 {
8224 0 ▶ warn sprintf("$package previously deleted, save now%s\n",
Branch: 2 branches
BranchTrueFalseTotal
if $B::C::verbose 0 0 0
$force ? : 0 0 0
8225 $force?" (forced)":"") if $verbose;
8226 # $include_package{$package} = 1;
8227 0 add_hashINC( $package );
8228 0 walk_syms( $package );
8229 } else {
8230 warn sprintf("mark $package%s\n", $force?" (forced)":"")
8231 0 ▶ if !$include_package{$package} and $verbose and $debug{pkg};
Branch: 2 branches
BranchTrueFalseTotal
if not $include_package{$package} and $B::C::verbose and $B::C::debug{"pkg"} 0 0 0
$force ? : 0 0 0
Condition0%0/6
not $include_package{$package} and $B::C::verbose and $B::C::debug{"pkg"}
!ll&&!rl&&r
000
not $include_package{$package} and $B::C::verbose
!ll&&!rl&&r
000
MC/DC0%0/3
not $include_package{$package} and $B::C::verbose and $B::C::debug{"pkg"}
not $include_package{$package} $B::C::verbose $B::C::debug{"pkg"}
Truth table0%0/4
not(A) and B and C
A= not $include_package{$package}B= $B::C::verboseC= $B::C::debug{"pkg"}
ABCresult
0XX0
10X0
1100
1111
8232 0 $include_package{$package} = 1;
8233 0 ▶ push_package($package) if $] < 5.010;
Branch: 1 branch
BranchTrueFalseTotal
if $] < "5.01" 0 0 0
8234 0 ▶ walk_syms( $package ) if !$B::C::walkall; # fixes i27-1
Branch: 1 branch
BranchTrueFalseTotal
unless $B::C::walkall 0 0 0
8235 }
8236 0 my @isa = get_isa($package);
8237 0 ▶ if ( @isa ) {
Branch: 1 branch
BranchTrueFalseTotal
if (@isa) 0 0 0
8238 # XXX walking the ISA is often not enough.
8239 # we should really check all new packages since the last full scan.
8240 0 foreach my $isa ( @isa ) {
8241 0 ▶ next if $isa eq $package;
Branch: 1 branch
BranchTrueFalseTotal
if $isa eq $package 0 0 0
8242 0 ▶ if ( $isa eq 'DynaLoader' ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($isa eq "DynaLoader") 0 0 0
8243 0 ▶ unless ( defined( &{ $package . '::bootstrap' } ) ) {
Branch: 1 branch
BranchTrueFalseTotal
unless (defined &{$package . '::bootstrap';}) 0 0 0
8244 0 ▶ warn "Forcing bootstrap of $package\n" if $verbose;
Branch: 1 branch
BranchTrueFalseTotal
if $B::C::verbose 0 0 0
8245 0 eval { $package->bootstrap };
8246 }
8247 }
8248 0 ▶ if ( !$include_package{$isa} and !$skip_package{$isa} ) {
Branch: 1 branch
BranchTrueFalseTotal
unless ($include_package{$isa} or $skip_package{$isa}) 0 0 0
Condition0%0/3
$include_package{$isa} or $skip_package{$isa}
l!l&&r!l&&!r
000
MC/DC0%0/2
$include_package{$isa} or $skip_package{$isa}
$include_package{$isa} $skip_package{$isa}
Truth table0%0/3
A or B
A= $include_package{$isa}B= $skip_package{$isa}
ABresult
1X1
011
000
8249 41 ▶ no strict 'refs';
Subroutine BEGIN: called CC=1 SCAR=0.0
8250 0 ▶ warn "$isa saved (it is in $package\'s \@ISA)\n" if $verbose;
Branch: 1 branch
BranchTrueFalseTotal
if $B::C::verbose 0 0 0
8251 0 B::svref_2object( \@{$isa."::ISA"} ) ->save; #308
8252 0 ▶ if (exists $include_package{$isa} ) {
Branch: 1 branch
BranchTrueFalseTotal
if (exists $include_package{$isa}) { } 0 0 0
8253 0 ▶ warn "$isa previously deleted, save now\n" if $verbose; # e.g. Sub::Name
Branch: 1 branch
BranchTrueFalseTotal
if $B::C::verbose 0 0 0
8254 0 mark_package($isa);
8255 0 walk_syms($isa); # avoid deep recursion
8256 } else {
8257 #warn "isa $isa save\n" if $verbose;
8258 0 mark_package($isa);
8259 }
8260 }
8261 }
8262 }
8263 }
8264 0 return 1;
8265 }
8266  
8267 # XS in CORE which do not need to be bootstrapped extra.
8268 # There are some specials like mro,re,UNIVERSAL.
8269 0 ▶sub in_static_core {
Subroutine in_static_core: not called CC=8 SCAR=42.8
Pod undocumented
8270 0 my ($stashname, $cvname) = @_;
8271 0 ▶ if ($stashname eq 'UNIVERSAL') {
Branch: 1 branch
BranchTrueFalseTotal
if ($stashname eq "UNIVERSAL") 0 0 0
8272 0 return $cvname =~ /^(isa|can|DOES|VERSION)$/;
8273 }
8274 0 ▶ %static_core_pkg = map {$_ => 1} static_core_packages()
Branch: 1 branch
BranchTrueFalseTotal
unless %static_core_pkg 0 0 0
8275 unless %static_core_pkg;
8276 0 ▶ return 1 if $static_core_pkg{$stashname};
Branch: 1 branch
BranchTrueFalseTotal
if $static_core_pkg{$stashname} 0 0 0
8277 0 ▶ if ($stashname eq 'mro') {
Branch: 1 branch
BranchTrueFalseTotal
if ($stashname eq "mro") 0 0 0
8278 0 return $cvname eq 'method_changed_in';
8279 }
8280 0 ▶ if ($stashname eq 're') {
Branch: 1 branch
BranchTrueFalseTotal
if ($stashname eq "re") 0 0 0
8281 0 return $cvname =~ /^(is_regexp|regname|regnames|regnames_count|regexp_pattern)$/;;
8282 }
8283 0 ▶ if ($stashname eq 'PerlIO') {
Branch: 1 branch
BranchTrueFalseTotal
if ($stashname eq "PerlIO") 0 0 0
8284 0 return $cvname eq 'get_layers';
8285 }
8286 0 ▶ if ($stashname eq 'PerlIO::Layer') {
Branch: 1 branch
BranchTrueFalseTotal
if ($stashname eq "PerlIO::Layer") 0 0 0
8287 0 return $cvname =~ /^(find|NoWarnings)$/;
8288 }
8289 0 return 0;
8290 }
8291  
8292 # XS modules in CORE. Reserved namespaces.
8293 # Note: mro,re,UNIVERSAL have both, static core and dynamic/static XS
8294 # version has an external ::vxs
8295 0 ▶sub static_core_packages {
Subroutine static_core_packages: not called CC=9 SCAR=45.0
Pod undocumented
8296 0 my @pkg = qw(Internals utf8 UNIVERSAL);
8297 0 ▶ push @pkg, qw(strict coretypes DynaLoader XSLoader) if $CPERL51;
Branch: 1 branch
BranchTrueFalseTotal
if $CPERL51 0 0 0
8298 0 ▶ push @pkg, 'attributes' if $] < 5.011; # partially static and dynamic
Branch: 1 branch
BranchTrueFalseTotal
if $] < "5.011" 0 0 0
8299 0 ▶ push @pkg, 'version' if $] >= 5.010; # partially static and dynamic
Branch: 1 branch
BranchTrueFalseTotal
if $] >= "5.01" 0 0 0
8300 0 ▶ push @pkg, 'Tie::Hash::NamedCapture' if !$PERL514; # dynamic since 5.14
Branch: 1 branch
BranchTrueFalseTotal
unless $PERL514 0 0 0
8301 #push @pkg, 'DynaLoader' if $Config{usedl};
8302 # Win32CORE only in official cygwin pkg. And it needs to be bootstrapped,
8303 # handled by static_ext.
8304 0 ▶ push @pkg, 'Cygwin' if $^O eq 'cygwin';
Branch: 1 branch
BranchTrueFalseTotal
if $^O eq "cygwin" 0 0 0
8305 0 ▶ push @pkg, 'NetWare' if $^O eq 'NetWare';
Branch: 1 branch
BranchTrueFalseTotal
if $^O eq "NetWare" 0 0 0
8306 0 ▶ push @pkg, 'OS2' if $^O eq 'os2';
Branch: 1 branch
BranchTrueFalseTotal
if $^O eq "os2" 0 0 0
8307 0 ▶ push @pkg, qw(VMS VMS::Filespec vmsish) if $^O eq 'VMS';
Branch: 1 branch
BranchTrueFalseTotal
if $^O eq "VMS" 0 0 0
8308 #push @pkg, 'PerlIO' if $] >= 5.008006; # get_layers only
8309 0 push @pkg, split(/ /,$Config{static_ext});
8310 0 return @pkg;
8311 }
8312  
8313 0 ▶sub skip_pkg {
Subroutine skip_pkg: not called CC=10 SCAR=47.0
Pod undocumented
8314 0 my $package = shift;
8315 0 ▶ if ( $package =~ /^(main::)?(Internals|O)::/
Branch: 1 branch
BranchTrueFalseTotal
if ($package =~ /^(main::)?(Internals|O)::/ or $package =~ /^B::C::/ or $package eq "__ANON__" or index($package, " ") != -1 or index($package, "(") != -1 or index($package, ")") != -1 or exists $skip_package{$package} or $DB::deep and $package =~ /^(DB|Term::ReadLine)/) 0 0 0
Condition0%0/24
$package =~ /^(main::)?(Internals|O)::/ or $package =~ /^B::C::/ or $package eq "__ANON__" or index($package, " ") != -1 or index($package, "(") != -1 or index($package, ")") != -1 or exists $skip_package{$package} or $DB::deep and $package =~ /^(DB|Term::ReadLine)/
l!l&&r!l&&!r
000
$package =~ /^(main::)?(Internals|O)::/ or $package =~ /^B::C::/ or $package eq "__ANON__" or index($package, " ") != -1 or index($package, "(") != -1 or index($package, ")") != -1 or exists $skip_package{$package}
l!l&&r!l&&!r
000
$package =~ /^(main::)?(Internals|O)::/ or $package =~ /^B::C::/ or $package eq "__ANON__" or index($package, " ") != -1 or index($package, "(") != -1 or index($package, ")") != -1
l!l&&r!l&&!r
000
$package =~ /^(main::)?(Internals|O)::/ or $package =~ /^B::C::/ or $package eq "__ANON__" or index($package, " ") != -1 or index($package, "(") != -1
l!l&&r!l&&!r
000
$package =~ /^(main::)?(Internals|O)::/ or $package =~ /^B::C::/ or $package eq "__ANON__" or index($package, " ") != -1
l!l&&r!l&&!r
000
$package =~ /^(main::)?(Internals|O)::/ or $package =~ /^B::C::/ or $package eq "__ANON__"
l!l&&r!l&&!r
000
$package =~ /^(main::)?(Internals|O)::/ or $package =~ /^B::C::/
l!l&&r!l&&!r
000
$DB::deep and $package =~ /^(DB|Term::ReadLine)/
!ll&&!rl&&r
000
MC/DC0%0/9
$package =~ /^(main::)?(Internals|O)::/ or $package =~ /^B::C::/ or $package eq "__ANON__" or index($package, " ") != -1 or index($package, "(") != -1 or index($package, ")") != -1 or exists $skip_package{$package} or $DB::deep and $package =~ /^(DB|Term::ReadLine)/
$package =~ /^(main::)?(Internals|O)::/ $package =~ /^B::C::/ $package eq "__ANON__" index($package, " ") != -1 index($package, "(") != -1 index($package, ")") != -1 exists $skip_package{$package} $DB::deep $package =~ /^(DB|Term::ReadLine)/
Truth table0%0/10
A or B or C or D or E or F or G or H and I
A= $package =~ /^(main::)?(Internals|O)::/B= $package =~ /^B::C::/C= $package eq "__ANON__"D= index($package, " ") != -1E= index($package, "(") != -1F= index($package, ")") != -1G= exists $skip_package{$package}H= $DB::deepI= $package =~ /^(DB|Term::ReadLine)/
ABCDEFGHIresult
1XXXXXXXX1
01XXXXXXX1
001XXXXXX1
0001XXXXX1
00001XXXX1
000001XXX1
0000001XX1
0000000111
00000000X0
0000000100
8316 #or $package =~ /::::/ # CORE/base/lex.t 54
8317 or $package =~ /^B::C::/
8318 or $package eq '__ANON__'
8319 or index($package, " ") != -1 # XXX skip invalid package names
8320 or index($package, "(") != -1 # XXX this causes the compiler to abort
8321 or index($package, ")") != -1 # XXX this causes the compiler to abort
8322 or exists $skip_package{$package}
8323 or ($DB::deep and $package =~ /^(DB|Term::ReadLine)/)) {
8324 0 return 1;
8325 }
8326 0 return 0;
8327 }
8328  
8329 # Do not delete/ignore packages which were brought in from the script,
8330 # i.e. not defined in B::C or O. Just to be on the safe side.
8331 0 ▶sub can_delete {
Subroutine can_delete: not called CC=3 SCAR=24.8
Pod undocumented
8332 0 my $pkg = shift;
8333 0 ▶ if (exists $all_bc_deps{$pkg} and $B::C::can_delete_pkg) { return 1 };
Branch: 1 branch
BranchTrueFalseTotal
if (exists $B::C::all_bc_deps{$pkg} and $B::C::can_delete_pkg) 0 0 0
Condition0%0/3
exists $B::C::all_bc_deps{$pkg} and $B::C::can_delete_pkg
!ll&&!rl&&r
000
MC/DC0%0/2
exists $B::C::all_bc_deps{$pkg} and $B::C::can_delete_pkg
exists $B::C::all_bc_deps{$pkg} $B::C::can_delete_pkg
Truth table0%0/3
A and B
A= exists $B::C::all_bc_deps{$pkg}B= $B::C::can_delete_pkg
ABresult
0X0
100
111
8334 0 return undef;
8335 }
8336  
8337 0 ▶sub should_save {
Subroutine should_save: not called CC=66 SCAR=83.2
Pod undocumented
8338 41 ▶ no strict qw(vars refs);
Subroutine BEGIN: called CC=1 SCAR=0.0
8339 0 my $package = shift;
8340 0 $package =~ s/::$//;
8341 0 ▶ if ( skip_pkg($package) ) {
Branch: 1 branch
BranchTrueFalseTotal
if (skip_pkg($package)) 0 0 0
8342 0 ▶ delete_unsaved_hashINC($package) if can_delete($package);
Branch: 1 branch
BranchTrueFalseTotal
if can_delete($package) 0 0 0
8343 0 return 0;
8344 }
8345 0 ▶ return $include_package{$package} = 0
Branch: 1 branch
BranchTrueFalseTotal
if $package =~ /::::/ 0 0 0
8346 if ( $package =~ /::::/ ); # skip ::::ISA::CACHE etc.
8347 0 ▶ warn "Considering $package\n" if $debug{pkg}; #$include_package{$package}
Branch: 1 branch
BranchTrueFalseTotal
if $debug{"pkg"} 0 0 0
8348 0 ▶ return if index($package, " ") != -1; # XXX skip invalid package names
Branch: 1 branch
BranchTrueFalseTotal
if index($package, " ") != -1 0 0 0
8349 0 ▶ return if index($package, "(") != -1; # XXX this causes the compiler to abort
Branch: 1 branch
BranchTrueFalseTotal
if index($package, "(") != -1 0 0 0
8350 0 ▶ return if index($package, ")") != -1; # XXX this causes the compiler to abort
Branch: 1 branch
BranchTrueFalseTotal
if index($package, ")") != -1 0 0 0
8351 # core static mro has exactly one member, ext/mro has more
8352 0 ▶ if ($package eq 'mro') {
Branch: 1 branch
BranchTrueFalseTotal
if ($package eq "mro") 0 0 0
8353 # B::C is setting %mro:: to 3, make sure we have at least 10
8354 0 ▶ if (!is_using_mro()) { # core or ext?
Branch: 1 branch
BranchTrueFalseTotal
if (not is_using_mro()) { } 0 0 0
8355 0 ▶ warn "ext/mro not loaded - skip\n" if $debug{pkg};
Branch: 1 branch
BranchTrueFalseTotal
if $debug{"pkg"} 0 0 0
8356 0 return;
8357 } else {
8358 0 ▶ warn "ext/mro already loaded\n" if $debug{pkg};
Branch: 1 branch
BranchTrueFalseTotal
if $debug{"pkg"} 0 0 0
8359 # $include_package{mro} = 1 if grep { $_ eq 'mro' } @DynaLoader::dl_modules;
8360 0 return $include_package{mro};
8361 }
8362 }
8363 0 ▶ if ($package eq 'attributes' and $] > 5.011
Branch: 1 branch
BranchTrueFalseTotal
if ($package eq "attributes" and $] > "5.011" and grep {$_ eq "attributes";} @DynaLoader::dl_modules) 0 0 0
Condition0%0/6
$package eq "attributes" and $] > "5.011" and grep {$_ eq "attributes";} @DynaLoader::dl_modules
!ll&&!rl&&r
000
$package eq "attributes" and $] > "5.011"
!ll&&!rl&&r
000
MC/DC0%0/3
$package eq "attributes" and $] > "5.011" and grep {$_ eq "attributes";} @DynaLoader::dl_modules
$package eq "attributes" $] > "5.011" grep {$_ eq "attributes";} @DynaLoader::dl_modules
Truth table0%0/4
A and B and C
A= $package eq "attributes"B= $] > "5.011"C= grep {$_ eq "attributes";} @DynaLoader::dl_modules
ABCresult
0XX0
10X0
1100
1111
8364 0 and grep { $_ eq 'attributes' } @DynaLoader::dl_modules)
8365 {
8366 0 mark_package($package, 1);
8367 0 return 1;
8368 }
8369 0 ▶ if (exists $all_bc_deps{$package}) {
Branch: 1 branch
BranchTrueFalseTotal
if (exists $all_bc_deps{$package}) 0 0 0
8370 0 foreach my $u ( grep( $include_package{$_}, sort keys %include_package ) ) {
8371 # If this package is a prefix to something we are saving, traverse it
8372 # but do not mark it for saving if it is not already
8373 # e.g. to get to B::OP we need to traverse B:: but need not save B
8374 0 my $p = $package;
8375 0 $p =~ s/(\W)/\\$1/g;
8376 0 ▶ return 1 if ( $u =~ /^$p\:\:/ ) && $include_package{$package};
Branch: 1 branch
BranchTrueFalseTotal
if $u =~ /^$p\:\:/ and $include_package{$package} 0 0 0
Condition0%0/3
$u =~ /^$p\:\:/ and $include_package{$package}
!ll&&!rl&&r
000
MC/DC0%0/2
$u =~ /^$p\:\:/ and $include_package{$package}
$u =~ /^$p\:\:/ $include_package{$package}
Truth table0%0/3
A and B
A= $u =~ /^$p\:\:/B= $include_package{$package}
ABresult
0X0
100
111
8377 }
8378 }
8379 # Needed since 5.12.2: Check already if deleted
8380 0 my $incpack = inc_packname($package);
8381 0 ▶ if ( $] > 5.015001 and exists $all_bc_deps{$package}
Branch: 1 branch
BranchTrueFalseTotal
if ($] > "5.015001" and exists $all_bc_deps{$package} and not exists $curINC{$incpack} and $savINC{$incpack}) 0 0 0
Condition0%0/9
$] > "5.015001" and exists $all_bc_deps{$package} and not exists $curINC{$incpack} and $savINC{$incpack}
!ll&&!rl&&r
000
$] > "5.015001" and exists $all_bc_deps{$package} and not exists $curINC{$incpack}
!ll&&!rl&&r
000
$] > "5.015001" and exists $all_bc_deps{$package}
!ll&&!rl&&r
000
MC/DC0%0/4
$] > "5.015001" and exists $all_bc_deps{$package} and not exists $curINC{$incpack} and $savINC{$incpack}
$] > "5.015001" exists $all_bc_deps{$package} not exists $curINC{$incpack} $savINC{$incpack}
Truth table0%0/5
A and B and not(C) and D
A= $] > "5.015001"B= exists $all_bc_deps{$package}C= not exists $curINC{$incpack}D= $savINC{$incpack}
ABCDresult
0XXX0
10XX0
110X0
11100
11111
8382 and !exists $curINC{$incpack} and $savINC{$incpack} ) {
8383 0 $include_package{$package} = 0;
8384 0 ▶ warn "Cached $package not in \%INC, already deleted (early)\n" if $debug{pkg};
Branch: 1 branch
BranchTrueFalseTotal
if $debug{"pkg"} 0 0 0
8385 0 return 0;
8386 }
8387 # issue348: only drop B::C packages, not any from user code.
8388 0 ▶ if (($package =~ /^DynaLoader|XSLoader$/ and $use_xsloader)
Branch: 1 branch
BranchTrueFalseTotal
if ($package =~ /^DynaLoader|XSLoader$/ and $use_xsloader or not exists $all_bc_deps{$package}) 0 0 0
Condition0%0/6
$package =~ /^DynaLoader|XSLoader$/ and $use_xsloader or not exists $all_bc_deps{$package}
l!l&&r!l&&!r
000
$package =~ /^DynaLoader|XSLoader$/ and $use_xsloader
!ll&&!rl&&r
000
MC/DC0%0/3
$package =~ /^DynaLoader|XSLoader$/ and $use_xsloader or not exists $all_bc_deps{$package}
$package =~ /^DynaLoader|XSLoader$/ $use_xsloader not exists $all_bc_deps{$package}
Truth table0%0/5
A and B or not(C)
A= $package =~ /^DynaLoader|XSLoader$/B= $use_xsloaderC= not exists $all_bc_deps{$package}
ABCresult
11X1
0X11
1011
0X00
1000
8389 or (!exists $all_bc_deps{$package})) {
8390 0 $include_package{$package} = 1;
8391 }
8392 # If this package is in the same file as main:: or our source, save it. (72, 73)
8393 0 ▶ if ($mainfile) {
Branch: 1 branch
BranchTrueFalseTotal
if ($mainfile) 0 0 0
8394 # Find the first cv in this package for CV->FILE
8395 41 ▶ no strict 'refs';
Subroutine BEGIN: called CC=1 SCAR=0.0
8396 0 for my $sym (sort keys %{$package.'::'}) {
8397 0 ▶ if (defined &{$package.'::'.$sym}) {
Branch: 1 branch
BranchTrueFalseTotal
if (defined &{$package . '::' . $sym;}) 0 0 0
8398 # compare cv->FILE to $mainfile
8399 0 my $cv = svref_2object(\&{$package.'::'.$sym});
8400 0 ▶ if ($cv and $cv->can('FILE') and $cv->FILE) {
Branch: 1 branch
BranchTrueFalseTotal
if ($cv and $cv->can("FILE") and $cv->FILE) 0 0 0
Condition0%0/6
$cv and $cv->can("FILE") and $cv->FILE
!ll&&!rl&&r
000
$cv and $cv->can("FILE")
!ll&&!rl&&r
000
MC/DC0%0/3
$cv and $cv->can("FILE") and $cv->FILE
$cv $cv->can("FILE") $cv->FILE
Truth table0%0/4
A and B and C
A= $cvB= $cv->can("FILE")C= $cv->FILE
ABCresult
0XX0
10X0
1100
1111
8401 0 ▶ $include_package{$package} = 1 if $mainfile eq $cv->FILE;
Branch: 1 branch
BranchTrueFalseTotal
if $mainfile eq $cv->FILE 0 0 0
8402 0 last;
8403 }
8404 }
8405 }
8406 }
8407 0 ▶ if ($module and $package ne $module) {
Branch: 1 branch
BranchTrueFalseTotal
if ($module and $package ne $module) 0 0 0
Condition0%0/3
$module and $package ne $module
!ll&&!rl&&r
000
MC/DC0%0/2
$module and $package ne $module
$module $package ne $module
Truth table0%0/3
A and B
A= $moduleB= $package ne $module
ABresult
0X0
100
111
8408 0 $include_package{$package} = 0;
8409 0 ▶ warn "Skip $package not in $mainfile\n" if $debug{pkg};
Branch: 1 branch
BranchTrueFalseTotal
if $debug{"pkg"} 0 0 0
8410 0 return 0;
8411 }
8412 # add overloaded but otherwise empty packages (#172)
8413 0 ▶ if ($savINC{'overload.pm'} and exists ${$package.'::'}{OVERLOAD} and exists ${$package.'::'}{'()'}) {
Branch: 1 branch
BranchTrueFalseTotal
if ($savINC{"overload.pm"} and exists do { $package . '::' }->{"OVERLOAD"} and exists do { $package . '::' }->{"()"}) 0 0 0
Condition0%0/6
$savINC{"overload.pm"} and exists do { $package . '::' }->{"OVERLOAD"} and exists do { $package . '::' }->{"()"}
!ll&&!rl&&r
000
$savINC{"overload.pm"} and exists do { $package . '::' }->{"OVERLOAD"}
!ll&&!rl&&r
000
MC/DC0%0/3
$savINC{"overload.pm"} and exists do { $package . '::' }->{"OVERLOAD"} and exists do { $package . '::' }->{"()"}
$savINC{"overload.pm"} exists do { $package . '::' }->{"OVERLOAD"} exists do { $package . '::' }->{"()"}
Truth table0%0/4
A and B and C
A= $savINC{"overload.pm"}B= exists do { $package . '::' }->{"OVERLOAD"}C= exists do { $package . '::' }->{"()"}
ABCresult
0XX0
10X0
1100
1111
8414 0 mark_package($package, 1);
8415 0 mark_package('overload', 1);
8416 0 return 1;
8417 }
8418 # Omit the packages which we use (and which cause grief
8419 # because of fancy "goto &$AUTOLOAD" stuff).
8420 # XXX Surely there must be a nicer way to do this.
8421 0 ▶ if ( exists $include_package{$package} ) {
Branch: 1 branch
BranchTrueFalseTotal
if (exists $include_package{$package}) 0 0 0
8422 0 ▶ if (! exists $all_bc_deps{$package}) {
Branch: 2 branches
BranchTrueFalseTotal
if (not exists $all_bc_deps{$package}) { } 0 0 0
elsif (not $include_package{$package}) { } 0 0 0
8423 0 $include_package{$package} = 1;
8424 0 $curINC{$incpack} = $savINC{$incpack};
8425 0 ▶ warn "Cached new $package is kept\n" if $debug{pkg};
Branch: 1 branch
BranchTrueFalseTotal
if $debug{"pkg"} 0 0 0
8426 }
8427 elsif (!$include_package{$package}) {
8428 0 ▶ delete_unsaved_hashINC($package) if can_delete($package);
Branch: 1 branch
BranchTrueFalseTotal
if can_delete($package) 0 0 0
8429 0 ▶ warn "Cached $package is already deleted\n" if $debug{pkg};
Branch: 1 branch
BranchTrueFalseTotal
if $debug{"pkg"} 0 0 0
8430 } else {
8431 0 ▶ warn "Cached $package is cached\n" if $debug{pkg};
Branch: 1 branch
BranchTrueFalseTotal
if $debug{"pkg"} 0 0 0
8432 }
8433 0 return $include_package{$package};
8434 }
8435  
8436 # Now see if current package looks like an OO class. This is probably too strong.
8437 0 ▶ if (!$all_bc_deps{$package}) {
Branch: 1 branch
BranchTrueFalseTotal
unless ($all_bc_deps{$package}) 0 0 0
8438 0 foreach my $m (qw(new DESTROY TIESCALAR TIEARRAY TIEHASH TIEHANDLE)) {
8439 # 5.10 introduced version and Regexp::DESTROY, which we dont want automatically.
8440 # XXX TODO This logic here is wrong and unstable. Fixes lead to more failures.
8441 # The walker deserves a rewrite.
8442 0 ▶ if ( UNIVERSAL::can( $package, $m ) and $package !~ /^(B::C|version|Regexp|utf8|SelectSaver)$/ ) {
Branch: 1 branch
BranchTrueFalseTotal
if (UNIVERSAL::can($package, $m) and not $package =~ /^(B::C|version|Regexp|utf8|SelectSaver)$/) 0 0 0
Condition0%0/3
UNIVERSAL::can($package, $m) and not $package =~ /^(B::C|version|Regexp|utf8|SelectSaver)$/
!ll&&!rl&&r
000
MC/DC0%0/2
UNIVERSAL::can($package, $m) and not $package =~ /^(B::C|version|Regexp|utf8|SelectSaver)$/
UNIVERSAL::can($package, $m) not $package =~ /^(B::C|version|Regexp|utf8|SelectSaver)$/
Truth table0%0/3
A and not(B)
A= UNIVERSAL::can($package, $m)B= not $package =~ /^(B::C|version|Regexp|utf8|SelectSaver)$/
ABresult
0X0
100
111
8443 0 ▶ next if $package eq 'utf8' and $m eq 'DESTROY'; # utf8::DESTROY is empty
Branch: 1 branch
BranchTrueFalseTotal
if $package eq "utf8" and $m eq "DESTROY" 0 0 0
Condition0%0/3
$package eq "utf8" and $m eq "DESTROY"
!ll&&!rl&&r
000
MC/DC0%0/2
$package eq "utf8" and $m eq "DESTROY"
$package eq "utf8" $m eq "DESTROY"
Truth table0%0/3
A and B
A= $package eq "utf8"B= $m eq "DESTROY"
ABresult
0X0
100
111
8444 # we load Errno by ourself to avoid double Config warnings [perl #]
8445 # and we have special logic to detect and include it
8446 0 ▶ next if $package =~ /^(Errno|Tie::Hash::NamedCapture)$/ and $m eq 'TIEHASH';
Branch: 1 branch
BranchTrueFalseTotal
if $package =~ /^(Errno|Tie::Hash::NamedCapture)$/ and $m eq "TIEHASH" 0 0 0
Condition0%0/3
$package =~ /^(Errno|Tie::Hash::NamedCapture)$/ and $m eq "TIEHASH"
!ll&&!rl&&r
000
MC/DC0%0/2
$package =~ /^(Errno|Tie::Hash::NamedCapture)$/ and $m eq "TIEHASH"
$package =~ /^(Errno|Tie::Hash::NamedCapture)$/ $m eq "TIEHASH"
Truth table0%0/3
A and B
A= $package =~ /^(Errno|Tie::Hash::NamedCapture)$/B= $m eq "TIEHASH"
ABresult
0X0
100
111
8447 # XXX Config and FileHandle should not just return. If unneeded skip em.
8448 0 ▶ return 0 if $package eq 'Config' and $m =~ /DESTROY|TIEHASH/; # Config detected in GV
Branch: 1 branch
BranchTrueFalseTotal
if $package eq "Config" and $m =~ /DESTROY|TIEHASH/ 0 0 0
Condition0%0/3
$package eq "Config" and $m =~ /DESTROY|TIEHASH/
!ll&&!rl&&r
000
MC/DC0%0/2
$package eq "Config" and $m =~ /DESTROY|TIEHASH/
$package eq "Config" $m =~ /DESTROY|TIEHASH/
Truth table0%0/3
A and B
A= $package eq "Config"B= $m =~ /DESTROY|TIEHASH/
ABresult
0X0
100
111
8449 # IO::File|IO::Handle added for B::CC only
8450 0 ▶ return 0 if $package =~ /^(FileHandle|IO::File|IO::Handle)/ and $m eq 'new';
Branch: 1 branch
BranchTrueFalseTotal
if $package =~ /^(FileHandle|IO::File|IO::Handle)/ and $m eq "new" 0 0 0
Condition0%0/3
$package =~ /^(FileHandle|IO::File|IO::Handle)/ and $m eq "new"
!ll&&!rl&&r
000
MC/DC0%0/2
$package =~ /^(FileHandle|IO::File|IO::Handle)/ and $m eq "new"
$package =~ /^(FileHandle|IO::File|IO::Handle)/ $m eq "new"
Truth table0%0/3
A and B
A= $package =~ /^(FileHandle|IO::File|IO::Handle)/B= $m eq "new"
ABresult
0X0
100
111
8451 0 ▶ warn "$package has method $m: saving package\n" if $debug{pkg};
Branch: 1 branch
BranchTrueFalseTotal
if $debug{"pkg"} 0 0 0
8452 0 return mark_package($package);
8453 }
8454 }
8455 }
8456 0 ▶ if ($package !~ /^PerlIO/ and can_delete($package)) {
Branch: 1 branch
BranchTrueFalseTotal
if (not $package =~ /^PerlIO/ and can_delete($package)) 0 0 0
Condition0%0/3
not $package =~ /^PerlIO/ and can_delete($package)
!ll&&!rl&&r
000
MC/DC0%0/2
not $package =~ /^PerlIO/ and can_delete($package)
not $package =~ /^PerlIO/ can_delete($package)
Truth table0%0/3
not(A) and B
A= not $package =~ /^PerlIO/B= can_delete($package)
ABresult
0X0
100
111
8457 0 delete_unsaved_hashINC($package);
8458 }
8459 0 ▶ if (can_delete($package)) {
Branch: 2 branches
BranchTrueFalseTotal
if (can_delete($package)) { } 0 0 0
elsif (not exists $all_bc_deps{$package}) { } 0 0 0
8460 0 ▶ warn "Delete $package\n" if $debug{pkg};
Branch: 1 branch
BranchTrueFalseTotal
if $debug{"pkg"} 0 0 0
8461 0 return $include_package{$package} = 0;
8462 } elsif (! exists $all_bc_deps{$package}) { # and not in @deps
8463 0 ▶ warn "Keep $package\n" if $debug{pkg};
Branch: 1 branch
BranchTrueFalseTotal
if $debug{"pkg"} 0 0 0
8464 0 return $include_package{$package} = 1;
8465 } else { # in @deps
8466 # warn "Ignore $package\n" if $debug{pkg};
8467 0 return;
8468 }
8469 }
8470  
8471 0 ▶sub inc_packname {
Subroutine inc_packname: not called CC=1 SCAR=6.9
Pod undocumented
8472 0 my $package = shift;
8473 # See below at the reverse packname_inc: utf8 => utf8.pm + utf8_heavy.pl
8474 0 $package =~ s/\:\:/\//g;
8475 0 $package .= '.pm';
8476 0 return $package;
8477 }
8478  
8479 0 ▶sub packname_inc {
Subroutine packname_inc: not called CC=3 SCAR=24.8
Pod undocumented
8480 0 my $package = shift;
8481 0 $package =~ s/\//::/g;
8482 0 ▶ if ($package =~ /^(Config_git\.pl|Config_heavy.pl)$/) {
Branch: 1 branch
BranchTrueFalseTotal
if ($package =~ /^(Config_git\.pl|Config_heavy.pl)$/) 0 0 0
8483 0 return 'Config';
8484 }
8485 0 ▶ if ($package eq 'utf8_heavy.pl') {
Branch: 1 branch
BranchTrueFalseTotal
if ($package eq "utf8_heavy.pl") 0 0 0
8486 0 return 'utf8';
8487 }
8488 0 $package =~ s/\.p[lm]$//;
8489 0 return $package;
8490 }
8491  
8492 0 ▶sub delete_unsaved_hashINC {
Subroutine delete_unsaved_hashINC: not called CC=9 SCAR=45.0
Pod undocumented
8493 0 my $package = shift;
8494 0 my $incpack = inc_packname($package);
8495 # Not already saved package, so it is not loaded again at run-time.
8496 0 ▶ return if $dumped_package{$package};
Branch: 1 branch
BranchTrueFalseTotal
if $dumped_package{$package} 0 0 0
8497 # Never delete external packages, but this check is done before
8498 0 ▶ return if $package =~ /^DynaLoader|XSLoader$/
Branch: 1 branch
BranchTrueFalseTotal
if $package =~ /^DynaLoader|XSLoader$/ and defined $use_xsloader and $use_xsloader == 0 0 0 0
Condition0%0/6
$package =~ /^DynaLoader|XSLoader$/ and defined $use_xsloader and $use_xsloader == 0
!ll&&!rl&&r
000
$package =~ /^DynaLoader|XSLoader$/ and defined $use_xsloader
!ll&&!rl&&r
000
MC/DC0%0/3
$package =~ /^DynaLoader|XSLoader$/ and defined $use_xsloader and $use_xsloader == 0
$package =~ /^DynaLoader|XSLoader$/ defined $use_xsloader $use_xsloader == 0
Truth table0%0/4
A and B and C
A= $package =~ /^DynaLoader|XSLoader$/B= defined $use_xsloaderC= $use_xsloader == 0
ABCresult
0XX0
10X0
1100
1111
8499 and defined $use_xsloader
8500 and $use_xsloader == 0;
8501 0 ▶ return if $^O eq 'MSWin32' and $package =~ /^Carp|File::Basename$/;
Branch: 1 branch
BranchTrueFalseTotal
if $^O eq "MSWin32" and $package =~ /^Carp|File::Basename$/ 0 0 0
Condition0%0/3
$^O eq "MSWin32" and $package =~ /^Carp|File::Basename$/
!ll&&!rl&&r
000
MC/DC0%0/2
$^O eq "MSWin32" and $package =~ /^Carp|File::Basename$/
$^O eq "MSWin32" $package =~ /^Carp|File::Basename$/
Truth table0%0/3
A and B
A= $^O eq "MSWin32"B= $package =~ /^Carp|File::Basename$/
ABresult
0X0
100
111
8502 0 $include_package{$package} = 0;
8503 0 ▶ if ($curINC{$incpack}) {
Branch: 1 branch
BranchTrueFalseTotal
if ($B::C::curINC{$incpack}) 0 0 0
8504 #warn "Deleting $package from \%INC\n" if $debug{pkg};
8505 0 ▶ $savINC{$incpack} = $curINC{$incpack} if !$savINC{$incpack};
Branch: 1 branch
BranchTrueFalseTotal
unless $B::C::savINC{$incpack} 0 0 0
8506 0 $curINC{$incpack} = undef;
8507 0 delete $curINC{$incpack};
8508 }
8509 }
8510  
8511 0 ▶sub add_hashINC {
Subroutine add_hashINC: not called CC=9 SCAR=45.0
Pod undocumented
8512 0 my $package = shift;
8513 0 my $incpack = inc_packname($package);
8514 0 $include_package{$package} = 1;
8515 0 ▶ unless ($curINC{$incpack}) {
Branch: 1 branch
BranchTrueFalseTotal
unless ($B::C::curINC{$incpack}) 0 0 0
8516 0 ▶ if ($savINC{$incpack}) {
Branch: 1 branch
BranchTrueFalseTotal
if ($B::C::savINC{$incpack}) { } 0 0 0
8517 0 ▶ warn "Adding $package to \%INC (again)\n" if $debug{pkg};
Branch: 1 branch
BranchTrueFalseTotal
if $B::C::debug{"pkg"} 0 0 0
8518 0 $curINC{$incpack} = $savINC{$incpack};
8519 # need to check xsub
8520 0 ▶ $use_xsloader = 1 if $package =~ /^DynaLoader|XSLoader$/;
Branch: 1 branch
BranchTrueFalseTotal
if $package =~ /^DynaLoader|XSLoader$/ 0 0 0
8521 } else {
8522 0 ▶ warn "Adding $package to \%INC\n" if $debug{pkg};
Branch: 1 branch
BranchTrueFalseTotal
if $B::C::debug{"pkg"} 0 0 0
8523 0 for (@INC) {
8524 0 my $p = $_.'/'.$incpack;
8525 0 ▶ if (-e $p) { $curINC{$incpack} = $p; last; }
Branch: 1 branch
BranchTrueFalseTotal
if (-e $p) 0 0 0
8526 }
8527 0 ▶ $curINC{$incpack} = $incpack unless $curINC{$incpack};
Branch: 1 branch
BranchTrueFalseTotal
unless $B::C::curINC{$incpack} 0 0 0
8528 }
8529 }
8530 }
8531  
8532 0 ▶sub walkpackages {
Subroutine walkpackages: not called CC=11 SCAR=46.5
Pod undocumented
8533 0 my ( $symref, $recurse, $prefix ) = @_;
8534 41 ▶ no strict 'vars';
Subroutine BEGIN: called CC=1 SCAR=0.0
8535 0 ▶ $prefix = '' unless defined $prefix;
Branch: 1 branch
BranchTrueFalseTotal
unless defined $prefix 0 0 0
8536 # check if already deleted - failed since 5.15.2
8537 0 ▶ return if $savINC{inc_packname(substr($prefix,0,-2))};
Branch: 1 branch
BranchTrueFalseTotal
if $savINC{inc_packname(substr($prefix, 0, -2))} 0 0 0
8538 0 for my $sym (sort keys %$symref) {
8539 0 my $ref = $symref->{$sym};
8540 0 ▶ next unless $ref;
Branch: 1 branch
BranchTrueFalseTotal
unless $ref 0 0 0
8541 0 local (*glob);
8542 0 *glob = $ref;
8543 0 ▶ if ( $sym =~ /::$/ ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($sym =~ /::$/) 0 0 0
8544 0 $sym = $prefix . $sym;
8545 0 ▶ warn("Walkpackages $sym\n") if $debug{pkg} and $debug{walk};
Branch: 1 branch
BranchTrueFalseTotal
if $debug{"pkg"} and $debug{"walk"} 0 0 0
Condition0%0/3
$debug{"pkg"} and $debug{"walk"}
!ll&&!rl&&r
000
MC/DC0%0/2
$debug{"pkg"} and $debug{"walk"}
$debug{"pkg"} $debug{"walk"}
Truth table0%0/3
A and B
A= $debug{"pkg"}B= $debug{"walk"}
ABresult
0X0
100
111
8546 # This walker skips main subs to avoid recursion into O compiler subs again
8547 # and main syms are already handled
8548 0 ▶ if ( $sym ne "main::" && $sym ne "<none>::" && &$recurse($sym) ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($sym ne "main::" and $sym ne "<none>::" and &$recurse($sym)) 0 0 0
Condition0%0/6
$sym ne "main::" and $sym ne "<none>::" and &$recurse($sym)
!ll&&!rl&&r
000
$sym ne "main::" and $sym ne "<none>::"
!ll&&!rl&&r
000
MC/DC0%0/3
$sym ne "main::" and $sym ne "<none>::" and &$recurse($sym)
$sym ne "main::" $sym ne "<none>::" &$recurse($sym)
Truth table0%0/4
A and B and C
A= $sym ne "main::"B= $sym ne "<none>::"C= &$recurse($sym)
ABCresult
0XX0
10X0
1100
1111
8549 0 walkpackages( \%glob, $recurse, $sym );
8550 }
8551 }
8552 }
8553 }
8554  
8555 0 ▶sub save_unused_subs {
Subroutine save_unused_subs: not called CC=30 SCAR=67.6
Pod undocumented
8556 41 ▶ no strict qw(refs);
Subroutine BEGIN: called CC=1 SCAR=0.0
8557 0 my %sav_debug;
8558 0 ▶ if ( $debug{unused} ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($B::C::debug{"unused"}) 0 0 0
8559 0 %sav_debug = %debug;
8560 0 %debug = ();
8561 }
8562 0 ▶ my $main = $module ? $module."::" : "main::";
Branch: 1 branch
BranchTrueFalseTotal
$B::C::module ? : 0 0 0
8563  
8564 # -fwalkall: better strategy for compile-time added and required packages:
8565 # loop savecv and check pkg cache for new pkgs.
8566 # if so loop again with those new pkgs only, until the list of new pkgs is empty
8567 0 my ($walkall_cnt, @init_unused, @unused, @dumped) = (0);
8568 #do
8569 0 @init_unused = grep { $include_package{$_} } keys %include_package;
8570 0 ▶ if ($verbose) {
Branch: 1 branch
BranchTrueFalseTotal
if ($B::C::verbose) 0 0 0
8571 0 ▶ warn "Prescan for unused subs in $main " . ($sav_debug{unused} ? " (silent)\n" : "\n");
Branch: 1 branch
BranchTrueFalseTotal
$sav_debug{'unused'} ? : 0 0 0
8572 }
8573 # XXX TODO better strategy for compile-time added and required packages:
8574 # loop savecv and check pkg cache for new pkgs.
8575 # if so loop again with those new pkgs only, until the list of new pkgs is empty
8576 0 descend_marked_unused();
8577 0 ▶ walkpackages( \%{$main}, \&should_save, $main eq 'main::' ? undef : $main );
Branch: 1 branch
BranchTrueFalseTotal
$main eq 'main::' ? : 0 0 0
8578 0 ▶ warn "Saving unused subs in $main" . ($sav_debug{unused} ? " (silent)\n" : "\n")
Branch: 2 branches
BranchTrueFalseTotal
if $B::C::verbose 0 0 0
$sav_debug{'unused'} ? : 0 0 0
8579 if $verbose;
8580 0 walksymtable( \%{$main}, "savecv", \&should_save );
8581 0 @unused = grep { $include_package{$_} } keys %include_package;
8582 0 ▶ @dumped = grep { $dumped_package{$_} and $_ ne 'main' } keys %dumped_package;
Condition0%0/3
$dumped_package{$_} && $_ ne 'main'
!ll&&!rl&&r
000
MC/DC0%0/2
$dumped_package{$_} && $_ ne 'main'
$dumped_package{$_} $_ ne 'main'
Truth table0%0/3
A && B
A= $dumped_package{$_}B= $_ ne 'main'
ABresult
0X0
100
111
8583 0 ▶ warn sprintf("old unused: %d, new: %d, dumped: %d\n", scalar @init_unused, scalar @unused, scalar @dumped)
Branch: 1 branch
BranchTrueFalseTotal
if $B::C::verbose 0 0 0
8584 if $verbose;
8585 0 ▶ if (!$B::C::walkall) {
Branch: 1 branch
BranchTrueFalseTotal
if (not $B::C::walkall) { } 0 0 0
8586 0 @unused = @init_unused = ();
8587 } else {
8588 0 my $done;
8589 0 ▶ do {
Branch: 1 branch
BranchTrueFalseTotal
@unused > @dumped and $done and do { do { $done = dump_rest(); @unused = grep({$include_package{$_};} keys %include_package); @dumped = grep({$dumped_package{$_} and $_ ne "main";} keys %dumped_package) } } 0 0 0
Condition0%0/3
@unused > @dumped and $done
!ll&&!rl&&r
000
MC/DC0%0/2
@unused > @dumped and $done
@unused > @dumped $done
Truth table0%0/3
A and B
A= @unused > @dumpedB= $done
ABresult
0X0
100
111
8590 0 $done = dump_rest();
8591 0 @unused = grep { $include_package{$_} } keys %include_package;
8592 0 ▶ @dumped = grep { $dumped_package{$_} and $_ ne 'main' } keys %dumped_package;
Condition0%0/3
$dumped_package{$_} && $_ ne 'main'
!ll&&!rl&&r
000
MC/DC0%0/2
$dumped_package{$_} && $_ ne 'main'
$dumped_package{$_} $_ ne 'main'
Truth table0%0/3
A && B
A= $dumped_package{$_}B= $_ ne 'main'
ABresult
0X0
100
111
8593 } while @unused > @dumped and $done;
8594 0 ▶ last if $walkall_cnt++ > 3;
Branch: 1 branch
BranchTrueFalseTotal
if $walkall_cnt++ > 3 0 0 0
8595 }
8596 #} while @unused > @init_unused;
8597  
8598 0 ▶ if ( $sav_debug{unused} ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($sav_debug{"unused"}) 0 0 0
8599 0 %debug = %sav_debug;
8600 }
8601  
8602 # If any m//i is run-time loaded we'll get a "Undefined subroutine utf8::SWASHNEW"
8603 # With -fno-fold we don't insist on loading utf8_heavy and Carp.
8604 # Until it is compile-time required.
8605 0 ▶ if (exists($INC{'unicore/To/Title.pl'})
Branch: 1 branch
BranchTrueFalseTotal
if (exists $INC{"unicore/To/Title.pl"} or exists $INC{"unicore/To/Tc.pl"} or exists $INC{"unicore/Heavy.pl"} or $B::C::savINC{"utf8_heavy.pl"} and $B::C::fold || exists $B::C::savINC{"utf8.pm"}) 0 0 0
Condition0%0/15
exists $INC{"unicore/To/Title.pl"} or exists $INC{"unicore/To/Tc.pl"} or exists $INC{"unicore/Heavy.pl"} or $B::C::savINC{"utf8_heavy.pl"} and $B::C::fold || exists $B::C::savINC{"utf8.pm"}
l!l&&r!l&&!r
000
exists $INC{"unicore/To/Title.pl"} or exists $INC{"unicore/To/Tc.pl"} or exists $INC{"unicore/Heavy.pl"}
l!l&&r!l&&!r
000
exists $INC{"unicore/To/Title.pl"} or exists $INC{"unicore/To/Tc.pl"}
l!l&&r!l&&!r
000
$B::C::savINC{"utf8_heavy.pl"} and $B::C::fold || exists $B::C::savINC{"utf8.pm"}
!ll&&!rl&&r
000
$B::C::fold or exists $B::C::savINC{"utf8.pm"}
l!l&&r!l&&!r
000
MC/DC0%0/6
exists $INC{"unicore/To/Title.pl"} or exists $INC{"unicore/To/Tc.pl"} or exists $INC{"unicore/Heavy.pl"} or $B::C::savINC{"utf8_heavy.pl"} and $B::C::fold || exists $B::C::savINC{"utf8.pm"}
exists $INC{"unicore/To/Title.pl"} exists $INC{"unicore/To/Tc.pl"} exists $INC{"unicore/Heavy.pl"} $B::C::savINC{"utf8_heavy.pl"} $B::C::fold exists $B::C::savINC{"utf8.pm"}
Truth table0%0/7
A or B or C or D and E or F
A= exists $INC{"unicore/To/Title.pl"}B= exists $INC{"unicore/To/Tc.pl"}C= exists $INC{"unicore/Heavy.pl"}D= $B::C::savINC{"utf8_heavy.pl"}E= $B::C::foldF= exists $B::C::savINC{"utf8.pm"}
ABCDEFresult
1XXXXX1
01XXXX1
001XXX1
00011X1
0001011
0000XX0
0001000
8606 or exists($INC{'unicore/To/Tc.pl'}) #242
8607 or exists($INC{'unicore/Heavy.pl'}) #242
8608 or ($savINC{'utf8_heavy.pl'} and ($B::C::fold or exists($savINC{'utf8.pm'})))) {
8609 0 ▶ require "utf8.pm" unless $savINC{"utf8.pm"};
Branch: 1 branch
BranchTrueFalseTotal
unless $B::C::savINC{"utf8.pm"} 0 0 0
8610 0 mark_package('utf8');
8611 0 load_utf8_heavy();
8612 }
8613 # run-time Carp
8614 # With -fno-warnings we don't insist on initializing warnings::register_categories and Carp.
8615 # Until it is compile-time required.
8616 # 68KB exe size 32-bit
8617 0 ▶ if ($] >= 5.013005 and ($B::C::warnings and exists $dumped_package{Carp})) {
Branch: 1 branch
BranchTrueFalseTotal
if ($] >= "5.013005" and ($B::C::warnings and exists $dumped_package{"Carp"})) 0 0 0
Condition0%0/6
$] >= "5.013005" and ($B::C::warnings and exists $dumped_package{"Carp"})
!ll&&!rl&&r
000
$B::C::warnings and exists $dumped_package{"Carp"}
!ll&&!rl&&r
000
MC/DC0%0/3
$] >= "5.013005" and ($B::C::warnings and exists $dumped_package{"Carp"})
$] >= "5.013005" $B::C::warnings exists $dumped_package{"Carp"}
Truth table0%0/4
A and B and C
A= $] >= "5.013005"B= $B::C::warningsC= exists $dumped_package{"Carp"}
ABCresult
0XX0
10X0
1100
1111
8618 0 svref_2object( \&{"warnings\::register_categories"} )->save; # 68Kb 32bit
8619 0 add_hashINC("warnings");
8620 0 add_hashINC("warnings::register");
8621 }
8622 #196 missing INIT
8623 0 ▶ if ($xsub{EV} and $dumped_package{EV} and $EV::VERSION le '4.21') {
Branch: 1 branch
BranchTrueFalseTotal
if ($xsub{"EV"} and $dumped_package{"EV"} and $EV::VERSION le "4.21") 0 0 0
Condition0%0/6
$xsub{"EV"} and $dumped_package{"EV"} and $EV::VERSION le "4.21"
!ll&&!rl&&r
000
$xsub{"EV"} and $dumped_package{"EV"}
!ll&&!rl&&r
000
MC/DC0%0/3
$xsub{"EV"} and $dumped_package{"EV"} and $EV::VERSION le "4.21"
$xsub{"EV"} $dumped_package{"EV"} $EV::VERSION le "4.21"
Truth table0%0/4
A and B and C
A= $xsub{"EV"}B= $dumped_package{"EV"}C= $EV::VERSION le "4.21"
ABCresult
0XX0
10X0
1100
1111
8624 0 $init2->add_eval
8625 (
8626 q(EV::default_loop() or )
8627 .q(die 'EV: cannot initialise libev backend. bad $ENV{LIBEV_FLAGS}?';)
8628 );
8629 }
8630 0 ▶ if ($use_xsloader) {
Branch: 1 branch
BranchTrueFalseTotal
if ($use_xsloader) 0 0 0
8631 0 force_saving_xsloader();
8632 0 mark_package('Config', 1); # required by Dynaloader and special cased previously
8633 }
8634 }
8635  
8636 0 ▶sub inc_cleanup {
Subroutine inc_cleanup: not called CC=24 SCAR=64.0
Pod undocumented
8637 0 my $rec_cnt = shift;
8638 # %INC sanity check issue 89:
8639 # omit unused, unsaved packages, so that at least run-time require will pull them in.
8640 0 my @deleted_inc;
8641 0 ▶ if ($CPERL51) {
Branch: 1 branch
BranchTrueFalseTotal
if ($CPERL51) 0 0 0
8642 0 for (qw(strict coretypes DynaLoader XSLoader)) {
8643 0 $dumped_package{$_}++;
8644 0 $curINC{$_.".pm"} = $INC{$_.".pm"};
8645 }
8646 }
8647 0 for my $package (sort keys %INC) {
8648 0 my $pkg = packname_inc($package);
8649 0 ▶ if ($package =~ /^(Config_git\.pl|Config_heavy.pl)$/ and !$dumped_package{'Config'}) {
Branch: 3 branches
BranchTrueFalseTotal
if ($package =~ /^(Config_git\.pl|Config_heavy.pl)$/ and not $dumped_package{'Config'}) { } 0 0 0
elsif ($package eq 'utf8_heavy.pl' and not $include_package{'utf8'}) { } 0 0 0
elsif (not $B::C::walkall || exists $dumped_package{$pkg}) { } 0 0 0
Condition0%0/3
$package =~ /^(Config_git\.pl|Config_heavy.pl)$/ and not $dumped_package{"Config"}
!ll&&!rl&&r
000
MC/DC0%0/2
$package =~ /^(Config_git\.pl|Config_heavy.pl)$/ and not $dumped_package{"Config"}
$package =~ /^(Config_git\.pl|Config_heavy.pl)$/ not $dumped_package{"Config"}
Truth table0%0/3
A and not(B)
A= $package =~ /^(Config_git\.pl|Config_heavy.pl)$/B= not $dumped_package{"Config"}
ABresult
0X0
100
111
8650 0 delete $curINC{$package};
8651 ▶ } elsif ($package eq 'utf8_heavy.pl' and !$include_package{'utf8'}) {
Condition0%0/3
$package eq "utf8_heavy.pl" and not $include_package{"utf8"}
!ll&&!rl&&r
000
MC/DC0%0/2
$package eq "utf8_heavy.pl" and not $include_package{"utf8"}
$package eq "utf8_heavy.pl" not $include_package{"utf8"}
Truth table0%0/3
A and not(B)
A= $package eq "utf8_heavy.pl"B= not $include_package{"utf8"}
ABresult
0X0
100
111
8652 0 delete $curINC{$package};
8653 0 delete_unsaved_hashINC('utf8');
8654 ▶ } elsif (!$B::C::walkall and !exists $dumped_package{$pkg}) {
Condition0%0/3
$B::C::walkall || exists $dumped_package{$pkg}
l!l&&r!l&&!r
000
MC/DC0%0/2
$B::C::walkall || exists $dumped_package{$pkg}
$B::C::walkall exists $dumped_package{$pkg}
Truth table0%0/3
A || B
A= $B::C::walkallB= exists $dumped_package{$pkg}
ABresult
1X1
011
000
8655 0 delete_unsaved_hashINC($pkg);
8656 0 push @deleted_inc, $pkg;
8657 }
8658 }
8659 # sync %curINC deletions back to %INC
8660 0 for my $p (sort keys %INC) {
8661 0 ▶ if (!exists $curINC{$p}) {
Branch: 1 branch
BranchTrueFalseTotal
unless (exists $B::C::curINC{$p}) 0 0 0
8662 0 delete $INC{$p};
8663 0 push @deleted_inc, $p;
8664 }
8665 }
8666 0 ▶ if ($debug{pkg} and $verbose) {
Branch: 1 branch
BranchTrueFalseTotal
if ($B::C::debug{"pkg"} and $B::C::verbose) 0 0 0
Condition0%0/3
$B::C::debug{"pkg"} and $B::C::verbose
!ll&&!rl&&r
000
MC/DC0%0/2
$B::C::debug{"pkg"} and $B::C::verbose
$B::C::debug{"pkg"} $B::C::verbose
Truth table0%0/3
A and B
A= $B::C::debug{"pkg"}B= $B::C::verbose
ABresult
0X0
100
111
8667 0 warn "\%include_package: ".join(" ",grep{$include_package{$_}} sort keys %include_package)."\n";
8668 0 warn "\%dumped_package: ".join(" ",grep{$dumped_package{$_}} sort keys %dumped_package)."\n";
8669 }
8670 # issue 340,350: do only on -fwalkall? do it in the main walker step
8671 # as in branch walkall-early?
8672 0 ▶ if ($B::C::walkall) {
Branch: 1 branch
BranchTrueFalseTotal
if ($B::C::walkall) 0 0 0
8673 0 my $again = dump_rest();
8674 0 ▶ inc_cleanup($rec_cnt++) if $again and $rec_cnt < 2; # maximal 3 times
Branch: 1 branch
BranchTrueFalseTotal
if $again and $rec_cnt < 2 0 0 0
Condition0%0/3
$again and $rec_cnt < 2
!ll&&!rl&&r
000
MC/DC0%0/2
$again and $rec_cnt < 2
$again $rec_cnt < 2
Truth table0%0/3
A and B
A= $againB= $rec_cnt < 2
ABresult
0X0
100
111
8675 }
8676 # final cleanup
8677 0 for my $p (sort keys %INC) {
8678 0 my $pkg = packname_inc($p);
8679 0 ▶ delete_unsaved_hashINC($pkg) unless exists $dumped_package{$pkg};
Branch: 1 branch
BranchTrueFalseTotal
unless exists $dumped_package{$pkg} 0 0 0
8680 # sync %curINC deletions back to %INC
8681 0 ▶ if (!exists $curINC{$p} and exists $INC{$p}) {
Branch: 1 branch
BranchTrueFalseTotal
if (not exists $B::C::curINC{$p} and exists $INC{$p}) 0 0 0
Condition0%0/3
not exists $B::C::curINC{$p} and exists $INC{$p}
!ll&&!rl&&r
000
MC/DC0%0/2
not exists $B::C::curINC{$p} and exists $INC{$p}
not exists $B::C::curINC{$p} exists $INC{$p}
Truth table0%0/3
not(A) and B
A= not exists $B::C::curINC{$p}B= exists $INC{$p}
ABresult
0X0
100
111
8682 0 delete $INC{$p};
8683 0 push @deleted_inc, $p;
8684 }
8685 }
8686 0 ▶ if ($debug{pkg} and $verbose) {
Branch: 1 branch
BranchTrueFalseTotal
if ($B::C::debug{"pkg"} and $B::C::verbose) 0 0 0
Condition0%0/3
$B::C::debug{"pkg"} and $B::C::verbose
!ll&&!rl&&r
000
MC/DC0%0/2
$B::C::debug{"pkg"} and $B::C::verbose
$B::C::debug{"pkg"} $B::C::verbose
Truth table0%0/3
A and B
A= $B::C::debug{"pkg"}B= $B::C::verbose
ABresult
0X0
100
111
8687 0 ▶ warn "Deleted from \%INC: ".join(" ",@deleted_inc)."\n" if @deleted_inc;
Branch: 1 branch
BranchTrueFalseTotal
if @deleted_inc 0 0 0
8688 0 my @inc = grep !/auto\/.+\.(al|ix)$/, sort keys %INC;
8689 0 warn "\%INC: ".join(" ",@inc)."\n";
8690 }
8691 }
8692  
8693 0 ▶sub dump_rest {
Subroutine dump_rest: not called CC=14 SCAR=53.5
Pod undocumented
8694 0 my $again;
8695 0 ▶ warn "dump_rest:\n" if $verbose or $debug{pkg};
Branch: 1 branch
BranchTrueFalseTotal
if $B::C::verbose or $B::C::debug{"pkg"} 0 0 0
Condition0%0/3
$B::C::verbose or $B::C::debug{"pkg"}
l!l&&r!l&&!r
000
MC/DC0%0/2
$B::C::verbose or $B::C::debug{"pkg"}
$B::C::verbose $B::C::debug{"pkg"}
Truth table0%0/3
A or B
A= $B::C::verboseB= $B::C::debug{"pkg"}
ABresult
1X1
011
000
8696 #for my $p (sort keys %INC) {
8697 #}
8698 0 for my $p (sort keys %include_package) {
8699 0 $p =~ s/^main:://;
8700 0 ▶ if ($include_package{$p} and !exists $dumped_package{$p}
Branch: 1 branch
BranchTrueFalseTotal
if ($include_package{$p} and not exists $dumped_package{$p} and not $static_core_pkg{$p} and not $p =~ /^(threads|main|__ANON__|PerlIO)$/) 0 0 0
Condition0%0/9
$include_package{$p} and not exists $dumped_package{$p} and not $static_core_pkg{$p} and not $p =~ /^(threads|main|__ANON__|PerlIO)$/
!ll&&!rl&&r
000
$include_package{$p} and not exists $dumped_package{$p} and not $static_core_pkg{$p}
!ll&&!rl&&r
000
$include_package{$p} and not exists $dumped_package{$p}
!ll&&!rl&&r
000
MC/DC0%0/4
$include_package{$p} and not exists $dumped_package{$p} and not $static_core_pkg{$p} and not $p =~ /^(threads|main|__ANON__|PerlIO)$/
$include_package{$p} not exists $dumped_package{$p} not $static_core_pkg{$p} not $p =~ /^(threads|main|__ANON__|PerlIO)$/
Truth table0%0/5
A and not(B) and not(C) and not(D)
A= $include_package{$p}B= not exists $dumped_package{$p}C= not $static_core_pkg{$p}D= not $p =~ /^(threads|main|__ANON__|PerlIO)$/
ABCDresult
0XXX0
10XX0
110X0
11100
11111
8701 and !$static_core_pkg{$p}
8702 and $p !~ /^(threads|main|__ANON__|PerlIO)$/
8703 )
8704 {
8705 0 ▶ next if $module and $p ne $module;
Branch: 1 branch
BranchTrueFalseTotal
if $B::C::module and $p ne $B::C::module 0 0 0
Condition0%0/3
$B::C::module and $p ne $B::C::module
!ll&&!rl&&r
000
MC/DC0%0/2
$B::C::module and $p ne $B::C::module
$B::C::module $p ne $B::C::module
Truth table0%0/3
A and B
A= $B::C::moduleB= $p ne $B::C::module
ABresult
0X0
100
111
8706 0 ▶ if ($p eq 'warnings::register' and !$B::C::warnings) {
Branch: 1 branch
BranchTrueFalseTotal
if ($p eq "warnings::register" and not $B::C::warnings) 0 0 0
Condition0%0/3
$p eq "warnings::register" and not $B::C::warnings
!ll&&!rl&&r
000
MC/DC0%0/2
$p eq "warnings::register" and not $B::C::warnings
$p eq "warnings::register" not $B::C::warnings
Truth table0%0/3
A and not(B)
A= $p eq "warnings::register"B= not $B::C::warnings
ABresult
0X0
100
111
8707 0 delete_unsaved_hashINC('warnings::register');
8708 0 next;
8709 }
8710 0 $again++;
8711 0 ▶ warn "$p marked but not saved, save now\n" if $verbose or $debug{pkg};
Branch: 1 branch
BranchTrueFalseTotal
if $B::C::verbose or $B::C::debug{"pkg"} 0 0 0
Condition0%0/3
$B::C::verbose or $B::C::debug{"pkg"}
l!l&&r!l&&!r
000
MC/DC0%0/2
$B::C::verbose or $B::C::debug{"pkg"}
$B::C::verbose $B::C::debug{"pkg"}
Truth table0%0/3
A or B
A= $B::C::verboseB= $B::C::debug{"pkg"}
ABresult
1X1
011
000
8712 # mark_package( $p, 1);
8713 #eval {
8714 # require(inc_packname($p)) && add_hashINC( $p );
8715 #} unless $savINC{inc_packname($p)};
8716 0 walk_syms( $p );
8717 }
8718 }
8719 0 $again;
8720 }
8721  
8722 41 my @made_c3;
8723  
8724 0 ▶sub make_c3 {
Subroutine make_c3: not called CC=7 SCAR=40.3
Pod undocumented
8725 0 ▶ my $package = shift or die;
Branch: 1 branch
BranchTrueFalseTotal
my $package = shift() or die 0 0 0
8726  
8727 0 ▶ return if ( grep { $_ eq $package } @made_c3 );
Branch: 1 branch
BranchTrueFalseTotal
if grep {$_ eq $package;} @made_c3 0 0 0
8728 0 push @made_c3, $package;
8729  
8730 0 mark_package( 'mro', 1 );
8731 0 mark_package($package);
8732 0 ▶ my $isa_packages = mro::get_linear_isa($package) || [];
Condition0%0/2
&mro::get_linear_isa($package) || []
l!l
00
MC/DC0%0/1
&mro::get_linear_isa($package) || []
&mro::get_linear_isa($package)
Truth table0%0/2
A
A= &mro::get_linear_isa($package)
Aresult
11
00
8733 0 foreach my $isa (@$isa_packages) {
8734 0 mark_package($isa);
8735 }
8736 0 ▶ warn "set c3 for $package\n" if $verbose or $debug{pkg};
Branch: 1 branch
BranchTrueFalseTotal
if $B::C::verbose or $B::C::debug{"pkg"} 0 0 0
Condition0%0/3
$B::C::verbose or $B::C::debug{"pkg"}
l!l&&r!l&&!r
000
MC/DC0%0/2
$B::C::verbose or $B::C::debug{"pkg"}
$B::C::verbose $B::C::debug{"pkg"}
Truth table0%0/3
A or B
A= $B::C::verboseB= $B::C::debug{"pkg"}
ABresult
1X1
011
000
8737  
8738 ## from setmro.xs:
8739 # classname = ST(0);
8740 # class_stash = gv_stashsv(classname, GV_ADD);
8741 # meta = HvMROMETA(class_stash);
8742 # Perl_mro_set_mro(aTHX_ meta, ST(1));
8743  
8744 0 $init2->add( sprintf( 'Perl_mro_set_mro(aTHX_ HvMROMETA(%s), newSVpvs("c3"));',
8745 savestashpv($package) ) );
8746 }
8747  
8748 # global state only, unneeded for modules
8749 0 ▶sub save_context {
Subroutine save_context: not called CC=40 SCAR=71.9
Pod undocumented
8750 # forbid run-time extends of curpad syms, names and INC
8751 0 ▶ warn "save context:\n" if $verbose;
Branch: 1 branch
BranchTrueFalseTotal
if $B::C::verbose 0 0 0
8752 0 my $warner = $SIG{__WARN__};
8753 0 ▶ save_sig($warner) if $B::C::save_sig;
Branch: 1 branch
BranchTrueFalseTotal
if $B::C::save_sig 0 0 0
8754 # honour -w and %^H
8755 0 $init->add( "/* honor -w */",
8756 sprintf "PL_dowarn = ( %s ) ? G_WARN_ON : G_WARN_OFF;", $^W );
8757 0 ▶ if ($^{TAINT}) {
Branch: 1 branch
BranchTrueFalseTotal
if ($^{"TAINT"}) 0 0 0
8758 $init->add( "/* honor -Tt */",
8759 "PL_tainting = TRUE;",
8760 # -T -1 false, -t 1 true
8761 0 ▶ "PL_taint_warn = ".($^{TAINT} < 0 ? "FALSE" : "TRUE").";");
Branch: 1 branch
BranchTrueFalseTotal
$^{'TAINT'} < 0 ? : 0 0 0
8762 }
8763  
8764 0 ▶ if ($PERL510) {
Branch: 1 branch
BranchTrueFalseTotal
if ($PERL510) 0 0 0
8765 # need to mark assign c3 to %main::. no need to assign the default dfs
8766 0 ▶ if (is_using_mro() && mro::get_mro("main") eq 'c3') {
Branch: 1 branch
BranchTrueFalseTotal
if (is_using_mro() and &mro::get_mro("main") eq "c3") 0 0 0
Condition0%0/3
is_using_mro() and &mro::get_mro("main") eq "c3"
!ll&&!rl&&r
000
MC/DC0%0/2
is_using_mro() and &mro::get_mro("main") eq "c3"
is_using_mro() &mro::get_mro("main") eq "c3"
Truth table0%0/3
A and B
A= is_using_mro()B= &mro::get_mro("main") eq "c3"
ABresult
0X0
100
111
8767 0 make_c3('main');
8768 }
8769 # Tie::Hash::NamedCapture is added for *+ *-, Errno for *!
8770 #no strict 'refs';
8771 #if ( defined(objsym(svref_2object(\*{'main::+'}))) or defined(objsym(svref_2object(\*{'main::-'}))) ) {
8772 # use strict 'refs';
8773 # if (!$include_package{'Tie::Hash::NamedCapture'}) {
8774 # $init->add("/* force saving of Tie::Hash::NamedCapture */");
8775 # if ($] >= 5.014) {
8776 # mark_package('Config', 1); # DynaLoader needs Config to set the EGV
8777 # walk_syms('Config');
8778 # svref_2object(\&{'Tie::Hash::NamedCapture::bootstrap'})->save;
8779 # }
8780 # mark_package('Tie::Hash::NamedCapture', 1);
8781 # } # else already included
8782 #} else {
8783 # use strict 'refs';
8784 # delete_unsaved_hashINC('Tie::Hash::NamedCapture');
8785 #}
8786 41 ▶ no strict 'refs';
Subroutine BEGIN: called CC=1 SCAR=0.0
8787 0 ▶ if ( defined(objsym(svref_2object(\*{'main::!'}))) ) {
Branch: 1 branch
BranchTrueFalseTotal
if (defined objsym(svref_2object(\*{'main::!';}))) { } 0 0 0
8788 41 ▶ use strict 'refs';
Subroutine BEGIN: called CC=1 SCAR=0.0
8789 0 ▶ if (!$module and !$include_package{'Errno'}) {
Branch: 1 branch
BranchTrueFalseTotal
unless ($B::C::module or $include_package{"Errno"}) 0 0 0
Condition0%0/3
$B::C::module or $include_package{"Errno"}
l!l&&r!l&&!r
000
MC/DC0%0/2
$B::C::module or $include_package{"Errno"}
$B::C::module $include_package{"Errno"}
Truth table0%0/3
A or B
A= $B::C::moduleB= $include_package{"Errno"}
ABresult
1X1
011
000
8790 0 $init->add("/* force saving of Errno */");
8791 0 mark_package('Config', 1);
8792 0 walk_syms('Config');
8793 0 mark_package('Errno', 1);
8794 0 svref_2object(\&{'Errno::bootstrap'})->save;
8795 } # else already included
8796 } else {
8797 41 ▶ use strict 'refs';
Subroutine BEGIN: called CC=1 SCAR=0.0
8798 0 delete_unsaved_hashINC('Errno');
8799 }
8800 }
8801  
8802 0 my ($curpad_nam, $curpad_sym);
8803 {
8804 # Record comppad sv's names, may not be static
8805 0 local $B::C::const_strings = 0;
8806 0 $init->add("/* curpad names */");
8807 0 ▶ warn "curpad names:\n" if $verbose;
Branch: 1 branch
BranchTrueFalseTotal
if $B::C::verbose 0 0 0
8808 0 $curpad_nam = ( comppadlist->ARRAY )[0]->save('curpad_name');
8809 0 ▶ warn "curpad syms:\n" if $verbose;
Branch: 1 branch
BranchTrueFalseTotal
if $B::C::verbose 0 0 0
8810 0 $init->add("/* curpad syms */");
8811 0 $curpad_sym = ( comppadlist->ARRAY )[1]->save('curpad_syms');
8812 }
8813 0 my ($inc_hv, $inc_av);
8814 {
8815 0 ▶ local $B::C::const_strings = 1 if $B::C::ro_inc;
Branch: 1 branch
BranchTrueFalseTotal
if $B::C::ro_inc 0 0 0
8816 0 ▶ warn "\%INC and \@INC:\n" if $verbose;
Branch: 1 branch
BranchTrueFalseTotal
if $B::C::verbose 0 0 0
8817 0 $init->add('/* %INC */');
8818 0 inc_cleanup(0);
8819 0 my $inc_gv = svref_2object( \*main::INC );
8820 0 $inc_hv = $inc_gv->HV->save('main::INC');
8821 0 ▶ if ($cross) {
Branch: 1 branch
BranchTrueFalseTotal
if ($B::C::cross) { } 0 0 0
8822 0 $init->add('/* cross @INC */');
8823 0 my @crossinc = ($Config{archlib});
8824 0 ▶ if ($Config{archlib} ne $Config{privlib}) {
Branch: 1 branch
BranchTrueFalseTotal
if ($B::C::Config{"archlib"} ne $B::C::Config{"privlib"}) 0 0 0
8825 0 push @crossinc, $Config{privlib};
8826 }
8827 0 ▶ if (exists $Config{sitearch} and $Config{sitearch}) {
Branch: 1 branch
BranchTrueFalseTotal
if (exists $B::C::Config{"sitearch"} and $B::C::Config{"sitearch"}) 0 0 0
Condition0%0/3
exists $B::C::Config{"sitearch"} and $B::C::Config{"sitearch"}
!ll&&!rl&&r
000
MC/DC0%0/2
exists $B::C::Config{"sitearch"} and $B::C::Config{"sitearch"}
exists $B::C::Config{"sitearch"} $B::C::Config{"sitearch"}
Truth table0%0/3
A and B
A= exists $B::C::Config{"sitearch"}B= $B::C::Config{"sitearch"}
ABresult
0X0
100
111
8828 0 unshift @crossinc, $Config{sitearch};
8829 unshift @crossinc, $Config{sitelib}
8830 0 ▶ if $Config{sitearch} ne $Config{sitelib};
Branch: 1 branch
BranchTrueFalseTotal
if $B::C::Config{"sitearch"} ne $B::C::Config{"sitelib"} 0 0 0
8831 }
8832 0 ▶ if (exists $Config{vendorarch} and $Config{vendorarch}) {
Branch: 1 branch
BranchTrueFalseTotal
if (exists $B::C::Config{"vendorarch"} and $B::C::Config{"vendorarch"}) 0 0 0
Condition0%0/3
exists $B::C::Config{"vendorarch"} and $B::C::Config{"vendorarch"}
!ll&&!rl&&r
000
MC/DC0%0/2
exists $B::C::Config{"vendorarch"} and $B::C::Config{"vendorarch"}
exists $B::C::Config{"vendorarch"} $B::C::Config{"vendorarch"}
Truth table0%0/3
A and B
A= exists $B::C::Config{"vendorarch"}B= $B::C::Config{"vendorarch"}
ABresult
0X0
100
111
8833 0 push @crossinc, $Config{vendorarch};
8834 push @crossinc, $Config{vendorlib}
8835 0 ▶ if $Config{vendorarch} ne $Config{vendorlib};
Branch: 1 branch
BranchTrueFalseTotal
if $B::C::Config{"vendorarch"} ne $B::C::Config{"vendorlib"} 0 0 0
8836 }
8837 0 ▶ if ($] < 5.026 and !$Config{usecperl}) {
Branch: 1 branch
BranchTrueFalseTotal
if ($] < "5.026" and not $B::C::Config{"usecperl"}) 0 0 0
Condition0%0/3
$] < "5.026" and not $B::C::Config{"usecperl"}
!ll&&!rl&&r
000
MC/DC0%0/2
$] < "5.026" and not $B::C::Config{"usecperl"}
$] < "5.026" not $B::C::Config{"usecperl"}
Truth table0%0/3
A and not(B)
A= $] < "5.026"B= not $B::C::Config{"usecperl"}
ABresult
0X0
100
111
8838 0 push @crossinc, '.';
8839 }
8840 0 $inc_av = svref_2object(\@crossinc)->save('main::INC');
8841 } else {
8842 0 $init->add('/* @INC */');
8843 0 $inc_av = $inc_gv->AV->save('main::INC');
8844 }
8845 }
8846 # ensure all included @ISA's are stored (#308), and also assign c3 (#325)
8847 0 my @saved_isa;
8848 0 for my $p (sort keys %include_package) {
8849 41 ▶ no strict 'refs';
Subroutine BEGIN: called CC=1 SCAR=0.0
8850 0 ▶ if ($include_package{$p} and exists(${$p.'::'}{ISA}) and ${$p.'::'}{ISA}) {
Branch: 1 branch
BranchTrueFalseTotal
if ($include_package{$p} and exists do { $p . '::' }->{"ISA"} and do { $p . '::' }->{"ISA"}) 0 0 0
Condition0%0/6
$include_package{$p} and exists do { $p . '::' }->{"ISA"} and do { $p . '::' }->{"ISA"}
!ll&&!rl&&r
000
$include_package{$p} and exists do { $p . '::' }->{"ISA"}
!ll&&!rl&&r
000
MC/DC0%0/3
$include_package{$p} and exists do { $p . '::' }->{"ISA"} and do { $p . '::' }->{"ISA"}
$include_package{$p} exists do { $p . '::' }->{"ISA"} do { $p . '::' }->{"ISA"}
Truth table0%0/4
A and B and C
A= $include_package{$p}B= exists do { $p . '::' }->{"ISA"}C= do { $p . '::' }->{"ISA"}
ABCresult
0XX0
10X0
1100
1111
8851 0 push @saved_isa, $p;
8852 0 svref_2object( \@{$p.'::ISA'} )->save($p.'::ISA');
8853 0 ▶ if ($PERL510 and is_using_mro() && mro::get_mro($p) eq 'c3') {
Branch: 1 branch
BranchTrueFalseTotal
if ($PERL510 and (is_using_mro() and &mro::get_mro($p) eq "c3")) 0 0 0
Condition0%0/6
$PERL510 and (is_using_mro() and &mro::get_mro($p) eq "c3")
!ll&&!rl&&r
000
is_using_mro() and &mro::get_mro($p) eq "c3"
!ll&&!rl&&r
000
MC/DC0%0/3
$PERL510 and (is_using_mro() and &mro::get_mro($p) eq "c3")
$PERL510 is_using_mro() &mro::get_mro($p) eq "c3"
Truth table0%0/4
A and B and C
A= $PERL510B= is_using_mro()C= &mro::get_mro($p) eq "c3"
ABCresult
0XX0
10X0
1100
1111
8854 0 make_c3($p);
8855 }
8856 }
8857 }
8858 0 ▶ warn "Saved \@ISA for: ".join(" ",@saved_isa)."\n" if @saved_isa and ($verbose or $debug{pkg});
Branch: 1 branch
BranchTrueFalseTotal
if @saved_isa and $B::C::verbose || $B::C::debug{"pkg"} 0 0 0
Condition0%0/6
@saved_isa and $B::C::verbose || $B::C::debug{"pkg"}
!ll&&!rl&&r
000
$B::C::verbose or $B::C::debug{"pkg"}
l!l&&r!l&&!r
000
MC/DC0%0/3
@saved_isa and $B::C::verbose || $B::C::debug{"pkg"}
@saved_isa $B::C::verbose $B::C::debug{"pkg"}
Truth table0%0/4
A and B or C
A= @saved_isaB= $B::C::verboseC= $B::C::debug{"pkg"}
ABCresult
0XX0
1000
11X1
1011
8859 0 $init->add(
8860 "GvHV(PL_incgv) = $inc_hv;",
8861 "GvAV(PL_incgv) = $inc_av;",
8862 "PL_curpad = AvARRAY($curpad_sym);",
8863 "PL_comppad = $curpad_sym;", # fixed "panic: illegal pad"
8864 "PL_stack_sp = PL_stack_base;" # reset stack (was 1++)
8865 );
8866 0 ▶ if ($] < 5.017005) {
Branch: 3 branches
BranchTrueFalseTotal
if ($] < 5.017005) { } 0 0 0
elsif ($] < 5.019003) { } 0 0 0
elsif ($] < 5.022) { } 0 0 0
8867 0 $init->add(
8868 "av_store((AV*)CvPADLIST(PL_main_cv), 0, SvREFCNT_inc_simple_NN($curpad_nam)); /* namepad */",
8869 "av_store((AV*)CvPADLIST(PL_main_cv), 1, SvREFCNT_inc_simple_NN($curpad_sym)); /* curpad */");
8870 } elsif ($] < 5.019003) {
8871 0 $init->add(
8872 "PadlistARRAY(CvPADLIST(PL_main_cv))[0] = PL_comppad_name = (PAD*)SvREFCNT_inc_simple_NN($curpad_nam); /* namepad */",
8873 "PadlistARRAY(CvPADLIST(PL_main_cv))[1] = (PAD*)SvREFCNT_inc_simple_NN($curpad_sym); /* curpad */");
8874 } elsif ($] < 5.022) {
8875 0 $init->add(
8876 "PadlistARRAY(CvPADLIST(PL_main_cv))[0] = PL_comppad_name = (PAD*)SvREFCNT_inc_simple_NN($curpad_nam); /* namepad */",
8877 "PadnamelistMAXNAMED(PL_comppad_name) = AvFILL($curpad_nam);",
8878 "PadlistARRAY(CvPADLIST(PL_main_cv))[1] = (PAD*)SvREFCNT_inc_simple_NN($curpad_sym); /* curpad */");
8879 } else {
8880 0 $init->add(
8881 "PadlistNAMES(CvPADLIST(PL_main_cv)) = PL_comppad_name = $curpad_nam; /* namepad */",
8882 "PadlistARRAY(CvPADLIST(PL_main_cv))[1] = (PAD*)$curpad_sym; /* curpad */");
8883 }
8884 0 ▶ if ($] < 5.017) {
Branch: 1 branch
BranchTrueFalseTotal
if ($] < "5.017") 0 0 0
8885 0 my $amagic_generate = B::amagic_generation();
8886 0 ▶ warn "amagic_generation = $amagic_generate\n" if $verbose;
Branch: 1 branch
BranchTrueFalseTotal
if $B::C::verbose 0 0 0
8887 0 $init->add("PL_amagic_generation = $amagic_generate;");
8888 };
8889 }
8890  
8891 0 ▶sub descend_marked_unused {
Subroutine descend_marked_unused: not called CC=10 SCAR=47.0
Pod undocumented
8892 #if ($B::C::walkall) {
8893 # for my $pack (keys %all_bc_deps) {
8894 # mark_unused($pack, 0) if !exists $include_package{$pack} and !skip_pkg($pack);
8895 # }
8896 #}
8897 0 foreach my $pack ( sort keys %INC ) {
8898 0 my $p = packname_inc($pack);
8899 0 ▶ mark_package($p) if !skip_pkg($p) and !$all_bc_deps{$p} and $pack !~ /(autosplit\.ix|\.al)$/;
Branch: 1 branch
BranchTrueFalseTotal
unless skip_pkg($p) or $B::C::all_bc_deps{$p} or $pack =~ /(autosplit\.ix|\.al)$/ 0 0 0
Condition0%0/6
skip_pkg($p) or $B::C::all_bc_deps{$p} or $pack =~ /(autosplit\.ix|\.al)$/
l!l&&r!l&&!r
000
skip_pkg($p) or $B::C::all_bc_deps{$p}
l!l&&r!l&&!r
000
MC/DC0%0/3
skip_pkg($p) or $B::C::all_bc_deps{$p} or $pack =~ /(autosplit\.ix|\.al)$/
skip_pkg($p) $B::C::all_bc_deps{$p} $pack =~ /(autosplit\.ix|\.al)$/
Truth table0%0/4
A or B or C
A= skip_pkg($p)B= $B::C::all_bc_deps{$p}C= $pack =~ /(autosplit\.ix|\.al)$/
ABCresult
1XX1
01X1
0011
0000
8900 }
8901 0 ▶ if ($debug{pkg} and $verbose) {
Branch: 1 branch
BranchTrueFalseTotal
if ($B::C::debug{"pkg"} and $B::C::verbose) 0 0 0
Condition0%0/3
$B::C::debug{"pkg"} and $B::C::verbose
!ll&&!rl&&r
000
MC/DC0%0/2
$B::C::debug{"pkg"} and $B::C::verbose
$B::C::debug{"pkg"} $B::C::verbose
Truth table0%0/3
A and B
A= $B::C::debug{"pkg"}B= $B::C::verbose
ABresult
0X0
100
111
8902 0 warn "\%include_package: ".join(" ",grep{$include_package{$_}} sort keys %include_package)."\n";
8903 0 warn "\%skip_package: ".join(" ",sort keys %skip_package)."\n";
8904 }
8905 0 foreach my $pack ( sort keys %include_package ) {
8906 0 ▶ mark_package($pack) unless skip_pkg($pack);
Branch: 1 branch
BranchTrueFalseTotal
unless skip_pkg($pack) 0 0 0
8907 }
8908 warn "descend_marked_unused: "
8909 0 ▶ .join(" ",sort keys %include_package)."\n" if $debug{pkg};
Branch: 1 branch
BranchTrueFalseTotal
if $B::C::debug{"pkg"} 0 0 0
8910 }
8911  
8912 0 ▶sub save_main {
Subroutine save_main: not called CC=6 SCAR=37.4
Pod undocumented
8913  
8914 0 ▶ warn "Starting compile\n" if $verbose;
Branch: 1 branch
BranchTrueFalseTotal
if $B::C::verbose 0 0 0
8915 0 ▶ warn "Walking tree\n" if $verbose;
Branch: 1 branch
BranchTrueFalseTotal
if $B::C::verbose 0 0 0
8916 0 %Exporter::Cache = (); # avoid B::C and B symbols being stored
8917 0 ▶ _delete_macros_vendor_undefined() if $PERL512;
Branch: 1 branch
BranchTrueFalseTotal
if $PERL512 0 0 0
8918 0 set_curcv B::main_cv;
8919 0 seek( STDOUT, 0, 0 ); #exclude print statements in BEGIN{} into output
8920 0 ▶ binmode( STDOUT, ':utf8' ) unless $PERL56;
Branch: 1 branch
BranchTrueFalseTotal
unless $PERL56 0 0 0
8921  
8922 0 ▶ $verbose
Branch: 1 branch
BranchTrueFalseTotal
$B::C::verbose ? : 0 0 0
8923 ? walkoptree_slow( main_root, "save" )
8924 : walkoptree( main_root, "save" );
8925 0 save_main_rest();
8926 }
8927  
8928 0 ▶sub _delete_macros_vendor_undefined {
Subroutine _delete_macros_vendor_undefined: not called CC=7 SCAR=31.7
8929 0 foreach my $class (qw(POSIX IO Fcntl Socket Exporter Errno)) {
8930 41 ▶ no strict 'refs';
Subroutine BEGIN: called CC=1 SCAR=0.0
8931 41 ▶ no strict 'subs';
Subroutine BEGIN: called CC=1 SCAR=0.0
8932 41 ▶ no warnings 'uninitialized';
Subroutine BEGIN: called CC=1 SCAR=0.0
8933 0 my $symtab = $class . '::';
8934 0 for my $symbol ( sort keys %$symtab ) {
8935 0 ▶ next if $symbol !~ m{^[0-9A-Z_]+$} || $symbol =~ m{(?:^ISA$|^EXPORT|^DESTROY|^TIE|^VERSION|^AUTOLOAD|^BEGIN|^INIT|^__|^DELETE|^CLEAR|^STORE|^NEXTKEY|^FIRSTKEY|^FETCH|^EXISTS)};
Branch: 1 branch
BranchTrueFalseTotal
if not $symbol =~ /^[0-9A-Z_]+$/ or $symbol =~ /(?:^ISA$|^EXPORT|^DESTROY|^TIE|^VERSION|^AUTOLOAD|^BEGIN|^INIT|^__|^DELETE|^CLEAR|^STORE|^NEXTKEY|^FIRSTKEY|^FETCH|^EXISTS)/ 0 0 0
Condition0%0/3
not $symbol =~ /^[0-9A-Z_]+$/ or $symbol =~ /(?:^ISA$|^EXPORT|^DESTROY|^TIE|^VERSION|^AUTOLOAD|^BEGIN|^INIT|^__|^DELETE|^CLEAR|^STORE|^NEXTKEY|^FIRSTKEY|^FETCH|^EXISTS)/
l!l&&r!l&&!r
000
MC/DC0%0/2
not $symbol =~ /^[0-9A-Z_]+$/ or $symbol =~ /(?:^ISA$|^EXPORT|^DESTROY|^TIE|^VERSION|^AUTOLOAD|^BEGIN|^INIT|^__|^DELETE|^CLEAR|^STORE|^NEXTKEY|^FIRSTKEY|^FETCH|^EXISTS)/
not $symbol =~ /^[0-9A-Z_]+$/ $symbol =~ /(?:^ISA$|^EXPORT|^DESTROY|^TIE|^VERSION|^AUTOLOAD|^BEGIN|^INIT|^__|^DELETE|^CLEAR|^STORE|^NEXTKEY|^FIRSTKEY|^FETCH|^EXISTS)/
Truth table0%0/3
not(A) or B
A= not $symbol =~ /^[0-9A-Z_]+$/B= $symbol =~ /(?:^ISA$|^EXPORT|^DESTROY|^TIE|^VERSION|^AUTOLOAD|^BEGIN|^INIT|^__|^DELETE|^CLEAR|^STORE|^NEXTKEY|^FIRSTKEY|^FETCH|^EXISTS)/
ABresult
1X1
011
000
8936 0 ▶ next if ref $symtab->{$symbol};
Branch: 1 branch
BranchTrueFalseTotal
if ref $symtab->{$symbol} 0 0 0
8937 0 local $@;
8938 0 my $code = "$class\:\:$symbol();";
8939 0 eval $code;
8940 0 ▶ if ( $@ =~ m{vendor has not defined} ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($@ =~ /vendor has not defined/) 0 0 0
8941 0 delete $symtab->{$symbol};
8942 0 next;
8943 }
8944 }
8945 }
8946 0 return 1;
8947 }
8948  
8949 0 ▶sub fixup_ppaddr {
Subroutine fixup_ppaddr: not called CC=4 SCAR=30.0
Pod undocumented
8950 # init op addrs must be the last action, otherwise
8951 # some ops might not be initialized
8952 # but it needs to happen before CALLREGCOMP, as a /i calls a compiled utf8::SWASHNEW
8953 0 ▶ if ($B::C::optimize_ppaddr) {
Branch: 1 branch
BranchTrueFalseTotal
if ($B::C::optimize_ppaddr) 0 0 0
8954 0 foreach my $i (@op_sections) {
8955 0 my $section = $$i;
8956 0 my $num = $section->index;
8957 0 ▶ next unless $num >= 0;
Branch: 1 branch
BranchTrueFalseTotal
unless $num >= 0 0 0 0
8958 0 init_op_addr( $section->name, $num + 1 );
8959 }
8960 }
8961 }
8962  
8963 # save %SIG ( in case it was set in a BEGIN block )
8964 0 ▶sub save_sig {
Subroutine save_sig: not called CC=11 SCAR=48.8
Pod undocumented
8965 # local $SIG{__WARN__} = shift;
8966 0 $init->no_split;
8967 0 my @save_sig;
8968 0 foreach my $k ( sort keys %SIG ) {
8969 0 ▶ next unless ref $SIG{$k};
Branch: 1 branch
BranchTrueFalseTotal
unless ref $SIG{$k} 0 0 0
8970 0 my $cvref = svref_2object( \$SIG{$k} );
8971 0 ▶ next if ref($cvref) eq 'B::CV' and $cvref->FILE =~ m|B/C\.pm$|; # ignore B::C SIG warn handler
Branch: 1 branch
BranchTrueFalseTotal
if ref $cvref eq "B::CV" and $cvref->FILE =~ m[B/C\.pm$] 0 0 0
Condition0%0/3
ref $cvref eq "B::CV" and $cvref->FILE =~ m[B/C\.pm$]
!ll&&!rl&&r
000
MC/DC0%0/2
ref $cvref eq "B::CV" and $cvref->FILE =~ m[B/C\.pm$]
ref $cvref eq "B::CV" $cvref->FILE =~ m[B/C\.pm$]
Truth table0%0/3
A and B
A= ref $cvref eq "B::CV"B= $cvref->FILE =~ m[B/C\.pm$]
ABresult
0X0
100
111
8972 0 push @save_sig, [$k, $cvref];
8973 }
8974 0 ▶ unless (@save_sig) {
Branch: 1 branch
BranchTrueFalseTotal
unless (@save_sig) 0 0 0
8975 0 ▶ $init->add( "/* no %SIG in BEGIN block */" ) if $verbose;
Branch: 1 branch
BranchTrueFalseTotal
if $B::C::verbose 0 0 0
8976 0 ▶ warn "no %SIG in BEGIN block\n" if $verbose;
Branch: 1 branch
BranchTrueFalseTotal
if $B::C::verbose 0 0 0
8977 0 return;
8978 }
8979 0 ▶ $init->add( "/* save %SIG */" ) if $verbose;
Branch: 1 branch
BranchTrueFalseTotal
if $B::C::verbose 0 0 0
8980 0 ▶ warn "save %SIG\n" if $verbose;
Branch: 1 branch
BranchTrueFalseTotal
if $B::C::verbose 0 0 0
8981 0 $init->add( "{", "\tHV* hv = get_hvs(\"main::SIG\", GV_ADD);" );
8982 0 foreach my $x ( @save_sig ) {
8983 0 my ($k, $cvref) = @$x;
8984 0 my $sv = $cvref->save;
8985 0 my ($cstring, $cur, $utf8) = strlen_flags($k);
8986 0 $init->add( '{', sprintf "\t".'SV* sv = (SV*)%s;', $sv );
8987 0 $init->add( sprintf("\thv_store(hv, %s, %u, %s, %d);",
8988 $cstring, $cur, 'sv', 0 ) );
8989 0 $init->add( "\t".'mg_set(sv);', '}' );
8990 }
8991 0 $init->add('}');
8992 0 $init->split;
8993 }
8994  
8995 0 ▶sub force_saving_xsloader {
Subroutine force_saving_xsloader: not called CC=4 SCAR=30.0
Pod undocumented
8996 0 mark_package("XSLoader", 1);
8997 # mark_package("DynaLoader", 1);
8998 0 ▶ if ($] < 5.015003) {
Branch: 2 branches
BranchTrueFalseTotal
if ($] < 5.015003) { } 0 0 0
elsif ($CPERL51) { } 0 0 0
8999 0 $init->add("/* force saving of XSLoader::load */");
9000 0 eval { XSLoader::load; };
9001 # does this really save the whole packages?
9002 0 $dumped_package{XSLoader} = 1;
9003 0 svref_2object( \&XSLoader::load )->save;
9004 } elsif ($CPERL51) {
9005 0 $init->add("/* XSLoader::load_file already builtin into cperl */");
9006 0 $dumped_package{XSLoader} = 1;
9007 0 $dumped_package{DynaLoader} = 1;
9008 0 add_hashINC("XSLoader"); # builtin
9009 } else {
9010 0 $init->add("/* custom XSLoader::load_file */");
9011 # does this really save the whole packages?
9012 0 $dumped_package{DynaLoader} = 1;
9013 0 svref_2object( \&XSLoader::load_file )->save;
9014 0 svref_2object( \&DynaLoader::dl_load_flags )->save; # not saved as XSUB constant?
9015 }
9016 0 ▶ add_hashINC("XSLoader") if $] < 5.015003;
Branch: 1 branch
BranchTrueFalseTotal
if $] < "5.015003" 0 0 0
9017 0 add_hashINC("DynaLoader");
9018 0 $use_xsloader = 0; # do not load again
9019 }
9020  
9021 0 ▶sub save_main_rest {
Subroutine save_main_rest: not called CC=25 SCAR=64.8
Pod undocumented
9022 # this is mainly for the test suite
9023 # local $SIG{__WARN__} = sub { print STDERR @_ } unless $debug{runtime};
9024  
9025 warn "done main optree, walking symtable for extras\n"
9026 0 ▶ if $verbose or $debug{cv};
Branch: 1 branch
BranchTrueFalseTotal
if $B::C::verbose or $B::C::debug{"cv"} 0 0 0
Condition0%0/3
$B::C::verbose or $B::C::debug{"cv"}
l!l&&r!l&&!r
000
MC/DC0%0/2
$B::C::verbose or $B::C::debug{"cv"}
$B::C::verbose $B::C::debug{"cv"}
Truth table0%0/3
A or B
A= $B::C::verboseB= $B::C::debug{"cv"}
ABresult
1X1
011
000
9027 0 $init->add("");
9028 0 $init->add("/* done main optree, extra subs which might be unused */");
9029 0 save_unused_subs();
9030 0 $init->add("/* done extras */");
9031  
9032 # startpoints: XXX TODO push BEGIN/END blocks to modules code.
9033 0 ▶ warn "Writing init_av\n" if $debug{av};
Branch: 1 branch
BranchTrueFalseTotal
if $B::C::debug{"av"} 0 0 0
9034 0 my $init_av = init_av->save('INIT');
9035 0 my $end_av;
9036 {
9037 # >=5.10 need to defer nullifying of all vars in END, not only new ones.
9038 0 local ($B::C::pv_copy_on_grow, $B::C::const_strings);
9039 0 $in_endav = 1;
9040 0 ▶ warn "Writing end_av\n" if $debug{av};
Branch: 1 branch
BranchTrueFalseTotal
if $B::C::debug{"av"} 0 0 0
9041 0 $init->add("/* END block */");
9042 0 $end_av = end_av->save('END');
9043 0 $in_endav = 0;
9044 }
9045 0 ▶ if ( !defined($module) ) {
Branch: 1 branch
BranchTrueFalseTotal
unless (defined $B::C::module) 0 0 0
9046 $init->add(
9047 "/* startpoints */",
9048 0 sprintf( "PL_main_root = s\\_%x;", ${ main_root() } ),
9049 0 sprintf( "PL_main_start = s\\_%x;", ${ main_start() } ),
9050 );
9051 0 ▶ $init->add(index($init_av,'(AV*)')>=0
Branch: 1 branch
BranchTrueFalseTotal
index($init_av, '(AV*)') != -1 ? : 0 0 0
9052 ? "PL_initav = $init_av;"
9053 : "PL_initav = (AV*)$init_av;");
9054 0 ▶ $init->add(index($end_av,'(AV*)')>=0
Branch: 1 branch
BranchTrueFalseTotal
index($end_av, '(AV*)') != -1 ? : 0 0 0
9055 ? "PL_endav = $end_av;"
9056 : "PL_endav = (AV*)$end_av;");
9057  
9058 0 save_context();
9059 # warn "use_xsloader=$use_xsloader\n" if $verbose;
9060 # If XSLoader was forced later, e.g. in curpad, INIT or END block
9061 0 ▶ force_saving_xsloader() if $use_xsloader;
Branch: 1 branch
BranchTrueFalseTotal
if $use_xsloader 0 0 0
9062 }
9063 0 $init->add('/* B::C specific: prepend static svs to arena for sv_clean_objs */',
9064 'if (&sv_list != (void *)PL_sv_arenaroot)',
9065 ' SvANY(&sv_list[0]) = (void *)PL_sv_arenaroot;',
9066 'PL_sv_arenaroot = &sv_list[0];');
9067  
9068 0 ▶ return if $check;
Branch: 1 branch
BranchTrueFalseTotal
if $B::C::check 0 0 0
9069 0 ▶ warn "Writing output\n" if $verbose;
Branch: 1 branch
BranchTrueFalseTotal
if $B::C::verbose 0 0 0
9070 0 ▶ my $cmodule = defined $module ? $module : "main";
Branch: 1 branch
BranchTrueFalseTotal
defined $B::C::module ? : 0 0 0
9071 0 $cmodule =~ s/::/__/g;
9072 0 output_boilerplate($cmodule);
9073  
9074 # add static modules like " Win32CORE"
9075 0 foreach my $stashname ( split /\s+/, $Config{static_ext} ) {
9076 0 ▶ next if $stashname =~ /^\s*$/; # often a leading space
Branch: 1 branch
BranchTrueFalseTotal
if $stashname =~ /^\s*$/ 0 0 0
9077 0 $static_ext{$stashname}++;
9078 0 my $stashxsub = $stashname;
9079 0 $stashxsub =~ s/::/__/g;
9080 0 ▶ print "EXTERN_C void boot_$stashxsub (pTHX_ CV* cv);\n" unless defined $module;
Branch: 1 branch
BranchTrueFalseTotal
unless defined $B::C::module 0 0 0
9081 }
9082 0 print "\n";
9083 0 ▶ output_all($init_name || "perl_init");
Condition0%0/2
$B::C::init_name || 'perl_init'
l!l
00
MC/DC0%0/1
$B::C::init_name || 'perl_init'
$B::C::init_name
Truth table0%0/2
A
A= $B::C::init_name
Aresult
11
00
9084 0 print "\n";
9085  
9086 0 ▶ if ( defined($module) ) {
Branch: 1 branch
BranchTrueFalseTotal
if (defined $B::C::module) { } 0 0 0
9087 0 save_destruct($cmodule);
9088  
9089 0 my $start = "&op_list[0]";
9090 0 ▶ warn "curpad syms:\n" if $verbose;
Branch: 1 branch
BranchTrueFalseTotal
if $B::C::verbose 0 0 0
9091 0 $init->add("/* curpad syms */");
9092 0 my $curpad_sym = ( comppadlist->ARRAY )[1]->save;
9093  
9094 0 print <<"EOT";
9095  
9096 XS(boot_$cmodule)
9097 {
9098 int exitstatus;
9099 dXSARGS;
9100 dVAR;
9101 EOT
9102 0 ▶ print <<'EOT' if $PERL510 and ($ITHREADS or $MULTI);
Branch: 1 branch
BranchTrueFalseTotal
if $PERL510 and $ITHREADS || $MULTI 0 0 0
Condition0%0/6
$PERL510 and $ITHREADS || $MULTI
!ll&&!rl&&r
000
$ITHREADS or $MULTI
l!l&&r!l&&!r
000
MC/DC0%0/3
$PERL510 and $ITHREADS || $MULTI
$PERL510 $ITHREADS $MULTI
Truth table0%0/4
A and B or C
A= $PERL510B= $ITHREADSC= $MULTI
ABCresult
0XX0
1000
11X1
1011
9103 {
9104 MY_CXT_INIT;
9105 dMY_CXT;
9106 EOT
9107 0 print <<'EOT';
9108  
9109 ENTER;
9110 SAVETMPS;
9111 SAVEVPTR(PL_curpad);
9112 SAVEVPTR(PL_op);
9113  
9114 EOT
9115  
9116 0 output_init();
9117  
9118 0 print <<"EOT";
9119  
9120 PL_curpad = AvARRAY($curpad_sym);
9121 PL_comppad = $curpad_sym;
9122 PL_op = $start;
9123 EOT
9124  
9125 0 ▶ print $DEBUGGING
Branch: 1 branch
BranchTrueFalseTotal
$DEBUGGING ? : 0 0 0
9126 ? " Perl_runops_debug(aTHX);\n"
9127 : " Perl_runops_standard(aTHX);\n";
9128 0 output_local_destruct($cmodule);
9129  
9130 0 print <<'EOT';
9131  
9132 FREETMPS;
9133 LEAVE;
9134 ST(0) = &PL_sv_yes;
9135 XSRETURN(1);
9136 EOT
9137 0 ▶ print <<"EOT" if $PERL510 and ($ITHREADS or $MULTI);
Branch: 1 branch
BranchTrueFalseTotal
if $PERL510 and $ITHREADS || $MULTI 0 0 0
Condition0%0/6
$PERL510 and $ITHREADS || $MULTI
!ll&&!rl&&r
000
$ITHREADS or $MULTI
l!l&&r!l&&!r
000
MC/DC0%0/3
$PERL510 and $ITHREADS || $MULTI
$PERL510 $ITHREADS $MULTI
Truth table0%0/4
A and B or C
A= $PERL510B= $ITHREADSC= $MULTI
ABCresult
0XX0
1000
11X1
1011
9138 }
9139 EOT
9140 0 print <<'EOT';
9141 }
9142 EOT
9143  
9144 } else {
9145 0 output_main_rest();
9146 0 output_main();
9147 }
9148 }
9149  
9150 0 ▶sub init_sections {
Subroutine init_sections: not called CC=5 SCAR=34.0
Pod undocumented
9151 0 my @sections = (
9152 decl => \$decl,
9153 init0 => \$init0,
9154 free => \$free,
9155 sym => \$symsect,
9156 hek => \$heksect,
9157 binop => \$binopsect,
9158 condop => \$condopsect,
9159 cop => \$copsect,
9160 padop => \$padopsect,
9161 listop => \$listopsect,
9162 logop => \$logopsect,
9163 loop => \$loopsect,
9164 op => \$opsect,
9165 pmop => \$pmopsect,
9166 pvop => \$pvopsect,
9167 svop => \$svopsect,
9168 unop => \$unopsect,
9169 unopaux => \$unopauxsect,
9170 methop => \$methopsect,
9171 sv => \$svsect,
9172 xpv => \$xpvsect,
9173 xpvav => \$xpvavsect,
9174 xpvhv => \$xpvhvsect,
9175 xpvcv => \$xpvcvsect,
9176 xpviv => \$xpvivsect,
9177 xpvuv => \$xpvuvsect,
9178 xpvnv => \$xpvnvsect,
9179 xpvmg => \$xpvmgsect,
9180 xpvlv => \$xpvlvsect,
9181 xrv => \$xrvsect,
9182 xpvbm => \$xpvbmsect,
9183 xpvio => \$xpviosect,
9184 padlist => \$padlistsect,
9185 padnamelist => \$padnlsect,
9186 padname => \$padnamesect,
9187 );
9188 0 ▶ if ($PERL522) {
Branch: 1 branch
BranchTrueFalseTotal
if ($PERL522) 0 0 0
9189 0 pop @sections;
9190 }
9191 0 my ( $name, $sectref );
9192 0 ▶ while ( ( $name, $sectref ) = splice( @sections, 0, 2 ) ) {
Branch: 1 branch
BranchTrueFalseTotal
if (() = splice(@sections, 0, 2)) 0 0 0
9193 0 $$sectref = new B::C::Section $name, \%symtable, 0;
9194 }
9195 0 ▶ if ($PERL522) {
Branch: 1 branch
BranchTrueFalseTotal
if ($PERL522) 0 0 0
9196 0 for my $size (@padnamesect_sizes) {
9197 0 my $name = "padname_$size";
9198 0 $padnamesect{$size} = new B::C::Section $name, \%symtable, 0;
9199 }
9200 }
9201 0 $init = new B::C::InitSection 'init', \%symtable, 0;
9202 0 $init1 = new B::C::InitSection 'init1', \%symtable, 0;
9203 0 $init2 = new B::C::InitSection 'init2', \%symtable, 0;
9204 0 %savINC = %curINC = %INC;
9205 }
9206  
9207 0 ▶sub mark_unused {
Subroutine mark_unused: not called CC=1 SCAR=6.9
Pod undocumented
9208 0 my ( $pkg, $val ) = @_;
9209 0 $include_package{$pkg} = $val;
9210 }
9211  
9212 0 ▶sub mark_skip {
Subroutine mark_skip: not called CC=3 SCAR=24.8
Pod undocumented
9213 0 for (@_) {
9214 0 delete_unsaved_hashINC($_);
9215 # $include_package{$_} = 0;
9216 0 ▶ $skip_package{$_} = 1 unless $include_package{$_};
Branch: 1 branch
BranchTrueFalseTotal
unless $include_package{$_} 0 0 0
9217 }
9218 }
9219  
9220 0 ▶sub compile {
Subroutine compile: not called CC=66 SCAR=83.9
Pod undocumented
9221 0 my @options = @_;
9222 # Allow debugging in CHECK blocks without Od
9223 0 ▶ $DB::single = 1 if defined &DB::DB;
Branch: 1 branch
BranchTrueFalseTotal
if defined &DB::DB 0 0 0
9224 0 my ( $option, $opt, $arg );
9225 0 my @eval_at_startup;
9226 0 $B::C::can_delete_pkg = 1;
9227 0 $B::C::save_sig = 1;
9228 0 $B::C::destruct = 1;
9229 0 $B::C::stash = 0;
9230 0 $B::C::cow = 0;
9231 0 ▶ $B::C::fold = 1 if $] >= 5.013009; # always include utf8::Cased tables
Branch: 1 branch
BranchTrueFalseTotal
if $] >= "5.013009" 0 0 0
9232 0 ▶ $B::C::warnings = 1 if $] >= 5.013005; # always include Carp warnings categories and B
Branch: 1 branch
BranchTrueFalseTotal
if $] >= "5.013005" 0 0 0
9233 0 ▶ $B::C::optimize_warn_sv = 1 if $^O ne 'MSWin32' or $Config{cc} !~ m/^cl/i;
Branch: 1 branch
BranchTrueFalseTotal
if $^O ne "MSWin32" or not $B::C::Config{"cc"} =~ /^cl/i 0 0 0
Condition0%0/3
$^O ne "MSWin32" or not $B::C::Config{"cc"} =~ /^cl/i
l!l&&r!l&&!r
000
MC/DC0%0/2
$^O ne "MSWin32" or not $B::C::Config{"cc"} =~ /^cl/i
$^O ne "MSWin32" not $B::C::Config{"cc"} =~ /^cl/i
Truth table0%0/3
A or not(B)
A= $^O ne "MSWin32"B= not $B::C::Config{"cc"} =~ /^cl/i
ABresult
1X1
011
000
9234 0 ▶ $B::C::dyn_padlist = 1 if $] >= 5.017; # default is dynamic and safe, disable with -O4
Branch: 1 branch
BranchTrueFalseTotal
if $] >= "5.017" 0 0 0
9235 0 $B::C::walkall = 1;
9236  
9237 0 mark_skip qw(B::C B::C::Config B::CC B::Asmdata B::FAKEOP O
9238 B::Pseudoreg B::Shadow B::C::InitSection);
9239 #mark_skip('DB', 'Term::ReadLine') if defined &DB::DB;
9240  
9241 OPTION:
9242 0 ▶ while ( $option = shift @options ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($option = shift @options) 0 0 0
9243 0 ▶ if ( $option =~ /^-(cross)=(.*)/ ) {
Branch: 2 branches
BranchTrueFalseTotal
if ($option =~ /^-(cross)=(.*)/) { } 0 0 0
elsif ($option =~ /^-(.)(.*)/) { } 0 0 0
9244 0 $opt = $1;
9245 0 $arg = $2;
9246 }
9247 elsif ( $option =~ /^-(.)(.*)/ ) {
9248 0 $opt = $1;
9249 0 $arg = $2;
9250 }
9251 else {
9252 0 unshift @options, $option;
9253 0 last OPTION;
9254 }
9255 0 ▶ if ( $opt eq "-" && $arg eq "-" ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($opt eq "-" and $arg eq "-") 0 0 0
Condition0%0/3
$opt eq "-" and $arg eq "-"
!ll&&!rl&&r
000
MC/DC0%0/2
$opt eq "-" and $arg eq "-"
$opt eq "-" $arg eq "-"
Truth table0%0/3
A and B
A= $opt eq "-"B= $arg eq "-"
ABresult
0X0
100
111
9256 0 shift @options;
9257 0 last OPTION;
9258 }
9259 0 ▶ if ( $opt eq "w" ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($opt eq "w") 0 0 0
9260 0 $warn_undefined_syms = 1;
9261 }
9262 0 ▶ if ( $opt eq "c" ) {
Branch: 14 branches
BranchTrueFalseTotal
if ($opt eq 'c') { } 0 0 0
elsif ($opt eq 'D') { } 0 0 0
elsif ($opt eq 'o') { } 0 0 0
elsif ($opt eq 's' and $arg eq 'taticxs') { } 0 0 0
elsif ($opt eq 'n') { } 0 0 0
elsif ($opt eq 'm') { } 0 0 0
elsif ($opt eq 'v') { } 0 0 0
elsif ($opt eq 'u') { } 0 0 0
elsif ($opt eq 'U') { } 0 0 0
elsif ($opt eq 'f') { } 0 0 0
elsif ($opt eq 'O') { } 0 0 0
elsif ($opt eq 'e') { } 0 0 0
elsif ($opt eq 'l') { } 0 0 0
elsif ($opt eq 'cross') { } 0 0 0
9263 0 $check = 1;
9264 }
9265 elsif ( $opt eq "D" ) {
9266 0 ▶ $arg ||= shift @options;
Condition0%0/3
$arg ||= shift @options
l!l&&r!l&&!r
000
MC/DC0%0/2
$arg ||= shift @options
$arg shift @options
Truth table0%0/3
A ||= B
A= $argB= shift @options
ABresult
1X1
011
000
9267 0 ▶ if ($arg eq 'full') {
Branch: 2 branches
BranchTrueFalseTotal
if ($arg eq 'full') { } 0 0 0
elsif ($arg eq 'ufull') { } 0 0 0
9268 0 $arg = 'OcAHCMGSPpsWF';
9269 0 $all_bc_deps{'B::Flags'}++;
9270 }
9271 elsif ($arg eq 'ufull') {
9272 0 $arg = 'uOcAHCMGSPpsWF';
9273 0 $all_bc_deps{'B::Flags'}++;
9274 }
9275 0 foreach my $arg ( split( //, $arg ) ) {
9276 0 ▶ if (exists $debug_map{$arg}) {
Branch: 4 branches
BranchTrueFalseTotal
if (exists $B::C::debug_map{$arg}) { } 0 0 0
elsif ($arg eq 'o') { } 0 0 0
elsif ($arg eq 'F') { } 0 0 0
elsif ($arg eq 'r') { } 0 0 0
9277 0 $debug{ $debug_map{$arg} }++;
9278 }
9279 elsif ( $arg eq "o" ) {
9280 0 $verbose++;
9281 0 B->debug(1);
9282 }
9283 elsif ( $arg eq "F" ) {
9284 0 ▶ $debug{flags}++ if $] > 5.008 and eval "require B::Flags;";
Branch: 1 branch
BranchTrueFalseTotal
if $] > "5.008" and eval "require B::Flags;" 0 0 0
Condition0%0/3
$] > "5.008" and eval "require B::Flags;"
!ll&&!rl&&r
000
MC/DC0%0/2
$] > "5.008" and eval "require B::Flags;"
$] > "5.008" eval "require B::Flags;"
Truth table0%0/3
A and B
A= $] > "5.008"B= eval "require B::Flags;"
ABresult
0X0
100
111
9285 0 $all_bc_deps{'B::Flags'}++;
9286 # $debug{flags}++ if require B::Flags;
9287 }
9288 elsif ( $arg eq "r" ) {
9289 0 $debug{runtime}++;
9290 0 ▶ $SIG{__WARN__} = sub {
Subroutine __ANON__: not called CC=2 SCAR=17.9
9291 0 warn @_;
9292 0 my $s = join(" ", @_);
9293 0 chomp $s;
9294 0 ▶ $init->add("/* ".$s." */") if $init;
Branch: 1 branch
BranchTrueFalseTotal
if $init 0 0 0
9295 0 };
9296 }
9297 else {
9298 0 warn "ignoring unknown debug option: $arg\n";
9299 }
9300 }
9301 }
9302 elsif ( $opt eq "o" ) {
9303 0 ▶ $arg ||= shift @options;
Condition0%0/3
$arg ||= shift @options
l!l&&r!l&&!r
000
MC/DC0%0/2
$arg ||= shift @options
$arg shift @options
Truth table0%0/3
A ||= B
A= $argB= shift @options
ABresult
1X1
011
000
9304 0 $outfile = $arg;
9305 0 ▶ if ($check) {
Branch: 1 branch
BranchTrueFalseTotal
if ($B::C::check) { } 0 0 0
9306 0 warn "Warning: -o argument ignored with -c\n";
9307 } else {
9308 0 ▶ open( STDOUT, ">", $arg ) or return "$arg: $!\n";
Branch: 1 branch
BranchTrueFalseTotal
open STDOUT, ">", $arg or return "${arg}: $!\n" 0 0 0
9309 }
9310 }
9311 ▶ elsif ( $opt eq "s" and $arg eq "taticxs" ) {
Condition0%0/3
$opt eq "s" and $arg eq "taticxs"
!ll&&!rl&&r
000
MC/DC0%0/2
$opt eq "s" and $arg eq "taticxs"
$opt eq "s" $arg eq "taticxs"
Truth table0%0/3
A and B
A= $opt eq "s"B= $arg eq "taticxs"
ABresult
0X0
100
111
9312 0 ▶ $outfile = "perlcc" unless $outfile;
Branch: 1 branch
BranchTrueFalseTotal
unless $outfile 0 0 0
9313 0 $staticxs = 1;
9314 }
9315 elsif ( $opt eq "n" ) {
9316 0 ▶ $arg ||= shift @options;
Condition0%0/3
$arg ||= shift @options
l!l&&r!l&&!r
000
MC/DC0%0/2
$arg ||= shift @options
$arg shift @options
Truth table0%0/3
A ||= B
A= $argB= shift @options
ABresult
1X1
011
000
9317 0 $init_name = $arg;
9318 }
9319 elsif ( $opt eq "m" ) {
9320 # $arg ||= shift @options;
9321 0 $module = $arg;
9322 0 mark_unused( $arg, 1 );
9323 }
9324 elsif ( $opt eq "v" ) {
9325 0 $verbose = 1;
9326 }
9327 elsif ( $opt eq "u" ) {
9328 0 ▶ $arg ||= shift @options;
Condition0%0/3
$arg ||= shift @options
l!l&&r!l&&!r
000
MC/DC0%0/2
$arg ||= shift @options
$arg shift @options
Truth table0%0/3
A ||= B
A= $argB= shift @options
ABresult
1X1
011
000
9329 0 ▶ if ($arg =~ /\.p[lm]$/) {
Branch: 1 branch
BranchTrueFalseTotal
if ($arg =~ /\.p[lm]$/) { } 0 0 0
9330 0 eval "require(\"$arg\");"; # path as string
9331 } else {
9332 0 eval "require $arg;"; # package as bareword with ::
9333 }
9334 0 mark_unused( $arg, 1 );
9335 }
9336 elsif ( $opt eq "U" ) {
9337 0 ▶ $arg ||= shift @options;
Condition0%0/3
$arg ||= shift @options
l!l&&r!l&&!r
000
MC/DC0%0/2
$arg ||= shift @options
$arg shift @options
Truth table0%0/3
A ||= B
A= $argB= shift @options
ABresult
1X1
011
000
9338 0 mark_skip( $arg );
9339 }
9340 elsif ( $opt eq "f" ) {
9341 0 ▶ $arg ||= shift @options;
Condition0%0/3
$arg ||= shift @options
l!l&&r!l&&!r
000
MC/DC0%0/2
$arg ||= shift @options
$arg shift @options
Truth table0%0/3
A ||= B
A= $argB= shift @options
ABresult
1X1
011
000
9342 0 $arg =~ m/(no-)?(.*)/;
9343 0 ▶ my $no = defined($1) && $1 eq 'no-';
Condition0%0/3
defined $1 && $1 eq 'no-'
!ll&&!rl&&r
000
MC/DC0%0/2
defined $1 && $1 eq 'no-'
defined $1 $1 eq 'no-'
Truth table0%0/3
A && B
A= defined $1B= $1 eq 'no-'
ABresult
0X0
100
111
9344 0 ▶ $arg = $no ? $2 : $arg;
Branch: 1 branch
BranchTrueFalseTotal
$no ? : 0 0 0
9345 0 ▶ if ( exists $option_map{$arg} ) {
Branch: 1 branch
BranchTrueFalseTotal
if (exists $B::C::option_map{$arg}) { } 0 0 0
9346 0 ${ $option_map{$arg} } = !$no;
9347 }
9348 else {
9349 0 die "Invalid optimization '$arg'";
9350 }
9351 }
9352 elsif ( $opt eq "O" ) {
9353 0 ▶ $arg = 1 if $arg eq "";
Branch: 1 branch
BranchTrueFalseTotal
if $arg eq "" 0 0 0
9354 0 my @opt;
9355 0 foreach my $i ( 1 .. $arg ) {
9356 0 push @opt, @{ $optimization_map{$i} }
9357 0 ▶ if exists $optimization_map{$i};
Branch: 1 branch
BranchTrueFalseTotal
if exists $B::C::optimization_map{$i} 0 0 0
9358 }
9359 0 unshift @options, @opt;
9360 0 ▶ warn "options : ".(join " ",@opt)."\n" if $verbose;
Branch: 1 branch
BranchTrueFalseTotal
if $B::C::verbose 0 0 0
9361 }
9362 elsif ( $opt eq "e" ) {
9363 0 push @eval_at_startup, $arg;
9364 }
9365 elsif ( $opt eq "l" ) {
9366 0 $max_string_len = $arg;
9367 }
9368 elsif ( $opt eq "cross" ) {
9369 0 $cross = $arg;
9370 0 cross_config($cross); # overrides %B::C::Config::Config
9371 }
9372 }
9373 0 ▶ if (!$B::C::Config::have_independent_comalloc) {
Branch: 2 branches
BranchTrueFalseTotal
if (not $B::C::Config::have_independent_comalloc) { } 0 0 0
elsif ($B::C::av_init2 and $B::C::av_init) { } 0 0 0
9374 0 ▶ if ($B::C::av_init2) {
Branch: 2 branches
BranchTrueFalseTotal
if ($B::C::av_init2) { } 0 0 0
elsif ($B::C::av_init) { } 0 0 0
9375 0 $B::C::av_init = 1;
9376 0 $B::C::av_init2 = 0;
9377 } elsif ($B::C::av_init) {
9378 0 $B::C::av_init2 = 0;
9379 }
9380 ▶ } elsif ($B::C::av_init2 and $B::C::av_init) {
Condition0%0/3
$B::C::av_init2 and $B::C::av_init
!ll&&!rl&&r
000
MC/DC0%0/2
$B::C::av_init2 and $B::C::av_init
$B::C::av_init2 $B::C::av_init
Truth table0%0/3
A and B
A= $B::C::av_init2B= $B::C::av_init
ABresult
0X0
100
111
9381 0 $B::C::av_init = 0;
9382 }
9383 0 ▶ $B::C::save_data_fh = 1 if $] >= 5.008 and (($] < 5.009004) or $MULTI);
Branch: 1 branch
BranchTrueFalseTotal
if $] >= "5.008" and $] < "5.009004" || $MULTI 0 0 0
Condition0%0/6
$] >= "5.008" and $] < "5.009004" || $MULTI
!ll&&!rl&&r
000
$] < "5.009004" or $MULTI
l!l&&r!l&&!r
000
MC/DC0%0/3
$] >= "5.008" and $] < "5.009004" || $MULTI
$] >= "5.008" $] < "5.009004" $MULTI
Truth table0%0/4
A and B or C
A= $] >= "5.008"B= $] < "5.009004"C= $MULTI
ABCresult
0XX0
1000
11X1
1011
9384 0 ▶ $B::C::destruct = 1 if $] < 5.008 or $^O eq 'MSWin32'; # skip -ffast-destruct there
Branch: 1 branch
BranchTrueFalseTotal
if $] < "5.008" or $^O eq "MSWin32" 0 0 0
Condition0%0/3
$] < "5.008" or $^O eq "MSWin32"
l!l&&r!l&&!r
000
MC/DC0%0/2
$] < "5.008" or $^O eq "MSWin32"
$] < "5.008" $^O eq "MSWin32"
Truth table0%0/3
A or B
A= $] < "5.008"B= $^O eq "MSWin32"
ABresult
1X1
011
000
9385  
9386 0 init_sections();
9387 0 foreach my $i (@eval_at_startup) {
9388 0 $init2->add_eval($i);
9389 }
9390 0 ▶ if (@options) { # modules or main?
Branch: 1 branch
BranchTrueFalseTotal
if (@options) { } 0 0 0
9391 0 ▶ return sub {
Subroutine __ANON__: not called CC=3 SCAR=24.8
9392 0 my $objname;
9393 0 foreach $objname (@options) {
9394 0 eval "save_object(\\$objname)";
9395 }
9396 0 ▶ output_all($init_name || "init_module");
Condition0%0/2
$B::C::init_name || 'init_module'
l!l
00
MC/DC0%0/1
$B::C::init_name || 'init_module'
$B::C::init_name
Truth table0%0/2
A
A= $B::C::init_name
Aresult
11
00
9397 }
9398 0 }
9399 else {
9400 0 ▶ return sub { save_main() };
Subroutine __ANON__: not called CC=1 SCAR=6.9
9401 }
9402 }
9403  
9404 41 1;
9405  
9406 __END__
↑ Summary blib/script/cc_harness »