MCPcopy Index your code
hub / github.com/explodingcamera/tinywasm / exec_global_set_32

Method exec_global_set_32

crates/tinywasm/src/interpreter/executor.rs:1233–1242  ·  view source on GitHub ↗
(&mut self, global_index: u32)

Source from the content-addressed store, hash-verified

1231 }
1232
1233 fn exec_global_set_32(&mut self, global_index: u32) {
1234 let global_addr = self.module.resolve_global_addr(global_index);
1235 let raw = <Value32>::stack_pop(&mut self.store.value_stack);
1236 let value = match self.store.state.get_global(global_addr).ty.ty {
1237 WasmType::I32 | WasmType::F32 => TinyWasmValue::Value32(raw),
1238 WasmType::RefExtern | WasmType::RefFunc => TinyWasmValue::ValueRef(ValueRef::from_raw(raw)),
1239 WasmType::I64 | WasmType::F64 | WasmType::V128 => unreachable!("invalid global.set.32 target type"),
1240 };
1241 self.store.state.set_global_val(global_addr, value);
1242 }
1243
1244 fn exec_const<T: InternalValue>(&mut self, val: T) -> Result<(), Trap> {
1245 self.store.value_stack.push(val)

Callers 1

execMethod · 0.80

Calls 4

ValueRefClass · 0.85
resolve_global_addrMethod · 0.80
get_globalMethod · 0.80
set_global_valMethod · 0.80

Tested by

no test coverage detected