| 1 | package Wasm::Memory; | ||||||||||||||||||||||||||||
| 2 | |||||||||||||||||||||||||||||
| 3 | 5 | ▶ | use strict; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 4 | 5 | ▶ | use warnings; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 5 | 5 | ▶ | use 5.008004; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 6 | 5 | ▶ | use Wasm::Wasmtime::Caller (); | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 7 | 5 | ▶ | use base qw( Exporter ); | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 8 | |||||||||||||||||||||||||||||
| 9 | 5 | our @EXPORT_OK = qw( wasm_caller_memory ); | |||||||||||||||||||||||||||
| 10 | |||||||||||||||||||||||||||||
| 11 | # ABSTRACT: Interface to WebAssembly Memory | ||||||||||||||||||||||||||||
| 12 | 5 | our $VERSION = '0.24'; # VERSION | |||||||||||||||||||||||||||
| 13 | |||||||||||||||||||||||||||||
| 14 | |||||||||||||||||||||||||||||
| 15 | sub wasm_caller_memory | ||||||||||||||||||||||||||||
| 16 | 2 | ▶ | { | ||||||||||||||||||||||||||
|
Subroutine
wasm_caller_memory: called CC=4 SCAR=14.6
Pod
documented
| |||||||||||||||||||||||||||||
| 17 | 2 | my $caller = Wasm::Wasmtime::Caller::wasmtime_caller(); | |||||||||||||||||||||||||||
| 18 | defined $caller | ||||||||||||||||||||||||||||
| 19 | 2 | ▶ | ? do { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 20 | 1 | my $wm = $caller->export_get('memory'); | |||||||||||||||||||||||||||
| 21 | 1 | ▶ | defined $wm && $wm->is_memory | ||||||||||||||||||||||||||
|
Branch: 1 branch
Condition33%1/3
defined $wm and $wm->is_memory
MC/DC0%0/2
defined $wm and $wm->is_memory
defined $wm
$wm->is_memory
Truth table33%1/3
A and B
A= defined $wmB= $wm->is_memory
| |||||||||||||||||||||||||||||
| 22 | ? __PACKAGE__->new($wm) | ||||||||||||||||||||||||||||
| 23 | : undef; | ||||||||||||||||||||||||||||
| 24 | } : undef; | ||||||||||||||||||||||||||||
| 25 | } | ||||||||||||||||||||||||||||
| 26 | |||||||||||||||||||||||||||||
| 27 | sub new | ||||||||||||||||||||||||||||
| 28 | 13 | ▶ | { | ||||||||||||||||||||||||||
|
Subroutine
new: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||||||||||||||||||||
| 29 | 13 | my($class, $memory) = @_; | |||||||||||||||||||||||||||
| 30 | 13 | bless \$memory, $class; | |||||||||||||||||||||||||||
| 31 | } | ||||||||||||||||||||||||||||
| 32 | |||||||||||||||||||||||||||||
| 33 | |||||||||||||||||||||||||||||
| 34 | 1 | ▶ | sub address { ${shift()}->data } | ||||||||||||||||||||||||||
|
Subroutine
address: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||||||||||||||||||
| 35 | 1 | ▶ | sub size { ${shift()}->data_size } | ||||||||||||||||||||||||||
|
Subroutine
size: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||||||||||||||||||
| 36 | |||||||||||||||||||||||||||||
| 37 | |||||||||||||||||||||||||||||
| 38 | sub limits | ||||||||||||||||||||||||||||
| 39 | 3 | ▶ | { | ||||||||||||||||||||||||||
|
Subroutine
limits: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||||||||||||||||||
| 40 | 3 | my $self = shift; | |||||||||||||||||||||||||||
| 41 | 3 | my $memory = $$self; | |||||||||||||||||||||||||||
| 42 | 3 | my $type = $memory->type; | |||||||||||||||||||||||||||
| 43 | 3 | ($memory->size, @{ $type->limits }); | |||||||||||||||||||||||||||
| 44 | } | ||||||||||||||||||||||||||||
| 45 | |||||||||||||||||||||||||||||
| 46 | |||||||||||||||||||||||||||||
| 47 | sub grow | ||||||||||||||||||||||||||||
| 48 | 1 | ▶ | { | ||||||||||||||||||||||||||
|
Subroutine
grow: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||||||||||||||||||
| 49 | 1 | my($self, $count) = @_; | |||||||||||||||||||||||||||
| 50 | 1 | ${$self}->grow($count); | |||||||||||||||||||||||||||
| 51 | } | ||||||||||||||||||||||||||||
| 52 | |||||||||||||||||||||||||||||
| 53 | 5 | 1; | |||||||||||||||||||||||||||
| 54 | |||||||||||||||||||||||||||||
| 55 | __END__ | ||||||||||||||||||||||||||||