mirror of
https://github.com/aljazceru/turso.git
synced 2026-01-31 22:04:23 +01:00
rename register for IsNull opcode
Now it has the same name as NotNull, so it is easier to write macros
This commit is contained in:
@@ -448,7 +448,7 @@ pub fn translate_condition_expr(
|
||||
let cur_reg = program.alloc_register();
|
||||
translate_expr(program, Some(referenced_tables), expr, cur_reg, resolver)?;
|
||||
program.emit_insn(Insn::IsNull {
|
||||
src: cur_reg,
|
||||
reg: cur_reg,
|
||||
target_pc: condition_metadata.jump_target_when_false,
|
||||
});
|
||||
}
|
||||
|
||||
@@ -310,7 +310,7 @@ impl ProgramBuilder {
|
||||
Insn::IdxGT { target_pc, .. } => {
|
||||
resolve(target_pc, "IdxGT");
|
||||
}
|
||||
Insn::IsNull { src: _, target_pc } => {
|
||||
Insn::IsNull { reg: _, target_pc } => {
|
||||
resolve(target_pc, "IsNull");
|
||||
}
|
||||
_ => continue,
|
||||
|
||||
@@ -1034,14 +1034,14 @@ pub fn insn_to_str(
|
||||
0,
|
||||
"".to_string(),
|
||||
),
|
||||
Insn::IsNull { src, target_pc } => (
|
||||
Insn::IsNull { reg, target_pc } => (
|
||||
"IsNull",
|
||||
*src as i32,
|
||||
*reg as i32,
|
||||
target_pc.to_debug_int(),
|
||||
0,
|
||||
OwnedValue::build_text(Rc::new("".to_string())),
|
||||
0,
|
||||
format!("if (r[{}]==NULL) goto {}", src, target_pc.to_debug_int()),
|
||||
format!("if (r[{}]==NULL) goto {}", reg, target_pc.to_debug_int()),
|
||||
),
|
||||
Insn::ParseSchema { db, where_clause } => (
|
||||
"ParseSchema",
|
||||
|
||||
@@ -510,7 +510,7 @@ pub enum Insn {
|
||||
/// Check if the register is null.
|
||||
IsNull {
|
||||
/// Source register (P1).
|
||||
src: usize,
|
||||
reg: usize,
|
||||
|
||||
/// Jump to this PC if the register is null (P2).
|
||||
target_pc: BranchOffset,
|
||||
|
||||
@@ -2389,8 +2389,8 @@ impl Program {
|
||||
cursors.get_mut(*cursor_id).unwrap().take();
|
||||
state.pc += 1;
|
||||
}
|
||||
Insn::IsNull { src, target_pc } => {
|
||||
if matches!(state.registers[*src], OwnedValue::Null) {
|
||||
Insn::IsNull { reg, target_pc } => {
|
||||
if matches!(state.registers[*reg], OwnedValue::Null) {
|
||||
state.pc = target_pc.to_offset_int();
|
||||
} else {
|
||||
state.pc += 1;
|
||||
|
||||
Reference in New Issue
Block a user