| 1 | package Wasm::Wasmtime::Table; | ||||||||||||||||||||
| 2 | |||||||||||||||||||||
| 3 | 16 | ▶ | use strict; | ||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||
| 4 | 16 | ▶ | use warnings; | ||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||
| 5 | 16 | ▶ | use 5.008004; | ||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||
| 6 | 16 | ▶ | use base qw( Wasm::Wasmtime::Extern ); | ||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||
| 7 | 16 | ▶ | use Ref::Util qw( is_ref ); | ||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||
| 8 | 16 | ▶ | use Wasm::Wasmtime::FFI; | ||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||
| 9 | 16 | ▶ | use Wasm::Wasmtime::Store; | ||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||
| 10 | 16 | ▶ | use Wasm::Wasmtime::TableType; | ||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||
| 11 | 16 | ▶ | use constant is_table => 1; | ||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||
| 12 | 16 | ▶ | use constant kind => 'table'; | ||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||
| 13 | |||||||||||||||||||||
| 14 | # ABSTRACT: Wasmtime table class | ||||||||||||||||||||
| 15 | 16 | our $VERSION = '0.23'; # VERSION | |||||||||||||||||||
| 16 | |||||||||||||||||||||
| 17 | |||||||||||||||||||||
| 18 | 16 | $ffi_prefix = 'wasm_table_'; | |||||||||||||||||||
| 19 | 16 | $ffi->load_custom_type('::PtrObject' => 'wasm_table_t' => __PACKAGE__); | |||||||||||||||||||
| 20 | |||||||||||||||||||||
| 21 | sub new | ||||||||||||||||||||
| 22 | { | ||||||||||||||||||||
| 23 | # TODO: add wasm_table_new for standalone support | ||||||||||||||||||||
| 24 | # TODO: add wasm_table_set | ||||||||||||||||||||
| 25 | # TODO: add wasm_table_get | ||||||||||||||||||||
| 26 | # TODO: add wasm_table_grow | ||||||||||||||||||||
| 27 | 0 | ▶ | my($class, $ptr, $owner) = @_; | ||||||||||||||||||
|
Subroutine
new: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||||||||||||
| 28 | 0 | bless { | |||||||||||||||||||
| 29 | ptr => $ptr, | ||||||||||||||||||||
| 30 | owner => $owner, | ||||||||||||||||||||
| 31 | }, $class; | ||||||||||||||||||||
| 32 | } | ||||||||||||||||||||
| 33 | |||||||||||||||||||||
| 34 | |||||||||||||||||||||
| 35 | $ffi->attach( type => ['wasm_table_t'] => 'wasm_tabletype_t' => sub { | ||||||||||||||||||||
| 36 | 2 | ▶ | my($xsub, $self) = @_; | ||||||||||||||||||
|
Subroutine
__ANON__: called CC=2 SCAR=7.4
| |||||||||||||||||||||
| 37 | 2 | my $type = $xsub->($self); | |||||||||||||||||||
| 38 | 2 | ▶ | $type->{owner} = $self->{owner} || $self; | ||||||||||||||||||
|
Condition33%1/3
$self->{'owner'} || $self
MC/DC0%0/2
$self->{'owner'} || $self
$self->{'owner'}
$self
Truth table33%1/3
A || B
A= $self->{'owner'}B= $self
| |||||||||||||||||||||
| 39 | 2 | $type; | |||||||||||||||||||
| 40 | 16 | }); | |||||||||||||||||||
| 41 | |||||||||||||||||||||
| 42 | |||||||||||||||||||||
| 43 | 16 | $ffi->attach( size => ['wasm_table_t'] => 'uint32' ); | |||||||||||||||||||
| 44 | |||||||||||||||||||||
| 45 | 16 | __PACKAGE__->_cast(2); | |||||||||||||||||||
| 46 | 16 | _generate_destroy(); | |||||||||||||||||||
| 47 | |||||||||||||||||||||
| 48 | 16 | 1; | |||||||||||||||||||
| 49 | |||||||||||||||||||||
| 50 | __END__ | ||||||||||||||||||||