line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Wasm::Wasmtime::Engine; |
2
|
|
|
|
|
|
|
|
3
|
26
|
|
|
26
|
|
459914
|
use strict; |
|
26
|
|
|
|
|
97
|
|
|
26
|
|
|
|
|
1158
|
|
4
|
26
|
|
|
26
|
|
142
|
use warnings; |
|
26
|
|
|
|
|
58
|
|
|
26
|
|
|
|
|
617
|
|
5
|
26
|
|
|
26
|
|
475
|
use 5.008004; |
|
26
|
|
|
|
|
108
|
|
6
|
26
|
|
|
26
|
|
1094
|
use Wasm::Wasmtime::FFI; |
|
26
|
|
|
|
|
99
|
|
|
26
|
|
|
|
|
2577
|
|
7
|
26
|
|
|
26
|
|
11149
|
use Wasm::Wasmtime::Config; |
|
26
|
|
|
|
|
87
|
|
|
26
|
|
|
|
|
6657
|
|
8
|
|
|
|
|
|
|
|
9
|
|
|
|
|
|
|
# ABSTRACT: Wasmtime engine class |
10
|
|
|
|
|
|
|
our $VERSION = '0.23'; # VERSION |
11
|
|
|
|
|
|
|
|
12
|
|
|
|
|
|
|
|
13
|
|
|
|
|
|
|
$ffi_prefix = 'wasm_engine_'; |
14
|
|
|
|
|
|
|
$ffi->load_custom_type('::PtrObject' => 'wasm_engine_t' => __PACKAGE__ ); |
15
|
|
|
|
|
|
|
|
16
|
|
|
|
|
|
|
|
17
|
|
|
|
|
|
|
$ffi->attach( [ 'new_with_config' => 'new' ] => ['wasm_config_t'] => 'wasm_engine_t' => sub { |
18
|
|
|
|
|
|
|
my($xsub, $class, $config) = @_; |
19
|
|
|
|
|
|
|
$config ||= Wasm::Wasmtime::Config->new; |
20
|
|
|
|
|
|
|
if(defined $ENV{PERL_WASM_WASMTIME_MEMORY}) |
21
|
|
|
|
|
|
|
{ |
22
|
|
|
|
|
|
|
my($static_memory_maximum_size, $static_memory_guard_size, $dynamic_memory_guard_size) = split /:/, $ENV{PERL_WASM_WASMTIME_MEMORY}; |
23
|
|
|
|
|
|
|
$config->static_memory_maximum_size($static_memory_maximum_size); |
24
|
|
|
|
|
|
|
$config->static_memory_guard_size($static_memory_guard_size); |
25
|
|
|
|
|
|
|
$config->dynamic_memory_guard_size($dynamic_memory_guard_size); |
26
|
|
|
|
|
|
|
} |
27
|
|
|
|
|
|
|
my $self = $xsub->($config), |
28
|
|
|
|
|
|
|
delete $config->{ptr}; |
29
|
|
|
|
|
|
|
$self; |
30
|
|
|
|
|
|
|
}); |
31
|
|
|
|
|
|
|
|
32
|
|
|
|
|
|
|
_generate_destroy(); |
33
|
|
|
|
|
|
|
|
34
|
|
|
|
|
|
|
1; |
35
|
|
|
|
|
|
|
|
36
|
|
|
|
|
|
|
__END__ |