Filename | /usr/lib/perl/5.10/XSLoader.pm |
Statements | Executed 0 statements in 32µs |
Calls | P | F | Exclusive Time |
Inclusive Time |
Subroutine |
---|---|---|---|---|---|
6 | 6 | 6 | 2.14ms | 2.20ms | load | XSLoader::
0 | 0 | 0 | 0s | 0s | bootstrap_inherit | XSLoader::
Line | State ments |
Time on line |
Calls | Time in subs |
Code |
---|---|---|---|---|---|
1 | # Generated from XSLoader.pm.PL (resolved %Config::Config value) | ||||
2 | |||||
3 | package XSLoader; | ||||
4 | |||||
5 | $VERSION = "0.10"; | ||||
6 | |||||
7 | #use strict; | ||||
8 | |||||
9 | # enable debug/trace messages from DynaLoader perl code | ||||
10 | # $dl_debug = $ENV{PERL_DL_DEBUG} || 0 unless defined $dl_debug; | ||||
11 | |||||
12 | my $dl_dlext = 'so'; | ||||
13 | |||||
14 | package DynaLoader; | ||||
15 | |||||
16 | # No prizes for guessing why we don't say 'bootstrap DynaLoader;' here. | ||||
17 | # NOTE: All dl_*.xs (including dl_none.xs) define a dl_error() XSUB | ||||
18 | boot_DynaLoader('DynaLoader') if defined(&boot_DynaLoader) && | ||||
19 | !defined(&dl_error); | ||||
20 | package XSLoader; | ||||
21 | |||||
22 | # spent 2.20ms (2.14+60µs) within XSLoader::load which was called 6 times, avg 367µs/call:
# once (699µs+0s) by MARC::Charset::Table::BEGIN@36 at line 36 of POSIX.pm
# once (334µs+60µs) by MARC::Charset::BEGIN@11 at line 10 of Encode.pm
# once (288µs+0s) by Fcntl::BEGIN@159 at line 160 of Fcntl.pm
# once (281µs+0s) by IO::Handle::BEGIN@9 at line 11 of IO.pm
# once (281µs+0s) by MARC::File::SAX::BEGIN@12 at line 36 of Data/Dumper.pm
# once (259µs+0s) by MARC::Charset::Table::BEGIN@37 at line 12 of SDBM_File.pm | ||||
23 | package DynaLoader; | ||||
24 | |||||
25 | die q{XSLoader::load('Your::Module', $Your::Module::VERSION)} unless @_; | ||||
26 | |||||
27 | my($module) = $_[0]; | ||||
28 | |||||
29 | # work with static linking too | ||||
30 | my $boots = "$module\::bootstrap"; | ||||
31 | goto &$boots if defined &$boots; | ||||
32 | |||||
33 | goto retry unless $module and defined &dl_load_file; | ||||
34 | |||||
35 | my @modparts = split(/::/,$module); | ||||
36 | my $modfname = $modparts[-1]; | ||||
37 | |||||
38 | my $modpname = join('/',@modparts); | ||||
39 | my $modlibname = (caller())[1]; | ||||
40 | my $c = @modparts; | ||||
41 | $modlibname =~ s,[\\/][^\\/]+$,, while $c--; # Q&D basename | ||||
42 | my $file = "$modlibname/auto/$modpname/$modfname.$dl_dlext"; | ||||
43 | |||||
44 | # print STDERR "XSLoader::load for $module ($file)\n" if $dl_debug; | ||||
45 | |||||
46 | my $bs = $file; | ||||
47 | $bs =~ s/(\.\w+)?(;\d*)?$/\.bs/; # look for .bs 'beside' the library | ||||
48 | |||||
49 | if (-s $bs) { # only read file if it's not empty | ||||
50 | # print STDERR "BS: $bs ($^O, $dlsrc)\n" if $dl_debug; | ||||
51 | eval { do $bs; }; | ||||
52 | warn "$bs: $@\n" if $@; | ||||
53 | } | ||||
54 | |||||
55 | goto retry if not -f $file or -s $bs; | ||||
56 | |||||
57 | my $bootname = "boot_$module"; | ||||
58 | $bootname =~ s/\W/_/g; | ||||
59 | @DynaLoader::dl_require_symbols = ($bootname); | ||||
60 | |||||
61 | my $boot_symbol_ref; | ||||
62 | |||||
63 | # Many dynamic extension loading problems will appear to come from | ||||
64 | # this section of code: XYZ failed at line 123 of DynaLoader.pm. | ||||
65 | # Often these errors are actually occurring in the initialisation | ||||
66 | # C code of the extension XS file. Perl reports the error as being | ||||
67 | # in this perl code simply because this was the last perl code | ||||
68 | # it executed. | ||||
69 | |||||
70 | my $libref = dl_load_file($file, 0) or do { | ||||
71 | require Carp; | ||||
72 | Carp::croak("Can't load '$file' for module $module: " . dl_error()); | ||||
73 | }; | ||||
74 | push(@DynaLoader::dl_librefs,$libref); # record loaded object | ||||
75 | |||||
76 | my @unresolved = dl_undef_symbols(); | ||||
77 | if (@unresolved) { | ||||
78 | require Carp; | ||||
79 | Carp::carp("Undefined symbols present after loading $file: @unresolved\n"); | ||||
80 | } | ||||
81 | |||||
82 | $boot_symbol_ref = dl_find_symbol($libref, $bootname) or do { | ||||
83 | require Carp; | ||||
84 | Carp::croak("Can't find '$bootname' symbol in $file\n"); | ||||
85 | }; | ||||
86 | |||||
87 | push(@DynaLoader::dl_modules, $module); # record loaded module | ||||
88 | |||||
89 | boot: | ||||
90 | my $xs = dl_install_xsub($boots, $boot_symbol_ref, $file); | ||||
91 | |||||
92 | # See comment block above | ||||
93 | push(@DynaLoader::dl_shared_objects, $file); # record files loaded | ||||
94 | 1 | 32µs | 4 | 60µs | return &$xs(@_); # spent 60µs making 4 calls to Encode::define_encoding, avg 15µs/call |
95 | |||||
96 | retry: | ||||
97 | my $bootstrap_inherit = DynaLoader->can('bootstrap_inherit') || | ||||
98 | XSLoader->can('bootstrap_inherit'); | ||||
99 | goto &$bootstrap_inherit; | ||||
100 | } | ||||
101 | |||||
102 | # Versions of DynaLoader prior to 5.6.0 don't have this function. | ||||
103 | sub bootstrap_inherit { | ||||
104 | package DynaLoader; | ||||
105 | |||||
106 | my $module = $_[0]; | ||||
107 | local *DynaLoader::isa = *{"$module\::ISA"}; | ||||
108 | local @DynaLoader::isa = (@DynaLoader::isa, 'DynaLoader'); | ||||
109 | # Cannot goto due to delocalization. Will report errors on a wrong line? | ||||
110 | require DynaLoader; | ||||
111 | DynaLoader::bootstrap(@_); | ||||
112 | } | ||||
113 | |||||
114 | 1; | ||||
115 | |||||
116 | __END__ | ||||
117 |