docs(phase29ab): closeout P1-P9
This commit is contained in:
@ -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 frag(Return/Normal)を合成して早期離脱を明示する形(Pattern6 scan-with-init)
|
||||
- どちらも **Frag の validity を前提** にし、Normalizer が入口で妥当性を保証する
|
||||
- Pattern6/7 contract SSOT: `docs/development/current/main/design/pattern6-7-contracts.md`
|
||||
|
||||
補足(Phase 270):
|
||||
- Pattern1(simple_while_minimal)は test-only stub のため、一般ループの “基準” には使えない。
|
||||
- Phase 270 では “最小の固定形” を Pattern9(AccumConstLoop)として追加し、後で Frag 合成側へ吸収される前提で橋渡しにする。
|
||||
|
||||
39
docs/development/current/main/design/pattern6-7-contracts.md
Normal file
39
docs/development/current/main/design/pattern6-7-contracts.md
Normal 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)
|
||||
Reference in New Issue
Block a user