mirror of
https://github.com/Ed94/Odin.git
synced 2026-08-04 14:48:47 +00:00
Narrow global gen_procs_mutex further
This commit is contained in:
+3
-6
@@ -439,7 +439,6 @@ gb_internal bool find_or_generate_polymorphic_procedure(CheckerContext *old_c, E
|
|||||||
// @@GPM //////////////////////////
|
// @@GPM //////////////////////////
|
||||||
mutex_lock(&info->gen_procs_mutex);
|
mutex_lock(&info->gen_procs_mutex);
|
||||||
///////////////////////////////////
|
///////////////////////////////////
|
||||||
|
|
||||||
auto *found = map_get(&info->gen_procs, base_entity->identifier.load());
|
auto *found = map_get(&info->gen_procs, base_entity->identifier.load());
|
||||||
if (found) {
|
if (found) {
|
||||||
gen_procs = *found;
|
gen_procs = *found;
|
||||||
@@ -462,6 +461,9 @@ gb_internal bool find_or_generate_polymorphic_procedure(CheckerContext *old_c, E
|
|||||||
gen_procs->procs.allocator = heap_allocator();
|
gen_procs->procs.allocator = heap_allocator();
|
||||||
map_set(&info->gen_procs, base_entity->identifier.load(), gen_procs);
|
map_set(&info->gen_procs, base_entity->identifier.load(), gen_procs);
|
||||||
}
|
}
|
||||||
|
// @@GPM ////////////////////////////
|
||||||
|
mutex_unlock(&info->gen_procs_mutex);
|
||||||
|
/////////////////////////////////////
|
||||||
|
|
||||||
{
|
{
|
||||||
// LEAK TODO(bill): This is technically a memory leak as it has to generate the type twice
|
// LEAK TODO(bill): This is technically a memory leak as it has to generate the type twice
|
||||||
@@ -475,11 +477,6 @@ gb_internal bool find_or_generate_polymorphic_procedure(CheckerContext *old_c, E
|
|||||||
// LEAK TODO(bill): Cloning this AST may be leaky
|
// LEAK TODO(bill): Cloning this AST may be leaky
|
||||||
Ast *cloned_proc_type_node = clone_ast(pt->node);
|
Ast *cloned_proc_type_node = clone_ast(pt->node);
|
||||||
success = check_procedure_type(&nctx, final_proc_type, cloned_proc_type_node, &operands);
|
success = check_procedure_type(&nctx, final_proc_type, cloned_proc_type_node, &operands);
|
||||||
|
|
||||||
// @@GPM ////////////////////////////
|
|
||||||
mutex_unlock(&info->gen_procs_mutex);
|
|
||||||
/////////////////////////////////////
|
|
||||||
|
|
||||||
if (!success) {
|
if (!success) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -51,6 +51,7 @@ gb_internal bool check_rtti_type_disallowed(Ast *expr, Type *type, char const *f
|
|||||||
gb_internal void scope_reset(Scope *scope) {
|
gb_internal void scope_reset(Scope *scope) {
|
||||||
if (scope == nullptr) return;
|
if (scope == nullptr) return;
|
||||||
|
|
||||||
|
MUTEX_GUARD(&scope->mutex);
|
||||||
scope->head_child.store(nullptr, std::memory_order_relaxed);
|
scope->head_child.store(nullptr, std::memory_order_relaxed);
|
||||||
string_map_clear(&scope->elements);
|
string_map_clear(&scope->elements);
|
||||||
ptr_set_clear(&scope->imported);
|
ptr_set_clear(&scope->imported);
|
||||||
|
|||||||
+1
-1
@@ -167,7 +167,7 @@ gb_internal THREAD_PROC(thread_pool_thread_proc) {
|
|||||||
idx = (idx + 1) % cast(usize)pool->threads.count;
|
idx = (idx + 1) % cast(usize)pool->threads.count;
|
||||||
|
|
||||||
Thread *thread = &pool->threads.data[idx];
|
Thread *thread = &pool->threads.data[idx];
|
||||||
WorkerTask task, another_task;
|
WorkerTask task;
|
||||||
if (!thread_pool_queue_pop(thread, &task)) {
|
if (!thread_pool_queue_pop(thread, &task)) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user