archive: Move JIT/Cranelift to archive during Phase 15 focus

Phase 15 requires concentrated development on PyVM and LLVM backends only.
JIT/Cranelift was causing build confusion and distracting AI developers.

## Archived Components
- src/jit/ → archive/jit-cranelift/src/jit/
- src/backend/cranelift/ → archive/jit-cranelift/src/backend/cranelift/
- JIT Box modules → archive/jit-cranelift/src/boxes/
- JIT scripts → archive/jit-cranelift/scripts/, tools/
- clif_adapter.rs → archive/jit-cranelift/src/semantics/

## Build Changes
- Cargo.toml: Comment out cranelift-jit feature and dependencies
- src/lib.rs: Disable JIT module declaration
- src/boxes/mod.rs: Disable JIT Box module declarations
- src/semantics/mod.rs: Disable clif_adapter module
- debug_box.rs: Replace JIT calls with archive stubs

## Documentation
- archive/jit-cranelift/ARCHIVE_NOTES.md: Complete restoration guide
- Reason: Phase 15 selfhosting focus (80k→20k line reduction)
- Restoration: Full procedure documented for future revival

This eliminates build errors and AI developer confusion, enabling
focused Phase 15 development on PyVM/LLVM backends only.

🤖 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:15:27 +09:00
parent 0d443dd6fa
commit a60d840b47
59 changed files with 145 additions and 27 deletions

View File

@ -328,17 +328,18 @@ impl DebugBox {
// --- Phase 1: JIT/Plugin shim tracing ---
pub fn trace_plugin_calls(&self, on: bool) -> Result<Box<dyn NyashBox>, RuntimeError> {
crate::jit::shim_trace::set_enabled(on);
// ARCHIVED: JIT functionality moved to archive/jit-cranelift/
println!(
"[DEBUG] JIT shim trace: {}",
"[DEBUG] JIT shim trace: {} (JIT ARCHIVED - no-op)",
if on { "ENABLED" } else { "DISABLED" }
);
Ok(Box::new(VoidBox::new()))
}
pub fn get_jit_events(&self) -> Result<Box<dyn NyashBox>, RuntimeError> {
let s = crate::jit::shim_trace::snapshot_joined();
Ok(Box::new(StringBox::new(s)))
// ARCHIVED: JIT functionality moved to archive/jit-cranelift/
let s = "[JIT ARCHIVED] No JIT events available - JIT moved to archive/jit-cranelift/";
Ok(Box::new(StringBox::new(s.to_string())))
}
}

View File

