275-fix-random-sigsegv #302

Merged
sb10q merged 9 commits from 275-fix-random-sigsegv into master 2022-07-04 18:06:36 +08:00
1 changed files with 8 additions and 0 deletions
Showing only changes of commit 4ea6f1e928 - Show all commits

View File

@ -53,6 +53,8 @@ pub struct StaticValueStore {
pub type VarValue<'ctx> = (PointerValue<'ctx>, Option<Arc<dyn StaticValue + Send + Sync>>, 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<AtomicBool> = 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);