phase: 20.49 COMPLETE; 20.50 Flow+String minimal reps; 20.51 selfhost v0/v1 minimal (Option A/B); hv1-inline binop/unop/copy; docs + run_all + CURRENT_TASK -> 21.0

This commit is contained in:
nyash-codex
2025-11-06 15:41:52 +09:00
parent 2dc370223d
commit 77d4fd72b3
1658 changed files with 6288 additions and 2612 deletions

View File

@ -19,7 +19,7 @@ impl NyashRunner {
// This function is only called after plugin initialization has already occurred.
// Quiet mode for child pipelines (e.g., selfhost compiler JSON emit)
let quiet_pipe = std::env::var("NYASH_JSON_ONLY").ok().as_deref() == Some("1");
let quiet_pipe = crate::config::env::env_bool("NYASH_JSON_ONLY");
// Enforce plugin-first policy for VM on this branch (deterministic):
// - Initialize plugin host if not yet loaded
// - Prefer plugin implementations for core boxes
@ -35,7 +35,7 @@ impl NyashRunner {
.unwrap_or(true)
};
if need_init {
let _ = nyash_rust::runtime::init_global_plugin_host("nyash.toml");
// Let init_bid_plugins resolve hakorune.toml/nyash.toml and configure
crate::runner_plugin_init::init_bid_plugins();
}
// Prefer plugin-builtins for core types unless explicitly disabled
@ -70,7 +70,7 @@ impl NyashRunner {
std::env::set_var("NYASH_PLUGIN_OVERRIDE_TYPES", override_types.join(","));
// Strict mode: verify providers exist for override types
if std::env::var("NYASH_VM_PLUGIN_STRICT").ok().as_deref() == Some("1") {
if crate::config::env::env_bool("NYASH_VM_PLUGIN_STRICT") {
let v2 = nyash_rust::runtime::get_global_registry();
let mut missing: Vec<String> = Vec::new();
for t in [
@ -158,7 +158,7 @@ impl NyashRunner {
let code_ref: &str = &preexpanded_owned;
// Parse to AST
if std::env::var("NYASH_STRIP_DEBUG").ok().as_deref() == Some("1") {
if crate::config::env::env_bool("NYASH_STRIP_DEBUG") {
eprintln!("[vm-debug] About to parse main source ({} bytes)", code_ref.len());
eprintln!("[vm-debug] First 20 lines:");
for (idx, line) in code_ref.lines().enumerate().take(20) {
@ -170,7 +170,7 @@ impl NyashRunner {
Err(e) => {
eprintln!("❌ Parse error in main source ({}): {}",
cfg.file.as_ref().map(|s| s.as_str()).unwrap_or("<stdin>"), e);
if std::env::var("NYASH_STRIP_DEBUG").ok().as_deref() == Some("1") {
if crate::config::env::env_bool("NYASH_STRIP_DEBUG") {
eprintln!("[vm-debug] Parse failed for main source");
eprintln!("[vm-debug] Line 15-25 of source:");
for (idx, line) in code_ref.lines().enumerate().skip(14).take(11) {
@ -233,14 +233,14 @@ impl NyashRunner {
}
// Optional: dump MIR for diagnostics
if std::env::var("NYASH_VM_DUMP_MIR").ok().as_deref() == Some("1") {
if crate::config::env::env_bool("NYASH_VM_DUMP_MIR") {
let p = nyash_rust::mir::MirPrinter::new();
eprintln!("{}", p.print_module(&compile_result.module));
}
// Optional: VM-only escape analysis to elide barriers before execution
let mut module_vm = compile_result.module.clone();
if std::env::var("NYASH_VM_ESCAPE_ANALYSIS").ok().as_deref() == Some("1") {
if crate::config::env::env_bool("NYASH_VM_ESCAPE_ANALYSIS") {
let removed = nyash_rust::mir::passes::escape::escape_elide_barriers_vm(&mut module_vm);
if removed > 0 { crate::cli_v!("[VM] escape_elide_barriers: removed {} barriers", removed); }
}
@ -534,10 +534,7 @@ impl NyashRunner {
type_parameters: type_parameters.clone(),
};
if let Ok(mut map) = runtime.box_declarations.write() {
if std::env::var("NYASH_BOX_DECL_TRACE")
.ok()
.as_deref()
== Some("1")
if crate::config::env::env_bool("NYASH_BOX_DECL_TRACE")
{
eprintln!("[box-decl] register {}", name);
}