Skip to content

Commit

Permalink
rewind_labels was renamed to scan_loop_body_labels
Browse files Browse the repository at this point in the history
  • Loading branch information
jussisaurio committed Oct 5, 2024
1 parent d22dbe9 commit d3e797f
Showing 1 changed file with 8 additions and 5 deletions.
13 changes: 8 additions & 5 deletions core/translate/emitter.rs
Original file line number Diff line number Diff line change
Expand Up @@ -286,8 +286,8 @@ impl Emitter for Operator {

let next_row_label = program.allocate_label();
m.next_row_labels.insert(*id, next_row_label);
let rewind_label = program.allocate_label();
m.rewind_labels.push(rewind_label);
let scan_loop_body_label = program.allocate_label();
m.scan_loop_body_labels.push(scan_loop_body_label);
program.emit_insn(Insn::OpenReadAsync {
cursor_id: table_cursor_id,
root_page: table.root_page,
Expand All @@ -310,7 +310,7 @@ impl Emitter for Operator {
} else {
table_cursor_id
};
let rewind_label = *m.rewind_labels.last().unwrap();
let scan_loop_body_label = *m.scan_loop_body_labels.last().unwrap();
let cmp_reg = program.alloc_register();
// TODO this only handles ascending indexes
match seek_cmp {
Expand Down Expand Up @@ -371,7 +371,10 @@ impl Emitter for Operator {
)?;
}

program.defer_label_resolution(rewind_label, program.offset() as usize);
program.defer_label_resolution(
scan_loop_body_label,
program.offset() as usize,
);

// TODO: We are currently only handling ascending indexes.
// For conditions like index_key > 10, we have already seeked to the first key greater than 10, and can just scan forward.
Expand Down Expand Up @@ -486,7 +489,7 @@ impl Emitter for Operator {
program
.resolve_label(*m.next_row_labels.get(id).unwrap(), program.offset());
program.emit_insn(Insn::NextAsync { cursor_id });
let jump_label = m.rewind_labels.pop().unwrap();
let jump_label = m.scan_loop_body_labels.pop().unwrap();
program.emit_insn_with_label_dependency(
Insn::NextAwait {
cursor_id,
Expand Down

0 comments on commit d3e797f

Please sign in to comment.