← Index
NYTProf Performance Profile   « line view »
For Makefile.PL
  Run on Sun Mar 1 16:04:44 2015
Reported on Sun Mar 1 16:09:02 2015

FilenameC:/tmp64ng/perl/lib/DynaLoader.pm
StatementsExecuted 141 statements in 0s
Subroutines
Calls P F Exclusive
Time
Inclusive
Time
Subroutine
1110s0sDynaLoader::::BEGIN@18DynaLoader::BEGIN@18
1110s0sDynaLoader::::BEGIN@22DynaLoader::BEGIN@22
10110s0sDynaLoader::::CORE:ftdirDynaLoader::CORE:ftdir (opcode)
4110s0sDynaLoader::::CORE:ftfileDynaLoader::CORE:ftfile (opcode)
3110s0sDynaLoader::::CORE:ftsizeDynaLoader::CORE:ftsize (opcode)
6210s0sDynaLoader::::CORE:substDynaLoader::CORE:subst (opcode)
3330s0sDynaLoader::::bootstrapDynaLoader::bootstrap
0000s0sDynaLoader::::bootstrap_inheritDynaLoader::bootstrap_inherit
0000s0sDynaLoader::::croakDynaLoader::croak
0000s0sDynaLoader::::dl_expandspecDynaLoader::dl_expandspec
3110s0sDynaLoader::::dl_find_symbolDynaLoader::dl_find_symbol (xsub)
0000s0sDynaLoader::::dl_find_symbol_anywhereDynaLoader::dl_find_symbol_anywhere
0000s0sDynaLoader::::dl_findfileDynaLoader::dl_findfile
3110s0sDynaLoader::::dl_install_xsubDynaLoader::dl_install_xsub (xsub)
3110s0sDynaLoader::::dl_load_fileDynaLoader::dl_load_file (xsub)
3110s0sDynaLoader::::dl_load_flagsDynaLoader::dl_load_flags
3110s0sDynaLoader::::dl_undef_symbolsDynaLoader::dl_undef_symbols (xsub)
Call graph for these subroutines as a Graphviz dot language file.
Line State
ments
Time
on line
Calls Time
in subs
Code
1
2# Generated from DynaLoader_pm.PL
3
4package DynaLoader;
5
6# And Gandalf said: 'Many folk like to know beforehand what is to
7# be set on the table; but those who have laboured to prepare the
8# feast like to keep their secret; for wonder makes the words of
9# praise louder.'
10
11# (Quote from Tolkien suggested by Anno Siegel.)
12#
13# See pod text at end of file for documentation.
14# See also ext/DynaLoader/README in source tree for other information.
15#
16# Tim.Bunce@ig.co.uk, August 1994
17
18
# spent 0s within DynaLoader::BEGIN@18 which was called: # once (0s+0s) by Win32::API::BEGIN@20 at line 20
BEGIN {
1910s $VERSION = '1.25';
2010s10s}
# spent 0s making 1 call to DynaLoader::BEGIN@18
21
2220s20s
# spent 0s within DynaLoader::BEGIN@22 which was called: # once (0s+0s) by Win32::API::BEGIN@20 at line 22
use Config;
# spent 0s making 1 call to Config::import # spent 0s making 1 call to DynaLoader::BEGIN@22
23
24# enable debug/trace messages from DynaLoader perl code
2510s$dl_debug = $ENV{PERL_DL_DEBUG} || 0 unless defined $dl_debug;
26
27#
28# Flags to alter dl_load_file behaviour. Assigned bits:
29# 0x01 make symbols available for linking later dl_load_file's.
30# (only known to work on Solaris 2 using dlopen(RTLD_GLOBAL))
31# (ignored under VMS; effect is built-in to image linking)
32# (ignored under Android; the linker always uses RTLD_LOCAL)
33#
34# This is called as a class method $module->dl_load_flags. The
35# definition here will be inherited and result on "default" loading
36# behaviour unless a sub-class of DynaLoader defines its own version.
37#
38
3930s
# spent 0s within DynaLoader::dl_load_flags which was called 3 times, avg 0s/call: # 3 times (0s+0s) by DynaLoader::bootstrap at line 191, avg 0s/call
sub dl_load_flags { 0x00 }
40
4110s30s($dl_dlext, $dl_so, $dlsrc) = @Config::Config{qw(dlext so dlsrc)};
# spent 0s making 3 calls to Config::FETCH, avg 0s/call
42
43
4410s$do_expand = 0;
45
4610s@dl_require_symbols = (); # names of symbols we need
4710s@dl_resolve_using = (); # names of files to link with
4810s@dl_library_path = (); # path to look for files
49
50#XSLoader.pm may have added elements before we were required
51#@dl_shared_objects = (); # shared objects for symbols we have
52#@dl_librefs = (); # things we have loaded
53#@dl_modules = (); # Modules we have loaded
54
55# This is a fix to support DLD's unfortunate desire to relink -lc
5610s@dl_resolve_using = dl_findfile('-lc') if $dlsrc eq "dl_dld.xs";
57
58# Initialise @dl_library_path with the 'standard' library path
59# for this platform as determined by Configure.
60
6110s10spush(@dl_library_path, split(' ', $Config::Config{libpth}));
# spent 0s making 1 call to Config::FETCH
62
63
6410s10smy $ldlibpthname = $Config::Config{ldlibpthname};
# spent 0s making 1 call to Config::FETCH
6510s10smy $ldlibpthname_defined = defined $Config::Config{ldlibpthname};
# spent 0s making 1 call to Config::FETCH
6610s10smy $pthsep = $Config::Config{path_sep};
# spent 0s making 1 call to Config::FETCH
67
68# Add to @dl_library_path any extra directories we can gather from environment
69# during runtime.
70
7110sif ($ldlibpthname_defined &&
72 exists $ENV{$ldlibpthname}) {
73 push(@dl_library_path, split(/$pthsep/, $ENV{$ldlibpthname}));
74}
75
76# E.g. HP-UX supports both its native SHLIB_PATH *and* LD_LIBRARY_PATH.
77
7810sif ($ldlibpthname_defined &&
79 $ldlibpthname ne 'LD_LIBRARY_PATH' &&
80 exists $ENV{LD_LIBRARY_PATH}) {
81 push(@dl_library_path, split(/$pthsep/, $ENV{LD_LIBRARY_PATH}));
82}
83
84
85# No prizes for guessing why we don't say 'bootstrap DynaLoader;' here.
86# NOTE: All dl_*.xs (including dl_none.xs) define a dl_error() XSUB
8710sboot_DynaLoader('DynaLoader') if defined(&boot_DynaLoader) &&
88 !defined(&dl_error);
89
9010sif ($dl_debug) {
91 print STDERR "DynaLoader.pm loaded (@INC, @dl_library_path)\n";
92 print STDERR "DynaLoader not linked into this perl\n"
93 unless defined(&boot_DynaLoader);
94}
95
9610s1; # End of main code
97
98
99sub croak { require Carp; Carp::croak(@_) }
100
101sub bootstrap_inherit {
102 my $module = $_[0];
103 local *isa = *{"$module\::ISA"};
104 local @isa = (@isa, 'DynaLoader');
105 # Cannot goto due to delocalization. Will report errors on a wrong line?
106 bootstrap(@_);
107}
108
109
# spent 0s within DynaLoader::bootstrap which was called 3 times, avg 0s/call: # once (0s+0s) by ExtUtils::MakeMaker::Locale::_init at line 610 of Win32/Console.pm # once (0s+0s) by ExtUtils::MM::_is_win95 at line 578 of Win32.pm # once (0s+0s) by Win32::API::BEGIN@79 at line 81 of Win32/API.pm
sub bootstrap {
110 # use local vars to enable $module.bs script to edit values
11130s local(@args) = @_;
11230s local($module) = $args[0];
11330s local(@dirs, $file);
114
11530s unless ($module) {
116 require Carp;
117 Carp::confess("Usage: DynaLoader::bootstrap(module)");
118 }
119
120 # A common error on platforms which don't support dynamic loading.
121 # Since it's fatal and potentially confusing we give a detailed message.
12230s croak("Can't load module $module, dynamic loading not available in this perl.\n".
123 " (You may need to build a new perl executable which either supports\n".
124 " dynamic loading or has the $module module statically linked into it.)\n")
125 unless defined(&dl_load_file);
126
- -
12930s my @modparts = split(/::/,$module);
13030s my $modfname = $modparts[-1];
131
132 # Some systems have restrictions on files names for DLL's etc.
133 # mod2fname returns appropriate file base name (typically truncated)
134 # It may also edit @modparts if required.
13530s $modfname = &mod2fname(\@modparts) if defined &mod2fname;
136
137
138
13930s my $modpname = join('/',@modparts);
140
14130s print STDERR "DynaLoader::bootstrap for $module ",
142 "(auto/$modpname/$modfname.$dl_dlext)\n"
143 if $dl_debug;
144
14530s foreach (@INC) {
146
147100s my $dir = "$_/auto/$modpname";
148
149100s100s next unless -d $dir; # skip over uninteresting directories
# spent 0s making 10 calls to DynaLoader::CORE:ftdir, avg 0s/call
150
151 # check for common cases to avoid autoload of dl_findfile
15240s my $try = "$dir/$modfname.$dl_dlext";
15340s40s last if $file = ($do_expand) ? dl_expandspec($try) : ((-f $try) && $try);
# spent 0s making 4 calls to DynaLoader::CORE:ftfile, avg 0s/call
154
155 # no luck here, save dir for possible later dl_findfile search
15610s push @dirs, $dir;
157 }
158 # last resort, let dl_findfile have a go in all known locations
15930s $file = dl_findfile(map("-L$_",@dirs,@INC), $modfname) unless $file;
160
16130s croak("Can't locate loadable object for module $module in \@INC (\@INC contains: @INC)")
162 unless $file; # wording similar to error from 'require'
163
164
16530s my $bootname = "boot_$module";
16630s30s $bootname =~ s/\W/_/g;
# spent 0s making 3 calls to DynaLoader::CORE:subst, avg 0s/call
16730s @dl_require_symbols = ($bootname);
168
169 # Execute optional '.bootstrap' perl script for this module.
170 # The .bs file can be used to configure @dl_resolve_using etc to
171 # match the needs of the individual module on this architecture.
17230s my $bs = $file;
17330s30s $bs =~ s/(\.\w+)?(;\d*)?$/\.bs/; # look for .bs 'beside' the library
# spent 0s making 3 calls to DynaLoader::CORE:subst, avg 0s/call
17430s30s if (-s $bs) { # only read file if it's not empty
# spent 0s making 3 calls to DynaLoader::CORE:ftsize, avg 0s/call
175 print STDERR "BS: $bs ($^O, $dlsrc)\n" if $dl_debug;
176 eval { do $bs; };
177 warn "$bs: $@\n" if $@;
178 }
179
18030s my $boot_symbol_ref;
181
182
183
184 # Many dynamic extension loading problems will appear to come from
185 # this section of code: XYZ failed at line 123 of DynaLoader.pm.
186 # Often these errors are actually occurring in the initialisation
187 # C code of the extension XS file. Perl reports the error as being
188 # in this perl code simply because this was the last perl code
189 # it executed.
190
19130s30s my $flags = $module->dl_load_flags;
# spent 0s making 3 calls to DynaLoader::dl_load_flags, avg 0s/call
192
19330s30s my $libref = dl_load_file($file, $flags) or
# spent 0s making 3 calls to DynaLoader::dl_load_file, avg 0s/call
194 croak("Can't load '$file' for module $module: ".dl_error());
195
19630s push(@dl_librefs,$libref); # record loaded object
197
19830s30s my @unresolved = dl_undef_symbols();
# spent 0s making 3 calls to DynaLoader::dl_undef_symbols, avg 0s/call
19930s if (@unresolved) {
200 require Carp;
201 Carp::carp("Undefined symbols present after loading $file: @unresolved\n");
202 }
203
20430s30s $boot_symbol_ref = dl_find_symbol($libref, $bootname) or
# spent 0s making 3 calls to DynaLoader::dl_find_symbol, avg 0s/call
205 croak("Can't find '$bootname' symbol in $file\n");
206
20730s push(@dl_modules, $module); # record loaded module
208
20930s30s boot:
# spent 0s making 3 calls to DynaLoader::dl_install_xsub, avg 0s/call
210 my $xs = dl_install_xsub("${module}::bootstrap", $boot_symbol_ref, $file);
211
212 # See comment block above
213
21430s push(@dl_shared_objects, $file); # record files loaded
215
21630s30s &$xs(@args);
# spent 0s making 1 call to Win32::API::bootstrap # spent 0s making 1 call to Win32::Console::bootstrap # spent 0s making 1 call to Win32::bootstrap
217}
218
219sub dl_findfile {
220 # Read ext/DynaLoader/DynaLoader.doc for detailed information.
221 # This function does not automatically consider the architecture
222 # or the perl library auto directories.
223 my (@args) = @_;
224 my (@dirs, $dir); # which directories to search
225 my (@found); # full paths to real files we have found
226 #my $dl_ext= 'xs.dll'; # $Config::Config{'dlext'} suffix for perl extensions
227 #my $dl_so = 'dll'; # $Config::Config{'so'} suffix for shared libraries
228
229 print STDERR "dl_findfile(@args)\n" if $dl_debug;
230
231 # accumulate directories but process files as they appear
232 arg: foreach(@args) {
233 # Special fast case: full filepath requires no search
234
235
236 if (m:/: && -f $_) {
237 push(@found,$_);
238 last arg unless wantarray;
239 next;
240 }
241
242
243 # Deal with directories first:
244 # Using a -L prefix is the preferred option (faster and more robust)
245 if (m:^-L:) { s/^-L//; push(@dirs, $_); next; }
246
247 # Otherwise we try to try to spot directories by a heuristic
248 # (this is a more complicated issue than it first appears)
249 if (m:/: && -d $_) { push(@dirs, $_); next; }
250
251
252
253 # Only files should get this far...
254 my(@names, $name); # what filenames to look for
255 if (m:-l: ) { # convert -lname to appropriate library name
256 s/-l//;
257 push(@names,"lib$_.$dl_so");
258 push(@names,"lib$_.a");
259 } else { # Umm, a bare name. Try various alternatives:
260 # these should be ordered with the most likely first
261 push(@names,"$_.$dl_dlext") unless m/\.$dl_dlext$/o;
262 push(@names,"$_.$dl_so") unless m/\.$dl_so$/o;
263
264 push(@names,"lib$_.$dl_so") unless m:/:;
265 push(@names,"$_.a") if !m/\.a$/ and $dlsrc eq "dl_dld.xs";
266 push(@names, $_);
267 }
268 my $dirsep = '/';
269
270 foreach $dir (@dirs, @dl_library_path) {
271 next unless -d $dir;
272
273 foreach $name (@names) {
274 my($file) = "$dir$dirsep$name";
275 print STDERR " checking in $dir for $name\n" if $dl_debug;
276 $file = ($do_expand) ? dl_expandspec($file) : (-f $file && $file);
277 #$file = _check_file($file);
278 if ($file) {
279 push(@found, $file);
280 next arg; # no need to look any further
281 }
282 }
283 }
284 }
285 if ($dl_debug) {
286 foreach(@dirs) {
287 print STDERR " dl_findfile ignored non-existent directory: $_\n" unless -d $_;
288 }
289 print STDERR "dl_findfile found: @found\n";
290 }
291 return $found[0] unless wantarray;
292 @found;
293}
294
- -
297sub dl_expandspec {
298 my($spec) = @_;
299 # Optional function invoked if DynaLoader.pm sets $do_expand.
300 # Most systems do not require or use this function.
301 # Some systems may implement it in the dl_*.xs file in which case
302 # this Perl version should be excluded at build time.
303
304 # This function is designed to deal with systems which treat some
305 # 'filenames' in a special way. For example VMS 'Logical Names'
306 # (something like unix environment variables - but different).
307 # This function should recognise such names and expand them into
308 # full file paths.
309 # Must return undef if $spec is invalid or file does not exist.
310
311 my $file = $spec; # default output to input
312
313 return undef unless -f $file;
314 print STDERR "dl_expandspec($spec) => $file\n" if $dl_debug;
315 $file;
316}
317
318sub dl_find_symbol_anywhere
319{
320 my $sym = shift;
321 my $libref;
322 foreach $libref (@dl_librefs) {
323 my $symref = dl_find_symbol($libref,$sym);
324 return $symref if $symref;
325 }
326 return undef;
327}
328
329__END__
 
# spent 0s within DynaLoader::CORE:ftdir which was called 10 times, avg 0s/call: # 10 times (0s+0s) by DynaLoader::bootstrap at line 149, avg 0s/call
sub DynaLoader::CORE:ftdir; # opcode
# spent 0s within DynaLoader::CORE:ftfile which was called 4 times, avg 0s/call: # 4 times (0s+0s) by DynaLoader::bootstrap at line 153, avg 0s/call
sub DynaLoader::CORE:ftfile; # opcode
# spent 0s within DynaLoader::CORE:ftsize which was called 3 times, avg 0s/call: # 3 times (0s+0s) by DynaLoader::bootstrap at line 174, avg 0s/call
sub DynaLoader::CORE:ftsize; # opcode
# spent 0s within DynaLoader::CORE:subst which was called 6 times, avg 0s/call: # 3 times (0s+0s) by DynaLoader::bootstrap at line 166, avg 0s/call # 3 times (0s+0s) by DynaLoader::bootstrap at line 173, avg 0s/call
sub DynaLoader::CORE:subst; # opcode
# spent 0s within DynaLoader::dl_find_symbol which was called 3 times, avg 0s/call: # 3 times (0s+0s) by DynaLoader::bootstrap at line 204, avg 0s/call
sub DynaLoader::dl_find_symbol; # xsub
# spent 0s within DynaLoader::dl_install_xsub which was called 3 times, avg 0s/call: # 3 times (0s+0s) by DynaLoader::bootstrap at line 209, avg 0s/call
sub DynaLoader::dl_install_xsub; # xsub
# spent 0s within DynaLoader::dl_load_file which was called 3 times, avg 0s/call: # 3 times (0s+0s) by DynaLoader::bootstrap at line 193, avg 0s/call
sub DynaLoader::dl_load_file; # xsub
# spent 0s within DynaLoader::dl_undef_symbols which was called 3 times, avg 0s/call: # 3 times (0s+0s) by DynaLoader::bootstrap at line 198, avg 0s/call
sub DynaLoader::dl_undef_symbols; # xsub