fix: Complete JIT/Cranelift archival cleanup for Phase 15

- Create JIT stub module with minimal compatibility layer
- Archive JIT-direct execution mode with helpful error message
- Fix remaining JIT references in config, runtime, and backend modules
- Resolve compilation errors preventing Phase 15 development
- All JIT functionality now properly archived to archive/jit-cranelift/

🎯 Phase 15 compilation now succeeds - ready for selfhosting debug

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
Selfhosting Dev
2025-09-23 02:26:33 +09:00
parent a60d840b47
commit 10f272a460
9 changed files with 189 additions and 32 deletions

View File

@ -103,20 +103,22 @@ fn strip_phi_functions(f: &mut MirFunction) {
fn lower_break_stmt(f: &mut MirFunction, cur_bb: BasicBlockId, exit_bb: BasicBlockId) {
jump_with_pred(f, cur_bb, exit_bb);
crate::jit::events::emit_lower(
serde_json::json!({ "id": "loop_break","exit_bb": exit_bb.0,"decision": "lower" }),
"loop",
"<json_v0>",
);
// ARCHIVED: JIT events moved to archive/jit-cranelift/ during Phase 15
// crate::jit::events::emit_lower(
// serde_json::json!({ "id": "loop_break","exit_bb": exit_bb.0,"decision": "lower" }),
// "loop",
// "<json_v0>",
// );
}
fn lower_continue_stmt(f: &mut MirFunction, cur_bb: BasicBlockId, cond_bb: BasicBlockId) {
jump_with_pred(f, cur_bb, cond_bb);
crate::jit::events::emit_lower(
serde_json::json!({ "id": "loop_continue","cond_bb": cond_bb.0,"decision": "lower" }),
"loop",
"<json_v0>",
);
// ARCHIVED: JIT events moved to archive/jit-cranelift/ during Phase 15
// crate::jit::events::emit_lower(
// serde_json::json!({ "id": "loop_continue","cond_bb": cond_bb.0,"decision": "lower" }),
// "loop",
// "<json_v0>",
// );
}

View File

@ -232,11 +232,12 @@ pub(super) fn lower_expr_with_scope<S: VarScope>(
});
}
}
crate::jit::events::emit_lower(
serde_json::json!({ "id":"shortcircuit","op": if is_and {"and"} else {"or"},"rhs_bb":rhs_bb.0,"fall_bb":fall_bb.0,"merge_bb":merge_bb.0 }),
"shortcircuit",
"<json_v0>",
);
// ARCHIVED: JIT events moved to archive/jit-cranelift/ during Phase 15
// crate::jit::events::emit_lower(
// serde_json::json!({ "id":"shortcircuit","op": if is_and {"and"} else {"or"},"rhs_bb":rhs_bb.0,"fall_bb":fall_bb.0,"merge_bb":merge_bb.0 }),
// "shortcircuit",
// "<json_v0>",
// );
let cdst = f.next_value_id();
if let Some(bb) = f.get_block_mut(fall_bb) {
let cval = if is_and {

View File

@ -293,7 +293,15 @@ impl NyashRunner {
impl NyashRunner {
/// Run a file through independent JIT engine (no VM execute loop)
/// ARCHIVED: JIT/Cranelift functionality disabled for Phase 15
fn run_file_jit_direct(&self, filename: &str) {
eprintln!("❌ JIT-direct mode is archived for Phase 15. JIT/Cranelift moved to archive/jit-cranelift/");
eprintln!(" Use VM backend instead: nyash {}", filename);
eprintln!(" Or use LLVM backend: nyash --backend llvm {}", filename);
std::process::exit(1);
// Original JIT implementation archived - commented out for Phase 15
/*
use nyash_rust::{mir::MirCompiler, parser::NyashParser};
use std::fs;
// Small helper for unified error output (text or JSON)
@ -653,6 +661,7 @@ impl NyashRunner {
std::process::exit(1);
}
}
*/ // End of archived JIT implementation
}
}