wasm_interp: Imeplement load instructions

This commit is contained in:
Brian Carroll 2022-11-25 10:13:13 +00:00
parent 85d5f3d109
commit c6bf34dd78
No known key found for this signature in database
GPG key ID: 5C7B2EC4101703C0
2 changed files with 116 additions and 14 deletions

View file

@ -103,6 +103,18 @@ impl<'a> ValueStack<'a> {
}
}
/// Memory addresses etc
pub fn pop_u32(&mut self) -> u32 {
match (self.is_float.pop(), self.is_64.pop()) {
(Some(false), Some(false)) => pop_bytes!(u32, self.bytes),
(Some(is_float), Some(is_64)) => panic!(
"Expected I32 but found {:?}",
type_from_flags(is_float, is_64)
),
_ => panic!("Expected I32 but value stack was empty"),
}
}
pub fn pop_i32(&mut self) -> i32 {
match (self.is_float.pop(), self.is_64.pop()) {
(Some(false), Some(false)) => pop_bytes!(i32, self.bytes),