Relocate source provenance when native suffixes move

This commit is contained in:
gloamxun committed 2026-12-01 22:17:10 +08:00
1 parent 6acd82dbfa
commit 41a459b4ca
16 files changed
+1507 -79

No files matched your search

@@ -200,6 +200,14 @@ impl Executor {
}
pub(super) fn equivalent_accounting_history(&self, old: &Self) -> bool {
self.equivalent_accounting_history_with_entry_sizes(old, None)
}
pub(super) fn equivalent_accounting_history_with_entry_sizes(
&self,
old: &Self,
entry_sizes: Option<(usize, usize)>,
) -> bool {
// These containers may reintroduce previously retained allocations
// that are outside the accounting walk at this boundary.
let fully_visited = |engine: &Self| {
@@ -219,6 +227,13 @@ impl Executor {
let old_live = old.collect_live_usage(None, None, collector().tracking_aliases());
// The splice translates steps separately and checks the job limit.
live.usage.steps = old_live.usage.steps;
if let Some((previous, current)) = entry_sizes {
let restore = |bytes: usize| bytes.checked_sub(current)?.checked_add(previous);
let Some(source) = restore(live.usage.source_payload_bytes) else { return false; };
let Some(mouth) = restore(live.usage.mouth_payload_bytes) else { return false; };
live.usage.source_payload_bytes = source;
live.usage.mouth_payload_bytes = mouth;
}
live.has_equivalent_history(&old_live, &history, &old_history)
})
}