jit: P1 jit-direct-only feature; disable plugin-builtins branch; stub legacy VM-args TLS for JIT-only builds

This commit is contained in:
nyash-dev
2025-09-06 12:20:27 +09:00
parent be8593fb02
commit f4dea3354b
3 changed files with 20 additions and 20 deletions

View File

@ -16,6 +16,9 @@ e2e = []
cli = [] cli = []
plugins-only = [] plugins-only = []
builtin-core = [] builtin-core = []
## JIT-direct only mode: disable legacy VM-arg fallback and plugin-builtins branches
## (keeps code compiling; VM-integrated JIT paths remain but are inert)
jit-direct-only = []
gui = ["dep:egui", "dep:eframe", "dep:egui_extras", "dep:image"] gui = ["dep:egui", "dep:eframe", "dep:egui_extras", "dep:image"]
gui-examples = ["gui"] gui-examples = ["gui"]
all-examples = ["gui-examples"] all-examples = ["gui-examples"]

View File

@ -11,7 +11,10 @@ pub enum InvokeDecision {
} }
fn use_plugin_builtins() -> bool { fn use_plugin_builtins() -> bool {
std::env::var("NYASH_USE_PLUGIN_BUILTINS").ok().as_deref() == Some("1") #[cfg(feature = "jit-direct-only")]
{ return false; }
#[cfg(not(feature = "jit-direct-only"))]
{ return std::env::var("NYASH_USE_PLUGIN_BUILTINS").ok().as_deref() == Some("1"); }
} }
/// Decide invocation policy for a known Box method. /// Decide invocation policy for a known Box method.

View File

@ -4,27 +4,21 @@ use crate::backend::vm::VMValue;
use crate::jit::abi::JitValue; use crate::jit::abi::JitValue;
// Legacy TLS for hostcalls that still expect VMValue — keep for compatibility // Legacy TLS for hostcalls that still expect VMValue — keep for compatibility
thread_local! { // Legacy VM args TLS — disabled in jit-direct-only (no-op/empty)
static LEGACY_VM_ARGS: RefCell<Vec<VMValue>> = RefCell::new(Vec::new()); #[cfg(not(feature = "jit-direct-only"))]
} thread_local! { static LEGACY_VM_ARGS: RefCell<Vec<VMValue>> = RefCell::new(Vec::new()); }
pub fn set_legacy_vm_args(args: &[VMValue]) { #[cfg(not(feature = "jit-direct-only"))]
LEGACY_VM_ARGS.with(|cell| { pub fn set_legacy_vm_args(args: &[VMValue]) { LEGACY_VM_ARGS.with(|cell| { let mut v = cell.borrow_mut(); v.clear(); v.extend_from_slice(args); }); }
let mut v = cell.borrow_mut();
v.clear();
v.extend_from_slice(args);
});
}
pub fn with_legacy_vm_args<F, R>(f: F) -> R #[cfg(feature = "jit-direct-only")]
where pub fn set_legacy_vm_args(_args: &[VMValue]) { /* no-op in jit-direct-only */ }
F: FnOnce(&[VMValue]) -> R,
{ #[cfg(not(feature = "jit-direct-only"))]
LEGACY_VM_ARGS.with(|cell| { pub fn with_legacy_vm_args<F, R>(f: F) -> R where F: FnOnce(&[VMValue]) -> R { LEGACY_VM_ARGS.with(|cell| { let v = cell.borrow(); f(&v) }) }
let v = cell.borrow();
f(&v) #[cfg(feature = "jit-direct-only")]
}) pub fn with_legacy_vm_args<F, R>(f: F) -> R where F: FnOnce(&[VMValue]) -> R { f(&[]) }
}
// New TLS for independent JIT ABI values // New TLS for independent JIT ABI values
thread_local! { thread_local! {