📚 Phase 11 documentation: Everything is Box × MIR15 revolution
Key updates: - Document MIR 26→15 instruction reduction plan (transitioning status) - Add Core-15 target instruction set in INSTRUCTION_SET.md - Save AI conference analyses validating Box Theory and 15-instruction design - Create MIR annotation system proposal for optimization hints - Update SKIP_PHASE_10_DECISION.md with LLVM direct migration rationale Technical insights: - RefNew/RefGet/RefSet can be eliminated through Box unification - GC/sync/async all achievable with 15 core instructions - BoxCall lowering can automatically insert GC barriers - 2-3x performance improvement expected with LLVM - Build time reduction 50%, binary size reduction 40% Status: Design complete, implementation pending
This commit is contained in:
@ -145,6 +145,30 @@ impl JitEngine {
|
||||
return Some(h);
|
||||
}
|
||||
// If Cranelift path did not produce a closure, treat as not compiled
|
||||
// Even if a closure was not produced, attempt AOT object emission when requested
|
||||
if let Ok(path) = std::env::var("NYASH_AOT_OBJECT_OUT") {
|
||||
if !path.is_empty() {
|
||||
let mut lower2 = crate::jit::lower::core::LowerCore::new();
|
||||
let mut objb = crate::jit::lower::builder::ObjectBuilder::new();
|
||||
match lower2.lower_function(mir, &mut objb) {
|
||||
Err(e) => eprintln!("[AOT] lower failed for {}: {}", func_name, e),
|
||||
Ok(()) => {
|
||||
if let Some(bytes) = objb.take_object_bytes() {
|
||||
use std::path::Path;
|
||||
let p = Path::new(&path);
|
||||
let out_path = if p.is_dir() || path.ends_with('/') { p.join(format!("{}.o", func_name)) } else { p.to_path_buf() };
|
||||
if let Some(parent) = out_path.parent() { let _ = std::fs::create_dir_all(parent); }
|
||||
match std::fs::write(&out_path, bytes) {
|
||||
Ok(_) => eprintln!("[AOT] wrote object: {}", out_path.display()),
|
||||
Err(e) => eprintln!("[AOT] failed to write object {}: {}", out_path.display(), e),
|
||||
}
|
||||
} else {
|
||||
eprintln!("[AOT] no object bytes available for {}", func_name);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return None;
|
||||
}
|
||||
#[cfg(not(feature = "cranelift-jit"))]
|
||||
|
||||
Reference in New Issue
Block a user