optimize: enable lto

This commit is contained in:
2025-05-22 19:49:14 +08:00
parent 6bb86ca2cf
commit b0b73439fd
2 changed files with 12 additions and 2 deletions

View File

@@ -135,9 +135,13 @@ pub struct JITContext<'ctx> {
impl<'vm, 'ctx: 'vm> JITContext<'ctx> {
pub fn new(context: &'ctx Context) -> Self {
// force linker to link JIT engine
unsafe {
inkwell::llvm_sys::execution_engine::LLVMLinkInMCJIT();
}
let module = context.create_module("nixjit");
let execution_engine = module
.create_jit_execution_engine(OptimizationLevel::Default)
.create_jit_execution_engine(OptimizationLevel::Aggressive)
.unwrap();
let helpers = Helpers::new(context, &module, &execution_engine);