Skip to content

Commit 53c4991

Browse files
authored
Codegen: stats and progress issues (#14763)
The `--stats` and `--progress` params had a couple issues: - codegen progress isn't updated when `--threads=1` (always the case on Windows); - only stats need to collect reused modules (progress doesn't).
1 parent 4d9a7e8 commit 53c4991

File tree

1 file changed

+8
-5
lines changed

1 file changed

+8
-5
lines changed

src/compiler/crystal/compiler.cr

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -505,8 +505,6 @@ module Crystal
505505
private def codegen_many_units(program, units, target_triple)
506506
all_reused = [] of String
507507

508-
wants_stats_or_progress = @progress_tracker.stats? || @progress_tracker.progress?
509-
510508
# Don't start more processes than compilation units
511509
n_threads = @n_threads.clamp(1..units.size)
512510

@@ -516,7 +514,12 @@ module Crystal
516514
if n_threads == 1
517515
units.each do |unit|
518516
unit.compile
519-
all_reused << unit.name if wants_stats_or_progress && unit.reused_previous_compilation?
517+
@progress_tracker.stage_progress += 1
518+
end
519+
if @progress_tracker.stats?
520+
units.each do |unit|
521+
all_reused << unit.name && unit.reused_previous_compilation?
522+
end
520523
end
521524
return all_reused
522525
end
@@ -597,10 +600,10 @@ module Crystal
597600
exit 1
598601
end
599602

600-
if wants_stats_or_progress
603+
if @progress_tracker.stats?
601604
all_reused << result["name"].as_s if result["reused"].as_bool
602-
@progress_tracker.stage_progress += 1
603605
end
606+
@progress_tracker.stage_progress += 1
604607
end
605608

606609
all_reused

0 commit comments

Comments
 (0)