Fix saving volatile registers now that we use unused args as scratch

This commit is contained in:
Jef
2019-01-18 13:04:53 +01:00
parent e57cec3b3f
commit b23e00893c

View File

@@ -2036,13 +2036,13 @@ impl Context<'_> {
fn save_volatile(&mut self) -> ArrayVec<[GPR; SCRATCH_REGS.len()]> { fn save_volatile(&mut self) -> ArrayVec<[GPR; SCRATCH_REGS.len()]> {
let mut out = ArrayVec::new(); let mut out = ArrayVec::new();
for &reg in SCRATCH_REGS.iter() { for &reg in self.block_state.stack.iter().filter_map(|v| {
if self if let StackValue::Temp(r) = v {
.block_state Some(r)
.stack } else {
.iter() None
.filter_map(|v| v.location(&self.block_state.locals)) }
.any(|p| p == ValueLocation::Reg(reg)) }) {
{ {
dynasm!(self.asm dynasm!(self.asm
; push Rq(reg) ; push Rq(reg)