optimize: make all call single arg
to allow more aggressive optimization
This commit is contained in:
@@ -392,23 +392,8 @@ impl<'vm, 'ctx: 'vm> JITContext<'ctx> {
|
||||
.left()
|
||||
.unwrap(),
|
||||
)?,
|
||||
OpCode::Call { arity } => {
|
||||
let args = self.builder.build_array_malloc(
|
||||
self.helpers.value_type,
|
||||
self.helpers.int_type.const_int(arity as u64, false),
|
||||
"malloc_args",
|
||||
)?;
|
||||
for i in 0..arity {
|
||||
let ptr = unsafe {
|
||||
self.builder.build_in_bounds_gep(
|
||||
self.helpers.value_type,
|
||||
args,
|
||||
&[self.helpers.int_type.const_int(i as u64, false)],
|
||||
"gep_arg",
|
||||
)?
|
||||
};
|
||||
self.builder.build_store(ptr, stack.pop())?;
|
||||
}
|
||||
OpCode::Call => {
|
||||
let arg = stack.pop();
|
||||
let func = self
|
||||
.builder
|
||||
.build_direct_call(
|
||||
@@ -425,11 +410,7 @@ impl<'vm, 'ctx: 'vm> JITContext<'ctx> {
|
||||
self.helpers.call,
|
||||
&[
|
||||
func.into(),
|
||||
args.into(),
|
||||
self.helpers
|
||||
.ptr_int_type
|
||||
.const_int(arity as u64, false)
|
||||
.into(),
|
||||
arg.into(),
|
||||
self.new_ptr(vm).into(),
|
||||
],
|
||||
"call",
|
||||
|
||||
Reference in New Issue
Block a user