line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Wasm::Wasmtime::TableType; |
2
|
|
|
|
|
|
|
|
3
|
26
|
|
|
26
|
|
225943
|
use strict; |
|
26
|
|
|
|
|
75
|
|
|
26
|
|
|
|
|
843
|
|
4
|
26
|
|
|
26
|
|
137
|
use warnings; |
|
26
|
|
|
|
|
149
|
|
|
26
|
|
|
|
|
1023
|
|
5
|
26
|
|
|
26
|
|
470
|
use 5.008004; |
|
26
|
|
|
|
|
93
|
|
6
|
26
|
|
|
26
|
|
154
|
use base qw( Wasm::Wasmtime::ExternType ); |
|
26
|
|
|
|
|
128
|
|
|
26
|
|
|
|
|
3083
|
|
7
|
26
|
|
|
26
|
|
215
|
use Wasm::Wasmtime::FFI; |
|
26
|
|
|
|
|
59
|
|
|
26
|
|
|
|
|
3011
|
|
8
|
26
|
|
|
26
|
|
193
|
use Wasm::Wasmtime::ValType; |
|
26
|
|
|
|
|
64
|
|
|
26
|
|
|
|
|
818
|
|
9
|
26
|
|
|
26
|
|
186
|
use Ref::Util qw( is_ref is_plain_arrayref ); |
|
26
|
|
|
|
|
96
|
|
|
26
|
|
|
|
|
1608
|
|
10
|
26
|
|
|
26
|
|
190
|
use constant is_tabletype => 1; |
|
26
|
|
|
|
|
75
|
|
|
26
|
|
|
|
|
1662
|
|
11
|
26
|
|
|
26
|
|
192
|
use constant kind => 'tabletype'; |
|
26
|
|
|
|
|
85
|
|
|
26
|
|
|
|
|
15274
|
|
12
|
|
|
|
|
|
|
|
13
|
|
|
|
|
|
|
# ABSTRACT: Wasmtime table type class |
14
|
|
|
|
|
|
|
our $VERSION = '0.22'; # 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
|
2406
|
my($self) = @_; |
70
|
3
|
|
|
|
|
9
|
my($min, $max) = @{ $self->limits }; |
|
3
|
|
|
|
|
9
|
|
71
|
3
|
|
|
|
|
43
|
my $string = "$min "; |
72
|
3
|
100
|
|
|
|
13
|
$string .= "$max " if $max != 0xffffffff; |
73
|
3
|
|
|
|
|
8
|
$string .= $self->element->to_string; |
74
|
|
|
|
|
|
|
} |
75
|
|
|
|
|
|
|
|
76
|
|
|
|
|
|
|
__PACKAGE__->_cast(2); |
77
|
|
|
|
|
|
|
_generate_destroy(); |
78
|
|
|
|
|
|
|
|
79
|
|
|
|
|
|
|
1; |
80
|
|
|
|
|
|
|
|
81
|
|
|
|
|
|
|
__END__ |