wasm_interp: pass arguments from CLI

This commit is contained in:
Brian Carroll 2022-11-26 08:48:36 +00:00
parent fa1e0a8614
commit a09fd95fd7
No known key found for this signature in database
GPG key ID: 5C7B2EC4101703C0
6 changed files with 92 additions and 36 deletions

View file

@ -258,10 +258,11 @@ impl<'a> TypeSection<'a> {
self.bytes.is_empty()
}
pub fn look_up_arg_count(&self, sig_index: u32) -> u32 {
pub fn look_up_arg_type_bytes(&self, sig_index: u32) -> &[u8] {
let mut offset = self.offsets[sig_index as usize];
offset += 1; // separator
u32::parse((), &self.bytes, &mut offset).unwrap()
let count = u32::parse((), &self.bytes, &mut offset).unwrap() as usize;
&self.bytes[offset..][..count]
}
}