mirror of
https://github.com/roc-lang/roc.git
synced 2025-10-02 08:11:12 +00:00
wasm_interp: implement select
instruction
This commit is contained in:
parent
9e7a92574d
commit
ae2e561945
2 changed files with 63 additions and 3 deletions
|
@ -418,7 +418,14 @@ impl<'a> ExecutionState<'a> {
|
|||
DROP => {
|
||||
self.value_stack.pop();
|
||||
}
|
||||
SELECT => todo!("{:?} @ {:#x}", op_code, file_offset),
|
||||
SELECT => {
|
||||
let c = self.value_stack.pop_i32();
|
||||
let val2 = self.value_stack.pop();
|
||||
let val1 = self.value_stack.pop();
|
||||
assert_eq!(ValueType::from(val1), ValueType::from(val2));
|
||||
let result = if c != 0 { val1 } else { val2 };
|
||||
self.value_stack.push(result);
|
||||
}
|
||||
GETLOCAL => {
|
||||
let index = self.fetch_immediate_u32(module);
|
||||
let value = self.call_stack.get_local(index);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue