line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Wasm::Wasmtime::TableType; |
2
|
|
|
|
|
|
|
|
3
|
26
|
|
|
26
|
|
181423
|
use strict; |
|
26
|
|
|
|
|
60
|
|
|
26
|
|
|
|
|
793
|
|
4
|
26
|
|
|
26
|
|
136
|
use warnings; |
|
26
|
|
|
|
|
78
|
|
|
26
|
|
|
|
|
659
|
|
5
|
26
|
|
|
26
|
|
446
|
use 5.008004; |
|
26
|
|
|
|
|
91
|
|
6
|
26
|
|
|
26
|
|
187
|
use base qw( Wasm::Wasmtime::ExternType ); |
|
26
|
|
|
|
|
64
|
|
|
26
|
|
|
|
|
4188
|
|
7
|
26
|
|
|
26
|
|
191
|
use Wasm::Wasmtime::FFI; |
|
26
|
|
|
|
|
49
|
|
|
26
|
|
|
|
|
2876
|
|
8
|
26
|
|
|
26
|
|
181
|
use Wasm::Wasmtime::ValType; |
|
26
|
|
|
|
|
73
|
|
|
26
|
|
|
|
|
907
|
|
9
|
26
|
|
|
26
|
|
171
|
use Ref::Util qw( is_ref is_plain_arrayref ); |
|
26
|
|
|
|
|
46
|
|
|
26
|
|
|
|
|
1552
|
|
10
|
26
|
|
|
26
|
|
184
|
use constant is_tabletype => 1; |
|
26
|
|
|
|
|
66
|
|
|
26
|
|
|
|
|
1703
|
|
11
|
26
|
|
|
26
|
|
179
|
use constant kind => 'tabletype'; |
|
26
|
|
|
|
|
51
|
|
|
26
|
|
|
|
|
14246
|
|
12
|
|
|
|
|
|
|
|
13
|
|
|
|
|
|
|
# ABSTRACT: Wasmtime table type class |
14
|
|
|
|
|
|
|
our $VERSION = '0.21'; # VERSION |
15
|
|
|
|
|
|
|
|
16
|
|
|
|
|
|
|
|
17
|
|
|
|
|
|
|
$ffi_prefix = 'wasm_tabletype_'; |
18
|
|
|
|
|
|
|
$ffi->load_custom_type('::PtrObject' => 'wasm_tabletype_t' => __PACKAGE__); |
19
|
|
|
|
|
|
|
|
20
|
|
|
|
|
|
|
|
21
|
|
|
|
|
|
|
$ffi->attach( new => ['wasm_valtype_t','uint32[2]'] => 'wasm_tabletype_t' => sub { |
22
|
|
|
|
|
|
|
my $xsub = shift; |
23
|
|
|
|
|
|
|
my $class = shift; |
24
|
|
|
|
|
|
|
if(defined $_[0] && !is_ref($_[0]) && $_[0] =~ /^[0-9]+$/) |
25
|
|
|
|
|
|
|
{ |
26
|
|
|
|
|
|
|
my($ptr, $owner) = @_; |
27
|
|
|
|
|
|
|
return bless { |
28
|
|
|
|
|
|
|
ptr => $ptr, |
29
|
|
|
|
|
|
|
owner => $owner, |
30
|
|
|
|
|
|
|
}, $class; |
31
|
|
|
|
|
|
|
} |
32
|
|
|
|
|
|
|
else |
33
|
|
|
|
|
|
|
{ |
34
|
|
|
|
|
|
|
my($valtype, $limit) = @_; |
35
|
|
|
|
|
|
|
if(ref($valtype) eq 'Wasm::Wasmtime::ValType') |
36
|
|
|
|
|
|
|
{ |
37
|
|
|
|
|
|
|
$valtype = Wasm::Wasmtime::ValType->new($valtype->kind); |
38
|
|
|
|
|
|
|
} |
39
|
|
|
|
|
|
|
else |
40
|
|
|
|
|
|
|
{ |
41
|
|
|
|
|
|
|
$valtype = Wasm::Wasmtime::ValType->new($valtype); |
42
|
|
|
|
|
|
|
} |
43
|
|
|
|
|
|
|
Carp::croak("bad limits") unless is_plain_arrayref($limit); |
44
|
|
|
|
|
|
|
Carp::croak("no minumum in limit") unless defined $limit->[0]; |
45
|
|
|
|
|
|
|
$limit->[1] = 0xffffffff unless defined $limit->[1]; |
46
|
|
|
|
|
|
|
my $self = $xsub->($valtype, $limit); |
47
|
|
|
|
|
|
|
delete $valtype->{ptr}; |
48
|
|
|
|
|
|
|
return $self; |
49
|
|
|
|
|
|
|
} |
50
|
|
|
|
|
|
|
}); |
51
|
|
|
|
|
|
|
|
52
|
|
|
|
|
|
|
|
53
|
|
|
|
|
|
|
$ffi->attach( element => ['wasm_tabletype_t'] => 'wasm_valtype_t' => sub { |
54
|
|
|
|
|
|
|
my($xsub, $self) = @_; |
55
|
|
|
|
|
|
|
my $valtype = $xsub->($self); |
56
|
|
|
|
|
|
|
$valtype->{owner} = $self; |
57
|
|
|
|
|
|
|
$valtype; |
58
|
|
|
|
|
|
|
}); |
59
|
|
|
|
|
|
|
|
60
|
|
|
|
|
|
|
|
61
|
|
|
|
|
|
|
$ffi->attach( limits => ['wasm_tabletype_t'] => 'uint32[2]' => sub { |
62
|
|
|
|
|
|
|
my($xsub, $self) = @_; |
63
|
|
|
|
|
|
|
$xsub->($self); |
64
|
|
|
|
|
|
|
}); |
65
|
|
|
|
|
|
|
|
66
|
|
|
|
|
|
|
|
67
|
|
|
|
|
|
|
sub to_string |
68
|
|
|
|
|
|
|
{ |
69
|
3
|
|
|
3
|
1
|
1975
|
my($self) = @_; |
70
|
3
|
|
|
|
|
4
|
my($min, $max) = @{ $self->limits }; |
|
3
|
|
|
|
|
8
|
|
71
|
3
|
|
|
|
|
44
|
my $string = "$min "; |
72
|
3
|
100
|
|
|
|
8
|
$string .= "$max " if $max != 0xffffffff; |
73
|
3
|
|
|
|
|
7
|
$string .= $self->element->to_string; |
74
|
|
|
|
|
|
|
} |
75
|
|
|
|
|
|
|
|
76
|
|
|
|
|
|
|
__PACKAGE__->_cast(2); |
77
|
|
|
|
|
|
|
_generate_destroy(); |
78
|
|
|
|
|
|
|
|
79
|
|
|
|
|
|
|
1; |
80
|
|
|
|
|
|
|
|
81
|
|
|
|
|
|
|
__END__ |