| line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
|
1
|
|
|
|
|
|
|
package Wasm::Wasm3::Runtime; |
|
2
|
|
|
|
|
|
|
|
|
3
|
4
|
|
|
4
|
|
21
|
use strict; |
|
|
4
|
|
|
|
|
23
|
|
|
|
4
|
|
|
|
|
91
|
|
|
4
|
4
|
|
|
4
|
|
15
|
use warnings; |
|
|
4
|
|
|
|
|
7
|
|
|
|
4
|
|
|
|
|
93
|
|
|
5
|
|
|
|
|
|
|
|
|
6
|
|
|
|
|
|
|
=encoding utf-8 |
|
7
|
|
|
|
|
|
|
|
|
8
|
|
|
|
|
|
|
=head1 NAME |
|
9
|
|
|
|
|
|
|
|
|
10
|
|
|
|
|
|
|
Wasm::Wasm3::Runtime |
|
11
|
|
|
|
|
|
|
|
|
12
|
|
|
|
|
|
|
=head1 SYNOPSIS |
|
13
|
|
|
|
|
|
|
|
|
14
|
|
|
|
|
|
|
See L. |
|
15
|
|
|
|
|
|
|
|
|
16
|
|
|
|
|
|
|
=head1 DESCRIPTION |
|
17
|
|
|
|
|
|
|
|
|
18
|
|
|
|
|
|
|
This module exposes L’s |
|
19
|
|
|
|
|
|
|
runtime object to Perl. |
|
20
|
|
|
|
|
|
|
|
|
21
|
|
|
|
|
|
|
=cut |
|
22
|
|
|
|
|
|
|
|
|
23
|
|
|
|
|
|
|
#---------------------------------------------------------------------- |
|
24
|
|
|
|
|
|
|
|
|
25
|
4
|
|
|
4
|
|
21
|
use Wasm::Wasm3; |
|
|
4
|
|
|
|
|
6
|
|
|
|
4
|
|
|
|
|
118
|
|
|
26
|
|
|
|
|
|
|
|
|
27
|
|
|
|
|
|
|
#---------------------------------------------------------------------- |
|
28
|
|
|
|
|
|
|
|
|
29
|
|
|
|
|
|
|
=head1 METHODS |
|
30
|
|
|
|
|
|
|
|
|
31
|
|
|
|
|
|
|
This class is not directly instantiated; see L for |
|
32
|
|
|
|
|
|
|
details. |
|
33
|
|
|
|
|
|
|
|
|
34
|
|
|
|
|
|
|
=head2 $obj = I->load_module( $MODULE_OBJ ) |
|
35
|
|
|
|
|
|
|
|
|
36
|
|
|
|
|
|
|
Loads a parsed module (i.e., L instance). |
|
37
|
|
|
|
|
|
|
Returns I. |
|
38
|
|
|
|
|
|
|
|
|
39
|
|
|
|
|
|
|
=head2 @returns = I->call( $FUNCTION_NAME, @ARGUMENTS ) |
|
40
|
|
|
|
|
|
|
|
|
41
|
|
|
|
|
|
|
Calls the named function with the given arguments, returning the |
|
42
|
|
|
|
|
|
|
returns from that function. |
|
43
|
|
|
|
|
|
|
|
|
44
|
|
|
|
|
|
|
A scalar-context call to this method will produce an exception |
|
45
|
|
|
|
|
|
|
if the WebAssembly function returns multiple values. |
|
46
|
|
|
|
|
|
|
|
|
47
|
|
|
|
|
|
|
=head2 $exit_code = I->run_wasi( @ARGV ) |
|
48
|
|
|
|
|
|
|
|
|
49
|
|
|
|
|
|
|
A WASI-specific variant of C. Calls WASI’s start function |
|
50
|
|
|
|
|
|
|
(as of this writing, always C<_start>) with the given @ARGV list |
|
51
|
|
|
|
|
|
|
(byte strings). |
|
52
|
|
|
|
|
|
|
|
|
53
|
|
|
|
|
|
|
Returns the WASI exit code. |
|
54
|
|
|
|
|
|
|
|
|
55
|
|
|
|
|
|
|
=head2 @types = I->get_function_arguments( $FUNCTION_NAME ) |
|
56
|
|
|
|
|
|
|
|
|
57
|
|
|
|
|
|
|
Returns a list of the named function’s argument types, as TYPE_* constants. |
|
58
|
|
|
|
|
|
|
(cf. L) |
|
59
|
|
|
|
|
|
|
|
|
60
|
|
|
|
|
|
|
=head2 @types = I->get_function_returns( $FUNCTION_NAME ) |
|
61
|
|
|
|
|
|
|
|
|
62
|
|
|
|
|
|
|
Like C but for return types. |
|
63
|
|
|
|
|
|
|
|
|
64
|
|
|
|
|
|
|
=head2 $str = I->get_memory( [ $OFFSET [, $WANTLENGTH] ] ) |
|
65
|
|
|
|
|
|
|
|
|
66
|
|
|
|
|
|
|
Fetches all or part of I’s WebAssembly memory buffer as a byte string. |
|
67
|
|
|
|
|
|
|
$OFFSET defaults to 0, and $WANTLENGTH defaults to the buffer’s length less |
|
68
|
|
|
|
|
|
|
$OFFSET. If $WANTLENGTH + $OFFSET exceed the buffer’s size, the returned |
|
69
|
|
|
|
|
|
|
string will contain just the content from $OFFSET to the buffer’s end. |
|
70
|
|
|
|
|
|
|
|
|
71
|
|
|
|
|
|
|
Currently both values B be nonnegative. |
|
72
|
|
|
|
|
|
|
|
|
73
|
|
|
|
|
|
|
=head2 $count = I->get_memory_size() |
|
74
|
|
|
|
|
|
|
|
|
75
|
|
|
|
|
|
|
Returns the size, in bytes of I’s WebAssembly memory buffer. |
|
76
|
|
|
|
|
|
|
|
|
77
|
|
|
|
|
|
|
=head2 $obj = I->set_memory( $OFFSET, $NEW_BYTES ) |
|
78
|
|
|
|
|
|
|
|
|
79
|
|
|
|
|
|
|
Overwrites all or part of I’s WebAssembly memory buffer with |
|
80
|
|
|
|
|
|
|
$NEW_BYTES. Returns I. |
|
81
|
|
|
|
|
|
|
|
|
82
|
|
|
|
|
|
|
=cut |
|
83
|
|
|
|
|
|
|
|
|
84
|
|
|
|
|
|
|
1; |