Review fixes.
This commit is contained in:
parent
4ea0aee6f4
commit
b94f9f2ab7
|
@ -392,15 +392,15 @@ impl<'a, E: Externals> Interpreter<'a, E> {
|
||||||
}
|
}
|
||||||
|
|
||||||
fn run_br_table(&mut self, table: &[isa::Target]) -> Result<InstructionOutcome, TrapKind> {
|
fn run_br_table(&mut self, table: &[isa::Target]) -> Result<InstructionOutcome, TrapKind> {
|
||||||
let index: u32 = self.value_stack
|
let index: u32 = self.value_stack.pop_as();
|
||||||
.pop_as();
|
|
||||||
|
|
||||||
let dst =
|
let dst = if (index as usize) < table.len() - 1 {
|
||||||
if (index as usize) < table.len() - 1 {
|
|
||||||
table[index as usize].clone()
|
table[index as usize].clone()
|
||||||
} else {
|
} else {
|
||||||
let len = table.len();
|
table
|
||||||
table[len - 1].clone()
|
.last()
|
||||||
|
.expect("Due to validation there should be at least one label")
|
||||||
|
.clone()
|
||||||
};
|
};
|
||||||
Ok(InstructionOutcome::Branch(dst))
|
Ok(InstructionOutcome::Branch(dst))
|
||||||
}
|
}
|
||||||
|
@ -426,9 +426,7 @@ impl<'a, E: Externals> Interpreter<'a, E> {
|
||||||
context: &mut FunctionContext,
|
context: &mut FunctionContext,
|
||||||
signature_idx: u32,
|
signature_idx: u32,
|
||||||
) -> Result<InstructionOutcome, TrapKind> {
|
) -> Result<InstructionOutcome, TrapKind> {
|
||||||
let table_func_idx: u32 = self
|
let table_func_idx: u32 = self.value_stack.pop_as();
|
||||||
.value_stack
|
|
||||||
.pop_as();
|
|
||||||
let table = context
|
let table = context
|
||||||
.module()
|
.module()
|
||||||
.table_by_index(DEFAULT_TABLE_INDEX)
|
.table_by_index(DEFAULT_TABLE_INDEX)
|
||||||
|
@ -453,9 +451,7 @@ impl<'a, E: Externals> Interpreter<'a, E> {
|
||||||
}
|
}
|
||||||
|
|
||||||
fn run_drop(&mut self) -> Result<InstructionOutcome, TrapKind> {
|
fn run_drop(&mut self) -> Result<InstructionOutcome, TrapKind> {
|
||||||
let _ = self
|
let _ = self.value_stack.pop();
|
||||||
.value_stack
|
|
||||||
.pop();
|
|
||||||
Ok(InstructionOutcome::RunNextInstruction)
|
Ok(InstructionOutcome::RunNextInstruction)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -434,7 +434,7 @@ impl FunctionReader {
|
||||||
let drop_keep = drop_keep_return(
|
let drop_keep = drop_keep_return(
|
||||||
&context.locals,
|
&context.locals,
|
||||||
&context.value_stack,
|
&context.value_stack,
|
||||||
&context.frame_stack
|
&context.frame_stack,
|
||||||
);
|
);
|
||||||
context.sink.emit(isa::Instruction::Return(drop_keep));
|
context.sink.emit(isa::Instruction::Return(drop_keep));
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue