docs: update normalized_shadow references and Phase 129 status

This commit is contained in:
nyash-codex
2025-12-18 08:18:20 +09:00
parent df23a52916
commit b2af9fb297
6 changed files with 35 additions and 34 deletions

View File

@ -94,7 +94,7 @@ JoinIR の箱構造と責務、ループ/if の lowering パターンを把握
- `docs/development/current/main/phases/phase-127/README.md` - `docs/development/current/main/phases/phase-127/README.md`
30. Phase 128: if-only Normalized partial-assign keep/mergedev-only 30. Phase 128: if-only Normalized partial-assign keep/mergedev-only
- `docs/development/current/main/phases/phase-128/README.md` - `docs/development/current/main/phases/phase-128/README.md`
31. Phase 129: Materialize join_k continuation + LLVM parityP1 in progress 31. Phase 129: Materialize join_k continuation + LLVM parityP1-B done, P2 in progress
- `docs/development/current/main/phases/phase-129/README.md` - `docs/development/current/main/phases/phase-129/README.md`
32. Phase 104: loop(true) break-only digitsVM + LLVM EXE 32. Phase 104: loop(true) break-only digitsVM + LLVM EXE
- `docs/development/current/main/phases/phase-104/README.md` - `docs/development/current/main/phases/phase-104/README.md`

View File

@ -4,6 +4,7 @@
**Phase 129: Materialize join_k continuationdev-only** **Phase 129: Materialize join_k continuationdev-only**
- 現状: Phase 129-B で join_k “if-as-last” を実体化then/else は TailCall(join_k) - 現状: Phase 129-B で join_k “if-as-last” を実体化then/else は TailCall(join_k)
- 補足: `src/mir/control_tree/normalized_shadow/` は責務分離済み(`if_as_last_join_k.rs` / `normalized_verifier.rs` / `parity_contract.rs` / `dev_pipeline.rs` など)
- 残り: post-if`if { x=2 }; return x`)を post_k continuation で表現join_k → post_k の tailcall - 残り: post-if`if { x=2 }; return x`)を post_k continuation で表現join_k → post_k の tailcall
- 入口: `docs/development/current/main/phases/phase-129/README.md` - 入口: `docs/development/current/main/phases/phase-129/README.md`

View File

@ -162,11 +162,18 @@ StepTree は capability を“宣言”し、未対応は **Fail-Fastdev-only
- 責務: "if-only に限定" チェック、capability 拒否理由の SSOT - 責務: "if-only に限定" チェック、capability 拒否理由の SSOT
- Unsupported capability の明示的列挙Loop / Break / Continue 等) - Unsupported capability の明示的列挙Loop / Break / Continue 等)
**`normalized_shadow/parity.rs`**: **`normalized_shadow/parity_contract.rs`**:
- 責務: router/既存経路との比較dev ログ / strict fail-fast - 責務: router/既存経路との契約比較dev ログ / strict fail-fast
- 比較対象: 出口契約(`exits`)と writes の一致(最小で壊れにくい) - 比較対象: 出口契約(`exits`)と writes の一致(最小で壊れにくい)
- strict mode では `freeze_with_hint` でエラーhint 必須) - strict mode では `freeze_with_hint` でエラーhint 必須)
**`normalized_shadow/normalized_verifier.rs`**:
- 責務: 生成された Normalized `JoinModule` の構造検証strict で Fail-Fast
- 例: env 引数個数、JoinFunction の形、tail-call 形式など
**`normalized_shadow/dev_pipeline.rs`**:
- 責務: dev/strict の入口を一本化capability guard → shadow lowering → parity/verify
### Parity検証最小セット ### Parity検証最小セット
**比較対象**(値の一致まではやらない): **比較対象**(値の一致まではやらない):
@ -258,7 +265,7 @@ StepTree は capability を“宣言”し、未対応は **Fail-Fastdev-only
- 責務: capability チェック(変更なし) - 責務: capability チェック(変更なし)
- Unsupported capability の SSOTLoop/Break/Continue - Unsupported capability の SSOTLoop/Break/Continue
**`normalized_shadow/parity.rs`**: **`normalized_shadow/normalized_verifier.rs`**:
- 責務: 構造検証(関数数/継続数/tail-call 形式/env 引数) - 責務: 構造検証(関数数/継続数/tail-call 形式/env 引数)
- strict 時: 生成失敗で `freeze_with_hint` - strict 時: 生成失敗で `freeze_with_hint`
- 実行器があれば RC 比較も可能(オプション) - 実行器があれば RC 比較も可能(オプション)

