Implement BranchNegative
This commit is contained in:
parent
49ce37402e
commit
cc4166a814
1 changed files with 9 additions and 0 deletions
|
@ -765,6 +765,15 @@ impl JVM {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Instruction::BranchNegative(branch_offset) => {
|
||||||
|
let test_value = wrap_stackframe_error(class, method, frame.operand_stack.pop_int(0))?;
|
||||||
|
|
||||||
|
if test_value < 0 {
|
||||||
|
frame.instruction_pointer -= offset as u32;
|
||||||
|
frame.instruction_pointer = if branch_offset < 0 { frame.instruction_pointer - branch_offset.abs() as u32} else { frame.instruction_pointer + branch_offset.abs() as u32};
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
Instruction::BranchNonNull(branch_offset) => {
|
Instruction::BranchNonNull(branch_offset) => {
|
||||||
let test_value = wrap_stackframe_error(class, method, frame.operand_stack.pop_reference(0))?;
|
let test_value = wrap_stackframe_error(class, method, frame.operand_stack.pop_reference(0))?;
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue