Fixed CallIndirect not fetching correct arity

This commit is contained in:
Rerumu 2021-10-17 14:07:20 -04:00
parent 2b2e5b4012
commit 679ed0b961

View File

@ -239,9 +239,10 @@ impl<'a> Body<'a> {
Instruction::CallIndirect(i, t) => { Instruction::CallIndirect(i, t) => {
let index = func.var_name_of(self.reg.pop(1)); let index = func.var_name_of(self.reg.pop(1));
let name = format!("TABLE_LIST[{}][{}]", t, index); let name = format!("TABLE_LIST[{}][{}]", t, index);
let arity = m.arity_of(*i as usize); let types = m.parent.type_section().unwrap().types();
let arity = Arity::from_index(types, *i);
self.gen_call(&name, func, arity, w) self.gen_call(&name, func, &arity, w)
} }
Instruction::Drop => { Instruction::Drop => {
self.reg.pop(1); self.reg.pop(1);