fix(mir): PHI検証panic修正 - update_cfg()を検証前に呼び出し
A案実装: debug_verify_phi_inputs呼び出し前にCFG predecessorを更新
修正箇所(7箇所):
- src/mir/builder/phi.rs:50, 73, 132, 143
- src/mir/builder/ops.rs:273, 328, 351
根本原因:
- Branch/Jump命令でsuccessorは即座に更新
- predecessorはupdate_cfg()で遅延再構築
- PHI検証が先に実行されてpredecessor未更新でpanic
解決策:
- 各debug_verify_phi_inputs呼び出し前に
if let Some(func) = self.current_function.as_mut() {
func.update_cfg();
}
を挿入してCFGを同期
影響: if/else文、論理演算子(&&/||)のPHI生成が正常動作
This commit is contained in:
@ -10,7 +10,7 @@ static box JsonUtilsBox {
|
||||
local pattern = "\"" + key + "\""
|
||||
local idx = StringHelpers.index_of(json, 0, pattern)
|
||||
if idx < 0 { return null }
|
||||
idx = idx + pattern.size()
|
||||
idx = idx + pattern.length()
|
||||
idx = StringHelpers.skip_ws(json, idx)
|
||||
if json.substring(idx, idx + 1) != ":" { return null }
|
||||
idx = StringHelpers.skip_ws(json, idx + 1)
|
||||
@ -25,15 +25,15 @@ static box JsonUtilsBox {
|
||||
local raw = me.extract_value(json, key)
|
||||
if raw == null { return default_value }
|
||||
local trimmed = StringHelpers.trim(raw)
|
||||
if trimmed.size() >= 2 && trimmed.substring(0,1) == "\"" && trimmed.substring(trimmed.size()-1, trimmed.size()) == "\"" {
|
||||
return me.unescape_string(trimmed.substring(1, trimmed.size()-1))
|
||||
if trimmed.length() >= 2 && trimmed.substring(0,1) == "\"" && trimmed.substring(trimmed.length()-1, trimmed.length()) == "\"" {
|
||||
return me.unescape_string(trimmed.substring(1, trimmed.length()-1))
|
||||
}
|
||||
return default_value
|
||||
}
|
||||
|
||||
// Read JSON value (dispatch to appropriate reader)
|
||||
read_value(json, idx) {
|
||||
local n = json.size()
|
||||
local n = json.length()
|
||||
if idx >= n { return "@" + StringHelpers.int_to_str(idx) }
|
||||
local ch = json.substring(idx, idx + 1)
|
||||
if ch == "\"" { return me.read_string(json, idx) }
|
||||
@ -45,7 +45,7 @@ static box JsonUtilsBox {
|
||||
// Read JSON string (escape-aware) with position marker
|
||||
read_string(json, idx) {
|
||||
local i = idx + 1
|
||||
local n = json.size()
|
||||
local n = json.length()
|
||||
local done = 0
|
||||
loop(done == 0 && i < n) {
|
||||
local ch = json.substring(i, i + 1)
|
||||
@ -61,7 +61,7 @@ static box JsonUtilsBox {
|
||||
// Skip JSON string (returns end position)
|
||||
skip_string(json, idx) {
|
||||
local i = idx + 1
|
||||
local n = json.size()
|
||||
local n = json.length()
|
||||
local done = 0
|
||||
loop(done == 0 && i < n) {
|
||||
local ch = json.substring(i, i + 1)
|
||||
@ -75,7 +75,7 @@ static box JsonUtilsBox {
|
||||
read_object(json, idx) {
|
||||
local depth = 0
|
||||
local i = idx
|
||||
local n = json.size()
|
||||
local n = json.length()
|
||||
loop(i < n) {
|
||||
local ch = json.substring(i, i + 1)
|
||||
if ch == "\"" {
|
||||
@ -96,7 +96,7 @@ static box JsonUtilsBox {
|
||||
read_array(json, idx) {
|
||||
local depth = 0
|
||||
local i = idx
|
||||
local n = json.size()
|
||||
local n = json.length()
|
||||
loop(i < n) {
|
||||
local ch = json.substring(i, i + 1)
|
||||
if ch == "\"" {
|
||||
@ -115,7 +115,7 @@ static box JsonUtilsBox {
|
||||
|
||||
// Read JSON literal (number/true/false/null) with position marker
|
||||
read_literal(json, idx) {
|
||||
local n = json.size()
|
||||
local n = json.length()
|
||||
local i = idx
|
||||
loop(i < n) {
|
||||
local ch = json.substring(i, i + 1)
|
||||
@ -128,7 +128,7 @@ static box JsonUtilsBox {
|
||||
// Split JSON array at top-level commas (depth-aware, escape-aware)
|
||||
split_top_level(array_json) {
|
||||
local out = new ArrayBox()
|
||||
local n = array_json.size()
|
||||
local n = array_json.length()
|
||||
local i = 1
|
||||
local start = 1
|
||||
local depth = 0
|
||||
@ -169,7 +169,7 @@ static box JsonUtilsBox {
|
||||
if s == null { return "" }
|
||||
local out = ""
|
||||
local i = 0
|
||||
local n = s.size()
|
||||
local n = s.length()
|
||||
loop(i < n) {
|
||||
local ch = s.substring(i, i + 1)
|
||||
if ch == "\\" && i + 1 < n {
|
||||
|
||||
Reference in New Issue
Block a user