feat(phi): Phase 26-F-2 - 箱理論による責務分離(IfBodyLocalMergeBox新設)
**箱理論による問題解決**: - ❌ 問題: LoopVarClassBox(ループスコープ分析)とif-merge処理が混在 - ✅ 解決: if-merge専用箱を新設して責務分離 **新箱: IfBodyLocalMergeBox**: - 責務: if-merge専用のbody-local φ候補決定 - ロジック: - 両腕に存在する変数を検出 - pre_ifと比較して値が変わった変数のみ - empty elseは空リスト返す - 特徴: LocalScopeInspector不要、LoopVarClassBox不使用 **変更ファイル**: - src/mir/phi_core/if_body_local_merge.rs: 新規作成(IfBodyLocalMergeBox) - src/mir/phi_core/phi_builder_box.rs: IfBodyLocalMergeBox使用に切り替え - src/mir/phi_core/body_local_phi_builder.rs: filter_if_merge_candidates()削除 - src/mir/loop_builder.rs: BodyLocalPhiBuilder setup削除 - src/mir/phi_core/mod.rs: if_body_local_merge追加 **テスト結果**: - Passed: 353→354 (+1) ✅ - Failed: 14→14 (退行なし) **既知の問題**: - domination error依然残存(%48 in bb48 from bb52) - 次フェーズで調査・修正予定 技術詳細: - ChatGPT箱理論分析による設計 - A案ベースのシンプル実装 - 責務明確化: ループスコープ分析 vs if-merge専用処理
This commit is contained in:
@ -501,8 +501,10 @@ static box FuncScannerBox {
|
||||
// 戻り値: トリム済み文字列(null の場合は空文字)
|
||||
method trim(s) {
|
||||
if s == null { return "" }
|
||||
__mir__.log("trim/entry", s)
|
||||
local str = "" + s
|
||||
local n = str.length()
|
||||
__mir__.log("trim/pre", n)
|
||||
local b = 0
|
||||
loop(b < n) {
|
||||
local ch = str.substring(b, b + 1)
|
||||
@ -513,6 +515,7 @@ static box FuncScannerBox {
|
||||
local ch = str.substring(e - 1, e)
|
||||
if ch == " " || ch == "\t" || ch == "\n" || ch == "\r" { e = e - 1 } else { break }
|
||||
}
|
||||
__mir__.log("trim/exit", b, e)
|
||||
if e > b { return str.substring(b, e) }
|
||||
return ""
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user