feat(phase285): Complete weak reference implementation (VM + LLVM harness)
Phase 285LLVM-1.1 to 1.4 + weak reference infrastructure: **LLVM Harness** (Phase 285LLVM-1.x): - 285LLVM-1.1: User Box registration & debug output - 285LLVM-1.2: WeakRef basic operations (identity deferred) - 285LLVM-1.3: InstanceBox field access (getField/setField) - 285LLVM-1.4: print Handle resolution (type tag propagation) **VM Runtime** (nyash_kernel): - FFI functions: nyrt_weak_new, nyrt_weak_to_strong, nyrt_weak_drop (crates/nyash_kernel/src/lib.rs: +209 lines) - WeakRef plugin invoke support (crates/nyash_kernel/src/plugin/invoke.rs: +250 lines) - weak_handles.rs: WeakRef handle registry (NEW) **LLVM Python Backend**: - WeakRef instruction lowering (weak.py: NEW) - Entry point integration (entry.py: +93 lines) - Instruction lowering (instruction_lower.py: +13 lines) - LLVM harness runner script (tools/run_llvm_harness.sh: NEW) **MIR & Runtime**: - WeakRef emission & validation - MIR JSON export for weak instructions - Environment variable support (NYASH_WEAK_*, HAKO_WEAK_*) **Documentation**: - CLAUDE.md: Phase 285 completion notes - LANGUAGE_REFERENCE_2025.md: Weak reference syntax - 10-Now.md & 30-Backlog.md: Phase 285 status updates Total: +864 lines, 24 files changed SSOT: docs/reference/language/lifecycle.md Related: Phase 285W-Syntax-0, Phase 285W-Syntax-0.1
This commit is contained in:
@ -9,7 +9,25 @@
|
||||
- 次: Phase 285(design-first)Box lifecycle SSOT(`docs/development/current/main/phases/phase-285/README.md`)
|
||||
- 次の次: Phase 286(design-first)JoinIR line absorption(`docs/development/current/main/phases/phase-286/README.md`)
|
||||
|
||||
## Recently Completed (2025-12-23)
|
||||
## Recently Completed
|
||||
|
||||
### 2025-12-24: Phase 285LLVM-1.3(LLVM InstanceBox Field Access)
|
||||
|
||||
- ✅ **Phase 285LLVM-1.3完了**: InstanceBox field access (getField/setField) implementation
|
||||
- 詳細: `docs/development/current/main/phases/phase-285/phase-285llvm-1.3-verification-report.md`
|
||||
- 実装: `crates/nyash_kernel/src/plugin/invoke.rs` (~170 lines)
|
||||
- 達成内容:
|
||||
- ✅ getField/setField handlers 実装完了(SSOT `fields_ng` 直接アクセス)
|
||||
- ✅ Fail-Fast error logging 実装(`[llvm/invoke/{get,set}Field]` tags)
|
||||
- ✅ Raw i64 fallback 対応(LLVM backend 特有の挙動)
|
||||
- ✅ Handle resolution 動作確認(handle 4 → IntegerBox(42))
|
||||
- 検証結果:
|
||||
- ✅ setField: Integer(42) を正しく保存
|
||||
- ✅ getField: Integer(42) を正しく取得、handle 返却
|
||||
- ⚠️ print issue: handle 解決問題により VM/LLVM parity blocked(Phase 285LLVM-1.4で対応)
|
||||
- 次フェーズ: Phase 285LLVM-1.4 (print Handle Resolution, 推定2-4時間)
|
||||
|
||||
### 2025-12-23
|
||||
|
||||
- Phase 283(bugfix): JoinIR if-condition remap fix: `docs/development/current/main/phases/phase-283/README.md`
|
||||
- Phase 282(Router shrinkage + extraction-based migration + extractor refactor P0–P9a): `docs/development/current/main/phases/phase-282/README.md`
|
||||
|
||||
@ -34,6 +34,20 @@ Related:
|
||||
- 参考(現状の入口候補):
|
||||
- weakref 表現: `src/value.rs`(`NyashValue::WeakBox`)
|
||||
- finalization: `src/finalization.rs`
|
||||
- 追加(syntax cleanup, small & focused):
|
||||
- `weak` の表面構文を `weak <expr>` に収束(`weak(<expr>)` を持ち込まない)
|
||||
- `let weak w;` / `let weak w = e` の糖衣を検討(概念を増やさず `let w = weak e` にデシュガー)
|
||||
- fixture/smoke は `apps/tests/*.hako` を SSOT にして VM/LLVM で共通化(必要なら LLVM 側は SKIP で理由を固定)
|
||||
|
||||
- **Phase 29x(planned, post self-host): De-Rust runtime for LLVM execution**
|
||||
- 目的: LLVM 実行経路のランタイム依存を段階的に Rust から切り離す(脱Rust)。
|
||||
- 前提: self-host ラインが安定し、VM/LLVM conformance(Phase 285)が十分に固まっていること。
|
||||
- 方針:
|
||||
- 仕様SSOT(strong/weak/fini/cleanup/void)は維持し、実装だけを差し替え可能にする。
|
||||
- まず ABI 境界(例: `nyrt_*`)を “将来置換する契約” として固定し、独立ランタイムに差し替える。
|
||||
- 受け入れ条件(最小):
|
||||
- 既存の `apps/tests/*.hako` fixture を再利用し、VM/LLVM parity のスモークが維持される。
|
||||
- weak の語彙(`weak <expr>` / `weak_to_strong()`)が同じ意味で動作する(cycleは当面リーク仕様でも可)。
|
||||
|
||||
- **Phase 286(planned, design-first): JoinIR Line Absorption(JoinIR→CorePlan/Frag 収束)**
|
||||
- 目的: 移行期間に残っている「2本の lowering(Plan line / JoinIR line)」を、構造で 1 本に収束させる
|
||||
|
||||
Reference in New Issue
Block a user