Relocate source provenance when native suffixes move
This commit is contained in:
1 parent
6acd82dbfa
commit
41a459b4ca
16 files changed
+1507
-79
No files matched your search
@@ -414,13 +414,20 @@ impl<'a> CapturedEntries<'a> {
|
||||
cancellation: &Cancellation,
|
||||
) -> Result<(), String> {
|
||||
let project = self.request.project.as_deref().expect("settled replay uses a project");
|
||||
let bytes = project.file(&completed.guard.entry).expect("settled entry").data.len();
|
||||
let path = &completed.guard.entry;
|
||||
let bytes = project.file(path).expect("settled entry").data.len();
|
||||
let previous_bytes = completed.guard.project.file(path).expect("prior settled entry").data.len();
|
||||
let resize = (previous_bytes != bytes).then_some((previous_bytes, bytes));
|
||||
let stride = bytes.div_ceil(SOURCE_INTERVALS).max(1);
|
||||
let offset = texrra_tex_core::execution::StepOffset::new(
|
||||
prior.entry.completed_steps(), current.completed_steps(),
|
||||
);
|
||||
let mut later = [const { None }; SOURCE_INTERVALS];
|
||||
if let Some(mut rebase) = current.prepare_suffix_rebase(&prior.entry, &completed.result.execution) {
|
||||
// Untranslated live continuations and their source intervals still
|
||||
// refer to the old entry when its length changed.
|
||||
if resize.is_none()
|
||||
&& let Some(mut rebase) = current.prepare_suffix_rebase(&prior.entry, &completed.result.execution)
|
||||
{
|
||||
// Keep the deepest compatible settled continuation per source interval.
|
||||
for (&page, anchor) in completed.settled.range((std::ops::Bound::Excluded(page), std::ops::Bound::Unbounded)).rev() {
|
||||
let interval = (anchor.entry.frontier() - 1) / stride;
|
||||
@@ -441,7 +448,7 @@ impl<'a> CapturedEntries<'a> {
|
||||
let Some(calls) = completed.calls.get(replayed..anchor.call_count) else {
|
||||
continue;
|
||||
};
|
||||
host.replay_suffix(calls, offset, cancellation)?;
|
||||
host.replay_suffix(calls, offset, None, cancellation)?;
|
||||
replayed = anchor.call_count;
|
||||
if anchor.host == host.files().replay_boundary() {
|
||||
let regular = CaptureSlots {
|
||||
@@ -454,7 +461,7 @@ impl<'a> CapturedEntries<'a> {
|
||||
self.capture(Capture::Settled { page, regular: Some(regular) }, Arc::new(entry), host);
|
||||
}
|
||||
}
|
||||
host.replay_suffix(&completed.calls[replayed..], offset, cancellation)?;
|
||||
host.replay_suffix(&completed.calls[replayed..], offset, resize, cancellation)?;
|
||||
completed.guard.verify_replayed_inputs(host.files(), project).map_err(|error| error.to_string())
|
||||
}
|
||||
|
||||
@@ -970,7 +977,8 @@ impl SelectedCheckpoint {
|
||||
};
|
||||
let Some((completed, old, execution)) = suffixes.clone().find_map(|completed| {
|
||||
let old = completed.settled.get(&page)?;
|
||||
if old.call_count != new.call_count || old.host != new.host
|
||||
if old.call_count != new.call_count
|
||||
|| !new.host.matches_for_suffix(&old.host)
|
||||
|| !can_replay_completed_suffix(completed, request, host.files())
|
||||
{
|
||||
return None;
|
||||
|
||||
Reference in new issue
Block a user