Files
wazero/wasm/vm_local.go
2020-05-05 21:04:23 +09:00

22 lines
445 B
Go

package wasm
func getLocal(vm *VirtualMachine) {
vm.ActiveContext.PC++
id := vm.FetchUint32()
vm.OperandStack.Push(vm.ActiveContext.Locals[id])
}
func setLocal(vm *VirtualMachine) {
vm.ActiveContext.PC++
id := vm.FetchUint32()
v := vm.OperandStack.Pop()
vm.ActiveContext.Locals[id] = v
}
func teeLocal(vm *VirtualMachine) {
vm.ActiveContext.PC++
id := vm.FetchUint32()
v := vm.OperandStack.Peek()
vm.ActiveContext.Locals[id] = v
}