mirror of
https://codeberg.org/ziglang/zig.git
synced 2026-04-27 19:09:47 +03:00
Zcu.PerThread: make debug logs less noisy
I often go through these logs when debugging issues with incremental compilation, but the first thing I do is always comment out some of these lines, because they're just way too noisy. I don't need to know every time Sema checks that a unit is up-to-date, I only care when things actually get analyzed! This decreases the size of `--debug-log zcu` by an order of magnitude (or more) in most cases.
This commit is contained in:
+7
-15
@@ -1073,8 +1073,6 @@ pub fn ensureMemoizedStateUpToDate(
|
||||
|
||||
const unit: AnalUnit = .wrap(.{ .memoized_state = stage });
|
||||
|
||||
log.debug("ensureMemoizedStateUpToDate", .{});
|
||||
|
||||
assert(!zcu.analysis_in_progress.contains(unit));
|
||||
|
||||
const was_outdated = zcu.clearOutdatedState(unit);
|
||||
@@ -1142,6 +1140,8 @@ fn analyzeMemoizedState(
|
||||
const comp = zcu.comp;
|
||||
const gpa = comp.gpa;
|
||||
|
||||
log.debug("analyzeMemoizedState({t})", .{stage});
|
||||
|
||||
const unit: AnalUnit = .wrap(.{ .memoized_state = stage });
|
||||
|
||||
try zcu.analysis_in_progress.putNoClobber(gpa, unit, reason);
|
||||
@@ -1182,8 +1182,6 @@ pub fn ensureComptimeUnitUpToDate(pt: Zcu.PerThread, cu_id: InternPool.ComptimeU
|
||||
|
||||
const anal_unit: AnalUnit = .wrap(.{ .@"comptime" = cu_id });
|
||||
|
||||
log.debug("ensureComptimeUnitUpToDate {f}", .{zcu.fmtAnalUnit(anal_unit)});
|
||||
|
||||
assert(!zcu.analysis_in_progress.contains(anal_unit));
|
||||
|
||||
// Determine whether or not this `ComptimeUnit` is outdated. For this kind of `AnalUnit`, that's
|
||||
@@ -1345,8 +1343,6 @@ pub fn ensureTypeLayoutUpToDate(
|
||||
|
||||
const anal_unit: AnalUnit = .wrap(.{ .type_layout = ty.toIntern() });
|
||||
|
||||
log.debug("ensureTypeLayoutUpToDate {f}", .{zcu.fmtAnalUnit(anal_unit)});
|
||||
|
||||
assert(!zcu.analysis_in_progress.contains(anal_unit));
|
||||
|
||||
const was_outdated: bool = outdated: {
|
||||
@@ -1413,6 +1409,8 @@ pub fn ensureTypeLayoutUpToDate(
|
||||
};
|
||||
defer sema.deinit();
|
||||
|
||||
log.debug("ensureTypeLayoutUpToDate {f} (out of date, resolving)", .{zcu.fmtAnalUnit(anal_unit)});
|
||||
|
||||
const result = switch (ty.zigTypeTag(zcu)) {
|
||||
.@"enum" => Sema.type_resolution.resolveEnumLayout(&sema, ty),
|
||||
.@"struct" => Sema.type_resolution.resolveStructLayout(&sema, ty),
|
||||
@@ -1478,8 +1476,6 @@ pub fn ensureStructDefaultsUpToDate(
|
||||
|
||||
const anal_unit: AnalUnit = .wrap(.{ .struct_defaults = ty.toIntern() });
|
||||
|
||||
log.debug("ensureStructDefaultsUpToDate {f}", .{zcu.fmtAnalUnit(anal_unit)});
|
||||
|
||||
assert(!zcu.analysis_in_progress.contains(anal_unit));
|
||||
|
||||
const was_outdated: bool = outdated: {
|
||||
@@ -1536,6 +1532,8 @@ pub fn ensureStructDefaultsUpToDate(
|
||||
};
|
||||
defer sema.deinit();
|
||||
|
||||
log.debug("ensureStructDefaultsUpToDate {f} (out of date, resolving)", .{zcu.fmtAnalUnit(anal_unit)});
|
||||
|
||||
const new_failed: bool = if (Sema.type_resolution.resolveStructDefaults(&sema, ty)) failed: {
|
||||
break :failed false;
|
||||
} else |err| switch (err) {
|
||||
@@ -1584,8 +1582,6 @@ pub fn ensureNavValUpToDate(
|
||||
const anal_unit: AnalUnit = .wrap(.{ .nav_val = nav_id });
|
||||
const nav = ip.getNav(nav_id);
|
||||
|
||||
log.debug("ensureNavValUpToDate {f}", .{zcu.fmtAnalUnit(anal_unit)});
|
||||
|
||||
assert(!zcu.analysis_in_progress.contains(anal_unit));
|
||||
|
||||
try zcu.ensureNavValAnalysisQueued(nav_id);
|
||||
@@ -1946,8 +1942,6 @@ pub fn ensureNavTypeUpToDate(
|
||||
const anal_unit: AnalUnit = .wrap(.{ .nav_ty = nav_id });
|
||||
const nav = ip.getNav(nav_id);
|
||||
|
||||
log.debug("ensureNavTypeUpToDate {f}", .{zcu.fmtAnalUnit(anal_unit)});
|
||||
|
||||
assert(!zcu.analysis_in_progress.contains(anal_unit));
|
||||
|
||||
try zcu.ensureNavValAnalysisQueued(nav_id);
|
||||
@@ -2191,8 +2185,6 @@ pub fn ensureFuncBodyUpToDate(
|
||||
|
||||
const anal_unit: AnalUnit = .wrap(.{ .func = func_index });
|
||||
|
||||
log.debug("ensureFuncBodyUpToDate {f}", .{zcu.fmtAnalUnit(anal_unit)});
|
||||
|
||||
assert(!zcu.analysis_in_progress.contains(anal_unit));
|
||||
|
||||
const func = zcu.funcInfo(func_index);
|
||||
@@ -2282,7 +2274,7 @@ fn analyzeFuncBody(
|
||||
else
|
||||
.none;
|
||||
|
||||
log.debug("analyze and generate fn body {f}", .{zcu.fmtAnalUnit(anal_unit)});
|
||||
log.debug("analyzeFuncBody {f}", .{zcu.fmtAnalUnit(anal_unit)});
|
||||
|
||||
var air = try pt.analyzeFuncBodyInner(func_index, reason);
|
||||
var air_owned = true;
|
||||
|
||||
Reference in New Issue
Block a user