Skip to content

Commit 3c8cfcf

Browse files
JonaZz747liketechnik
authored andcommitted
feat(executor/opcodes): support Dcmp, Fcmp, Lcmp
1 parent 036ead7 commit 3c8cfcf

File tree

2 files changed

+188
-98
lines changed

2 files changed

+188
-98
lines changed

src/executor.rs

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ use std::rc::Rc;
77

88
use thiserror::Error;
99

10+
use self::op_code::OffsetDirection;
1011
pub use crate::executor::op_code::OpCode;
1112
use crate::{
1213
class::{
@@ -21,8 +22,6 @@ use crate::{
2122
heap::Heap,
2223
};
2324

24-
use self::op_code::OffsetDirection;
25-
2625
pub struct ExecutorFrame {
2726
frame: Frame,
2827
pc: ProgramCounter,
@@ -121,12 +120,12 @@ pub fn run(code: &Code, heap: &mut Heap) {
121120
};
122121
current_pc.next(1).unwrap();
123122
},
124-
Update::GoTo(offset, direction) => {
125-
match direction {
126-
OffsetDirection::Forward => current_pc.next(offset).unwrap(),
127-
OffsetDirection::Backward => current_pc.previous(offset).unwrap(),
128-
}
129-
}
123+
Update::GoTo(offset, direction) => match direction {
124+
OffsetDirection::Forward => current_pc.next(offset).unwrap(),
125+
OffsetDirection::Backward => {
126+
current_pc.previous(offset).unwrap()
127+
},
128+
},
130129
}
131130
}
132131
}

0 commit comments

Comments
 (0)