Share packed box diagnostics across native execution

This commit is contained in:
gloamxun committed 2026-11-28 07:43:44 +08:00
1 parent 526ec9b3b0
commit ca3730338e
13 files changed
+126 -22

No files matched your search

@@ -24,8 +24,8 @@ impl Executor {
return Ok(());
}
// Packing can move existing lists or replace an old register. Recount
// actual owners at an execution boundary before rejecting the job.
let usage = self.resource_usage(shipping, None);
// actual storage here, including a shared diagnostic allocation once.
let usage = self.collect_usage(shipping, None, Collector::for_capacity());
self.material_charge = usage
.active_material
.records()
@@ -40,7 +40,15 @@ impl Executor {
shipping: Option<&NativeBox>,
host: Option<HostResourceUsage>,
) -> ResourceUsage {
let mut c = Collector::default();
self.collect_usage(shipping, host, Collector::default())
}
fn collect_usage(
&self,
shipping: Option<&NativeBox>,
host: Option<HostResourceUsage>,
mut c: Collector,
) -> ResourceUsage {
self.state.collect_statistics(&mut c);
c.usage.steps = self.steps;
c.usage.source_files = self.sources.len();
@@ -132,7 +140,7 @@ impl Executor {
c.vertical(v, Retained);
}
for b in &p.diagnostic_lines {
c.diagnostics(&b.nodes, Retained);
c.shared_diagnostics(&b.nodes, Retained);
}
for paragraph in &p.lines {
for line in &paragraph.lines {