line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Wasm::Memory; |
2
|
|
|
|
|
|
|
|
3
|
5
|
|
|
5
|
|
473
|
use strict; |
|
5
|
|
|
|
|
11
|
|
|
5
|
|
|
|
|
167
|
|
4
|
5
|
|
|
5
|
|
25
|
use warnings; |
|
5
|
|
|
|
|
10
|
|
|
5
|
|
|
|
|
122
|
|
5
|
5
|
|
|
5
|
|
104
|
use 5.008004; |
|
5
|
|
|
|
|
18
|
|
6
|
5
|
|
|
5
|
|
452
|
use Wasm::Wasmtime::Caller (); |
|
5
|
|
|
|
|
19
|
|
|
5
|
|
|
|
|
137
|
|
7
|
5
|
|
|
5
|
|
28
|
use base qw( Exporter ); |
|
5
|
|
|
|
|
12
|
|
|
5
|
|
|
|
|
1953
|
|
8
|
|
|
|
|
|
|
|
9
|
|
|
|
|
|
|
our @EXPORT_OK = qw( wasm_caller_memory ); |
10
|
|
|
|
|
|
|
|
11
|
|
|
|
|
|
|
# ABSTRACT: Interface to WebAssembly Memory |
12
|
|
|
|
|
|
|
our $VERSION = '0.21'; # VERSION |
13
|
|
|
|
|
|
|
|
14
|
|
|
|
|
|
|
|
15
|
|
|
|
|
|
|
sub wasm_caller_memory |
16
|
|
|
|
|
|
|
{ |
17
|
2
|
|
|
2
|
1
|
486
|
my $caller = Wasm::Wasmtime::Caller::wasmtime_caller(); |
18
|
|
|
|
|
|
|
defined $caller |
19
|
2
|
100
|
|
|
|
17
|
? do { |
20
|
1
|
|
|
|
|
6
|
my $wm = $caller->export_get('memory'); |
21
|
1
|
50
|
33
|
|
|
21
|
defined $wm && $wm->is_memory |
22
|
|
|
|
|
|
|
? __PACKAGE__->new($wm) |
23
|
|
|
|
|
|
|
: undef; |
24
|
|
|
|
|
|
|
} : undef; |
25
|
|
|
|
|
|
|
} |
26
|
|
|
|
|
|
|
|
27
|
|
|
|
|
|
|
sub new |
28
|
|
|
|
|
|
|
{ |
29
|
13
|
|
|
13
|
0
|
39
|
my($class, $memory) = @_; |
30
|
13
|
|
|
|
|
56
|
bless \$memory, $class; |
31
|
|
|
|
|
|
|
} |
32
|
|
|
|
|
|
|
|
33
|
|
|
|
|
|
|
|
34
|
1
|
|
|
1
|
1
|
1409
|
sub address { ${shift()}->data } |
|
1
|
|
|
|
|
10
|
|
35
|
1
|
|
|
1
|
1
|
353
|
sub size { ${shift()}->data_size } |
|
1
|
|
|
|
|
6
|
|
36
|
|
|
|
|
|
|
|
37
|
|
|
|
|
|
|
|
38
|
|
|
|
|
|
|
sub limits |
39
|
|
|
|
|
|
|
{ |
40
|
3
|
|
|
3
|
1
|
2057
|
my $self = shift; |
41
|
3
|
|
|
|
|
12
|
my $memory = $$self; |
42
|
3
|
|
|
|
|
14
|
my $type = $memory->type; |
43
|
3
|
|
|
|
|
15
|
($memory->size, @{ $type->limits }); |
|
3
|
|
|
|
|
41
|
|
44
|
|
|
|
|
|
|
} |
45
|
|
|
|
|
|
|
|
46
|
|
|
|
|
|
|
|
47
|
|
|
|
|
|
|
sub grow |
48
|
|
|
|
|
|
|
{ |
49
|
1
|
|
|
1
|
1
|
718
|
my($self, $count) = @_; |
50
|
1
|
|
|
|
|
2
|
${$self}->grow($count); |
|
1
|
|
|
|
|
5
|
|
51
|
|
|
|
|
|
|
} |
52
|
|
|
|
|
|
|
|
53
|
|
|
|
|
|
|
1; |
54
|
|
|
|
|
|
|
|
55
|
|
|
|
|
|
|
__END__ |