Skip to content

Commit 10b981d

Browse files
committed
Recreate GlobalAsmConfig per CGU
1 parent 68471f1 commit 10b981d

1 file changed

Lines changed: 2 additions & 12 deletions

File tree

src/driver/aot.rs

Lines changed: 2 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@
44
use std::fs::File;
55
use std::io::BufWriter;
66
use std::path::PathBuf;
7-
use std::sync::Arc;
87
use std::thread::JoinHandle;
98

109
use cranelift_object::{ObjectBuilder, ObjectModule};
@@ -344,7 +343,6 @@ fn codegen_cgu_content(
344343

345344
fn module_codegen(
346345
tcx: TyCtxt<'_>,
347-
global_asm_config: Arc<GlobalAsmConfig>,
348346
cgu_name: rustc_span::Symbol,
349347
token: ConcurrencyLimiterToken,
350348
) -> OngoingModuleCodegen {
@@ -360,6 +358,7 @@ fn module_codegen(
360358
let profiler = tcx.prof.clone();
361359
let output_filenames = tcx.output_filenames(()).clone();
362360
let should_write_ir = crate::pretty_clif::should_write_ir(tcx.sess);
361+
let global_asm_config = GlobalAsmConfig::new(tcx.sess);
363362

364363
OngoingModuleCodegen::Async(std::thread::spawn(move || {
365364
profiler.clone().generic_activity_with_arg("compile functions", &*cgu_name).run(|| {
@@ -461,8 +460,6 @@ pub(crate) fn run_aot(tcx: TyCtxt<'_>) -> Box<OngoingCodegen> {
461460
}
462461
});
463462

464-
let global_asm_config = Arc::new(crate::global_asm::GlobalAsmConfig::new(tcx.sess));
465-
466463
let (todo_cgus, done_cgus) =
467464
cgus.iter().enumerate().partition::<Vec<_>, _>(|&(i, _)| match cgu_reuse[i] {
468465
_ if tcx.sess.opts.unstable_opts.disable_incr_comp_backend_caching => true,
@@ -479,14 +476,7 @@ pub(crate) fn run_aot(tcx: TyCtxt<'_>) -> Box<OngoingCodegen> {
479476
let (module, _) = tcx.dep_graph.with_task(
480477
dep_node,
481478
tcx,
482-
|| {
483-
module_codegen(
484-
tcx,
485-
global_asm_config.clone(),
486-
cgu.name(),
487-
concurrency_limiter.acquire(tcx.dcx()),
488-
)
489-
},
479+
|| module_codegen(tcx, cgu.name(), concurrency_limiter.acquire(tcx.dcx())),
490480
Some(rustc_middle::dep_graph::hash_result),
491481
);
492482
IntoDynSyncSend(module)

0 commit comments

Comments
 (0)