blib/lib/Wasm/Memory.pm

filter: Statementstmt 100% 35 / 35 Branchbran 75.0% 3 / 4 Conditioncond 33.3% 1 / 3 MC/DCmcdc 0.0% 0 / 2 Subroutinesub 100% 11 / 11 Podpod 83.3% 5 / 6 totaltotal 90.1% 55 / 61 CC 4 SCAR 6.7
CC
4
Cov
93%
wasm_caller_memory
4.3
BEGIN
1.0
BEGIN
1.0
CRAP 1.9
« blib/lib/Wasm/Table.pm ↑ Summary blib/lib/Wasm/Wasmtime/Global.pm »
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
BranchTrueFalseTotal
defined $caller ? : 1 1 2
20 1 my $wm = $caller->export_get('memory');
21 1 ▶ defined $wm && $wm->is_memory
Branch: 1 branch
BranchTrueFalseTotal
defined $wm && $wm->is_memory ? : 1 0 1
Condition33%1/3
defined $wm and $wm->is_memory
!ll&&!rl&&r
001
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
ABresult
0X0
100
111
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__
« blib/lib/Wasm/Table.pm ↑ Summary blib/lib/Wasm/Wasmtime/Global.pm »