Preserve read evidence and box accounting in settled suffix reuse
This commit is contained in:
1 parent
473b3beace
commit
f78aff25c5
12 files changed
+381
-46
No files matched your search
@@ -6,7 +6,7 @@ use std::fs;
|
||||
#[cfg(test)]
|
||||
use texrra_tex_core::source_map::SourceMap;
|
||||
use texrra_tex_core::{
|
||||
execution::{Error, HostResourceUsage, StatisticsPhase, StatisticsReport, StepOffset, WriteDestination},
|
||||
execution::{Error, HostResourceUsage, StatisticsPhase, StatisticsReport, WriteDestination},
|
||||
resources::{LoadedResource, ResourceKind, ResourceVersion},
|
||||
};
|
||||
|
||||
@@ -177,8 +177,7 @@ impl<'a> RecordingHost<'a> {
|
||||
pub(super) fn replay_suffix(
|
||||
&mut self,
|
||||
calls: &[Call],
|
||||
offset: StepOffset,
|
||||
resize: Option<(usize, usize)>,
|
||||
end_statistics: Option<&StatisticsReport>,
|
||||
cancellation: &Cancellation,
|
||||
) -> Result<(), String> {
|
||||
let recorded = self.calls.as_mut().ok_or("host calls are unavailable")?;
|
||||
@@ -188,15 +187,14 @@ impl<'a> RecordingHost<'a> {
|
||||
for call in calls {
|
||||
check(cancellation).map_err(|error| error.to_string())?;
|
||||
let call = match call {
|
||||
Call::EndStatistics(report) if !offset.is_identity() || resize.is_some() => {
|
||||
let report = report.with_step_offset(offset).ok_or("invalid replayed statistics")?;
|
||||
let report = if let Some((previous, current)) = resize {
|
||||
report.with_suffix_entry_resize(previous, current)
|
||||
.ok_or("invalid replayed entry size in statistics")?
|
||||
Call::EndStatistics(report) => {
|
||||
// The kernel has already checked and translated this report.
|
||||
let translated = end_statistics.ok_or("completed suffix is missing its final statistics")?;
|
||||
if report.as_ref() == translated {
|
||||
call.clone()
|
||||
} else {
|
||||
report
|
||||
};
|
||||
Call::EndStatistics(Arc::new(report))
|
||||
Call::EndStatistics(Arc::new(translated.clone()))
|
||||
}
|
||||
}
|
||||
call => call.clone(),
|
||||
};
|
||||
|
||||
Reference in new issue
Block a user