@ -1,213 +0,0 @@
use crate::box_trait::{BoolBox, BoxBase, BoxCore, IntegerBox, NyashBox, StringBox, VoidBox};
use crate::interpreter::RuntimeError;
use crate::jit::config::JitConfig;
use std::any::Any;
use std::sync::RwLock;
#[derive(Debug)]
pub struct JitConfigBox {
base: BoxBase,
pub config: RwLock<JitConfig>,
}
impl JitConfigBox {
pub fn new() -> Self {
Self {
base: BoxBase::new(),
config: RwLock::new(JitConfig::from_env()),
}
}
/// Update internal config flags from runtime capability probe
pub fn from_runtime_probe(&self) -> Box<dyn NyashBox> {
let caps = crate::jit::config::probe_capabilities();
let mut cfg = self.config.write().unwrap();
if cfg.native_bool_abi && !caps.supports_b1_sig {
cfg.native_bool_abi = false;
}
Box::new(VoidBox::new())
}
pub fn set_flag(&self, name: &str, on: bool) -> Result<Box<dyn NyashBox>, RuntimeError> {
let mut cfg = self.config.write().unwrap();
match name {
"exec" => cfg.exec = on,
"stats" => cfg.stats = on,
"stats_json" => cfg.stats_json = on,
"dump" => cfg.dump = on,
"phi_min" => cfg.phi_min = on,
"hostcall" => cfg.hostcall = on,
"handle_debug" => cfg.handle_debug = on,
"native_f64" => cfg.native_f64 = on,
"native_bool" => cfg.native_bool = on,
"bool_abi" | "native_bool_abi" => cfg.native_bool_abi = on,
"ret_b1" | "ret_bool_b1" => cfg.ret_bool_b1 = on,
"relax_numeric" | "hostcall_relax_numeric" => cfg.relax_numeric = on,
_ => {
return Err(RuntimeError::InvalidOperation {
message: format!("Unknown flag: {}", name),
})
}
}
Ok(Box::new(VoidBox::new()))
}
pub fn get_flag(&self, name: &str) -> Result<Box<dyn NyashBox>, RuntimeError> {
let cfg = self.config.read().unwrap();
let b = match name {
"exec" => cfg.exec,
"stats" => cfg.stats,
"stats_json" => cfg.stats_json,
"dump" => cfg.dump,
"phi_min" => cfg.phi_min,
"hostcall" => cfg.hostcall,
"handle_debug" => cfg.handle_debug,
"native_f64" => cfg.native_f64,
"native_bool" => cfg.native_bool,
"bool_abi" | "native_bool_abi" => cfg.native_bool_abi,
"ret_b1" | "ret_bool_b1" => cfg.ret_bool_b1,
"relax_numeric" | "hostcall_relax_numeric" => cfg.relax_numeric,
_ => {
return Err(RuntimeError::InvalidOperation {
message: format!("Unknown flag: {}", name),
})
}
};
Ok(Box::new(BoolBox::new(b)))
}
pub fn set_threshold(&self, v: i64) -> Result<Box<dyn NyashBox>, RuntimeError> {
let mut cfg = self.config.write().unwrap();
if v <= 0 {
cfg.threshold = None;
} else {
cfg.threshold = Some(v as u32);
}
Ok(Box::new(VoidBox::new()))
}
pub fn get_threshold(&self) -> Box<dyn NyashBox> {
let cfg = self.config.read().unwrap();
Box::new(IntegerBox::new(
cfg.threshold.map(|v| v as i64).unwrap_or(0),
))
}
pub fn to_json(&self) -> Box<dyn NyashBox> {
let cfg = self.config.read().unwrap();
let val = serde_json::json!({
"exec": cfg.exec,
"stats": cfg.stats,
"stats_json": cfg.stats_json,
"dump": cfg.dump,
"threshold": cfg.threshold,
"phi_min": cfg.phi_min,
"hostcall": cfg.hostcall,
"handle_debug": cfg.handle_debug,
"native_f64": cfg.native_f64,
"native_bool": cfg.native_bool,
"native_bool_abi": cfg.native_bool_abi,
"ret_bool_b1": cfg.ret_bool_b1,
"relax_numeric": cfg.relax_numeric,
});
Box::new(StringBox::new(val.to_string()))
}
pub fn from_json(&self, s: &str) -> Result<Box<dyn NyashBox>, RuntimeError> {
let mut cfg = self.config.write().unwrap();
let v: serde_json::Value =
serde_json::from_str(s).map_err(|e| RuntimeError::InvalidOperation {
message: format!("Invalid JSON: {}", e),
})?;
if let Some(b) = v.get("exec").and_then(|x| x.as_bool()) {
cfg.exec = b;
}
if let Some(b) = v.get("stats").and_then(|x| x.as_bool()) {
cfg.stats = b;
}
if let Some(b) = v.get("stats_json").and_then(|x| x.as_bool()) {
cfg.stats_json = b;
}
if let Some(b) = v.get("dump").and_then(|x| x.as_bool()) {
cfg.dump = b;
}
if let Some(n) = v.get("threshold").and_then(|x| x.as_u64()) {
cfg.threshold = Some(n as u32);
}
if let Some(b) = v.get("phi_min").and_then(|x| x.as_bool()) {
cfg.phi_min = b;
}
if let Some(b) = v.get("hostcall").and_then(|x| x.as_bool()) {
cfg.hostcall = b;
}
if let Some(b) = v.get("handle_debug").and_then(|x| x.as_bool()) {
cfg.handle_debug = b;
}
if let Some(b) = v.get("native_f64").and_then(|x| x.as_bool()) {
cfg.native_f64 = b;
}
if let Some(b) = v.get("native_bool").and_then(|x| x.as_bool()) {
cfg.native_bool = b;
}
if let Some(b) = v.get("native_bool_abi").and_then(|x| x.as_bool()) {
cfg.native_bool_abi = b;
}
if let Some(b) = v.get("ret_bool_b1").and_then(|x| x.as_bool()) {
cfg.ret_bool_b1 = b;
}
if let Some(b) = v.get("relax_numeric").and_then(|x| x.as_bool()) {
cfg.relax_numeric = b;
}
Ok(Box::new(VoidBox::new()))
}
pub fn apply(&self) -> Box<dyn NyashBox> {
let cfg = self.config.read().unwrap().clone();
// Apply to env for CLI parity
cfg.apply_env();
// Also set global current JIT config for hot paths (env-less)
crate::jit::config::set_current(cfg);
Box::new(VoidBox::new())
}
pub fn summary(&self) -> Box<dyn NyashBox> {
let cfg = self.config.read().unwrap();
let s = format!(
"exec={} stats={} json={} dump={} thr={:?} phi_min={} hostcall={} hdbg={} f64={} bool={} relax_numeric={}",
cfg.exec, cfg.stats, cfg.stats_json, cfg.dump, cfg.threshold,
cfg.phi_min, cfg.hostcall, cfg.handle_debug, cfg.native_f64, cfg.native_bool, cfg.relax_numeric
);
Box::new(StringBox::new(s))
}
}
impl BoxCore for JitConfigBox {
fn box_id(&self) -> u64 {
self.base.id
}
fn parent_type_id(&self) -> Option<std::any::TypeId> {
self.base.parent_type_id
}
fn fmt_box(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
write!(f, "JitConfigBox")
}
fn as_any(&self) -> &dyn Any {
self
}
fn as_any_mut(&mut self) -> &mut dyn Any {
self
}
}
impl NyashBox for JitConfigBox {
fn to_string_box(&self) -> StringBox {
StringBox::new(self.summary().to_string_box().value)
}
fn equals(&self, other: &dyn NyashBox) -> BoolBox {
BoolBox::new(other.as_any().is::<JitConfigBox>())
}
fn type_name(&self) -> &'static str {
"JitConfigBox"
}
fn clone_box(&self) -> Box<dyn NyashBox> {
let cfg = self.config.read().unwrap().clone();
Box::new(JitConfigBox {
base: self.base.clone(),
config: RwLock::new(cfg),
})
}
fn share_box(&self) -> Box<dyn NyashBox> {
self.clone_box()
}
}

