Advance replay checkpoints through completed entry lines

This commit is contained in:
gloamxun committed 2026-11-29 11:10:17 +08:00
1 parent d249ec7eba
commit 51db480b34
5 files changed
+175 -14

No files matched your search

@@ -322,6 +322,7 @@ pub struct CheckpointSource<'a> {
pub bytes: usize,
pub frontier: usize,
pub is_entry: bool,
pub line_consumed: bool,
pub output_returned: bool,
}
@@ -355,6 +356,22 @@ impl EntryCheckpoint {
self.executor.steps
}
/// The later anchor may replace an ordinary checkpoint on the same
/// already loaded physical line when it can accept the same source edits.
pub fn can_advance_entry_anchor(&self, earlier: &Self) -> bool {
self.active_source == self.entry
&& earlier.active_source == earlier.entry
&& self.frontier == earlier.frontier
&& self.executor.steps > earlier.executor.steps
&& self.executor.sources[self.entry].name == earlier.executor.sources[earlier.entry].name
&& self.source_mouth(self.entry)
.same_loaded_prefix_constraint(earlier.source_mouth(earlier.entry))
&& (!self.executor.reads.observed_statistics()
|| (earlier.executor.reads.observed_statistics()
&& self.executor.sources[self.entry].data.len()
== earlier.executor.sources[earlier.entry].data.len()))
}
pub fn accepts_entry(&self, source: &SourceFile) -> bool {
self.accepts_entry_bytes(&source.name, &source.data)
}
@@ -3945,6 +3962,7 @@ impl Executor {
bytes: file.data.len(),
frontier,
is_entry: active_source == entry,
line_consumed: mouth.line_consumed(),
output_returned: engine.output_frame.is_none(),
};
let Some(slot) = select(position, engine.shipped_pages) else {