From 4ea6f1e9288714b7366e1d6726e04ae7f7906e18 Mon Sep 17 00:00:00 2001 From: z78078 Date: Mon, 4 Jul 2022 16:17:04 +0800 Subject: [PATCH] update comments for the changes on nac3core/src/codegen/mod.rs --- nac3core/src/codegen/mod.rs | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/nac3core/src/codegen/mod.rs b/nac3core/src/codegen/mod.rs index c47398b4..93271d53 100644 --- a/nac3core/src/codegen/mod.rs +++ b/nac3core/src/codegen/mod.rs @@ -53,6 +53,8 @@ pub struct StaticValueStore { pub type VarValue<'ctx> = (PointerValue<'ctx>, Option>, i64); lazy_static!( + // HACK: The Mutex is a work-around for issue + // https://git.m-labs.hk/M-Labs/nac3/issues/275 static ref PASSES_INIT_LOCK: Mutex = Mutex::new(AtomicBool::new(true)); ); @@ -230,7 +232,13 @@ impl WorkerRegistry { let passes = PassManager::create(&module); + + // HACK: This critical section is a work-around for issue + // https://git.m-labs.hk/M-Labs/nac3/issues/275 { + // the variable holder `_data` is required even we are not using the + // variable. The lock will release itself if the variable `_data` is not + // there let _data = PASSES_INIT_LOCK.lock(); let pass_builder = PassManagerBuilder::create(); pass_builder.set_optimization_level(OptimizationLevel::Default);