← Index
NYTProf Performance Profile   « line view »
For index.cgi
  Run on Sat May 9 17:18:47 2020
Reported on Sat May 9 17:19:07 2020

Filename/usr/share/perl/5.18/XSLoader.pm
StatementsExecuted 0 statements in 0s
Subroutines
Calls P F Exclusive
Time
Inclusive
Time
Subroutine
9992.33ms2.33msXSLoader::::loadXSLoader::load
0000s0sXSLoader::::bootstrap_inheritXSLoader::bootstrap_inherit
Call graph for these subroutines as a Graphviz dot language file.
Line State
ments
Time
on line
Calls Time
in subs
Code
1# Generated from XSLoader.pm.PL (resolved %Config::Config value)
2
3package XSLoader;
4
5$VERSION = "0.16";
6
7#use strict;
8
9package DynaLoader;
10
11# No prizes for guessing why we don't say 'bootstrap DynaLoader;' here.
12# NOTE: All dl_*.xs (including dl_none.xs) define a dl_error() XSUB
13boot_DynaLoader('DynaLoader') if defined(&boot_DynaLoader) &&
14 !defined(&dl_error);
15package XSLoader;
16
17
# spent 2.33ms within XSLoader::load which was called 9 times, avg 259µs/call: # once (689µs+0s) by B::BEGIN@17 at line 27 of B.pm # once (268µs+0s) by Module::Runtime::require_module at line 11 of Class/XSAccessor.pm # once (236µs+0s) by Moo::_Utils::BEGIN@10 at line 23 of List/Util.pm # once (213µs+0s) by Variable::Magic::BEGIN@213 at line 215 of Variable/Magic.pm # once (207µs+0s) by Sub::Identify::BEGIN@6 at line 27 of Sub/Identify.pm # once (203µs+0s) by Module::Runtime::require_module at line 21 of Package/Stash/XS.pm # once (199µs+0s) by Data::GUID::BEGIN@7 at line 24 of Digest/MD5.pm # once (159µs+0s) by Moo::_Utils::BEGIN@28 at line 41 of mro.pm # once (156µs+0s) by Try::Tiny::BEGIN@1 at line 64 of Sub/Name.pm
sub load {
18 package DynaLoader;
19
20 my ($module, $modlibname) = caller();
21
22 if (@_) {
23 $module = $_[0];
24 } else {
25 $_[0] = $module;
26 }
27
28 # work with static linking too
29 my $boots = "$module\::bootstrap";
30 goto &$boots if defined &$boots;
31
32 goto \&XSLoader::bootstrap_inherit unless $module and defined &dl_load_file;
33
34 my @modparts = split(/::/,$module);
35 my $modfname = $modparts[-1];
36
37 my $modpname = join('/',@modparts);
38 my $c = @modparts;
39 $modlibname =~ s,[\\/][^\\/]+$,, while $c--; # Q&D basename
40 # Does this look like a relative path?
41 if ($modlibname !~ m|^[\\/]|) {
42 # Someone may have a #line directive that changes the file name, or
43 # may be calling XSLoader::load from inside a string eval. We cer-
44 # tainly do not want to go loading some code that is not in @INC,
45 # as it could be untrusted.
46 #
47 # We could just fall back to DynaLoader here, but then the rest of
48 # this function would go untested in the perl core, since all @INC
49 # paths are relative during testing. That would be a time bomb
50 # waiting to happen, since bugs could be introduced into the code.
51 #
52 # So look through @INC to see if $modlibname is in it. A rela-
53 # tive $modlibname is not a common occurrence, so this block is
54 # not hot code.
55 FOUND: {
56 for (@INC) {
57 if ($_ eq $modlibname) {
58 last FOUND;
59 }
60 }
61 # Not found. Fall back to DynaLoader.
62 goto \&XSLoader::bootstrap_inherit;
63 }
64 }
65 my $file = "$modlibname/auto/$modpname/$modfname.so";
66
67# print STDERR "XSLoader::load for $module ($file)\n" if $dl_debug;
68
69 my $bs = $file;
70 $bs =~ s/(\.\w+)?(;\d*)?$/\.bs/; # look for .bs 'beside' the library
71
72 if (-s $bs) { # only read file if it's not empty
73# print STDERR "BS: $bs ($^O, $dlsrc)\n" if $dl_debug;
74 eval { do $bs; };
75 warn "$bs: $@\n" if $@;
76 }
77
78 goto \&XSLoader::bootstrap_inherit if not -f $file or -s $bs;
79
80 my $bootname = "boot_$module";
81 $bootname =~ s/\W/_/g;
82 @DynaLoader::dl_require_symbols = ($bootname);
83
84 my $boot_symbol_ref;
85
86 # Many dynamic extension loading problems will appear to come from
87 # this section of code: XYZ failed at line 123 of DynaLoader.pm.
88 # Often these errors are actually occurring in the initialisation
89 # C code of the extension XS file. Perl reports the error as being
90 # in this perl code simply because this was the last perl code
91 # it executed.
92
93 my $libref = dl_load_file($file, 0) or do {
94 require Carp;
95 Carp::croak("Can't load '$file' for module $module: " . dl_error());
96 };
97 push(@DynaLoader::dl_librefs,$libref); # record loaded object
98
99 my @unresolved = dl_undef_symbols();
100 if (@unresolved) {
101 require Carp;
102 Carp::carp("Undefined symbols present after loading $file: @unresolved\n");
103 }
104
105 $boot_symbol_ref = dl_find_symbol($libref, $bootname) or do {
106 require Carp;
107 Carp::croak("Can't find '$bootname' symbol in $file\n");
108 };
109
110 push(@DynaLoader::dl_modules, $module); # record loaded module
111
112 boot:
113 my $xs = dl_install_xsub($boots, $boot_symbol_ref, $file);
114
115 # See comment block above
116 push(@DynaLoader::dl_shared_objects, $file); # record files loaded
117 return &$xs(@_);
118}
119
120sub bootstrap_inherit {
121 require DynaLoader;
122 goto \&DynaLoader::bootstrap_inherit;
123}
124
1251;
126
127__END__
128