fix: CFG 异常边覆盖 try 体全部块,补全干涉图 keep 与 callee 边

This commit is contained in:
2026-10-05 22:00:50 +00:00
parent 3ceadcf8c9
commit 013c0eb3cf
9 changed files with 136 additions and 61 deletions
+2 -2
View File
@@ -236,7 +236,7 @@ mod tests {
fn try_catch_reg0_not_polluting_entry() {
// 0: try_begin(L_catch)
// 1: ADD r3=r3+r2
// 2: RETURN Reg(3)
// 2: TRY_END
// 3: STORE_VAR(Reg(5), None, None) catch 入口:a=None→0 读 reg 0
// 4: RETURN Reg(5)
let mut f = empty_function();
@@ -244,7 +244,7 @@ mod tests {
f.insts
.push(Inst::new(OpCode::ADD, Operand::Reg(3), Operand::Reg(3), Operand::Reg(2)));
f.insts
.push(Inst::new(OpCode::RETURN, Operand::Reg(3), Operand::None, Operand::None));
.push(Inst::new(OpCode::TRY_END, Operand::None, Operand::None, Operand::None));
f.insts
.push(Inst::new(OpCode::STORE_VAR, Operand::Reg(5), Operand::None, Operand::None));
f.insts
+2 -2
View File
@@ -118,14 +118,14 @@ mod tests {
#[test]
fn catch_entry_reg0_not_live_before_block() {
// 0: try_begin(3) 1: ADD r3=r3+r2 2: RETURN r3
// 0: try_begin(3) 1: ADD r3=r3+r2 2: TRY_END
// 3: STORE_VAR(r5, None, None) 4: RETURN r5
let mut f = empty_function();
f.insts.push(Inst::try_begin(3));
f.insts
.push(Inst::new(OpCode::ADD, Operand::Reg(3), Operand::Reg(3), Operand::Reg(2)));
f.insts
.push(Inst::new(OpCode::RETURN, Operand::Reg(3), Operand::None, Operand::None));
.push(Inst::new(OpCode::TRY_END, Operand::None, Operand::None, Operand::None));
f.insts
.push(Inst::new(OpCode::STORE_VAR, Operand::Reg(5), Operand::None, Operand::None));
f.insts