docs(phase29ab): closeout P1-P9

This commit is contained in:
2025-12-28 16:36:15 +09:00
parent c397016ac7
commit 209b04d808
12 changed files with 395 additions and 280 deletions

View File

@ -361,6 +361,13 @@ MIR Terminator Instructions
- loop の EdgeCFG 化は、まず **BasicBlockId 層で持っている箇所Phase 268 の if_form のような場所)**から適用を進める。
- JoinIR 側の loop は Phase 270 で **fixture/smoke による SSOT 固定**を先に行い、壊れたら最小差分で直す。
## compose SSOT使い分けガイド
- `compose::if_`: then/else が **Normal exit** で step/merge に合流する形Pattern7 split scan の if/else
- `compose::cleanup`: main frag に cleanup fragReturn/Normalを合成して早期離脱を明示する形Pattern6 scan-with-init
- どちらも **Frag の validity を前提** にし、Normalizer が入口で妥当性を保証する
- Pattern6/7 contract SSOT: `docs/development/current/main/design/pattern6-7-contracts.md`
補足Phase 270:
- Pattern1simple_while_minimalは test-only stub のため、一般ループの “基準” には使えない。
- Phase 270 では “最小の固定形” を Pattern9AccumConstLoopとして追加し、後で Frag 合成側へ吸収される前提で橋渡しにする。

View File

@ -0,0 +1,39 @@
# Pattern6/7 Contracts (SSOT)
This document defines the **contract boundary** for Pattern6/7 extractors.
It is the SSOT for `NotApplicable` vs `Freeze` decisions.
## Common Rule
- **NotApplicable**: shape mismatch (another pattern may apply)
- **Freeze**: shape matches but contract is violated (fail-fast)
Tags:
- Pattern6: `[joinir/phase29ab/pattern6/contract]`
- Pattern7: `[joinir/phase29ab/pattern7/contract]`
## Pattern6 (ScanWithInit / MatchScan)
Accepted shape:
- `loop(i < s.length())` or `loop(i <= s.length() - needle.length())`
- `if s.substring(i, i + 1) == needle { return i }`
- step update exists and matches direction
Freeze conditions:
- step update missing
- forward scan with step != `i = i + 1`
- reverse scan with step != `i = i - 1`
Note:
- plan line is forward-only; reverse scans are currently treated as NotApplicable
## Pattern7 (SplitScan)
Accepted shape:
- `loop(i <= s.length() - separator.length())`
- `if s.substring(i, i + separator.length()) == separator`
- then: `result.push(...)`, `start = i + separator.length()`, `i = start`
- else: `i = i + 1`
Freeze conditions:
- then/else update contracts broken (start/i updates)
- separator literal length != 1 (P0 scope)