View File

@ -1,74 +0,0 @@
use crate::box_trait::{BoolBox, BoxBase, BoxCore, NyashBox, StringBox, VoidBox};
use std::any::Any;
#[derive(Debug, Clone)]
pub struct JitEventsBox {
base: BoxBase,
}
impl JitEventsBox {
pub fn new() -> Self {
Self {
base: BoxBase::new(),
}
}
}
impl BoxCore for JitEventsBox {
fn box_id(&self) -> u64 {
self.base.id
}
fn parent_type_id(&self) -> Option<std::any::TypeId> {
self.base.parent_type_id
}
fn fmt_box(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
write!(f, "JitEventsBox")
}
fn as_any(&self) -> &dyn Any {
self
}
fn as_any_mut(&mut self) -> &mut dyn Any {
self
}
}
impl NyashBox for JitEventsBox {
fn to_string_box(&self) -> StringBox {
StringBox::new("JitEventsBox")
}
fn equals(&self, other: &dyn NyashBox) -> BoolBox {
BoolBox::new(other.as_any().is::<JitEventsBox>())
}
fn type_name(&self) -> &'static str {
"JitEventsBox"
}
fn clone_box(&self) -> Box<dyn NyashBox> {
Box::new(Self {
base: self.base.clone(),
})
}
fn share_box(&self) -> Box<dyn NyashBox> {
self.clone_box()
}
}
impl JitEventsBox {
pub fn set_path(&self, path: &str) -> Box<dyn NyashBox> {
std::env::set_var("NYASH_JIT_EVENTS_PATH", path);
Box::new(VoidBox::new())
}
pub fn enable(&self, on: bool) -> Box<dyn NyashBox> {
if on {
std::env::set_var("NYASH_JIT_EVENTS", "1");
} else {
std::env::remove_var("NYASH_JIT_EVENTS");
}
Box::new(VoidBox::new())
}
pub fn log(&self, kind: &str, function: &str, note_json: &str) -> Box<dyn NyashBox> {
let extra = serde_json::from_str::<serde_json::Value>(note_json)
.unwrap_or_else(|_| serde_json::json!({"note": note_json}));
crate::jit::events::emit(kind, function, None, None, extra);
Box::new(VoidBox::new())
}
}

View File

