Step -> ControlFlow (use ?)

This commit is contained in:
2026-04-21 09:31:41 +08:00
parent 11b0b8a78e
commit b31c2a4906
11 changed files with 86 additions and 128 deletions
+5 -9
View File
@@ -8,14 +8,12 @@ impl<'gc> crate::Vm<'gc> {
mc: &gc_arena::Mutation<'gc>,
) -> Step {
let offset = reader.read_i32();
if let Some(step) = self.try_force(0, reader, mc) {
return step;
}
self.try_force(0, reader, mc)?;
let cond = self.pop();
if cond.as_inline::<bool>() == Some(false) {
reader.set_pc(((reader.pc() as isize) + (offset as isize)) as usize);
}
Step::Continue
Step::Continue(())
}
#[inline(always)]
@@ -25,21 +23,19 @@ impl<'gc> crate::Vm<'gc> {
mc: &gc_arena::Mutation<'gc>,
) -> Step {
let offset = reader.read_i32();
if let Some(step) = self.try_force(0, reader, mc) {
return step;
}
self.try_force(0, reader, mc)?;
let cond = self.pop();
if cond.as_inline::<bool>() == Some(true) {
reader.set_pc(((reader.pc() as isize) + (offset as isize)) as usize);
}
Step::Continue
Step::Continue(())
}
#[inline(always)]
pub(crate) fn op_jump(&mut self, reader: &mut BytecodeReader<'_>) -> Step {
let offset = reader.read_i32();
reader.set_pc(((reader.pc() as isize) + (offset as isize)) as usize);
Step::Continue
Step::Continue(())
}
#[inline(always)]