📚 Phase 11 documentation: Everything is Box × MIR15 revolution

Key updates:
- Document MIR 26→15 instruction reduction plan (transitioning status)
- Add Core-15 target instruction set in INSTRUCTION_SET.md
- Save AI conference analyses validating Box Theory and 15-instruction design
- Create MIR annotation system proposal for optimization hints
- Update SKIP_PHASE_10_DECISION.md with LLVM direct migration rationale

Technical insights:
- RefNew/RefGet/RefSet can be eliminated through Box unification
- GC/sync/async all achievable with 15 core instructions
- BoxCall lowering can automatically insert GC barriers
- 2-3x performance improvement expected with LLVM
- Build time reduction 50%, binary size reduction 40%

Status: Design complete, implementation pending
This commit is contained in:
Moe Charm
2025-08-31 03:03:04 +09:00
parent 1812cda7d5
commit b003bdf25b
50 changed files with 2621 additions and 136 deletions

View File

@ -468,6 +468,50 @@ impl PluginLoaderV2 {
}
Ok(None)
}
("env.debug", "trace") => {
// Minimal debug trace; prints to stderr when enabled
if std::env::var("NYASH_DEBUG_TRACE").ok().as_deref() == Some("1") {
for a in args { eprintln!("[debug.trace] {}", a.to_string_box().value); }
}
Ok(None)
}
("env.runtime", "checkpoint") => {
// Minimal safepoint checkpoint stub (no-op)
if std::env::var("NYASH_RUNTIME_CHECKPOINT_TRACE").ok().as_deref() == Some("1") {
eprintln!("[runtime.checkpoint] reached");
}
Ok(None)
}
// Future/Await bridge (scaffold): maps MIR Future* to Box operations
("env.future", "new") => {
// new(value) -> FutureBox(set to value)
let fut = crate::boxes::future::FutureBox::new();
if let Some(v) = args.get(0) { fut.set_result(v.clone_box()); }
Ok(Some(Box::new(fut)))
}
("env.future", "set") => {
// set(future, value)
if args.len() >= 2 {
if let Some(fut) = args[0].as_any().downcast_ref::<crate::boxes::future::FutureBox>() {
fut.set_result(args[1].clone_box());
}
}
Ok(None)
}
("env.future", "await") => {
// await(future) -> value (pass-through if not a FutureBox)
if let Some(arg) = args.get(0) {
if let Some(fut) = arg.as_any().downcast_ref::<crate::boxes::future::FutureBox>() {
match fut.wait_and_get() { Ok(v) => return Ok(Some(v)), Err(e) => {
eprintln!("[env.future.await] error: {}", e);
return Ok(None);
} }
} else {
return Ok(Some(arg.clone_box()));
}
}
Ok(None)
}
("env.canvas", _) => {
eprintln!("[env.canvas] {} invoked (stub)", method_name);
Ok(None)