NAME
Wasm::Wasm3::Runtime
SYNOPSIS
See Wasm::Wasm3.
DESCRIPTION
This module exposes wasm3’s runtime object to Perl.
METHODS
This class is not directly instantiated; see Wasm::Wasm3 for details.
$obj = OBJ->load_module( $MODULE_OBJ )
Loads a parsed module (i.e., Wasm::Wasm3::Module instance). Returns OBJ.
@returns = OBJ->call( $FUNCTION_NAME, @ARGUMENTS )
Calls the named function with the given arguments, returning the returns from that function.
A scalar-context call to this method will produce an exception if the WebAssembly function returns multiple values.
$exit_code = OBJ->run_wasi( @ARGV )
A WASI-specific variant of call()
. Calls WASI’s start function (as of this writing, always _start
) with the given @ARGV list (byte strings).
Returns the WASI exit code.
@types = OBJ->get_function_arguments( $FUNCTION_NAME )
Returns a list of the named function’s argument types, as TYPE_* constants. (cf. Wasm::Wasm3)
@types = OBJ->get_function_returns( $FUNCTION_NAME )
Like get_function_arguments()
but for return types.
$str = OBJ->get_memory( [ $OFFSET [, $WANTLENGTH] ] )
Fetches all or part of OBJ’s WebAssembly memory buffer as a byte string. $OFFSET defaults to 0, and $WANTLENGTH defaults to the buffer’s length less $OFFSET. If $WANTLENGTH + $OFFSET exceed the buffer’s size, the returned string will contain just the content from $OFFSET to the buffer’s end.
Currently both values MUST be nonnegative.
$count = OBJ->get_memory_size()
Returns the size, in bytes of OBJ’s WebAssembly memory buffer.
$obj = OBJ->set_memory( $OFFSET, $NEW_BYTES )
Overwrites all or part of OBJ’s WebAssembly memory buffer with $NEW_BYTES. Returns OBJ.