aboutsummaryrefslogtreecommitdiff
path: root/src/llvm_backend_general.cpp
diff options
context:
space:
mode:
authorgingerBill <gingerBill@users.noreply.github.com>2025-09-19 16:15:04 +0100
committergingerBill <gingerBill@users.noreply.github.com>2025-09-19 16:15:04 +0100
commit9b8771b475a2e0a75205408b2615f69d65a329bd (patch)
tree0040a390f8c5cfc2f2da1610886eb2b5ff26d7f0 /src/llvm_backend_general.cpp
parent655176e5e7ab10b66f7fd936a23f7472a818e5f2 (diff)
Handle missing procedures better
Diffstat (limited to 'src/llvm_backend_general.cpp')
-rw-r--r--src/llvm_backend_general.cpp9
1 files changed, 7 insertions, 2 deletions
diff --git a/src/llvm_backend_general.cpp b/src/llvm_backend_general.cpp
index f42087f6b..02f67b1b8 100644
--- a/src/llvm_backend_general.cpp
+++ b/src/llvm_backend_general.cpp
@@ -3082,9 +3082,12 @@ gb_internal lbValue lb_find_procedure_value_from_entity(lbModule *m, Entity *e)
if (found == nullptr) {
// THIS IS THE RACE CONDITION
lbProcedure *missing_proc_in_other_module = lb_create_procedure(other_module, e, false);
- mpsc_enqueue(&other_module->missing_procedures_to_check, missing_proc_in_other_module);
+ if (!missing_proc_in_other_module->is_done.load(std::memory_order_relaxed)) {
+ mpsc_enqueue(&other_module->missing_procedures_to_check, missing_proc_in_other_module);
+ }
}
} else {
+ GB_PANIC("missing procedure: %.*s", LIT(missing_proc->name));
mpsc_enqueue(&m->missing_procedures_to_check, missing_proc);
}
@@ -3157,7 +3160,9 @@ gb_internal lbValue lb_generate_anonymous_proc_lit(lbModule *m, String const &pr
rw_mutex_shared_unlock(&target_module->values_mutex);
if (found == nullptr) {
lbProcedure *missing_proc_in_target_module = lb_create_procedure(target_module, e, false);
- mpsc_enqueue(&target_module->missing_procedures_to_check, missing_proc_in_target_module);
+ if (!missing_proc_in_target_module->is_done.load(std::memory_order_relaxed)) {
+ mpsc_enqueue(&target_module->missing_procedures_to_check, missing_proc_in_target_module);
+ }
}
lbProcedure *p = lb_create_procedure(m, e, true);