@ -1,78 +0,0 @@
use crate::box_trait::{BoolBox, BoxBase, BoxCore, NyashBox, StringBox, VoidBox};
use std::any::Any;
#[derive(Debug, Clone)]
pub struct JitHostcallRegistryBox {
base: BoxBase,
}
impl JitHostcallRegistryBox {
pub fn new() -> Self {
Self {
base: BoxBase::new(),
}
}
}
impl BoxCore for JitHostcallRegistryBox {
fn box_id(&self) -> u64 {
self.base.id
}
fn parent_type_id(&self) -> Option<std::any::TypeId> {
self.base.parent_type_id
}
fn fmt_box(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
write!(f, "JitHostcallRegistryBox")
}
fn as_any(&self) -> &dyn Any {
self
}
fn as_any_mut(&mut self) -> &mut dyn Any {
self
}
}
impl NyashBox for JitHostcallRegistryBox {
fn to_string_box(&self) -> StringBox {
let (ro, mu) = crate::jit::hostcall_registry::snapshot();
let payload = serde_json::json!({ "readonly": ro, "mutating": mu });
StringBox::new(payload.to_string())
}
fn equals(&self, other: &dyn NyashBox) -> BoolBox {
BoolBox::new(other.as_any().is::<JitHostcallRegistryBox>())
}
fn type_name(&self) -> &'static str {
"JitHostcallRegistryBox"
}
fn clone_box(&self) -> Box<dyn NyashBox> {
Box::new(Self {
base: self.base.clone(),
})
}
fn share_box(&self) -> Box<dyn NyashBox> {
self.clone_box()
}
}
impl JitHostcallRegistryBox {
pub fn add_readonly(&self, sym: &str) -> Box<dyn NyashBox> {
crate::jit::hostcall_registry::add_readonly(sym);
Box::new(VoidBox::new())
}
pub fn add_mutating(&self, sym: &str) -> Box<dyn NyashBox> {
crate::jit::hostcall_registry::add_mutating(sym);
Box::new(VoidBox::new())
}
pub fn set_from_csv(&self, ro_csv: &str, mu_csv: &str) -> Box<dyn NyashBox> {
crate::jit::hostcall_registry::set_from_csv(ro_csv, mu_csv);
Box::new(VoidBox::new())
}
pub fn add_signature(&self, sym: &str, args_csv: &str, ret_str: &str) -> Box<dyn NyashBox> {
let ok = crate::jit::hostcall_registry::set_signature_csv(sym, args_csv, ret_str);
if ok {
Box::new(VoidBox::new())
} else {
Box::new(StringBox::new("Invalid signature"))
}
}
}

View File

