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

@@ -11,9 +11,15 @@ name = "repl"
required-features = ["repl"]
[profile.perf]
debug = 1
debug = 2
strip = false
inherits = "release"
[profile.release]
lto = true
codegen-units = 1
strip = true
[dependencies]
rnix = "0.12"
thiserror = "2.0"

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);