📚 Phase 12.5 最適化戦略 & Phase 15 セルフホスティング計画

Phase 12.5: MIR15最適化戦略 - コンパイラ丸投げ作戦
- optimization-strategy.txt: 詳細戦略(MIR側は軽量、コンパイラに丸投げ)
- implementation-examples.md: 具体的な実装例
- debug-safety-comparison.md: 現在のDebugBox vs ChatGPT5提案の比較分析

Phase 15: Nyashセルフホスティング - 究極の目標
- self-hosting-plan.txt: 内蔵Craneliftによる実現計画
- technical-details.md: CompilerBox設計とブートストラップ手順
- README.md: セルフホスティングのビジョン

重要な知見:
- LLVM統合完了済み(Phase 11)だが依存が重すぎる
- Craneliftが現実的な選択肢(3-5MB vs LLVM 50-100MB)
- 「コンパイラもBox、すべてがBox」の夢へ

MASTERロードマップ更新済み
This commit is contained in:
Moe Charm
2025-09-02 05:11:10 +09:00
parent c9366d5c54
commit da96bcb906
37 changed files with 2454 additions and 58 deletions

View File

@ -468,6 +468,17 @@ impl PluginLoaderV2 {
}
Ok(None)
}
("env.task", "cancelCurrent") => {
let tok = crate::runtime::global_hooks::current_group_token();
tok.cancel();
Ok(None)
}
("env.task", "currentToken") => {
// Return a TokenBox representing current task group's cancellation token
let tok = crate::runtime::global_hooks::current_group_token();
let tb = crate::boxes::token_box::TokenBox::from_token(tok);
Ok(Some(Box::new(tb)))
}
("env.debug", "trace") => {
// Minimal debug trace; prints to stderr when enabled
if std::env::var("NYASH_DEBUG_TRACE").ok().as_deref() == Some("1") {
@ -530,6 +541,21 @@ impl PluginLoaderV2 {
}
Ok(Some(Box::new(crate::boxes::result::NyashResultBox::new_err(Box::new(crate::box_trait::StringBox::new("InvalidArgs"))))))
}
("env.future", "delay") => {
// delay(ms) -> FutureBox resolved to void after ms
use crate::box_trait::NyashBox as _;
let fut = crate::boxes::future::FutureBox::new();
let ms = if let Some(arg0) = args.get(0) {
if let Some(i) = arg0.as_any().downcast_ref::<crate::box_trait::IntegerBox>() { i.value.max(0) as u64 }
else { arg0.to_string_box().value.trim().parse::<i64>().unwrap_or(0).max(0) as u64 }
} else { 0 };
let fut_setter = fut.clone();
let _scheduled = crate::runtime::global_hooks::spawn_task_after(ms, "env.future.delay", Box::new(move || {
fut_setter.set_result(Box::new(crate::box_trait::VoidBox::new()));
}));
crate::runtime::global_hooks::register_future_to_current_group(&fut);
Ok(Some(Box::new(fut)))
}
("env.future", "spawn_instance") => {
// spawn_instance(recv, method_name, args...) -> FutureBox
// If a scheduler is available, schedule the call; else invoke synchronously.