optimize: remove {StepResult,TailResult}::ForceThunk

This commit is contained in:
2026-04-20 15:10:55 +08:00
parent 98b07f00e4
commit 520bb7d75e
12 changed files with 132 additions and 188 deletions
+11 -11
View File
@@ -13,7 +13,7 @@ impl<'gc> crate::Vm<'gc> {
ctx: &mut impl crate::VmContext,
reader: &mut BytecodeReader<'_>,
mc: &gc_arena::Mutation<'gc>,
) -> StepResult<'gc> {
) -> StepResult {
let count = reader.read_u32() as usize;
let mut entries: SmallVec<[AttrEntry; 4]> = SmallVec::with_capacity(count);
for _ in 0..count {
@@ -42,7 +42,7 @@ impl<'gc> crate::Vm<'gc> {
}
#[inline(always)]
pub(crate) fn op_make_empty_attrs(&mut self) -> StepResult<'gc> {
pub(crate) fn op_make_empty_attrs(&mut self) -> StepResult {
self.push_stack(self.empty_attrs);
StepResult::Continue
}
@@ -53,11 +53,11 @@ impl<'gc> crate::Vm<'gc> {
ctx: &mut impl crate::VmContext,
reader: &mut BytecodeReader<'_>,
mc: &gc_arena::Mutation<'gc>,
) -> StepResult<'gc> {
) -> StepResult {
let _span_id = reader.read_u32();
let key = reader.read_string_id();
if let Some(step) = self.try_force_resolved(0, reader.inst_start_pc(), mc) {
if let Some(step) = self.try_force(0, reader, mc) {
return step;
}
@@ -98,13 +98,13 @@ impl<'gc> crate::Vm<'gc> {
ctx: &mut impl crate::VmContext,
reader: &mut BytecodeReader<'_>,
mc: &gc_arena::Mutation<'gc>,
) -> StepResult<'gc> {
) -> StepResult {
let _span_id = reader.read_u32();
if let Some(step) = self.try_force_resolved(0, reader.inst_start_pc(), mc) {
if let Some(step) = self.try_force(0, reader, mc) {
return step;
}
if let Some(step) = self.try_force_resolved(1, reader.inst_start_pc(), mc) {
if let Some(step) = self.try_force(1, reader, mc) {
return step;
}
@@ -143,14 +143,14 @@ impl<'gc> crate::Vm<'gc> {
pub(crate) fn op_jump_if_select_succeeded(
&mut self,
reader: &mut BytecodeReader<'_>,
) -> StepResult<'gc> {
) -> StepResult {
let offset = reader.read_i32();
reader.set_pc(((reader.pc() as isize) + (offset as isize)) as usize);
StepResult::Continue
}
#[inline(always)]
pub(crate) fn op_has_attr(&mut self, reader: &mut BytecodeReader<'_>) -> StepResult<'gc> {
pub(crate) fn op_has_attr(&mut self, reader: &mut BytecodeReader<'_>) -> StepResult {
let _n = reader.read_u16() as usize;
todo!("HasAttr");
}
@@ -161,7 +161,7 @@ impl<'gc> crate::Vm<'gc> {
ctx: &mut impl crate::VmContext,
reader: &mut BytecodeReader<'_>,
mc: &gc_arena::Mutation<'gc>,
) -> StepResult<'gc> {
) -> StepResult {
let count = reader.read_u32() as usize;
let mut items: SmallVec<[Value; 4]> = SmallVec::with_capacity(count);
for _ in 0..count {
@@ -173,7 +173,7 @@ impl<'gc> crate::Vm<'gc> {
}
#[inline(always)]
pub(crate) fn op_make_empty_list(&mut self) -> StepResult<'gc> {
pub(crate) fn op_make_empty_list(&mut self) -> StepResult {
self.push_stack(self.empty_list);
StepResult::Continue
}