feat(llvm): Phase 285 P3 - KeepAlive/ReleaseStrong LLVM implementation
Phase 285 P3: LLVM One-Pass (VM/LLVM一気通貫の最小ゲート)
## 実装内容
### 1. LLVM Backend (Python)
- src/llvm_py/instructions/lifecycle.py: NEW
- lower_keepalive(): no-op (DCE/liveness only)
- lower_release_strong(): ny_release_strong() 呼び出し
- src/llvm_py/builders/instruction_lower.py:
- KeepAlive/ReleaseStrong ディスパッチエントリ追加
### 2. Runtime (Rust)
- crates/nyash_kernel/src/lib.rs:
- ny_release_strong(handle: i64): handles::drop() 呼び出し
- Phase 287対応(変数上書きセマンティクス)
### 3. MIR JSON Serialization
- src/runner/mir_json_emit.rs:
- KeepAlive/ReleaseStrong JSON emit 追加(両関数)
- {"op":"keepalive","values":[...]}
- {"op":"release_strong","values":[...]}
## テスト結果
✅ **phase285_p2_weak_upgrade_fail_llvm**: PASS (exit 1, weak_to_strong null)
⏸️ **phase285_p2_weak_upgrade_success_llvm**: SKIP (--version に features 表示なし)
⏸️ **phase284_p2_return_in_loop_llvm**: SKIP (同上)
## SKIP理由(--version feature表示問題)
テストスクリプトが `--version | grep "features.*llvm"` で環境チェックするが、
現在の --version は "nyash 1.0" のみ出力。LLVM feature有効でも SKIP される。
**対応方針**: Phase 285 P3 目的(KeepAlive/ReleaseStrong LLVM実装)達成。
--version feature表示は Phase 286以降で対応予定。
## 検証
- cargo build --release --features llvm: OK
- weak_upgrade_fail_llvm: PASS (VM/LLVM parity確認)
- quick gate: 154/154 PASS (退行なし)
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
This commit is contained in:
@ -37,3 +37,25 @@ cargo build --release --features llvm
|
||||
- `cargo build --release --features llvm` が通る
|
||||
- 上記 integration filter が PASS または理由付き SKIP
|
||||
- quick gate が緑(154/154 PASS)
|
||||
|
||||
---
|
||||
|
||||
## Phase 285 P3 実施結果(2025-12-26)
|
||||
|
||||
### 実装完了
|
||||
- ✅ LLVM バックエンド: lifecycle.py で lower_keepalive/lower_release_strong 実装
|
||||
- ✅ instruction_lower.py: KeepAlive/ReleaseStrong ディスパッチ追加
|
||||
- ✅ nyash_kernel: ny_release_strong() ランタイム関数実装
|
||||
- ✅ mir_json_emit.rs: KeepAlive/ReleaseStrong JSON シリアライゼーション追加
|
||||
|
||||
### テスト結果
|
||||
- ✅ **phase285_p2_weak_upgrade_fail_llvm**: PASS
|
||||
- ⏸️ **phase285_p2_weak_upgrade_success_llvm**: SKIP
|
||||
- ⏸️ **phase284_p2_return_in_loop_llvm**: SKIP
|
||||
|
||||
### SKIP 理由(llvm feature 有効でも SKIP)
|
||||
テストスクリプトは `./target/release/hakorune --version` の出力に "features.*llvm" が含まれているかをチェックしているが、現在の --version 実装は feature 情報を出力していない。そのため、LLVM feature を有効にしてビルドしても、環境チェックで SKIP される。
|
||||
|
||||
**技術的詳細**: `--version` が "nyash 1.0" のみを出力し、cargo features 情報を含めていない。weak_upgrade_fail_llvm は別の環境チェック方式(または環境変数ベース)を使用しているため PASS した。
|
||||
|
||||
**対応方針**: Phase 285 P3 の目的(KeepAlive/ReleaseStrong の LLVM 実装)は達成済み。--version 出力の feature 表示は別タスク(Phase 286 以降)で対応予定。
|
||||
|
||||
Reference in New Issue
Block a user