optimize: make all call single arg

to allow more aggressive optimization
This commit is contained in:
2025-05-23 09:21:40 +08:00
parent f380e5fd70
commit 53cbb37b00
8 changed files with 60 additions and 101 deletions

View File

@@ -95,8 +95,7 @@ impl<'ctx> Helpers<'ctx> {
value_type.fn_type(
&[
value_type.into(),
ptr_type.into(),
ptr_int_type.into(),
value_type.into(),
ptr_type.into(),
],
false,
@@ -317,21 +316,16 @@ extern "C" fn helper_or(lhs: JITValue, rhs: JITValue) -> JITValue {
extern "C" fn helper_call<'jit>(
func: JITValue,
args: *mut JITValue,
arity: usize,
arg: JITValue,
vm: *const VM<'jit>,
) -> JITValue {
use ValueTag::*;
let args = unsafe { Vec::from_raw_parts(args, arity, arity) }
.into_iter()
.map(Value::from)
.collect();
match func.tag {
Function => {
let func: Value = func.into();
func.call(unsafe { vm.as_ref() }.unwrap(), args)
.unwrap()
.into()
let mut func: Value = func.into();
func.call(unsafe { vm.as_ref() }.unwrap(), arg.into())
.unwrap();
func.into()
}
_ => todo!(),
}