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.

@types = OBJ->get_function_arguments( $FUNCTION_NAME )

Returns 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.