line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Wasm::Wasmtime::MemoryType; |
2
|
|
|
|
|
|
|
|
3
|
26
|
|
|
26
|
|
185664
|
use strict; |
|
26
|
|
|
|
|
63
|
|
|
26
|
|
|
|
|
835
|
|
4
|
26
|
|
|
26
|
|
194
|
use warnings; |
|
26
|
|
|
|
|
79
|
|
|
26
|
|
|
|
|
620
|
|
5
|
26
|
|
|
26
|
|
405
|
use 5.008004; |
|
26
|
|
|
|
|
92
|
|
6
|
26
|
|
|
26
|
|
178
|
use base qw( Wasm::Wasmtime::ExternType ); |
|
26
|
|
|
|
|
56
|
|
|
26
|
|
|
|
|
3284
|
|
7
|
26
|
|
|
26
|
|
216
|
use Ref::Util qw( is_ref is_plain_arrayref ); |
|
26
|
|
|
|
|
59
|
|
|
26
|
|
|
|
|
1358
|
|
8
|
26
|
|
|
26
|
|
178
|
use Wasm::Wasmtime::FFI; |
|
26
|
|
|
|
|
71
|
|
|
26
|
|
|
|
|
2638
|
|
9
|
26
|
|
|
26
|
|
187
|
use constant is_memorytype => 1; |
|
26
|
|
|
|
|
57
|
|
|
26
|
|
|
|
|
1647
|
|
10
|
26
|
|
|
26
|
|
185
|
use constant kind => 'memorytype'; |
|
26
|
|
|
|
|
61
|
|
|
26
|
|
|
|
|
10389
|
|
11
|
|
|
|
|
|
|
|
12
|
|
|
|
|
|
|
# ABSTRACT: Wasmtime memory type class |
13
|
|
|
|
|
|
|
our $VERSION = '0.21'; # 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
|
1622
|
my($self) = @_; |
52
|
3
|
|
|
|
|
6
|
my($min, $max) = @{ $self->limits }; |
|
3
|
|
|
|
|
43
|
|
53
|
3
|
|
|
|
|
11
|
my $string = "$min"; |
54
|
3
|
50
|
|
|
|
14
|
$string .= " $max" if $max != 0xffffffff; |
55
|
3
|
|
|
|
|
13
|
return $string; |
56
|
|
|
|
|
|
|
} |
57
|
|
|
|
|
|
|
|
58
|
|
|
|
|
|
|
__PACKAGE__->_cast(3); |
59
|
|
|
|
|
|
|
_generate_destroy(); |
60
|
|
|
|
|
|
|
|
61
|
|
|
|
|
|
|
1; |
62
|
|
|
|
|
|
|
|
63
|
|
|
|
|
|
|
__END__ |