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