minor changes
This commit is contained in:
+9
-7
@@ -422,12 +422,10 @@ impl<C: VmContext> Vm<C> {
|
||||
self.fuel -= 1;
|
||||
|
||||
let byte = self.ctx.bytecode()[self.pc];
|
||||
if likely_stable::unlikely(!(0..Op::Illegal as u8).contains(&byte)) {
|
||||
if !likely_stable::likely((0..Op::Illegal as u8).contains(&byte)) {
|
||||
panic!("unknown opcode: {byte:#04x}")
|
||||
}
|
||||
let op = unsafe {
|
||||
std::mem::transmute::<u8, Op>(byte)
|
||||
};
|
||||
let op = unsafe { std::mem::transmute::<u8, Op>(byte) };
|
||||
// let Ok(op) = Op::try_from_primitive(self.ctx.bytecode()[self.pc])
|
||||
// .map_err(|err| panic!("unknown opcode: {:#04x}", err.number));
|
||||
self.pc += 1;
|
||||
@@ -1105,7 +1103,7 @@ impl<C: VmContext> Vm<C> {
|
||||
return self.handle_return();
|
||||
}
|
||||
|
||||
Illegal => unreachable!()
|
||||
Illegal => unreachable!(),
|
||||
}
|
||||
|
||||
Action::Continue
|
||||
@@ -1294,13 +1292,13 @@ impl<C: VmContext> Vm<C> {
|
||||
#[inline]
|
||||
fn force_tos(&mut self) -> Action {
|
||||
loop {
|
||||
let (run, target_depth) = self.arena.mutate_root(|_mc, root| {
|
||||
let (run, target_depth) = self.arena.mutate_root(|mc, root| {
|
||||
let thunk = root.stack.tos_mut().expect("stack underflow");
|
||||
|
||||
let Some(thunk_state) = thunk.as_gc::<Thunk>() else {
|
||||
return (false, 0);
|
||||
};
|
||||
match *thunk_state.borrow() {
|
||||
let ret = match *thunk_state.borrow() {
|
||||
ThunkState::Pending { ip, env, with_env } => {
|
||||
root.frames
|
||||
.push(CallFrame {
|
||||
@@ -1320,7 +1318,11 @@ impl<C: VmContext> Vm<C> {
|
||||
(false, 0)
|
||||
}
|
||||
ThunkState::Blackhole => todo!("force_tos"),
|
||||
};
|
||||
if ret.0 {
|
||||
*thunk_state.borrow_mut(mc) = ThunkState::Blackhole;
|
||||
}
|
||||
ret
|
||||
});
|
||||
if likely_stable::likely(!run) {
|
||||
return Action::Continue;
|
||||
|
||||
+1
-3
@@ -384,9 +384,7 @@ impl<'gc> Deref for AttrSet<'gc> {
|
||||
}
|
||||
|
||||
impl<'gc> AttrSet<'gc> {
|
||||
pub(crate) fn from_sorted_unchecked(
|
||||
entries: SmallVec<[(StringId, Value<'gc>); 4]>,
|
||||
) -> Self {
|
||||
pub(crate) fn from_sorted_unchecked(entries: SmallVec<[(StringId, Value<'gc>); 4]>) -> Self {
|
||||
debug_assert!(entries.is_sorted_by_key(|(key, _)| *key));
|
||||
Self { entries }
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user