chore: cargo fmt

This commit is contained in:
2025-05-28 21:59:45 +08:00
parent 99dce2e778
commit f3bf44ab97
3 changed files with 48 additions and 20 deletions

View File

@@ -103,7 +103,12 @@ impl<'ctx> Helpers<'ctx> {
let call = module.add_function(
"call",
value_type.fn_type(
&[value_type.into(), value_type.into(), ptr_type.into(), ptr_type.into()],
&[
value_type.into(),
value_type.into(),
ptr_type.into(),
ptr_type.into(),
],
false,
),
None,
@@ -115,7 +120,15 @@ impl<'ctx> Helpers<'ctx> {
);
let force = module.add_function(
"force",
value_type.fn_type(&[value_type.into(), ptr_type.into(), ptr_type.into(), ptr_type.into()], false),
value_type.fn_type(
&[
value_type.into(),
ptr_type.into(),
ptr_type.into(),
ptr_type.into(),
],
false,
),
None,
);
@@ -341,7 +354,12 @@ extern "C" fn helper_lookup(sym: usize, env: *const VmEnv) -> JITValue {
val
}
extern "C" fn helper_force<'gc>(thunk: JITValue, vm: *const VM<'gc>, mc: *const Mutation<'gc>, jit: *const JITContext<'gc>) -> JITValue {
extern "C" fn helper_force<'gc>(
thunk: JITValue,
vm: *const VM<'gc>,
mc: *const Mutation<'gc>,
jit: *const JITContext<'gc>,
) -> JITValue {
if !matches!(thunk.tag, ValueTag::Thunk) {
return thunk;
}
@@ -350,10 +368,13 @@ extern "C" fn helper_force<'gc>(thunk: JITValue, vm: *const VM<'gc>, mc: *const
let mc = unsafe { mc.as_ref() }.unwrap();
let thunk = Value::from(thunk).unwrap_thunk();
if let Some(val) = thunk.get_value() {
return val.into()
return val.into();
}
let (opcodes, env) = thunk.suspend(mc).unwrap();
let func = unsafe { jit.as_ref() }.unwrap().compile_seq(opcodes.iter().copied(), vm).unwrap();
let func = unsafe { jit.as_ref() }
.unwrap()
.compile_seq(opcodes.iter().copied(), vm)
.unwrap();
let val = unsafe { func.call(env.as_ref() as *const _, mc as *const _) };
thunk.insert_value(val.into(), mc);
val