line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Wasm::Wasmtime::Caller; |
2
|
|
|
|
|
|
|
|
3
|
10
|
|
|
10
|
|
1037
|
use strict; |
|
10
|
|
|
|
|
28
|
|
|
10
|
|
|
|
|
317
|
|
4
|
10
|
|
|
10
|
|
68
|
use warnings; |
|
10
|
|
|
|
|
22
|
|
|
10
|
|
|
|
|
254
|
|
5
|
10
|
|
|
10
|
|
213
|
use 5.008004; |
|
10
|
|
|
|
|
45
|
|
6
|
10
|
|
|
10
|
|
937
|
use Wasm::Wasmtime::FFI; |
|
10
|
|
|
|
|
27
|
|
|
10
|
|
|
|
|
1481
|
|
7
|
10
|
|
|
10
|
|
3169
|
use Wasm::Wasmtime::Extern; |
|
10
|
|
|
|
|
32
|
|
|
10
|
|
|
|
|
348
|
|
8
|
10
|
|
|
10
|
|
69
|
use base qw( Exporter ); |
|
10
|
|
|
|
|
25
|
|
|
10
|
|
|
|
|
3586
|
|
9
|
|
|
|
|
|
|
|
10
|
|
|
|
|
|
|
our @EXPORT = qw( wasmtime_caller ); |
11
|
|
|
|
|
|
|
|
12
|
|
|
|
|
|
|
$ffi_prefix = 'wasmtime_caller_'; |
13
|
|
|
|
|
|
|
$ffi->load_custom_type('::PtrObject' => 'wasmtime_caller_t' => __PACKAGE__); |
14
|
|
|
|
|
|
|
|
15
|
|
|
|
|
|
|
# ABSTRACT: Wasmtime caller interface |
16
|
|
|
|
|
|
|
our $VERSION = '0.22'; # VERSION |
17
|
|
|
|
|
|
|
|
18
|
|
|
|
|
|
|
|
19
|
|
|
|
|
|
|
our @callers; |
20
|
|
|
|
|
|
|
|
21
|
|
|
|
|
|
|
sub wasmtime_caller (;$) |
22
|
|
|
|
|
|
|
{ |
23
|
4
|
|
50
|
4
|
1
|
721
|
$callers[$_[0]||0] |
24
|
|
|
|
|
|
|
} |
25
|
|
|
|
|
|
|
|
26
|
|
|
|
|
|
|
|
27
|
|
|
|
|
|
|
sub new |
28
|
|
|
|
|
|
|
{ |
29
|
11
|
|
|
11
|
0
|
30
|
my($class, $ptr) = @_; |
30
|
11
|
|
|
|
|
43
|
bless { |
31
|
|
|
|
|
|
|
ptr => $ptr, |
32
|
|
|
|
|
|
|
}, $class; |
33
|
|
|
|
|
|
|
} |
34
|
|
|
|
|
|
|
|
35
|
|
|
|
|
|
|
$ffi->attach( export_get => ['wasmtime_caller_t','wasm_byte_vec_t*'] => 'wasm_extern_t' => sub { |
36
|
|
|
|
|
|
|
my $xsub = shift; |
37
|
|
|
|
|
|
|
my $self = shift; |
38
|
|
|
|
|
|
|
return undef unless $self->{ptr}; |
39
|
|
|
|
|
|
|
my $name = Wasm::Wasmtime::ByteVec->new($_[0]); |
40
|
|
|
|
|
|
|
$xsub->($self, $name); |
41
|
|
|
|
|
|
|
}); |
42
|
|
|
|
|
|
|
|
43
|
|
|
|
|
|
|
1; |
44
|
|
|
|
|
|
|
|
45
|
|
|
|
|
|
|
__END__ |