@ -1,144 +0,0 @@
use crate::box_trait::{BoolBox, BoxBase, BoxCore, NyashBox, StringBox, VoidBox};
use std::any::Any;
#[derive(Debug, Clone)]
pub struct JitPolicyBox {
base: BoxBase,
}
impl JitPolicyBox {
pub fn new() -> Self {
Self {
base: BoxBase::new(),
}
}
}
impl BoxCore for JitPolicyBox {
fn box_id(&self) -> u64 {
self.base.id
}
fn parent_type_id(&self) -> Option<std::any::TypeId> {
self.base.parent_type_id
}
fn fmt_box(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
write!(f, "JitPolicyBox")
}
fn as_any(&self) -> &dyn Any {
self
}
fn as_any_mut(&mut self) -> &mut dyn Any {
self
}
}
impl NyashBox for JitPolicyBox {
fn to_string_box(&self) -> StringBox {
let p = crate::jit::policy::current();
let s = format!(
"read_only={} whitelist={}",
p.read_only,
p.hostcall_whitelist.join(",")
);
StringBox::new(s)
}
fn equals(&self, other: &dyn NyashBox) -> BoolBox {
BoolBox::new(other.as_any().is::<JitPolicyBox>())
}
fn type_name(&self) -> &'static str {
"JitPolicyBox"
}
fn clone_box(&self) -> Box<dyn NyashBox> {
Box::new(Self {
base: self.base.clone(),
})
}
fn share_box(&self) -> Box<dyn NyashBox> {
self.clone_box()
}
}
// Methods (exposed via VM dispatch):
impl JitPolicyBox {
pub fn set_flag(&self, name: &str, on: bool) -> Box<dyn NyashBox> {
let mut cur = crate::jit::policy::current();
match name {
"read_only" | "readonly" => cur.read_only = on,
_ => return Box::new(StringBox::new(format!("Unknown flag: {}", name))),
}
crate::jit::policy::set_current(cur);
Box::new(VoidBox::new())
}
pub fn get_flag(&self, name: &str) -> Box<dyn NyashBox> {
let cur = crate::jit::policy::current();
let v = match name {
"read_only" | "readonly" => cur.read_only,
_ => false,
};
Box::new(BoolBox::new(v))
}
pub fn set_whitelist_csv(&self, csv: &str) -> Box<dyn NyashBox> {
let mut cur = crate::jit::policy::current();
cur.hostcall_whitelist = csv
.split(',')
.map(|t| t.trim().to_string())
.filter(|s| !s.is_empty())
.collect();
crate::jit::policy::set_current(cur);
Box::new(VoidBox::new())
}
pub fn add_whitelist(&self, name: &str) -> Box<dyn NyashBox> {
let mut cur = crate::jit::policy::current();
if !cur.hostcall_whitelist.iter().any(|s| s == name) {
cur.hostcall_whitelist.push(name.to_string());
}
crate::jit::policy::set_current(cur);
Box::new(VoidBox::new())
}
pub fn clear_whitelist(&self) -> Box<dyn NyashBox> {
let mut cur = crate::jit::policy::current();
cur.hostcall_whitelist.clear();
crate::jit::policy::set_current(cur);
Box::new(VoidBox::new())
}
pub fn enable_preset(&self, name: &str) -> Box<dyn NyashBox> {
let mut cur = crate::jit::policy::current();
match name {
// 最小: Array.push_h のみ許可(読み取り以外は変えない)
"mutating_minimal" | "mutating_array_push" => {
let id = crate::jit::r#extern::collections::SYM_ARRAY_PUSH_H;
if !cur.hostcall_whitelist.iter().any(|s| s == id) {
cur.hostcall_whitelist.push(id.to_string());
}
}
// 例: Map.set_h も追加許可(必要に応じて拡張)
"mutating_map_set" => {
let id = crate::jit::r#extern::collections::SYM_MAP_SET_H;
if !cur.hostcall_whitelist.iter().any(|s| s == id) {
cur.hostcall_whitelist.push(id.to_string());
}
}
// よく使う: Array.push_h + Array.set_h + Map.set_h を許可
"mutating_common" => {
let ids = [
crate::jit::r#extern::collections::SYM_ARRAY_PUSH_H,
crate::jit::r#extern::collections::SYM_ARRAY_SET_H,
crate::jit::r#extern::collections::SYM_MAP_SET_H,
];
for id in ids {
if !cur.hostcall_whitelist.iter().any(|s| s == id) {
cur.hostcall_whitelist.push(id.to_string());
}
}
}
_ => {
return Box::new(StringBox::new(format!("Unknown preset: {}", name)));
}
}
crate::jit::policy::set_current(cur);
Box::new(VoidBox::new())
}
}

View File

@ -1,71 +0,0 @@
use crate::box_trait::{BoolBox, BoxBase, BoxCore, NyashBox, StringBox};
use std::any::Any;
#[derive(Debug, Clone)]
pub struct JitStatsBox {
base: BoxBase,
}
impl JitStatsBox {
pub fn new() -> Self {
Self {
base: BoxBase::new(),
}
}
pub fn to_json(&self) -> Box<dyn NyashBox> {
let cfg = crate::jit::config::current();
let caps = crate::jit::config::probe_capabilities();
let mode = if cfg.native_bool_abi && caps.supports_b1_sig {
"b1_bool"
} else {
"i64_bool"
};
let payload = serde_json::json!({
"version": 1,
"abi_mode": mode,
"abi_b1_enabled": cfg.native_bool_abi,
"abi_b1_supported": caps.supports_b1_sig,
"b1_norm_count": crate::jit::rt::b1_norm_get(),
"ret_bool_hint_count": crate::jit::rt::ret_bool_hint_get(),
"phi_total_slots": crate::jit::rt::phi_total_get(),
"phi_b1_slots": crate::jit::rt::phi_b1_get(),
});
Box::new(StringBox::new(payload.to_string()))
}
}
impl BoxCore for JitStatsBox {
fn box_id(&self) -> u64 {
self.base.id
}
fn parent_type_id(&self) -> Option<std::any::TypeId> {
self.base.parent_type_id
}
fn fmt_box(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
write!(f, "JitStatsBox")
}
fn as_any(&self) -> &dyn Any {
self
}
fn as_any_mut(&mut self) -> &mut dyn Any {
self
}
}
impl NyashBox for JitStatsBox {
fn to_string_box(&self) -> StringBox {
StringBox::new(self.to_json().to_string_box().value)
}
fn equals(&self, other: &dyn NyashBox) -> BoolBox {
BoolBox::new(other.as_any().is::<JitStatsBox>())
}
fn type_name(&self) -> &'static str {
"JitStatsBox"
}
fn clone_box(&self) -> Box<dyn NyashBox> {
Box::new(self.clone())
}
fn share_box(&self) -> Box<dyn NyashBox> {
self.clone_box()
}
}

