Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix stats and progress issues in codegen #14763

Merged
Merged
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 10 additions & 7 deletions src/compiler/crystal/compiler.cr
Original file line number Diff line number Diff line change
Expand Up @@ -505,8 +505,6 @@ module Crystal
private def codegen_many_units(program, units, target_triple)
all_reused = [] of String

wants_stats_or_progress = @progress_tracker.stats? || @progress_tracker.progress?

# Don't start more processes than compilation units
n_threads = @n_threads.clamp(1..units.size)

Expand All @@ -516,7 +514,12 @@ module Crystal
if n_threads == 1
units.each do |unit|
unit.compile
all_reused << unit.name if wants_stats_or_progress && unit.reused_previous_compilation?
@progress_tracker.stage_progress += 1
end
if @progress_tracker.stats?
units.each do |unit|
all_reused << unit.name && unit.reused_previous_compilation?
end
end
return all_reused
end
Expand Down Expand Up @@ -578,10 +581,10 @@ module Crystal
end

while response = channel.receive?
next unless wants_stats_or_progress

result = JSON.parse(response)
all_reused << result["name"].as_s if result["reused"].as_bool
if @progress_tracker.stats?
result = JSON.parse(response)
all_reused << result["name"].as_s if result["reused"].as_bool
end
@progress_tracker.stage_progress += 1
end

Expand Down
Loading