line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Wasm::Wasmtime::MemoryType; |
2
|
|
|
|
|
|
|
|
3
|
26
|
|
|
26
|
|
239980
|
use strict; |
|
26
|
|
|
|
|
70
|
|
|
26
|
|
|
|
|
846
|
|
4
|
26
|
|
|
26
|
|
134
|
use warnings; |
|
26
|
|
|
|
|
77
|
|
|
26
|
|
|
|
|
780
|
|
5
|
26
|
|
|
26
|
|
491
|
use 5.008004; |
|
26
|
|
|
|
|
113
|
|
6
|
26
|
|
|
26
|
|
145
|
use base qw( Wasm::Wasmtime::ExternType ); |
|
26
|
|
|
|
|
79
|
|
|
26
|
|
|
|
|
3295
|
|
7
|
26
|
|
|
26
|
|
232
|
use Ref::Util qw( is_ref is_plain_arrayref ); |
|
26
|
|
|
|
|
67
|
|
|
26
|
|
|
|
|
1544
|
|
8
|
26
|
|
|
26
|
|
246
|
use Wasm::Wasmtime::FFI; |
|
26
|
|
|
|
|
61
|
|
|
26
|
|
|
|
|
3012
|
|
9
|
26
|
|
|
26
|
|
211
|
use constant is_memorytype => 1; |
|
26
|
|
|
|
|
61
|
|
|
26
|
|
|
|
|
1619
|
|
10
|
26
|
|
|
26
|
|
225
|
use constant kind => 'memorytype'; |
|
26
|
|
|
|
|
60
|
|
|
26
|
|
|
|
|
11149
|
|
11
|
|
|
|
|
|
|
|
12
|
|
|
|
|
|
|
# ABSTRACT: Wasmtime memory type class |
13
|
|
|
|
|
|
|
our $VERSION = '0.22'; # 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
|
2004
|
my($self) = @_; |
52
|
3
|
|
|
|
|
6
|
my($min, $max) = @{ $self->limits }; |
|
3
|
|
|
|
|
14
|
|
53
|
3
|
|
|
|
|
12
|
my $string = "$min"; |
54
|
3
|
50
|
|
|
|
13
|
$string .= " $max" if $max != 0xffffffff; |
55
|
3
|
|
|
|
|
27
|
return $string; |
56
|
|
|
|
|
|
|
} |
57
|
|
|
|
|
|
|
|
58
|
|
|
|
|
|
|
__PACKAGE__->_cast(3); |
59
|
|
|
|
|
|
|
_generate_destroy(); |
60
|
|
|
|
|
|
|
|
61
|
|
|
|
|
|
|
1; |
62
|
|
|
|
|
|
|
|
63
|
|
|
|
|
|
|
__END__ |