feat(phase88): Ring0Context Skeleton implementation
Phase 88: OS API abstraction layer implementation **Implementation**: - Ring0Context module added (4 files) - mod.rs: Public API, global initialization (OnceLock) - traits.rs: MemApi, IoApi, TimeApi, LogApi trait definitions - std_impls.rs: std-based default implementations - errors.rs: IoError, TimeError type definitions **Design Principles**: - Ring0 knows nothing about Box - Ring0 knows nothing about Nyash - Pure OS API abstraction **Global Initialization**: - NyashRunner::new() initializes Ring0Context globally - OnceLock ensures safe initialization (idempotent) **Migration (2 paths)**: - src/runner/selfhost.rs:27: eprintln! → ring0.log.error() (OOB strict) - src/runner/selfhost.rs:177: eprintln! → ring0.log.error() (PyVM error) **Tests**: - 4 unit tests added (ring0 module) - All tests passed - Build successful (0 errors) **Migration Status**: - Migrated: 2/3,955 (0.05%) - Remaining: 3,953 paths (Phase 89+) **Files Changed**: - src/runtime/ring0/mod.rs (new, 100 lines) - src/runtime/ring0/traits.rs (new, 93 lines) - src/runtime/ring0/std_impls.rs (new, 77 lines) - src/runtime/ring0/errors.rs (new, 26 lines) - src/runtime/mod.rs (Ring0Context export) - src/runner/mod.rs (global initialization) - src/runner/selfhost.rs (2 paths migrated) - docs/development/current/main/ring0-inventory.md (Phase 88 status) Phase 88 complete. Ready for Phase 89 (gradual migration). 🐱✨
This commit is contained in:
@ -14,6 +14,24 @@
|
||||
- 将来的には `Ring0Context.log` / `Ring0Context.io` 経由に寄せる。
|
||||
- 代表パス(selfhost/hack_check/VM/LLVM)の `println!/eprintln!` から段階的に移行する。
|
||||
|
||||
### Phase 88 移行状況(2025-12-02)
|
||||
|
||||
**移行済みパス(2箇所)**:
|
||||
|
||||
| ファイル | 行 | Before | After |
|
||||
|---------|---|--------|-------|
|
||||
| `src/runner/selfhost.rs` | 27 | `eprintln!("[selfhost][oob-strict] ...")` | `ring0.log.error("[selfhost][oob-strict] ...")` |
|
||||
| `src/runner/selfhost.rs` | 177 | `eprintln!("❌ PyVM error ...")` | `ring0.log.error("❌ PyVM error ...")` |
|
||||
|
||||
**残存パス(3,953箇所)**:
|
||||
|
||||
| カテゴリ | 出現回数 | 移行予定 |
|
||||
|---------|---------|---------|
|
||||
| println! | 2,200 | Phase 89-A |
|
||||
| eprintln! | 1,753 | Phase 89-B |
|
||||
|
||||
Phase 89 以降で段階的に移行予定。
|
||||
|
||||
---
|
||||
|
||||
## 2. Box / プラグイン / カーネル実装の数
|
||||
|
||||
Reference in New Issue
Block a user