phase15: implement Phase S root treatment for break control flow
🔧 **Phase S (Immediate Stabilization) Implementation** - Create control flow utilities module (src/mir/utils/) - Refactor loop_builder.rs duplicated code to utilities - Fix PHI incoming predecessor capture per ChatGPT Pro analysis 📊 **AI Collaborative Analysis Complete** - Task agent: Root cause identification - Gemini: Strategic 3-phase approach - codex: Advanced type inference solution (archived) - ChatGPT Pro: Definitive staged treatment strategy 🗂️ **Documentation & Archive** - Strategy document: docs/development/strategies/break-control-flow-strategy.md - codex solutions: archive/codex-solutions/ (100+ lines changes) - Update CLAUDE.md with 2025-09-23 progress ⚡ **Expected Impact** - Resolve collect_prints null return issue - Eliminate code duplication (4 locations unified) - Foundation for Phase M (PHI unification) and Phase L (BuildOutcome) 🎯 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
@ -541,13 +541,19 @@ static box MiniVm {
|
||||
local k_print = "\"kind\":\"Print\""
|
||||
loop (true) {
|
||||
guard = guard + 1
|
||||
if guard > 200 { if trace == 1 { print("[collect][guard_break] guard="+guard) } break }
|
||||
if guard > 200 {
|
||||
if trace == 1 { print("[collect][guard_break] guard="+guard) }
|
||||
if trace == 1 { print("[collect][loop_exit] guard="+guard+" out.size="+out.size()) }
|
||||
if trace == 1 { print("[collect][return] out.size="+out.size()) }
|
||||
return out
|
||||
}
|
||||
local p = index_of_from(json, k_print, pos)
|
||||
if trace == 1 { print("[collect][loop] pos="+pos+" p="+p+" guard="+guard) }
|
||||
if p < 0 {
|
||||
if trace == 1 { print("[collect][p_break] p="+p) }
|
||||
if trace == 1 { print("[collect][pre_break] about to break, out.size="+out.size()) }
|
||||
break
|
||||
if p < 0 {
|
||||
if trace == 1 { print("[collect][p_break] p="+p) }
|
||||
if trace == 1 { print("[collect][loop_exit] guard="+guard+" out.size="+out.size()) }
|
||||
if trace == 1 { print("[collect][return] out.size="+out.size()) }
|
||||
return out
|
||||
}
|
||||
// bound current Print slice to [this, next)
|
||||
local obj_start = p
|
||||
@ -761,13 +767,8 @@ static box MiniVm {
|
||||
pos = obj_end + 1
|
||||
if pos <= p { pos = p + k_print.length() }
|
||||
}
|
||||
if trace == 1 { print("[collect][loop_exit] starting cleanup") }
|
||||
if trace == 1 { print("[collect][guard_val] "+guard) }
|
||||
if trace == 1 { print("[collect][out_ref_check] checking out reference") }
|
||||
if trace == 1 { print("[collect][calling_size] about to call out.size()") }
|
||||
local outsize = out.size()
|
||||
if trace == 1 { print("[collect][size_result] size="+outsize) }
|
||||
if trace == 1 { print("[collect][return] returning out with size="+outsize) }
|
||||
if trace == 1 { print("[collect][loop_exit] guard="+guard+" out.size="+out.size()) }
|
||||
if trace == 1 { print("[collect][return] out.size="+out.size()) }
|
||||
return out
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user