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