feat(phase276-p0): Quick Win improvements - type helper SSOT + debug cleanup
Phase 276 P0 post-Phase 275 robustness improvements: 1. Debug cleanup (wiring.py L100-103): - Remove traceback.format_stack() output - Cleaner debug logs after Phase 275 completion 2. box_from_f64 usage investigation: - Confirmed ZERO usage (Rust/Python/MIR) - Ready for deletion (Phase 275 unboxed double SSOT) - crates/nyash_kernel/src/lib.rs L244-252, L971-982 3. Type resolution SSOT (⭐ most important): - New file: src/llvm_py/phi_wiring/type_helper.py (72 lines) - Unified 3 duplicate logic sites: * tagging.py: inst.get("dst_type") → type_helper.get_phi_dst_type() * llvm_builder.py: 9 lines → 2 lines (-7) * wiring.py: 18 lines → 5 lines (-13) - Priority: MIR JSON dst_type > resolver.value_types - Benefits: SSOT principle, bug prevention, easy extension 4. Type mismatch warning enhancement (wiring.py L63-79): - CRITICAL warning for predeclared PHI type mismatch - PhiManager.invalidate_phi() notification - Early bug detection with ⚠️ marker Effects: - Type resolution logic: 3 sites → 1 SSOT (type_helper.py) - Code reduction: -20 lines duplicate logic - Robustness: SSOT principle, CRITICAL warnings, Fail-Fast - Debuggability: cleaner logs, prominent type mismatch alerts Testing: - LLVM harness: exit=3 verified (/tmp/test_p275_debug2.hako) - NYASH_PHI_TYPE_DEBUG=1: correct type resolution confirmed Docs: - Phase 276 P0 completion: docs/.../phase-276/P0-COMPLETION.md - 10-Now.md: Phase 276 P0 ✅, Phase 275 P0 completed section Next steps (Phase 277 P0 recommended): - Delete box_from_f64 (nyash.box.from_f64, nyash.float.box_from_f64) - Adopt dst_type_to_llvm_type() helper 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
This commit is contained in:
@ -1,9 +1,84 @@
|
||||
# Self Current Task — Now (main)
|
||||
|
||||
## Next: Phase 271(docs-only)— Bridge pattern 撤去条件SSOT
|
||||
## Current: Phase 276(P0)— Quick Win 改善(型取得SSOT化) ✅
|
||||
|
||||
- 目的: bridge pattern(例: `Pattern9_AccumConstLoop`)を「汎用化せず、吸収して消す」ための撤去条件を SSOT 化
|
||||
- 変更: `docs/development/current/main/design/edgecfg-fragments.md` と `docs/development/current/main/30-Backlog.md` のみ
|
||||
- 目的: Phase 275 P0 完了後の堅牢性改善(デバッグコード削減・型取得ロジックSSOT化・警告強化)
|
||||
- 完了ドキュメント: `docs/development/current/main/phases/phase-276/P0-COMPLETION.md`
|
||||
- 達成内容:
|
||||
- ✅ デバッグスタックトレース削除(wiring.py)
|
||||
- ✅ box_from_f64 使用確認(削除可能と判断)
|
||||
- ✅ 型取得ロジックSSOT化(type_helper.py 作成、3ファイル統一)
|
||||
- ✅ 型不一致CRITICAL警告強化(PhiManager連携)
|
||||
- 効果:
|
||||
- 型取得ロジックの重複削除(3箇所 → 1箇所)
|
||||
- SSOT原則適用(バグ防止・拡張性向上)
|
||||
- デバッグ性向上(CRITICAL警告で早期発見)
|
||||
|
||||
## 2025-12-22:Phase 275(P0)— coercion SSOT rollout(truthiness / `==` / `+`) ✅
|
||||
|
||||
- 完了: Phase 274 P3 で確定した coercion ルール(A1/B2/C2)を VM/LLVM に実装
|
||||
- Decision (SSOT): `docs/development/current/main/phases/phase-274/P3-DECISIONS.md`
|
||||
- 実装ガイド: `docs/development/current/main/phases/phase-275/P0-INSTRUCTIONS.md`
|
||||
- 重要修正:
|
||||
- Float型PHI完全対応(MIR型伝播 → LLVM IR double生成)
|
||||
- 型取得ロジック3箇所統一(type_helper.py)
|
||||
- 型不一致警告強化(CRITICAL表示)
|
||||
- fixture/smoke:
|
||||
- `apps/tests/phase275_p0_float_phi_min.hako` (想定)
|
||||
- LLVM harness で exit=3 動作確認済み
|
||||
|
||||
### 過去の Blocker: 型伝播パイプラインの二重化(lifecycle vs JoinIR)
|
||||
|
||||
- 現状、型伝播/PHI 型解決の順序が経路により異なり、同一 fixture が別ルートで壊れ得る(実質 "2本のコンパイラ")。
|
||||
- 対処(SSOT): Phase 276 P0 で型取得ロジックをSSOT化(部分対応完了)
|
||||
- Phase 276 本体: type propagation pipeline 完全統一(長期計画)
|
||||
- 予定: `docs/development/current/main/phases/phase-276/README.md`
|
||||
|
||||
## 2025-12-22:Phase 274(P1)— TypeOp(is/as)を Rust VM で実行可能にする ✅
|
||||
|
||||
- 完了: Rust VM が `MirInstruction::TypeOp`(Check/Cast)を実行可能
|
||||
- fixture/smoke:
|
||||
- `apps/tests/phase274_p1_typeop_is_as_min.hako`
|
||||
- `tools/smokes/v2/profiles/integration/apps/phase274_p1_typeop_is_as_vm.sh`
|
||||
|
||||
## 2025-12-22:Phase 274(P2)— LLVM TypeOp alignment ✅
|
||||
|
||||
- 完了: LLVM harness でも `TypeOp(Check/Cast)` が SSOT(Rust VM)と一致
|
||||
- 重要修正: MIR JSON emitter(bin)で `typeop` が欠落していたため、JSON に `op:"typeop"` を出力するよう修正
|
||||
- fixture/smoke(LLVM):
|
||||
- `apps/tests/phase274_p2_typeop_primitives_only.hako`
|
||||
- `tools/smokes/v2/profiles/integration/apps/phase274_p2_typeop_is_as_llvm.sh`
|
||||
|
||||
## 2025-12-22:Phase 272(P0.2)— Pattern7 Frag+emit_frag 移行 ✅
|
||||
|
||||
- 目的: Pattern7(split scan)を `Frag + emit_frag()` 経路へ移行し、terminator emission を SSOT に集約する(副作用 `result.push` を含む)
|
||||
- 状況: Phase 272 P0.1(Pattern6)+ P0.2(Pattern7)ともに ✅ 完了
|
||||
- 入口 fixture/smoke:
|
||||
- Pattern7: `apps/tests/phase256_p0_split_min.hako` + `tools/smokes/v2/profiles/integration/apps/phase256_p0_split_vm.sh`
|
||||
- SSOT: `docs/development/current/main/design/edgecfg-fragments.md`(合成則/bridge撤去条件)
|
||||
- 詳細: `docs/development/current/main/phases/phase-272/README.md`
|
||||
|
||||
## 2025-12-22:Phase 271(docs-only)— Bridge pattern 撤去条件SSOT ✅
|
||||
|
||||
- 変更:
|
||||
- `docs/development/current/main/design/edgecfg-fragments.md` に bridge contract(テンプレ)+ `Pattern9_AccumConstLoop` 撤去条件を追記
|
||||
- `docs/development/current/main/30-Backlog.md` の Phase 271 成果物を明文化
|
||||
|
||||
## 2025-12-22:Phase 269 P1.2(this/me in loop)— Static Call 正規化SSOT ✅
|
||||
|
||||
- 目的: static box 内の `this.method(...)` / `me.method(...)` を runtime receiver にせず、compile-time に static call へ正規化する(NewBox 禁止 / by-name ハードコード禁止)
|
||||
- SSOT: `comp_ctx.current_static_box` と `BoxName.method/arity`(canonical key)
|
||||
- 実装: MethodCall 共通入口で `This/Me` receiver を最優先で検出し、static call へ正規化(ハードコード無し)
|
||||
- fixture/smoke:
|
||||
- `apps/tests/phase269_p1_2_this_method_in_loop_min.hako`
|
||||
- `tools/smokes/v2/profiles/integration/apps/phase269_p1_2_this_method_in_loop_vm.sh`
|
||||
- 受け入れ: MIR dump に receiver `const "StringUtils"` が出ない / `call_method StringUtils.is_digit/1`(同等の static call)になる
|
||||
|
||||
## 2025-12-22:Phase 269 P1(Pattern8 EdgeCFG lowering)— SSA を閉じる ✅
|
||||
|
||||
- 完了: header に `i_current = phi [i_init, preheader], [i_next, step_bb]` を入れて SSA を閉じ、header/body/step の参照を `i_current` に統一
|
||||
- 検証: `tools/smokes/v2/profiles/integration/apps/phase269_p0_pattern8_frag_vm.sh` PASS(+ 回帰 `phase259_p0_is_integer_vm` PASS)
|
||||
- 詳細: `docs/development/current/main/phases/phase-269/README.md`
|
||||
|
||||
## 2025-12-21:Phase 270(P0+P1)— JoinIR-only minimal loop SSOT ✅
|
||||
|
||||
@ -12,25 +87,26 @@
|
||||
- 制約: `cf_loop` は JoinIR-only(非JoinIR loop 経路や env-var 分岐は追加しない)
|
||||
- 詳細: `docs/development/current/main/phases/phase-270/README.md`
|
||||
|
||||
## 2025-12-21:Phase 269 P1(Pattern8 EdgeCFG lowering 実装中)🚧
|
||||
## 2025-12-21:Phase 269 P1(Pattern8 EdgeCFG lowering)✅
|
||||
|
||||
**目的**: Pattern8(BoolPredicateScan)を JoinIR ではなく **EdgeCFG Frag + emit_frag()** で “本当に”動かす(層境界は維持)
|
||||
**スコープ**: Pattern8 内だけ差し替え(merge/EdgeCFG plumbing/Pattern6/7/9 は触らない、cf_loop hard-freeze維持)
|
||||
|
||||
**現状(P1)**:
|
||||
**完了内容(P1)**:
|
||||
- ✅ emission 入口 `loop_predicate_scan` を追加し、Frag 構築 + `emit_frag()` を配線
|
||||
- ✅ 5ブロック構成(header/body/step/after/ret_false)で terminator は生成できている
|
||||
- ❌ ループ変数 `i` が SSA 上で更新されず、挙動が誤る(`i` が初期値のまま)
|
||||
|
||||
**P1 の残タスク(次の一手)**:
|
||||
- header に `i_current = phi [i_init, preheader], [i_next, step_bb]` を入れて SSA を閉じる
|
||||
- header/body/step で `i` の参照をすべて `i_current` に置換
|
||||
- step で `i_next = i_current + 1` を作り、phi の backedge に接続
|
||||
- `return true` は loop 後の既存 AST に任せ、Frag は early-exit `return false` だけを Return wire にする
|
||||
- Pattern8 lower の返り値は当面 `emit_void(builder)`(loop を statement として扱う)
|
||||
- ✅ 5ブロック構成(header/body/step/after/ret_false)で terminator を生成
|
||||
- ✅ header に PHI を挿入して `i` の SSA を閉じた(`i_current`)
|
||||
- ✅ early-exit `return false` は Return wire、`return true` は loop 後 AST に任せる
|
||||
- ✅ Pattern8 lower は当面 `emit_void(builder)`(loop-statement 扱い)
|
||||
|
||||
**詳細**: `docs/development/current/main/phases/phase-269/README.md`
|
||||
|
||||
## 2025-12-21:Phase 269 P1.1(call_method return type)— 署名SSOTで型注釈 ✅
|
||||
|
||||
- 問題: `call_method BoxName.method/N(...)` の戻り値型が既定 `String` になり、Bool を返すメソッドが誤動作する
|
||||
- 修正方針: `emit_unified_call_impl` の直後で、`BoxName.method/arity` の canonical key を構築し、
|
||||
`MirFunction.signature.return_type`(SSOT)から dst の型を注釈する(ハードコード禁止)
|
||||
|
||||
## 2025-12-21:Phase 267 P0(BranchStub + emit_frag)✅
|
||||
|
||||
**目的**: Frag に Branch を第一級で追加し、wires(Jump/Return)と同様に MIR terminator へ落とせる入口(SSOT)を作る
|
||||
|
||||
Reference in New Issue
Block a user