line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Wasm::Wasmtime::Instance::Exports; |
2
|
|
|
|
|
|
|
|
3
|
15
|
|
|
15
|
|
108
|
use strict; |
|
15
|
|
|
|
|
38
|
|
|
15
|
|
|
|
|
619
|
|
4
|
15
|
|
|
15
|
|
95
|
use warnings; |
|
15
|
|
|
|
|
37
|
|
|
15
|
|
|
|
|
355
|
|
5
|
15
|
|
|
15
|
|
235
|
use 5.008004; |
|
15
|
|
|
|
|
57
|
|
6
|
15
|
|
|
15
|
|
98
|
use Carp (); |
|
15
|
|
|
|
|
37
|
|
|
15
|
|
|
|
|
388
|
|
7
|
15
|
|
|
15
|
|
84
|
use Hash::Util (); |
|
15
|
|
|
|
|
37
|
|
|
15
|
|
|
|
|
2615
|
|
8
|
|
|
|
|
|
|
use overload |
9
|
|
|
|
|
|
|
'%{}' => sub { |
10
|
6
|
|
|
6
|
|
801
|
my $self = shift; |
11
|
6
|
|
|
|
|
12
|
my $instance = $$self; |
12
|
6
|
|
|
|
|
34
|
$instance->{exports}; |
13
|
|
|
|
|
|
|
}, |
14
|
|
|
|
|
|
|
'@{}' => sub { |
15
|
23
|
|
|
23
|
|
709
|
my $self = shift; |
16
|
23
|
|
|
|
|
65
|
my $instance = $$self; |
17
|
23
|
|
|
|
|
77
|
my @exports = $instance->_exports; |
18
|
23
|
|
|
|
|
105
|
Internals::SvREADONLY @exports, 1; |
19
|
23
|
|
|
|
|
135
|
Internals::SvREADONLY $exports[$_], 1 for 0..$#exports; |
20
|
23
|
|
|
|
|
111
|
\@exports; |
21
|
|
|
|
|
|
|
}, |
22
|
0
|
|
|
0
|
|
0
|
bool => sub { 1 }, |
23
|
15
|
|
|
15
|
|
342
|
fallback => 1; |
|
15
|
|
|
|
|
36
|
|
|
15
|
|
|
|
|
212
|
|
24
|
|
|
|
|
|
|
|
25
|
|
|
|
|
|
|
# ABSTRACT: Wasmtime instance exports class |
26
|
|
|
|
|
|
|
our $VERSION = '0.23'; # VERSION |
27
|
|
|
|
|
|
|
|
28
|
|
|
|
|
|
|
|
29
|
|
|
|
|
|
|
sub new |
30
|
|
|
|
|
|
|
{ |
31
|
30
|
|
|
30
|
0
|
106
|
my($class, $instance) = @_; |
32
|
|
|
|
|
|
|
|
33
|
30
|
|
66
|
|
|
146
|
$instance->{exports} ||= do { |
34
|
29
|
|
|
|
|
134
|
my @exports = $instance->_exports; |
35
|
29
|
|
|
|
|
78
|
my @module_exports = @{ $instance->module->exports }; |
|
29
|
|
|
|
|
160
|
|
36
|
29
|
|
|
|
|
146
|
my %exports; |
37
|
29
|
|
|
|
|
87
|
foreach my $i (0..$#exports) |
38
|
|
|
|
|
|
|
{ |
39
|
59
|
|
|
|
|
387
|
$exports{$module_exports[$i]->name} = $exports[$i]; |
40
|
|
|
|
|
|
|
} |
41
|
29
|
|
|
|
|
294
|
Hash::Util::lock_hash(%exports); |
42
|
29
|
|
|
|
|
676
|
\%exports; |
43
|
|
|
|
|
|
|
}; |
44
|
|
|
|
|
|
|
|
45
|
30
|
|
|
|
|
430
|
bless \$instance, $class; |
46
|
|
|
|
|
|
|
} |
47
|
|
|
|
|
|
|
|
48
|
|
|
|
|
|
|
sub can |
49
|
|
|
|
|
|
|
{ |
50
|
11
|
|
|
11
|
0
|
25346
|
my($self, $name) = @_; |
51
|
11
|
|
|
|
|
144
|
my $instance = $$self; |
52
|
|
|
|
|
|
|
exists $instance->{exports}->{$name} |
53
|
0
|
|
|
0
|
|
0
|
? sub { $self->$name } |
54
|
11
|
100
|
|
|
|
101
|
: $self->SUPER::can($name); |
55
|
|
|
|
|
|
|
} |
56
|
|
|
|
|
|
|
|
57
|
|
|
|
|
|
|
sub AUTOLOAD |
58
|
|
|
|
|
|
|
{ |
59
|
12
|
|
|
12
|
|
224
|
our $AUTOLOAD; |
60
|
12
|
|
|
|
|
31
|
my $self = shift; |
61
|
|
|
|
|
|
|
|
62
|
12
|
|
|
|
|
23
|
my $name = $AUTOLOAD; |
63
|
12
|
|
|
|
|
71
|
$name=~ s/^.*:://; |
64
|
|
|
|
|
|
|
|
65
|
12
|
|
|
|
|
70
|
my $instance = $$self; |
66
|
12
|
50
|
|
|
|
66
|
Carp::croak("no export $name") unless exists $instance->{exports}->{$name}; |
67
|
12
|
|
|
|
|
48
|
$instance->{exports}->{$name}; |
68
|
|
|
|
|
|
|
} |
69
|
|
|
|
|
|
|
|
70
|
|
|
|
|
|
|
sub DESTROY |
71
|
|
|
|
0
|
|
|
{ |
72
|
|
|
|
|
|
|
# needed because of AUTOLOAD |
73
|
|
|
|
|
|
|
} |
74
|
|
|
|
|
|
|
|
75
|
|
|
|
|
|
|
|
76
|
|
|
|
|
|
|
1; |
77
|
|
|
|
|
|
|
|
78
|
|
|
|
|
|
|
__END__ |