Skip to content

Commit 50763ce

Browse files
committed
JIT support for ToBool instruction
1 parent f12d2f3 commit 50763ce

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

crates/jit/src/instructions.rs

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -635,9 +635,14 @@ impl<'a, 'b> FunctionCompiler<'a, 'b> {
635635
self.stack.swap(i, j);
636636
Ok(())
637637
}
638-
Instruction::UnaryNot => {
638+
Instruction::ToBool => {
639639
let a = self.stack.pop().ok_or(JitCompileError::BadBytecode)?;
640-
let boolean = self.boolean_val(a)?;
640+
let value = self.boolean_val(a)?;
641+
self.stack.push(JitValue::Bool(value));
642+
Ok(())
643+
}
644+
Instruction::UnaryNot => {
645+
let boolean = self.stack.pop().ok_or(JitCompileError::BadBytecode)?;
641646
let not_boolean = self.builder.ins().bxor_imm(boolean, 1);
642647
self.stack.push(JitValue::Bool(not_boolean));
643648
Ok(())

0 commit comments

Comments
 (0)