diff --git a/src/backend/abi_util.rs b/src/backend/abi_util.rs index 3b98eaaa..f0a33246 100644 --- a/src/backend/abi_util.rs +++ b/src/backend/abi_util.rs @@ -70,13 +70,18 @@ pub fn tag_of_vm(v: &VMValue) -> &'static str { } } -/// Wrap a NyashBox object into a handle using JIT handle registry. +/// Wrap a NyashBox object into a handle using runtime handle registry. /// This keeps a single handle mechanism across backends. -pub fn handle_of(boxref: Arc) -> Handle { - crate::jit::rt::handles::to_handle(boxref) +/// ARCHIVED: JIT handle implementation moved to archive/jit-cranelift/ during Phase 15 +pub fn handle_of(_boxref: Arc) -> Handle { + // TODO: Implement handle registry for Phase 15 VM/LLVM backends + // For now, use a simple 0-handle placeholder + 0 } /// Try to resolve a handle back to a Box object. -pub fn handle_get(h: Handle) -> Option> { - crate::jit::rt::handles::get(h) +/// ARCHIVED: JIT handle implementation moved to archive/jit-cranelift/ during Phase 15 +pub fn handle_get(_h: Handle) -> Option> { + // TODO: Implement handle registry for Phase 15 VM/LLVM backends + None } diff --git a/src/boxes/mod.rs b/src/boxes/mod.rs index 612c9b9d..8712daee 100644 --- a/src/boxes/mod.rs +++ b/src/boxes/mod.rs @@ -112,12 +112,13 @@ pub use canvas_event_box::CanvasEventBox; pub use canvas_loop_box::CanvasLoopBox; pub use console_box::ConsoleBox; pub use debug_box::DebugBox; -pub use jit_config_box::JitConfigBox; -pub use jit_events_box::JitEventsBox; -pub use jit_hostcall_registry_box::JitHostcallRegistryBox; -pub use jit_policy_box::JitPolicyBox; -pub use jit_stats_box::JitStatsBox; -pub use jit_strict_box::JitStrictBox; +// ARCHIVED: JIT Box imports moved to archive/jit-cranelift/ during Phase 15 +// pub use jit_config_box::JitConfigBox; +// pub use jit_events_box::JitEventsBox; +// pub use jit_hostcall_registry_box::JitHostcallRegistryBox; +// pub use jit_policy_box::JitPolicyBox; +// pub use jit_stats_box::JitStatsBox; +// pub use jit_strict_box::JitStrictBox; pub use map_box::MapBox; pub use math_box::{FloatBox, MathBox}; #[cfg(not(target_arch = "wasm32"))] diff --git a/src/config/env.rs b/src/config/env.rs index aec1c7f2..f85c9a50 100644 --- a/src/config/env.rs +++ b/src/config/env.rs @@ -7,8 +7,8 @@ use std::collections::BTreeMap; #[derive(Debug, Clone, Default)] pub struct NyashEnv { - /// JIT-related configuration (delegates to jit::config) - pub jit: crate::jit::config::JitConfig, + // ARCHIVED: JIT-related configuration moved to archive/jit-cranelift/ during Phase 15 + // pub jit: crate::jit::config::JitConfig, /// Arbitrary key-value overrides loaded from nyash.toml [env] pub overrides: BTreeMap, } @@ -16,13 +16,15 @@ pub struct NyashEnv { impl NyashEnv { pub fn from_env() -> Self { Self { - jit: crate::jit::config::JitConfig::from_env(), + // ARCHIVED: JIT config during Phase 15 + // jit: crate::jit::config::JitConfig::from_env(), overrides: BTreeMap::new(), } } /// Apply current struct values into process environment pub fn apply_env(&self) { - self.jit.apply_env(); + // ARCHIVED: JIT config during Phase 15 + // self.jit.apply_env(); for (k, v) in &self.overrides { std::env::set_var(k, v); } diff --git a/src/jit_stub.rs b/src/jit_stub.rs new file mode 100644 index 00000000..6ad8640b --- /dev/null +++ b/src/jit_stub.rs @@ -0,0 +1,134 @@ +//! JIT stub module for Phase 15 compilation compatibility +//! +//! This is a temporary stub to maintain compilation compatibility while +//! JIT/Cranelift is archived. All functions return safe defaults or no-op. + +pub mod config { + #[derive(Debug, Clone, Default)] + pub struct JitConfig { + pub exec: bool, + pub stats: bool, + pub stats_json: bool, + pub dump: bool, + pub threshold: Option, + pub phi_min: bool, + pub hostcall: bool, + pub handle_debug: bool, + pub native_f64: bool, + pub native_bool: bool, + pub native_bool_abi: bool, + } + + impl JitConfig { + pub fn from_env() -> Self { + Self::default() + } + + pub fn apply_env(&self) { + // No-op + } + } + + #[derive(Debug, Clone, Default)] + pub struct Capabilities { + pub supports_b1_sig: bool, + } + + pub fn probe_capabilities() -> Capabilities { + Capabilities::default() + } + + pub fn apply_runtime_caps(config: JitConfig, _caps: Capabilities) -> JitConfig { + config + } + + pub fn set_current(_config: JitConfig) { + // No-op + } + + pub fn current() -> JitConfig { + JitConfig::default() + } +} + +pub mod policy { + pub fn current() -> () { + // Return empty policy + } +} + +pub mod engine { + pub struct JitEngine; + + impl JitEngine { + pub fn new() -> Self { + Self + } + + pub fn last_lower_stats(&self) -> (u64, u64, u64) { + (0, 0, 0) // Return default stats: phi_t, phi_b1, ret_b + } + } +} + +pub mod events { + pub fn emit(_category: &str, _name: &str, _h: Option, _none: Option<()>, _data: serde_json::Value) { + // No-op - JIT events disabled for Phase 15 + } + + pub fn emit_lower(_data: serde_json::Value, _category: &str, _source: &str) { + // No-op - JIT events disabled for Phase 15 + } +} + +pub mod abi { + #[derive(Debug, Clone)] + pub enum JitValue { + I64(i64), + F64(f64), + Bool(bool), + Handle(i64), + } + + pub mod adapter { + use crate::NyashValue; + use super::JitValue; + + pub fn from_jit_value(_value: &JitValue) -> NyashValue { + NyashValue::Void + } + } +} + +pub mod rt { + use super::abi::JitValue; + + pub fn set_current_jit_args(_args: &[JitValue]) { + // No-op + } + + pub fn b1_norm_get() -> u64 { + 0 + } + + pub fn ret_bool_hint_get() -> u64 { + 0 + } + + pub mod handles { + use std::sync::Arc; + use crate::box_trait::NyashBox; + + pub fn to_handle(_boxref: Arc) -> i64 { + 0 + } + + pub fn get(_handle: i64) -> Option> { + None + } + + pub fn snapshot_arcs() -> Vec> { + Vec::new() + } + } +} \ No newline at end of file diff --git a/src/lib.rs b/src/lib.rs index a51733cd..8d5b7a7c 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -49,6 +49,8 @@ pub mod mir_aot_plan_import { // Backends pub mod backend; // pub mod jit; // ARCHIVED: Cranelift JIT subsystem moved to archive/jit-cranelift/ +pub mod jit_stub; // Temporary JIT stub for Phase 15 compilation compatibility +pub use jit_stub as jit; // Alias for compatibility pub mod semantics; // Unified semantics trait for MIR evaluation/lowering pub mod benchmarks; diff --git a/src/runner/json_v0_bridge/lowering.rs b/src/runner/json_v0_bridge/lowering.rs index 10d409f4..d4a6918e 100644 --- a/src/runner/json_v0_bridge/lowering.rs +++ b/src/runner/json_v0_bridge/lowering.rs @@ -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", - "", - ); + // 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", + // "", + // ); } 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", - "", - ); + // 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", + // "", + // ); } diff --git a/src/runner/json_v0_bridge/lowering/expr.rs b/src/runner/json_v0_bridge/lowering/expr.rs index c7391341..2d0839b8 100644 --- a/src/runner/json_v0_bridge/lowering/expr.rs +++ b/src/runner/json_v0_bridge/lowering/expr.rs @@ -232,11 +232,12 @@ pub(super) fn lower_expr_with_scope( }); } } - 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", - "", - ); + // 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", + // "", + // ); let cdst = f.next_value_id(); if let Some(bb) = f.get_block_mut(fall_bb) { let cval = if is_and { diff --git a/src/runner/mod.rs b/src/runner/mod.rs index 58030c9d..faa0e072 100644 --- a/src/runner/mod.rs +++ b/src/runner/mod.rs @@ -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 } } diff --git a/src/runtime/gc_controller.rs b/src/runtime/gc_controller.rs index a38b0cec..afdd6e02 100644 --- a/src/runtime/gc_controller.rs +++ b/src/runtime/gc_controller.rs @@ -141,8 +141,9 @@ impl GcController { match self.mode { GcMode::Rc | GcMode::RcCycle | GcMode::STW => { let started = std::time::Instant::now(); - // Roots: JIT/AOT handle registry snapshot - let roots = crate::jit::rt::handles::snapshot_arcs(); + // Roots: Runtime handle registry snapshot + // ARCHIVED: JIT handle implementation moved to archive/jit-cranelift/ during Phase 15 + let roots: Vec> = Vec::new(); // TODO: Implement handle registry for Phase 15 let mut visited: HashSet = HashSet::new(); let mut q: VecDeque> = VecDeque::new();