| line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
|
1
|
|
|
|
|
|
|
package Wasm::Wasmtime::MemoryType; |
|
2
|
|
|
|
|
|
|
|
|
3
|
26
|
|
|
26
|
|
231745
|
use strict; |
|
|
26
|
|
|
|
|
65
|
|
|
|
26
|
|
|
|
|
819
|
|
|
4
|
26
|
|
|
26
|
|
143
|
use warnings; |
|
|
26
|
|
|
|
|
67
|
|
|
|
26
|
|
|
|
|
588
|
|
|
5
|
26
|
|
|
26
|
|
442
|
use 5.008004; |
|
|
26
|
|
|
|
|
241
|
|
|
6
|
26
|
|
|
26
|
|
167
|
use base qw( Wasm::Wasmtime::ExternType ); |
|
|
26
|
|
|
|
|
58
|
|
|
|
26
|
|
|
|
|
3207
|
|
|
7
|
26
|
|
|
26
|
|
189
|
use Ref::Util qw( is_ref is_plain_arrayref ); |
|
|
26
|
|
|
|
|
118
|
|
|
|
26
|
|
|
|
|
1515
|
|
|
8
|
26
|
|
|
26
|
|
190
|
use Wasm::Wasmtime::FFI; |
|
|
26
|
|
|
|
|
90
|
|
|
|
26
|
|
|
|
|
2677
|
|
|
9
|
26
|
|
|
26
|
|
202
|
use constant is_memorytype => 1; |
|
|
26
|
|
|
|
|
62
|
|
|
|
26
|
|
|
|
|
1626
|
|
|
10
|
26
|
|
|
26
|
|
189
|
use constant kind => 'memorytype'; |
|
|
26
|
|
|
|
|
55
|
|
|
|
26
|
|
|
|
|
10998
|
|
|
11
|
|
|
|
|
|
|
|
|
12
|
|
|
|
|
|
|
# ABSTRACT: Wasmtime memory type class |
|
13
|
|
|
|
|
|
|
our $VERSION = '0.23'; # VERSION |
|
14
|
|
|
|
|
|
|
|
|
15
|
|
|
|
|
|
|
|
|
16
|
|
|
|
|
|
|
$ffi_prefix = 'wasm_memorytype_'; |
|
17
|
|
|
|
|
|
|
$ffi->load_custom_type('::PtrObject' => 'wasm_memorytype_t' => __PACKAGE__); |
|
18
|
|
|
|
|
|
|
|
|
19
|
|
|
|
|
|
|
|
|
20
|
|
|
|
|
|
|
$ffi->attach( new => ['uint32[2]'] => 'wasm_memorytype_t' => sub { |
|
21
|
|
|
|
|
|
|
my $xsub = shift; |
|
22
|
|
|
|
|
|
|
my $class = shift; |
|
23
|
|
|
|
|
|
|
if(is_ref $_[0]) |
|
24
|
|
|
|
|
|
|
{ |
|
25
|
|
|
|
|
|
|
my $limit = shift; |
|
26
|
|
|
|
|
|
|
Carp::croak("bad limits") unless is_plain_arrayref($limit); |
|
27
|
|
|
|
|
|
|
Carp::croak("no minumum in limit") unless defined $limit->[0]; |
|
28
|
|
|
|
|
|
|
$limit->[1] = 0xffffffff unless defined $limit->[1]; |
|
29
|
|
|
|
|
|
|
return $xsub->($limit); |
|
30
|
|
|
|
|
|
|
} |
|
31
|
|
|
|
|
|
|
else |
|
32
|
|
|
|
|
|
|
{ |
|
33
|
|
|
|
|
|
|
my ($ptr, $owner) = @_; |
|
34
|
|
|
|
|
|
|
return bless { |
|
35
|
|
|
|
|
|
|
ptr => $ptr, |
|
36
|
|
|
|
|
|
|
owner => $owner, |
|
37
|
|
|
|
|
|
|
}, $class; |
|
38
|
|
|
|
|
|
|
} |
|
39
|
|
|
|
|
|
|
}); |
|
40
|
|
|
|
|
|
|
|
|
41
|
|
|
|
|
|
|
|
|
42
|
|
|
|
|
|
|
$ffi->attach( limits => ['wasm_memorytype_t'] => 'uint32[2]' => sub { |
|
43
|
|
|
|
|
|
|
my($xsub, $self) = @_; |
|
44
|
|
|
|
|
|
|
my $limits = $xsub->($self); |
|
45
|
|
|
|
|
|
|
$limits; |
|
46
|
|
|
|
|
|
|
}); |
|
47
|
|
|
|
|
|
|
|
|
48
|
|
|
|
|
|
|
|
|
49
|
|
|
|
|
|
|
sub to_string |
|
50
|
|
|
|
|
|
|
{ |
|
51
|
3
|
|
|
3
|
1
|
2009
|
my($self) = @_; |
|
52
|
3
|
|
|
|
|
9
|
my($min, $max) = @{ $self->limits }; |
|
|
3
|
|
|
|
|
9
|
|
|
53
|
3
|
|
|
|
|
10
|
my $string = "$min"; |
|
54
|
3
|
50
|
|
|
|
13
|
$string .= " $max" if $max != 0xffffffff; |
|
55
|
3
|
|
|
|
|
14
|
return $string; |
|
56
|
|
|
|
|
|
|
} |
|
57
|
|
|
|
|
|
|
|
|
58
|
|
|
|
|
|
|
__PACKAGE__->_cast(3); |
|
59
|
|
|
|
|
|
|
_generate_destroy(); |
|
60
|
|
|
|
|
|
|
|
|
61
|
|
|
|
|
|
|
1; |
|
62
|
|
|
|
|
|
|
|
|
63
|
|
|
|
|
|
|
__END__ |