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 create new target_machine for every program #14694

Merged
merged 1 commit into from
Jun 12, 2024
Merged
Changes from all 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
6 changes: 5 additions & 1 deletion src/compiler/crystal/compiler.cr
Original file line number Diff line number Diff line change
Expand Up @@ -254,7 +254,7 @@ module Crystal
program.compiler = self
program.filename = sources.first.filename
program.codegen_target = codegen_target
program.target_machine = target_machine
program.target_machine = create_target_machine
program.flags << "release" if release?
program.flags << "debug" unless debug.none?
program.flags << "static" if static?
Expand Down Expand Up @@ -662,6 +662,10 @@ module Crystal
end

getter(target_machine : LLVM::TargetMachine) do
create_target_machine
end

def create_target_machine
@codegen_target.to_target_machine(@mcpu || "", @mattr || "", @optimization_mode, @mcmodel)
rescue ex : ArgumentError
stderr.print colorize("Error: ").red.bold
Expand Down
Loading