Basic block support in JIT

This commit is contained in:
Tom Schuster 2020-10-11 02:37:25 +02:00
parent eedbf3aa6c
commit 6d0978226e

View file

@ -1388,14 +1388,18 @@ impl<O: OutputStream> Compiler<O> {
self.emit(Instruction::CompareOperation { self.emit(Instruction::CompareOperation {
op: to_operator(ops.last().unwrap()), op: to_operator(ops.last().unwrap()),
}); });
self.emit(Instruction::Jump { target: last_label });
// early exit left us with stack: `rhs, comparison_result`. We need to clean up rhs. if vals.len() > 2 {
self.set_label(break_label); self.emit(Instruction::Jump { target: last_label });
self.emit(Instruction::Rotate { amount: 2 });
self.emit(Instruction::Pop); // early exit left us with stack: `rhs, comparison_result`. We need to clean up rhs.
self.set_label(break_label);
self.emit(Instruction::Rotate { amount: 2 });
self.emit(Instruction::Pop);
self.set_label(last_label);
}
self.set_label(last_label);
Ok(()) Ok(())
} }