View File

@ -154,10 +154,10 @@ Phase 121 is complete. Future work:
## Known Limitations ## Known Limitations
- **Stub implementation**: Returns empty JoinModule (contract check only) - **Phase 121 scope**: contract parityexits/writesまでを固定値の一致や JoinModule の実行は対象外)
- **If-only scope**: Loops/breaks/continues rejected - **If-only scope**: Loops/breaks/continues rejected
- **No value comparison**: Only contracts compared (exits/writes) - **No value comparison**: Only contracts compared (exits/writes)
- **LLVM test incomplete**: Harness configuration needed (VM tests validate core) - **JoinModule emission**: Phase 122+ で段階的に追加Phase 121 自体は parity の足場)
## Files Modified ## Files Modified
@ -165,7 +165,7 @@ Phase 121 is complete. Future work:
- `src/mir/control_tree/normalized_shadow/mod.rs` - `src/mir/control_tree/normalized_shadow/mod.rs`
- `src/mir/control_tree/normalized_shadow/contracts.rs` - `src/mir/control_tree/normalized_shadow/contracts.rs`
- `src/mir/control_tree/normalized_shadow/builder.rs` - `src/mir/control_tree/normalized_shadow/builder.rs`
- `src/mir/control_tree/normalized_shadow/parity.rs` - `src/mir/control_tree/normalized_shadow/parity_contract.rs`
- `tools/smokes/v2/profiles/integration/apps/phase121_shadow_if_only_vm.sh` - `tools/smokes/v2/profiles/integration/apps/phase121_shadow_if_only_vm.sh`
- `tools/smokes/v2/profiles/integration/apps/phase121_shadow_if_only_llvm_exe.sh` - `tools/smokes/v2/profiles/integration/apps/phase121_shadow_if_only_llvm_exe.sh`

View File

