mirror of
https://github.com/pjh456/OxideJS.git
synced 2026-10-23 18:21:13 +08:00
fix: 顶层模块 param_layout.base 改 0 防父槽误判 + regalloc/VM 诊断日志
This commit is contained in:
@@ -235,6 +235,25 @@ fn rewrite_inst(
|
||||
}
|
||||
}
|
||||
let _ = f;
|
||||
// 防御:imm16 编码位的操作数必须是 Imm/None,不得是 Reg——
|
||||
// 否则会被上面的 Reg 重写改号,VM 侧 imm16 读到错值(历史 B020 根因)。
|
||||
match inst.op {
|
||||
OpCode::LOAD_UPVALUE | OpCode::CREATE_CLOSURE => {
|
||||
debug_assert!(
|
||||
matches!(a, Operand::Imm(_) | Operand::None),
|
||||
"{}: a 槽是 imm16 编码位,不得为 Reg",
|
||||
inst.op
|
||||
);
|
||||
}
|
||||
OpCode::MAKE_CELL | OpCode::CELL_GET | OpCode::CELL_SET | OpCode::STORE_UPVALUE => {
|
||||
debug_assert!(
|
||||
matches!(b, Operand::Imm(_) | Operand::None),
|
||||
"{}: b 槽是 imm16 编码位,不得为 Reg",
|
||||
inst.op
|
||||
);
|
||||
}
|
||||
_ => {}
|
||||
}
|
||||
(Inst { op: inst.op, rd, a, b, ext }, arg_movs)
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user