authorgravatar for mlugg@mlugg.co.ukMatthew Lugg <mlugg@mlugg.co.uk> 2024-08-17 08:31:33+01:00
committergravatar for jacobly@ziglang.orgJacob Young <jacobly@ziglang.org> 2024-08-17 18:50:10-04:00
log04b13547e13e3410b911fdbb06cbb27b5051cfbf
tree2ddfd6d5debfaab1321d632484fa07b14f59976e
parent90116d92b08ff882715ca94ecc79934bc0a73762

Zcu: avoid unnecessary re-analysis in some dependency loop situations

I'm like 80% sure this is correct

1 files changed, 5 insertions(+), 1 deletions(-)

src/Zcu.zig+5-1
...@@ -2429,7 +2429,11 @@ fn markTransitiveDependersPotentiallyOutdated(zcu: *Zcu, maybe_outdated: AnalUni...@@ -2429,7 +2429,11 @@ fn markTransitiveDependersPotentiallyOutdated(zcu: *Zcu, maybe_outdated: AnalUni
2429pub fn findOutdatedToAnalyze(zcu: *Zcu) Allocator.Error!?AnalUnit {2429pub fn findOutdatedToAnalyze(zcu: *Zcu) Allocator.Error!?AnalUnit {
2430 if (!zcu.comp.incremental) return null;2430 if (!zcu.comp.incremental) return null;
24312431
2432 if (zcu.outdated.count() == 0 and zcu.potentially_outdated.count() == 0) {2432 if (zcu.outdated.count() == 0) {
2433 // Any units in `potentially_outdated` must just be stuck in loops with one another: none of those
2434 // units have had any outdated dependencies so far, and all of their remaining PO deps are triggered
2435 // by other units in `potentially_outdated`. So, we can safety assume those units up-to-date.
2436 zcu.potentially_outdated.clear();
2433 log.debug("findOutdatedToAnalyze: no outdated depender", .{});2437 log.debug("findOutdatedToAnalyze: no outdated depender", .{});
2434 return null;2438 return null;
2435 }2439 }