optimize: remove {StepResult,TailResult}::ForceThunk
This commit is contained in:
@@ -11,11 +11,11 @@ impl<'gc> crate::Vm<'gc> {
|
||||
ctx: &mut impl crate::VmContext,
|
||||
reader: &mut BytecodeReader<'_>,
|
||||
mc: &Mutation<'gc>,
|
||||
) -> StepResult<'gc> {
|
||||
if let Some(step) = self.try_force_resolved(1, reader.inst_start_pc(), mc) {
|
||||
) -> StepResult {
|
||||
if let Some(step) = self.try_force(1, reader, mc) {
|
||||
return step;
|
||||
}
|
||||
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;
|
||||
}
|
||||
let rhs = self.pop_stack_forced();
|
||||
@@ -43,8 +43,8 @@ impl<'gc> crate::Vm<'gc> {
|
||||
&mut self,
|
||||
reader: &mut BytecodeReader<'_>,
|
||||
mc: &Mutation<'gc>,
|
||||
) -> StepResult<'gc> {
|
||||
self.op_arith(mc, i64::wrapping_sub, |a, b| a - b, reader.inst_start_pc())
|
||||
) -> StepResult {
|
||||
self.op_arith(reader, mc, i64::wrapping_sub, |a, b| a - b)
|
||||
}
|
||||
|
||||
#[inline(always)]
|
||||
@@ -52,22 +52,22 @@ impl<'gc> crate::Vm<'gc> {
|
||||
&mut self,
|
||||
reader: &mut BytecodeReader<'_>,
|
||||
mc: &Mutation<'gc>,
|
||||
) -> StepResult<'gc> {
|
||||
self.op_arith(mc, i64::wrapping_mul, |a, b| a * b, reader.inst_start_pc())
|
||||
) -> StepResult {
|
||||
self.op_arith(reader, mc, i64::wrapping_mul, |a, b| a * b)
|
||||
}
|
||||
|
||||
#[inline(always)]
|
||||
fn op_arith(
|
||||
&mut self,
|
||||
reader: &mut BytecodeReader<'_>,
|
||||
mc: &Mutation<'gc>,
|
||||
int_op: fn(i64, i64) -> i64,
|
||||
float_op: fn(f64, f64) -> f64,
|
||||
inst_start_pc: usize,
|
||||
) -> StepResult<'gc> {
|
||||
if let Some(step) = self.try_force_resolved(1, inst_start_pc, mc) {
|
||||
) -> StepResult {
|
||||
if let Some(step) = self.try_force(1, reader, mc) {
|
||||
return step;
|
||||
}
|
||||
if let Some(step) = self.try_force_resolved(0, inst_start_pc, mc) {
|
||||
if let Some(step) = self.try_force(0, reader, mc) {
|
||||
return step;
|
||||
}
|
||||
let rhs = self.pop_stack_forced();
|
||||
@@ -87,11 +87,11 @@ impl<'gc> crate::Vm<'gc> {
|
||||
&mut self,
|
||||
reader: &mut BytecodeReader<'_>,
|
||||
mc: &Mutation<'gc>,
|
||||
) -> StepResult<'gc> {
|
||||
if let Some(step) = self.try_force_resolved(1, reader.inst_start_pc(), mc) {
|
||||
) -> StepResult {
|
||||
if let Some(step) = self.try_force(1, reader, mc) {
|
||||
return step;
|
||||
}
|
||||
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;
|
||||
}
|
||||
let rhs = self.pop_stack_forced();
|
||||
@@ -120,11 +120,11 @@ impl<'gc> crate::Vm<'gc> {
|
||||
ctx: &mut impl crate::VmContext,
|
||||
reader: &mut BytecodeReader<'_>,
|
||||
mc: &Mutation<'gc>,
|
||||
) -> StepResult<'gc> {
|
||||
if let Some(step) = self.try_force_resolved(1, reader.inst_start_pc(), mc) {
|
||||
) -> StepResult {
|
||||
if let Some(step) = self.try_force(1, reader, mc) {
|
||||
return step;
|
||||
}
|
||||
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;
|
||||
}
|
||||
let eq = match self.values_equal(ctx) {
|
||||
@@ -141,11 +141,11 @@ impl<'gc> crate::Vm<'gc> {
|
||||
ctx: &mut impl crate::VmContext,
|
||||
reader: &mut BytecodeReader<'_>,
|
||||
mc: &Mutation<'gc>,
|
||||
) -> StepResult<'gc> {
|
||||
if let Some(step) = self.try_force_resolved(1, reader.inst_start_pc(), mc) {
|
||||
) -> StepResult {
|
||||
if let Some(step) = self.try_force(1, reader, mc) {
|
||||
return step;
|
||||
}
|
||||
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;
|
||||
}
|
||||
let eq = match self.values_equal(ctx) {
|
||||
@@ -162,7 +162,7 @@ impl<'gc> crate::Vm<'gc> {
|
||||
ctx: &mut impl crate::VmContext,
|
||||
reader: &mut BytecodeReader<'_>,
|
||||
mc: &Mutation<'gc>,
|
||||
) -> StepResult<'gc> {
|
||||
) -> StepResult {
|
||||
self.compare_values(ctx, reader, mc, Ordering::is_lt)
|
||||
}
|
||||
|
||||
@@ -172,7 +172,7 @@ impl<'gc> crate::Vm<'gc> {
|
||||
ctx: &mut impl crate::VmContext,
|
||||
reader: &mut BytecodeReader<'_>,
|
||||
mc: &Mutation<'gc>,
|
||||
) -> StepResult<'gc> {
|
||||
) -> StepResult {
|
||||
self.compare_values(ctx, reader, mc, Ordering::is_gt)
|
||||
}
|
||||
|
||||
@@ -182,7 +182,7 @@ impl<'gc> crate::Vm<'gc> {
|
||||
ctx: &mut impl crate::VmContext,
|
||||
reader: &mut BytecodeReader<'_>,
|
||||
mc: &Mutation<'gc>,
|
||||
) -> StepResult<'gc> {
|
||||
) -> StepResult {
|
||||
self.compare_values(ctx, reader, mc, Ordering::is_le)
|
||||
}
|
||||
|
||||
@@ -192,7 +192,7 @@ impl<'gc> crate::Vm<'gc> {
|
||||
ctx: &mut impl crate::VmContext,
|
||||
reader: &mut BytecodeReader<'_>,
|
||||
mc: &Mutation<'gc>,
|
||||
) -> StepResult<'gc> {
|
||||
) -> StepResult {
|
||||
self.compare_values(ctx, reader, mc, Ordering::is_ge)
|
||||
}
|
||||
|
||||
@@ -202,11 +202,11 @@ impl<'gc> crate::Vm<'gc> {
|
||||
reader: &mut BytecodeReader<'_>,
|
||||
mc: &Mutation<'gc>,
|
||||
pred: fn(Ordering) -> bool,
|
||||
) -> StepResult<'gc> {
|
||||
if let Some(step) = self.try_force_resolved(1, reader.inst_start_pc(), mc) {
|
||||
) -> StepResult {
|
||||
if let Some(step) = self.try_force(1, reader, mc) {
|
||||
return step;
|
||||
}
|
||||
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;
|
||||
}
|
||||
match self.compare_values_inner(ctx, pred) {
|
||||
@@ -220,11 +220,11 @@ impl<'gc> crate::Vm<'gc> {
|
||||
&mut self,
|
||||
reader: &mut BytecodeReader<'_>,
|
||||
mc: &Mutation<'gc>,
|
||||
) -> StepResult<'gc> {
|
||||
if let Some(step) = self.try_force_resolved(1, reader.inst_start_pc(), mc) {
|
||||
) -> StepResult {
|
||||
if let Some(step) = self.try_force(1, reader, mc) {
|
||||
return step;
|
||||
}
|
||||
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;
|
||||
}
|
||||
let rhs = self.pop_stack_forced();
|
||||
@@ -249,13 +249,13 @@ impl<'gc> crate::Vm<'gc> {
|
||||
#[inline(always)]
|
||||
pub(crate) fn op_update(
|
||||
&mut self,
|
||||
reader: &mut BytecodeReader<'_>,
|
||||
mc: &Mutation<'gc>,
|
||||
inst_start_pc: usize,
|
||||
) -> StepResult<'gc> {
|
||||
if let Some(step) = self.try_force_resolved(1, inst_start_pc, mc) {
|
||||
) -> StepResult {
|
||||
if let Some(step) = self.try_force(1, reader, mc) {
|
||||
return step;
|
||||
}
|
||||
if let Some(step) = self.try_force_resolved(0, inst_start_pc, mc) {
|
||||
if let Some(step) = self.try_force(0, reader, mc) {
|
||||
return step;
|
||||
}
|
||||
let rhs = self.pop_stack_forced();
|
||||
@@ -275,12 +275,12 @@ impl<'gc> crate::Vm<'gc> {
|
||||
}
|
||||
|
||||
#[inline(always)]
|
||||
pub(crate) fn op_neg(&mut self) -> StepResult<'gc> {
|
||||
pub(crate) fn op_neg(&mut self) -> StepResult {
|
||||
todo!("implement unary operation");
|
||||
}
|
||||
|
||||
#[inline(always)]
|
||||
pub(crate) fn op_not(&mut self) -> StepResult<'gc> {
|
||||
pub(crate) fn op_not(&mut self) -> StepResult {
|
||||
todo!("implement unary operation");
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user