aboutsummaryrefslogtreecommitdiff
path: root/src/Zcu/PerThread.zig
diff options
context:
space:
mode:
authormlugg <mlugg@mlugg.co.uk>2025-04-20 03:43:02 +0100
committermlugg <mlugg@mlugg.co.uk>2025-04-20 18:11:53 +0100
commit8c9c24e09b8a1e1ea92a16edd654a4b27e9ecf94 (patch)
treeca9b15c23345a9ed82e0d8f25b28510583cf1b8e /src/Zcu/PerThread.zig
parent6561a98a61bb54c9d6c868f788da3eaa6f48d2c3 (diff)
downloadzig-8c9c24e09b8a1e1ea92a16edd654a4b27e9ecf94.tar.gz
zig-8c9c24e09b8a1e1ea92a16edd654a4b27e9ecf94.zip
compiler: integrate `@compileLog` with incremental compilation
Compile log output is now separated based on the `AnalUnit` which perfomred the `@compileLog` call, so that we can omit the output for unreferenced ("dead") units. The units are also sorted when collecting the `ErrorBundle`, so that compile logs are always printed in a consistent order, like compile errors are. This is important not only for incremental compilation, but also for parallel analysis. Resolves: #23609
Diffstat (limited to 'src/Zcu/PerThread.zig')
-rw-r--r--src/Zcu/PerThread.zig6
1 files changed, 6 insertions, 0 deletions
diff --git a/src/Zcu/PerThread.zig b/src/Zcu/PerThread.zig
index 9084e8b0ca..c80b80cb7d 100644
--- a/src/Zcu/PerThread.zig
+++ b/src/Zcu/PerThread.zig
@@ -599,6 +599,7 @@ pub fn ensureMemoizedStateUpToDate(pt: Zcu.PerThread, stage: InternPool.Memoized
_ = zcu.outdated_ready.swapRemove(unit);
// No need for `deleteUnitExports` because we never export anything.
zcu.deleteUnitReferences(unit);
+ zcu.deleteUnitCompileLogs(unit);
if (zcu.failed_analysis.fetchSwapRemove(unit)) |kv| {
kv.value.destroy(gpa);
}
@@ -749,6 +750,7 @@ pub fn ensureComptimeUnitUpToDate(pt: Zcu.PerThread, cu_id: InternPool.ComptimeU
if (dev.env.supports(.incremental)) {
zcu.deleteUnitExports(anal_unit);
zcu.deleteUnitReferences(anal_unit);
+ zcu.deleteUnitCompileLogs(anal_unit);
if (zcu.failed_analysis.fetchSwapRemove(anal_unit)) |kv| {
kv.value.destroy(gpa);
}
@@ -921,6 +923,7 @@ pub fn ensureNavValUpToDate(pt: Zcu.PerThread, nav_id: InternPool.Nav.Index) Zcu
_ = zcu.outdated_ready.swapRemove(anal_unit);
zcu.deleteUnitExports(anal_unit);
zcu.deleteUnitReferences(anal_unit);
+ zcu.deleteUnitCompileLogs(anal_unit);
if (zcu.failed_analysis.fetchSwapRemove(anal_unit)) |kv| {
kv.value.destroy(gpa);
}
@@ -1293,6 +1296,7 @@ pub fn ensureNavTypeUpToDate(pt: Zcu.PerThread, nav_id: InternPool.Nav.Index) Zc
_ = zcu.outdated_ready.swapRemove(anal_unit);
zcu.deleteUnitExports(anal_unit);
zcu.deleteUnitReferences(anal_unit);
+ zcu.deleteUnitCompileLogs(anal_unit);
if (zcu.failed_analysis.fetchSwapRemove(anal_unit)) |kv| {
kv.value.destroy(gpa);
}
@@ -1527,6 +1531,7 @@ pub fn ensureFuncBodyUpToDate(pt: Zcu.PerThread, maybe_coerced_func_index: Inter
_ = zcu.outdated_ready.swapRemove(anal_unit);
zcu.deleteUnitExports(anal_unit);
zcu.deleteUnitReferences(anal_unit);
+ zcu.deleteUnitCompileLogs(anal_unit);
if (zcu.failed_analysis.fetchSwapRemove(anal_unit)) |kv| {
kv.value.destroy(gpa);
}
@@ -3764,6 +3769,7 @@ pub fn ensureTypeUpToDate(pt: Zcu.PerThread, ty: InternPool.Index) Zcu.SemaError
// reusing the memory which is currently being used to track this state.
zcu.deleteUnitExports(anal_unit);
zcu.deleteUnitReferences(anal_unit);
+ zcu.deleteUnitCompileLogs(anal_unit);
if (zcu.failed_analysis.fetchSwapRemove(anal_unit)) |kv| {
kv.value.destroy(gpa);
}