mirror of
https://github.com/Ed94/Odin.git
synced 2026-07-31 03:40:08 +00:00
Minimize contention on the deps for decls
This commit is contained in:
+4
-1
@@ -1608,7 +1608,10 @@ gb_internal bool check_proc_body(CheckerContext *ctx_, Token token, DeclInfo *de
|
|||||||
|
|
||||||
check_scope_usage(ctx->checker, ctx->scope);
|
check_scope_usage(ctx->checker, ctx->scope);
|
||||||
|
|
||||||
add_deps_from_child_to_parent(decl);
|
if (decl->entity == nullptr) {
|
||||||
|
// Only care about nested procedure literals
|
||||||
|
add_deps_from_child_to_parent(decl);
|
||||||
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -9455,6 +9455,9 @@ gb_internal ExprKind check_expr_base_internal(CheckerContext *c, Operand *o, Ast
|
|||||||
|
|
||||||
pl->decl = decl;
|
pl->decl = decl;
|
||||||
check_procedure_later(ctx.checker, ctx.file, empty_token, decl, type, pl->body, pl->tags);
|
check_procedure_later(ctx.checker, ctx.file, empty_token, decl, type, pl->body, pl->tags);
|
||||||
|
mutex_lock(&ctx.checker->nested_proc_lits_mutex);
|
||||||
|
array_add(&ctx.checker->nested_proc_lits, decl);
|
||||||
|
mutex_unlock(&ctx.checker->nested_proc_lits_mutex);
|
||||||
}
|
}
|
||||||
check_close_scope(&ctx);
|
check_close_scope(&ctx);
|
||||||
|
|
||||||
|
|||||||
@@ -1256,6 +1256,7 @@ gb_internal void init_checker(Checker *c) {
|
|||||||
|
|
||||||
// NOTE(bill): 1 Mi elements should be enough on average
|
// NOTE(bill): 1 Mi elements should be enough on average
|
||||||
array_init(&c->procs_to_check, heap_allocator(), 0, 1<<20);
|
array_init(&c->procs_to_check, heap_allocator(), 0, 1<<20);
|
||||||
|
array_init(&c->nested_proc_lits, heap_allocator(), 0, 1<<20);
|
||||||
|
|
||||||
mpsc_init(&c->global_untyped_queue, a); // , 1<<20);
|
mpsc_init(&c->global_untyped_queue, a); // , 1<<20);
|
||||||
|
|
||||||
@@ -1267,6 +1268,7 @@ gb_internal void destroy_checker(Checker *c) {
|
|||||||
|
|
||||||
destroy_checker_context(&c->builtin_ctx);
|
destroy_checker_context(&c->builtin_ctx);
|
||||||
|
|
||||||
|
array_free(&c->nested_proc_lits);
|
||||||
array_free(&c->procs_to_check);
|
array_free(&c->procs_to_check);
|
||||||
mpsc_destroy(&c->global_untyped_queue);
|
mpsc_destroy(&c->global_untyped_queue);
|
||||||
}
|
}
|
||||||
@@ -5657,6 +5659,11 @@ gb_internal void check_walk_all_dependencies(DeclInfo *decl) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
gb_internal void check_update_dependency_tree_for_procedures(Checker *c) {
|
gb_internal void check_update_dependency_tree_for_procedures(Checker *c) {
|
||||||
|
mutex_lock(&c->nested_proc_lits_mutex);
|
||||||
|
for (DeclInfo *decl : c->nested_proc_lits) {
|
||||||
|
check_walk_all_dependencies(decl);
|
||||||
|
}
|
||||||
|
mutex_unlock(&c->nested_proc_lits_mutex);
|
||||||
for (Entity *e : c->info.entities) {
|
for (Entity *e : c->info.entities) {
|
||||||
DeclInfo *decl = e->decl_info;
|
DeclInfo *decl = e->decl_info;
|
||||||
check_walk_all_dependencies(decl);
|
check_walk_all_dependencies(decl);
|
||||||
|
|||||||
@@ -449,6 +449,10 @@ struct Checker {
|
|||||||
MPSCQueue<Entity *> procs_with_deferred_to_check;
|
MPSCQueue<Entity *> procs_with_deferred_to_check;
|
||||||
Array<ProcInfo *> procs_to_check;
|
Array<ProcInfo *> procs_to_check;
|
||||||
|
|
||||||
|
BlockingMutex nested_proc_lits_mutex;
|
||||||
|
Array<DeclInfo *> nested_proc_lits;
|
||||||
|
|
||||||
|
|
||||||
MPSCQueue<UntypedExprInfo> global_untyped_queue;
|
MPSCQueue<UntypedExprInfo> global_untyped_queue;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user