mirror of
https://github.com/roc-lang/roc.git
synced 2025-10-03 16:44:33 +00:00
wasm_interp: implement call
and return
instructions
This commit is contained in:
parent
57aa3aafd8
commit
972d9dbb19
5 changed files with 75 additions and 32 deletions
|
@ -642,6 +642,22 @@ impl From<u8> for ValueType {
|
|||
}
|
||||
}
|
||||
|
||||
impl Parse<()> for ValueType {
|
||||
fn parse(_: (), bytes: &[u8], cursor: &mut usize) -> Result<Self, ParseError> {
|
||||
let byte = u8::parse((), bytes, cursor)?;
|
||||
Ok(ValueType::from(byte))
|
||||
}
|
||||
}
|
||||
|
||||
// A group of local variable declarations
|
||||
impl Parse<()> for (u32, ValueType) {
|
||||
fn parse(_: (), bytes: &[u8], cursor: &mut usize) -> Result<Self, ParseError> {
|
||||
let count = u32::parse((), bytes, cursor)?;
|
||||
let ty = ValueType::parse((), bytes, cursor)?;
|
||||
Ok((count, ty))
|
||||
}
|
||||
}
|
||||
|
||||
/// Wasm memory alignment for load/store instructions.
|
||||
/// Rust representation matches Wasm encoding.
|
||||
/// It's an error to specify alignment higher than the "natural" alignment of the instruction
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue