feat: Major documentation reorganization and unified Box design updates
## Documentation & Organization - Moved copilot_issues.txt → 00_MASTER_ROADMAP.md (phases folder) - Created Phase 9.79b.1 & 9.79b.2 plans for unified Box implementation - Updated unified-box-design-deep-analysis.md with ChatGPT5 insights - Added P2P documentation and examples (ping-pong, self-ping) ## Code Updates - P2PBox: Reverted to original error state for demonstration - VM: Enhanced BoxCall dispatch for unified approach - Updated box factory, interpreter calls, and transport layer ## Cleanup & Privacy - Removed private/ and private_test/ from git tracking - Added private folders to .gitignore for security - Cleaned root directory: moved backups, removed temp files - Moved consultation files to docs/archive/consultations/ ## Other Improvements - Added object literal syntax improvement idea - Updated CLAUDE.md with master roadmap reference - Updated CURRENT_TASK.md with latest progress 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
@ -1,6 +1,6 @@
|
||||
# Phase 9.79a: Unified Box Dispatch (Minimal) + P2PBox Polish
|
||||
|
||||
Status: Planned
|
||||
Status: Completed
|
||||
Last Updated: 2025-08-26
|
||||
Owner: core-runtime
|
||||
|
||||
@ -37,6 +37,7 @@ Owner: core-runtime
|
||||
- VM: universal methods 前置ディスパッチ
|
||||
- Interpreter: 同様の前置ディスパッチ
|
||||
- スモーク:既存演算子/print動作の回帰なし
|
||||
- 進捗: 2025-08-26 達成(VM/Interpreterともに toString/type/equals/clone を前段で統一。cargo build 成功)
|
||||
- M2(Day 3–4)
|
||||
- P2PBox unregister安全化(endpoint一致 or refcount)
|
||||
- E2E: onOnce/off 追加、two-node ping-pong 安定、asyncデモが確実に出力
|
||||
@ -44,6 +45,26 @@ Owner: core-runtime
|
||||
- VM表示整合:P2PヘルパのtoString/ConsoleをInterpreterと一致
|
||||
- Docs更新:言語ガイド/P2Pリファレンス反映
|
||||
|
||||
## Completion Notes (2025-08-26)
|
||||
- Universal dispatch (toString/type/equals/clone): Interpreter/VMに前段実装・整合確認済み。
|
||||
- P2PBox Polish:
|
||||
- InProcess unregister: endpoint一致時のみunregisterで安全化。
|
||||
- E2E: onOnce/off ユニットテスト追加、two-node ping→pong スモーク、self→selfスモーク追加。
|
||||
- 受信トレース: getLastFrom/getLastIntentName を受信時に更新。
|
||||
- 実用ミニ糖衣: IntentBoxの第2引数に MapBox/JSONBox を直接渡せるよう拡張。
|
||||
- Docs: 新規リファレンス追加(P2P)/ 例追加
|
||||
- docs/reference/boxes-system/p2p_box.md
|
||||
- examples/p2p_self_ping.nyash
|
||||
- examples/p2p_ping_pong.nyash
|
||||
|
||||
Notes:
|
||||
- 非WASM環境のTimerBoxはダミーのため、async出力の確実化はWASM側のガイドで扱う。ネイティブでは同期スモーク(self→self/二者)で安定確認。
|
||||
|
||||
## Next (roll-forward)
|
||||
- Language sugar: Object literal → MapBox lowering(feature flag `object_literal`で段階導入)
|
||||
- Proposal: docs/ideas/improvements/2025-08-26-object-literal-sugar.md
|
||||
- WASMガイドにTimer併用のasyncサンプル追記。
|
||||
|
||||
## リスクと対策
|
||||
- VM分岐に触るリスク → 型別分岐の“前段”に追加、既存分岐はフォールバックとして維持
|
||||
- unregister回りの退行 → 一致解除テスト/順次Dropテスト(clone/share/Drop順の組み合わせ)を追加
|
||||
|
||||
@ -0,0 +1,49 @@
|
||||
# Phase 9.79b.1: Unified Registry IDs + Builder Slotting
|
||||
|
||||
Status: Planned
|
||||
Owner: core-runtime
|
||||
Target: Before Phase 10 (Cranelift JIT)
|
||||
Last Updated: 2025-08-26
|
||||
|
||||
## Goals
|
||||
- Introduce `BoxTypeId`/`MethodId` and stable method slot reservation in the unified registry.
|
||||
- Resolve method names to slot IDs at MIR builder time when possible.
|
||||
- Keep MIR instruction set stable (26) while enabling ID-based BoxCall.
|
||||
|
||||
## Scope
|
||||
- Registry
|
||||
- Add numeric `BoxTypeId` mapping (type-name → id) and `(type_id, method)` → `slot` table.
|
||||
- Reserve low slots for universal methods: `0=toString`, `1=type`, `2=equals`, `3=clone`.
|
||||
- Provide `reserve_method_slot()`, `resolve_slot()` APIs.
|
||||
- MIR Builder
|
||||
- When receiver type can be inferred, emit `BoxCall { method_id }` (slot ID) instead of name.
|
||||
- Add late-bind fallback path for unresolved sites (keeps current behavior).
|
||||
- Debug scaffolding
|
||||
- Add `MIRDebugInfo` container types (empty by default) for ID→name mapping (off by default).
|
||||
- Docs
|
||||
- Update MIR design note to mention ID-based BoxCall with late-bind fallback.
|
||||
|
||||
## Deliverables
|
||||
- New IDs and slot APIs in registry
|
||||
- Builder emits `method_id` when resolvable
|
||||
- Unit tests for slot reservation and universal slot invariants
|
||||
|
||||
## Non-Goals
|
||||
- VM vtable/thunk dispatch (handled in 9.79b.2)
|
||||
- PIC/JIT codegen
|
||||
|
||||
## Risks & Mitigations
|
||||
- Slot consistency with inheritance: document rule “override keeps parent slot”; add test.
|
||||
- Partial resolvability: ensure late-bind remains correct and does not regress semantics.
|
||||
|
||||
## Timeline
|
||||
- 1–2 days
|
||||
|
||||
## Acceptance Criteria
|
||||
- Tests pass; builder prints BoxCall with numeric `method_id` for resolvable sites.
|
||||
- Universal methods occupy reserved slots across all types.
|
||||
- No change to MIR opcode count (26) and existing dumps remain valid except for `method_id` where applicable.
|
||||
|
||||
## Roll-forward
|
||||
- Proceed to 9.79b.2 (VM vtable/thunk + mono-PIC).
|
||||
|
||||
@ -0,0 +1,51 @@
|
||||
# Phase 9.79b.2: VM VTable Thunks + Mono-PIC
|
||||
|
||||
Status: Planned
|
||||
Owner: core-runtime
|
||||
Target: Before Phase 10 (Cranelift JIT)
|
||||
Last Updated: 2025-08-26
|
||||
|
||||
## Goals
|
||||
- Implement unified VM BoxCall path via vtable thunks indexed by `MethodId`.
|
||||
- Add monomorphic inline cache (PIC) at call sites; prepare for polymorphic expansion.
|
||||
- Keep behavior identical; improve structure and enable JIT lowering.
|
||||
|
||||
## Scope
|
||||
- VM Dispatch
|
||||
- Add `TypeMeta` with `vtable_base`, `version`.
|
||||
- `execute_boxcall(receiver, method_id, args)`: lookup thunk = `vtable[slot]` and call target.
|
||||
- PIC (Monomorphic)
|
||||
- Per call-site cache: `(type_id, version) → target` fast path with fallback.
|
||||
- Counters for hit/miss (debug only) to validate performance wins.
|
||||
- Plugin safety (stub)
|
||||
- Provide thunk replacement and type `version++` API (actual unload handled later with plugin mgr).
|
||||
- Tests
|
||||
- BoxCall correctness across builtin/user/plugin (plugin mocked if needed).
|
||||
- PIC hit on repeated calls; miss on version change.
|
||||
- Docs
|
||||
- Update VM README with unified path and PIC diagram.
|
||||
|
||||
## Deliverables
|
||||
- Unified VM BoxCall path (vtable + thunk)
|
||||
- Monomorphic PIC
|
||||
- Test coverage for core scenarios
|
||||
|
||||
## Non-Goals
|
||||
- Polymorphic PIC (plan only)
|
||||
- JIT emission (Phase 10)
|
||||
|
||||
## Risks & Mitigations
|
||||
- Thunk ABI uniformity: define single target signature usable by builtin/VM/plugin shims.
|
||||
- Cache invalidation: bump `version` on thunk replacement; verify miss logic.
|
||||
|
||||
## Timeline
|
||||
- 2–3 days
|
||||
|
||||
## Acceptance Criteria
|
||||
- All existing tests pass; new VM dispatch tests pass.
|
||||
- Measurable hit rate on hot call-sites in debug stats.
|
||||
- No observable behavior change from user code perspective.
|
||||
|
||||
## Roll-forward
|
||||
- Phase 10: Cranelift JIT lowers BoxCall to the same thunks; add poly-PIC and codegen stubs.
|
||||
|
||||
Reference in New Issue
Block a user