line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Wasm::Wasmtime::Instance::Exports; |
2
|
|
|
|
|
|
|
|
3
|
15
|
|
|
15
|
|
111
|
use strict; |
|
15
|
|
|
|
|
35
|
|
|
15
|
|
|
|
|
446
|
|
4
|
15
|
|
|
15
|
|
77
|
use warnings; |
|
15
|
|
|
|
|
29
|
|
|
15
|
|
|
|
|
405
|
|
5
|
15
|
|
|
15
|
|
237
|
use 5.008004; |
|
15
|
|
|
|
|
68
|
|
6
|
15
|
|
|
15
|
|
83
|
use Carp (); |
|
15
|
|
|
|
|
39
|
|
|
15
|
|
|
|
|
237
|
|
7
|
15
|
|
|
15
|
|
154
|
use Hash::Util (); |
|
15
|
|
|
|
|
139
|
|
|
15
|
|
|
|
|
2763
|
|
8
|
|
|
|
|
|
|
use overload |
9
|
|
|
|
|
|
|
'%{}' => sub { |
10
|
6
|
|
|
6
|
|
870
|
my $self = shift; |
11
|
6
|
|
|
|
|
14
|
my $instance = $$self; |
12
|
6
|
|
|
|
|
32
|
$instance->{exports}; |
13
|
|
|
|
|
|
|
}, |
14
|
|
|
|
|
|
|
'@{}' => sub { |
15
|
23
|
|
|
23
|
|
733
|
my $self = shift; |
16
|
23
|
|
|
|
|
55
|
my $instance = $$self; |
17
|
23
|
|
|
|
|
80
|
my @exports = $instance->_exports; |
18
|
23
|
|
|
|
|
87
|
Internals::SvREADONLY @exports, 1; |
19
|
23
|
|
|
|
|
129
|
Internals::SvREADONLY $exports[$_], 1 for 0..$#exports; |
20
|
23
|
|
|
|
|
113
|
\@exports; |
21
|
|
|
|
|
|
|
}, |
22
|
0
|
|
|
0
|
|
0
|
bool => sub { 1 }, |
23
|
15
|
|
|
15
|
|
116
|
fallback => 1; |
|
15
|
|
|
|
|
57
|
|
|
15
|
|
|
|
|
253
|
|
24
|
|
|
|
|
|
|
|
25
|
|
|
|
|
|
|
# ABSTRACT: Wasmtime instance exports class |
26
|
|
|
|
|
|
|
our $VERSION = '0.21'; # VERSION |
27
|
|
|
|
|
|
|
|
28
|
|
|
|
|
|
|
|
29
|
|
|
|
|
|
|
sub new |
30
|
|
|
|
|
|
|
{ |
31
|
30
|
|
|
30
|
0
|
93
|
my($class, $instance) = @_; |
32
|
|
|
|
|
|
|
|
33
|
30
|
|
66
|
|
|
183
|
$instance->{exports} ||= do { |
34
|
29
|
|
|
|
|
113
|
my @exports = $instance->_exports; |
35
|
29
|
|
|
|
|
71
|
my @module_exports = @{ $instance->module->exports }; |
|
29
|
|
|
|
|
128
|
|
36
|
29
|
|
|
|
|
91
|
my %exports; |
37
|
29
|
|
|
|
|
87
|
foreach my $i (0..$#exports) |
38
|
|
|
|
|
|
|
{ |
39
|
59
|
|
|
|
|
430
|
$exports{$module_exports[$i]->name} = $exports[$i]; |
40
|
|
|
|
|
|
|
} |
41
|
29
|
|
|
|
|
325
|
Hash::Util::lock_hash(%exports); |
42
|
29
|
|
|
|
|
651
|
\%exports; |
43
|
|
|
|
|
|
|
}; |
44
|
|
|
|
|
|
|
|
45
|
30
|
|
|
|
|
447
|
bless \$instance, $class; |
46
|
|
|
|
|
|
|
} |
47
|
|
|
|
|
|
|
|
48
|
|
|
|
|
|
|
sub can |
49
|
|
|
|
|
|
|
{ |
50
|
11
|
|
|
11
|
0
|
24799
|
my($self, $name) = @_; |
51
|
11
|
|
|
|
|
141
|
my $instance = $$self; |
52
|
|
|
|
|
|
|
exists $instance->{exports}->{$name} |
53
|
0
|
|
|
0
|
|
0
|
? sub { $self->$name } |
54
|
11
|
100
|
|
|
|
102
|
: $self->SUPER::can($name); |
55
|
|
|
|
|
|
|
} |
56
|
|
|
|
|
|
|
|
57
|
|
|
|
|
|
|
sub AUTOLOAD |
58
|
|
|
|
|
|
|
{ |
59
|
12
|
|
|
12
|
|
229
|
our $AUTOLOAD; |
60
|
12
|
|
|
|
|
28
|
my $self = shift; |
61
|
|
|
|
|
|
|
|
62
|
12
|
|
|
|
|
23
|
my $name = $AUTOLOAD; |
63
|
12
|
|
|
|
|
73
|
$name=~ s/^.*:://; |
64
|
|
|
|
|
|
|
|
65
|
12
|
|
|
|
|
84
|
my $instance = $$self; |
66
|
12
|
50
|
|
|
|
44
|
Carp::croak("no export $name") unless exists $instance->{exports}->{$name}; |
67
|
12
|
|
|
|
|
54
|
$instance->{exports}->{$name}; |
68
|
|
|
|
|
|
|
} |
69
|
|
|
|
|
|
|
|
70
|
|
|
|
|
|
|
sub DESTROY |
71
|
|
|
|
0
|
|
|
{ |
72
|
|
|
|
|
|
|
# needed because of AUTOLOAD |
73
|
|
|
|
|
|
|
} |
74
|
|
|
|
|
|
|
|
75
|
|
|
|
|
|
|
|
76
|
|
|
|
|
|
|
1; |
77
|
|
|
|
|
|
|
|
78
|
|
|
|
|
|
|
__END__ |