feat(jit): fix segfault

This commit is contained in:
2025-05-18 17:07:49 +08:00
parent f98d623c13
commit af5a312e1e
10 changed files with 115 additions and 111 deletions

View File

@@ -1,7 +1,7 @@
use inkwell::AddressSpace;
use inkwell::context::Context;
use inkwell::execution_engine::ExecutionEngine;
use inkwell::module::{Linkage, Module};
use inkwell::module::Module;
use inkwell::types::{FloatType, FunctionType, IntType, PointerType, StructType};
use inkwell::values::{BasicValueEnum, FunctionValue};
@@ -194,7 +194,9 @@ extern "C" fn helper_add(lhs: JITValue, rhs: JITValue) -> JITValue {
}
#[unsafe(no_mangle)]
extern "C" fn helper_call(vm: *const VM<'_>, env: *const Env<'_>, func_ptr: *const (), arg: JITValue) -> JITValue {
extern "C" fn helper_call<'jit, 'vm>(vm: *const VM<'jit>, env: *const Env<'jit, 'vm>, func_ptr: *const (), arg: JITValue) -> JITValue {
let func: JITFunc = unsafe { std::mem::transmute(func_ptr) };
func(vm, env, arg)
unsafe {
func(vm, env, arg)
}
}