wasm_interp: Fix bug where all arguments were being set as I32

This commit is contained in:
Brian Carroll 2022-12-06 20:23:34 +00:00
parent 1b126d3b58
commit 4cf5d19ace
No known key found for this signature in database
GPG Key ID: 5C7B2EC4101703C0

View File

@ -74,8 +74,18 @@ impl<'a> CallStack<'a> {
// Pop arguments off the value stack and into locals
for (i, type_byte) in arg_type_bytes.iter().copied().enumerate().rev() {
let arg = value_stack.pop();
assert_eq!(ValueType::from(arg), ValueType::from(type_byte));
let ty = ValueType::from(arg);
let expected_type = ValueType::from(type_byte);
assert_eq!(ty, expected_type);
self.set_local_help(i as u32, arg);
self.is_64.set(
frame_offset + i,
matches!(ty, ValueType::I64 | ValueType::F64),
);
self.is_float.set(
frame_offset + i,
matches!(ty, ValueType::F32 | ValueType::F64),
);
}
self.value_stack_bases.push(value_stack.len() as u32);