Merge 'Implement Noop bytecode' from Pedro Muniz

This PR implements Noop. I really don't know what else to say. This
bytecode according to sqlite does: _Do nothing. Continue downward to the
next opcode._ I advanced the program counter to account for continuing
to the next instruction.

Closes #795
This commit is contained in:
Pekka Enberg
2025-01-31 18:49:54 +02:00
4 changed files with 16 additions and 1 deletions

View File

@@ -487,7 +487,7 @@ Modifiers:
| Next | No | |
| NextAsync | Yes | |
| NextAwait | Yes | |
| Noop | No | |
| Noop | Yes | |
| Not | Yes | |
| NotExists | Yes | |
| NotFound | No | |

View File

@@ -1154,6 +1154,15 @@ pub fn insn_to_str(
0,
format!("r[{}]=(r[{}] || r[{}])", dest, lhs, rhs),
),
Insn::Noop => (
"Noop",
0,
0,
0,
OwnedValue::build_text(Rc::new("".to_string())),
0,
String::new(),
),
};
format!(
"{:<4} {:<17} {:<4} {:<4} {:<4} {:<13} {:<2} {}",

View File

@@ -569,6 +569,7 @@ pub enum Insn {
rhs: usize,
dest: usize,
},
Noop,
}
fn cast_text_to_numerical(value: &str) -> OwnedValue {

View File

@@ -2457,6 +2457,11 @@ impl Program {
exec_or(&state.registers[*lhs], &state.registers[*rhs]);
state.pc += 1;
}
Insn::Noop => {
// Do nothing
// Advance the program counter for the next opcode
state.pc += 1
}
}
}
}