@ -60,7 +60,7 @@
**完了** - commit \`cc1a0946b\`P2-P3 統合) **完了** - commit \`cc1a0946b\`P2-P3 統合)
**変更**: **変更**:
- \`src/mir/control_tree/normalized_shadow/parity.rs\` - \`src/mir/control_tree/normalized_shadow/normalized_verifier.rs\`
- \`verify_normalized_structure()\` 追加 - \`verify_normalized_structure()\` 追加
- \`src/mir/builder/calls/lowering.rs\` - \`src/mir/builder/calls/lowering.rs\`
- Phase 122 検証呼び出し追加 - Phase 122 検証呼び出し追加

View File

@ -79,7 +79,7 @@ join_k(env_phi):
## Implementation Plan ## Implementation Plan
### P0: LLVM EXE smoke for Phase 128 ✅ ### P0: LLVM EXE parity baseline (Phase 128)
- Add `phase128_if_only_partial_assign_normalized_llvm_exe.sh` - Add `phase128_if_only_partial_assign_normalized_llvm_exe.sh`
- Verify VM+LLVM parity for Phase 128 baseline - Verify VM+LLVM parity for Phase 128 baseline
@ -87,29 +87,21 @@ join_k(env_phi):
**Status**: DONE (commit e7ad3d31b) **Status**: DONE (commit e7ad3d31b)
### P1: Materialize join_k Continuation ### P1-B: Materialize join_k (if-as-last) ✅
**Target**: `src/mir/control_tree/normalized_shadow/builder.rs` **Target**:
- `src/mir/control_tree/normalized_shadow/if_as_last_join_k.rs`
- orchestrator: `src/mir/control_tree/normalized_shadow/builder.rs`
- structure verification: `src/mir/control_tree/normalized_shadow/normalized_verifier.rs`
- contract parity: `src/mir/control_tree/normalized_shadow/parity_contract.rs`
**Changes**: **What is supported**:
1. **lower_if_node**: Generate join_k function - if-only, and the `if` is the last statement (Phase 129-B)
- Create JoinFunction with env parameter - then/else: TailCall(join_k) with env argument (PHI禁止)
- then: `TailCall(join_k, env_then)`
- else: `TailCall(join_k, env_else)`
- join_k body: process post-if statements
2. **verify_normalized_structure**: Add join_k checks **Status**: DONE (Phase 129-B: fixture + VM smoke PASS)
- If exists → join_k exists (by name or structure)
- then/else end with TailCall (not Ret)
- join_k has params (env fields)
- No PHI instructions anywhere
**Acceptance**: ### P2: Post-if support (return-var) 🔜
- `cargo test --lib` PASS
- Phase 128 VM smoke PASS
- Phase 129 LLVM EXE smoke PASS (new fixture)
### P2: Post-If Return Var Fixture
**New fixture**: `apps/tests/phase129_if_only_post_if_return_var_min.hako` **New fixture**: `apps/tests/phase129_if_only_post_if_return_var_min.hako`
```hako ```hako
@ -122,9 +114,9 @@ x=1; flag=1; if flag==1 { x=2 }; print(x); return "OK"
- `NYASH_JOINIR_DEV=1 HAKO_JOINIR_STRICT=1` - `NYASH_JOINIR_DEV=1 HAKO_JOINIR_STRICT=1`
- Verify join_k continuation works - Verify join_k continuation works
**Acceptance**: **Status**:
- VM smoke PASS - Fixture + VM smoke exist.
- join_k actually used (not fallback path) - Not yet guaranteed to run through Normalized join_k path (can still fall back).
### P3: Documentation ### P3: Documentation
@ -136,7 +128,8 @@ x=1; flag=1; if flag==1 { x=2 }; print(x); return "OK"
- ✅ P0: Phase 128 LLVM EXE smoke passes - ✅ P0: Phase 128 LLVM EXE smoke passes
- ✅ P1-B: join_k materialized for if-as-last (then/else tail-call join_k) - ✅ P1-B: join_k materialized for if-as-last (then/else tail-call join_k)
- ✅ P1-B: verify_normalized_structure enforces join_k tailcall + PHI禁止 - ✅ P1-B: verify_normalized_structure enforces join_k tailcall + PHI禁止
- [ ] P2: Phase 129 fixture + VM smoke passes - ✅ P2 (setup): fixture + VM smoke exist
- [ ] P2 (behavior): post-if path runs via Normalized (no fallback)
- [ ] P3: Documentation updated - [ ] P3: Documentation updated
- [ ] Regression: phase103, phase118, phase128 all PASS - [ ] Regression: phase103, phase118, phase128 all PASS
- [ ] `cargo test --lib` PASS - [ ] `cargo test --lib` PASS
@ -147,10 +140,10 @@ x=1; flag=1; if flag==1 { x=2 }; print(x); return "OK"
# Unit tests # Unit tests
cargo test --lib cargo test --lib
# Smoke tests # Smoke tests (baseline)
bash tools/smokes/v2/profiles/integration/apps/phase128_if_only_partial_assign_normalized_vm.sh bash tools/smokes/v2/profiles/integration/apps/phase128_if_only_partial_assign_normalized_vm.sh
bash tools/smokes/v2/profiles/integration/apps/phase128_if_only_partial_assign_normalized_llvm_exe.sh bash tools/smokes/v2/profiles/integration/apps/phase128_if_only_partial_assign_normalized_llvm_exe.sh
bash tools/smokes/v2/profiles/integration/apps/phase129_if_only_post_if_return_var_vm.sh bash tools/smokes/v2/profiles/integration/apps/phase129_join_k_as_last_vm.sh
# Regression # Regression
bash tools/smokes/v2/profiles/integration/apps/phase103_if_only_llvm_exe.sh bash tools/smokes/v2/profiles/integration/apps/phase103_if_only_llvm_exe.sh