chore: cargo fmt
This commit is contained in:
@@ -91,11 +91,7 @@ impl<'ctx> Helpers<'ctx> {
|
||||
let call = module.add_function(
|
||||
"call",
|
||||
value_type.fn_type(
|
||||
&[
|
||||
value_type.into(),
|
||||
value_type.into(),
|
||||
ptr_type.into(),
|
||||
],
|
||||
&[value_type.into(), value_type.into(), ptr_type.into()],
|
||||
false,
|
||||
),
|
||||
None,
|
||||
@@ -142,7 +138,7 @@ impl<'ctx> Helpers<'ctx> {
|
||||
or,
|
||||
call,
|
||||
lookup,
|
||||
force
|
||||
force,
|
||||
}
|
||||
}
|
||||
|
||||
@@ -283,7 +279,7 @@ extern "C" fn helper_eq(lhs: JITValue, rhs: JITValue) -> JITValue {
|
||||
(Int, Int) => JITValue {
|
||||
tag: Bool,
|
||||
data: JITValueData {
|
||||
bool: unsafe { lhs.data.int == rhs.data.int }
|
||||
bool: unsafe { lhs.data.int == rhs.data.int },
|
||||
},
|
||||
},
|
||||
_ => todo!(
|
||||
@@ -322,7 +318,9 @@ extern "C" fn helper_call<'jit, 'vm>(
|
||||
match func.tag {
|
||||
Function => {
|
||||
let func: Value = func.into();
|
||||
func.call(unsafe { vm.as_ref() }.unwrap(), vec![arg.into()]).unwrap().into()
|
||||
func.call(unsafe { vm.as_ref() }.unwrap(), vec![arg.into()])
|
||||
.unwrap()
|
||||
.into()
|
||||
}
|
||||
_ => todo!(),
|
||||
}
|
||||
@@ -332,7 +330,6 @@ extern "C" fn helper_call<'jit, 'vm>(
|
||||
extern "C" fn helper_lookup<'jit, 'vm>(sym: usize, env: *const LetEnv<'jit, 'vm>) -> JITValue {
|
||||
let env = unsafe { env.as_ref() }.unwrap();
|
||||
let val = env.lookup(sym);
|
||||
dbg!(val.as_ref().unwrap().typename());
|
||||
val.unwrap().into()
|
||||
}
|
||||
|
||||
|
||||
@@ -76,14 +76,14 @@ impl From<Value<'_, '_>> for JITValue {
|
||||
Value::Func(func) => JITValue {
|
||||
tag: ValueTag::Function,
|
||||
data: JITValueData {
|
||||
ptr: Rc::into_raw(func) as *const _
|
||||
}
|
||||
ptr: Rc::into_raw(func) as *const _,
|
||||
},
|
||||
},
|
||||
Value::Thunk(thunk) => JITValue {
|
||||
tag: ValueTag::Thunk,
|
||||
data: JITValueData {
|
||||
ptr: Rc::into_raw(thunk) as *const _
|
||||
}
|
||||
ptr: Rc::into_raw(thunk) as *const _,
|
||||
},
|
||||
},
|
||||
_ => todo!(),
|
||||
}
|
||||
@@ -371,13 +371,23 @@ impl<'vm, 'ctx: 'vm> JITContext<'ctx> {
|
||||
for _ in 0..arity {
|
||||
args.insert(0, stack.pop());
|
||||
}
|
||||
let func = self.builder
|
||||
.build_direct_call(self.helpers.force, &[stack.pop().into(), self.new_ptr(vm).into()], "force")?
|
||||
let func = self
|
||||
.builder
|
||||
.build_direct_call(
|
||||
self.helpers.force,
|
||||
&[stack.pop().into(), self.new_ptr(vm).into()],
|
||||
"force",
|
||||
)?
|
||||
.try_as_basic_value()
|
||||
.left()
|
||||
.unwrap();
|
||||
let ret = self.builder
|
||||
.build_direct_call(self.helpers.call, &[func.into(), args[0].into(), self.new_ptr(vm).into()], "call")?
|
||||
let ret = self
|
||||
.builder
|
||||
.build_direct_call(
|
||||
self.helpers.call,
|
||||
&[func.into(), args[0].into(), self.new_ptr(vm).into()],
|
||||
"call",
|
||||
)?
|
||||
.try_as_basic_value()
|
||||
.left()
|
||||
.unwrap();
|
||||
|
||||
Reference in New Issue
Block a user