aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorgingerBill <gingerBill@users.noreply.github.com>2025-09-18 16:56:19 +0100
committergingerBill <gingerBill@users.noreply.github.com>2025-09-18 16:56:19 +0100
commit5bc9d79f772cd01f9ca1e42dbee17e1f4762aad1 (patch)
tree429e95dd69eb7c2ffd2cee408ac32529734cd26c
parent111e2f0c1b9c25159bee114f170d0d20914c1c7c (diff)
Change mutex usage for missing procedures
-rw-r--r--src/llvm_backend.hpp2
-rw-r--r--src/llvm_backend_general.cpp6
2 files changed, 6 insertions, 2 deletions
diff --git a/src/llvm_backend.hpp b/src/llvm_backend.hpp
index ebe9fe796..5d6f56433 100644
--- a/src/llvm_backend.hpp
+++ b/src/llvm_backend.hpp
@@ -173,6 +173,8 @@ struct lbModule {
StringMap<lbValue> members;
StringMap<lbProcedure *> procedures;
PtrMap<LLVMValueRef, Entity *> procedure_values;
+
+ BlockingMutex missing_procedures_to_check_mutex;
Array<lbProcedure *> missing_procedures_to_check;
StringMap<LLVMValueRef> const_strings;
diff --git a/src/llvm_backend_general.cpp b/src/llvm_backend_general.cpp
index 9561f86dd..3ac405e0b 100644
--- a/src/llvm_backend_general.cpp
+++ b/src/llvm_backend_general.cpp
@@ -3030,10 +3030,11 @@ gb_internal lbValue lb_find_procedure_value_from_entity(lbModule *m, Entity *e)
}
if (ignore_body) {
- mutex_lock(&gen->anonymous_proc_lits_mutex);
- defer (mutex_unlock(&gen->anonymous_proc_lits_mutex));
+ // mutex_lock(&gen->anonymous_proc_lits_mutex);
+ // defer (mutex_unlock(&gen->anonymous_proc_lits_mutex));
GB_ASSERT(other_module != nullptr);
+ mutex_lock(&other_module->missing_procedures_to_check_mutex);
rw_mutex_shared_lock(&other_module->values_mutex);
auto *found = map_get(&other_module->values, e);
rw_mutex_shared_unlock(&other_module->values_mutex);
@@ -3042,6 +3043,7 @@ gb_internal lbValue lb_find_procedure_value_from_entity(lbModule *m, Entity *e)
lbProcedure *missing_proc_in_other_module = lb_create_procedure(other_module, e, false);
array_add(&other_module->missing_procedures_to_check, missing_proc_in_other_module);
}
+ mutex_unlock(&other_module->missing_procedures_to_check_mutex);
} else {
array_add(&m->missing_procedures_to_check, missing_proc);
}