Function wasm::execution::const_interpreter_loop::run_const
source · pub(crate) fn run_const(
wasm: WasmReader<'_>,
stack: &mut Stack,
_imported_globals: ()
)
Expand description
Execute a previosly-validated constant expression. These type of expressions are used for initializing global variables.
§Arguments
wasm
- a WasmReader whose program counter is set at the beginning of the constant expression. Reader will be consumed.stack
- a Stack. It is preferrable for it to be clean, but that is not required. As long as the executed code is validated, the values on this stack will remain the same except for the addition of the return value of this code sequence. A global’s final value can be popped off the top of the stack.imported_globals
(TODO) - instances of all imported globals. They are required as local globals can reference imported globals in their initialization.
§Safety
This function assumes that the expression has been validated. Passing unvalidated code will likely result in a panic, or undefined behaviour.
§Note
The following instructions are not yet supported:
ref.null
ref.func
global.get