wasm_interp: implement call and return instructions

This commit is contained in:
Brian Carroll 2022-11-22 20:54:33 +00:00
parent 57aa3aafd8
commit 972d9dbb19
No known key found for this signature in database
GPG key ID: 5C7B2EC4101703C0
5 changed files with 75 additions and 32 deletions

View file

@ -78,10 +78,17 @@ impl<'a> ExecutionState<'a> {
todo!("{:?}", op_code);
}
RETURN => {
todo!("{:?}", op_code);
self.program_counter = self.call_stack.pop_frame() as usize;
}
CALL => {
todo!("{:?}", op_code);
let index = self.fetch_immediate_u32(module) as usize;
let return_addr = self.program_counter as u32;
self.program_counter = module.code.function_offsets[index] as usize;
self.call_stack.push_frame(
return_addr,
&module.code.bytes,
&mut self.program_counter,
)
}
CALLINDIRECT => {
todo!("{:?}", op_code);