ZJIT: Add fail-fast assert for non-register {cpush,cpop}_pair

There is no splitting for these so let's add a assert to try and catch
misuse. VRegs are not necessarily registers in the end, so this is best
effort. In those situations they'll get a less proximate panic message.
This commit is contained in:
Alan Wu 2026-01-20 19:06:54 -05:00
parent f7e73ba3bf
commit 36809a8d0c
Notes: git 2026-01-21 00:42:55 +00:00

View File

@ -2159,7 +2159,10 @@ impl Assembler {
self.push_insn(Insn::CPopInto(opnd));
}
#[track_caller]
pub fn cpop_pair_into(&mut self, opnd0: Opnd, opnd1: Opnd) {
assert!(matches!(opnd0, Opnd::Reg(_) | Opnd::VReg{ .. }), "Destination of cpop_pair_into must be a register, got: {opnd0:?}");
assert!(matches!(opnd1, Opnd::Reg(_) | Opnd::VReg{ .. }), "Destination of cpop_pair_into must be a register, got: {opnd1:?}");
self.push_insn(Insn::CPopPairInto(opnd0, opnd1));
}
@ -2167,7 +2170,10 @@ impl Assembler {
self.push_insn(Insn::CPush(opnd));
}
#[track_caller]
pub fn cpush_pair(&mut self, opnd0: Opnd, opnd1: Opnd) {
assert!(matches!(opnd0, Opnd::Reg(_) | Opnd::VReg{ .. }), "Destination of cpush_pair must be a register, got: {opnd0:?}");
assert!(matches!(opnd1, Opnd::Reg(_) | Opnd::VReg{ .. }), "Destination of cpush_pair must be a register, got: {opnd1:?}");
self.push_insn(Insn::CPushPair(opnd0, opnd1));
}