View File

@ -1,104 +0,0 @@
use crate::box_trait::{BoolBox, BoxBase, BoxCore, NyashBox, StringBox, VoidBox};
use std::any::Any;
#[derive(Debug, Clone)]
pub struct JitStrictBox {
base: BoxBase,
}
impl JitStrictBox {
pub fn new() -> Self {
Self {
base: BoxBase::new(),
}
}
}
impl BoxCore for JitStrictBox {
fn box_id(&self) -> u64 {
self.base.id
}
fn parent_type_id(&self) -> Option<std::any::TypeId> {
self.base.parent_type_id
}
fn fmt_box(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
write!(f, "JitStrictBox")
}
fn as_any(&self) -> &dyn Any {
self
}
fn as_any_mut(&mut self) -> &mut dyn Any {
self
}
}
impl NyashBox for JitStrictBox {
fn to_string_box(&self) -> StringBox {
StringBox::new("JitStrictBox".to_string())
}
fn equals(&self, other: &dyn NyashBox) -> BoolBox {
BoolBox::new(other.as_any().is::<JitStrictBox>())
}
fn type_name(&self) -> &'static str {
"JitStrictBox"
}
fn clone_box(&self) -> Box<dyn NyashBox> {
Box::new(Self {
base: self.base.clone(),
})
}
fn share_box(&self) -> Box<dyn NyashBox> {
self.clone_box()
}
}
impl JitStrictBox {
/// Enable/disable strict mode. When enabling, also set JIT-only and args-handle-only by default.
pub fn enable(&self, on: bool) -> Box<dyn NyashBox> {
if on {
std::env::set_var("NYASH_JIT_STRICT", "1");
if std::env::var("NYASH_JIT_ONLY").ok().is_none() {
std::env::set_var("NYASH_JIT_ONLY", "1");
}
if std::env::var("NYASH_JIT_ARGS_HANDLE_ONLY").ok().is_none() {
std::env::set_var("NYASH_JIT_ARGS_HANDLE_ONLY", "1");
}
} else {
std::env::remove_var("NYASH_JIT_STRICT");
}
Box::new(VoidBox::new())
}
pub fn set_only(&self, on: bool) -> Box<dyn NyashBox> {
if on {
std::env::set_var("NYASH_JIT_ONLY", "1");
} else {
std::env::remove_var("NYASH_JIT_ONLY");
}
Box::new(VoidBox::new())
}
pub fn set_handle_only(&self, on: bool) -> Box<dyn NyashBox> {
if on {
std::env::set_var("NYASH_JIT_ARGS_HANDLE_ONLY", "1");
} else {
std::env::remove_var("NYASH_JIT_ARGS_HANDLE_ONLY");
}
Box::new(VoidBox::new())
}
pub fn status(&self) -> Box<dyn NyashBox> {
let s = serde_json::json!({
"strict": std::env::var("NYASH_JIT_STRICT").ok().as_deref() == Some("1"),
"jit_only": std::env::var("NYASH_JIT_ONLY").ok().as_deref() == Some("1"),
"args_handle_only": std::env::var("NYASH_JIT_ARGS_HANDLE_ONLY").ok().as_deref() == Some("1"),
"lower_fallbacks": crate::jit::events::lower_fallbacks_get(),
});
Box::new(StringBox::new(s.to_string()))
}
/// Reset compile-time counters (e.g., lower fallback count) before next compile.
pub fn reset_counters(&self) -> Box<dyn NyashBox> {
crate::jit::events::lower_counters_reset();
Box::new(VoidBox::new())
}
}

View File

@ -73,12 +73,13 @@ pub mod console_box;
pub mod debug_config_box;
pub mod function_box;
pub mod gc_config_box;
pub mod jit_config_box;
pub mod jit_events_box;
pub mod jit_hostcall_registry_box;
pub mod jit_policy_box;
pub mod jit_stats_box;
pub mod jit_strict_box;
// ARCHIVED: JIT Box modules moved to archive/jit-cranelift/ during Phase 15
// pub mod jit_config_box;
// pub mod jit_events_box;
// pub mod jit_hostcall_registry_box;
// pub mod jit_policy_box;
// pub mod jit_stats_box;
// pub mod jit_strict_box;
pub mod map_box;
#[cfg(not(target_arch = "wasm32"))]
pub mod qr_box;