Phase 10.10: GC Switchable Runtime & Unified Debug System 実装完了

Phase 10.10の主要実装:
- GcConfigBox: GC設定の実行時制御(counting/trace/barrier_strict)
- DebugConfigBox: デバッグ設定の統一管理(JIT events/stats/dump/dot)
- メソッドディスパッチ: system_methods.rsで両Boxのメソッド実装
- CountingGC動作確認: write_barriers正常カウント(VM実行時)

技術的詳細:
- BoxCore/BoxBase統一アーキテクチャを活用
- setFlag/getFlag/apply/summaryメソッドで統一API提供
- 環境変数経由でVM/JITランタイムと連携
- GcConfigBox.apply()は次回実行から有効(ランタイム作成前に環境変数参照)

テスト済み:
- examples/gc_counting_demo.nyash: CountingGCの動作確認
- write_barriers=3でArray.push/set, Map.setを正しくカウント
- NYASH_GC_TRACE=1でGC統計出力確認

Box-First哲学の体現: 設定も制御も観測もすべてBox!

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
Moe Charm
2025-08-28 22:31:51 +09:00
parent 4e1b595796
commit d67f27f4b8
27 changed files with 1341 additions and 63 deletions

View File

@ -292,6 +292,36 @@ impl BuiltinBoxFactory {
}
Ok(Box::new(crate::boxes::jit_config_box::JitConfigBox::new()))
});
// JitPolicyBox (runtime JIT policy as a Box)
self.register("JitPolicyBox", |args| {
if !args.is_empty() {
return Err(RuntimeError::InvalidOperation {
message: format!("JitPolicyBox constructor expects 0 arguments, got {}", args.len()),
});
}
Ok(Box::new(crate::boxes::jit_policy_box::JitPolicyBox::new()))
});
// DebugConfigBox (runtime debug/observability switches)
self.register("DebugConfigBox", |args| {
if !args.is_empty() {
return Err(RuntimeError::InvalidOperation {
message: format!("DebugConfigBox constructor expects 0 arguments, got {}", args.len()),
});
}
Ok(Box::new(crate::boxes::debug_config_box::DebugConfigBox::new()))
});
// GcConfigBox (runtime GC switches)
self.register("GcConfigBox", |args| {
if !args.is_empty() {
return Err(RuntimeError::InvalidOperation {
message: format!("GcConfigBox constructor expects 0 arguments, got {}", args.len()),
});
}
Ok(Box::new(crate::boxes::gc_config_box::GcConfigBox::new()))
});
}
/// Register I/O types