Prepare for multithreading the semantic checker by giving mutexes to variables of contention

NOTE(bill): I know this is dodgy, but I want to make sure it is correct logic before improve those data structures
This commit is contained in:
gingerBill
2021-07-10 15:14:25 +01:00
parent 4a932616fc
commit 9f7154a039
6 changed files with 144 additions and 56 deletions
+3
View File
@@ -786,6 +786,7 @@ void check_proc_decl(CheckerContext *ctx, Entity *e, DeclInfo *d) {
GB_ASSERT(pl->body->kind == Ast_BlockStmt);
if (!pt->is_polymorphic) {
// check_procedure_now(ctx->checker, ctx->file, e->token, d, proc_type, pl->body, pl->tags);
check_procedure_later(ctx->checker, ctx->file, e->token, d, proc_type, pl->body, pl->tags);
}
} else if (!is_foreign) {
@@ -808,7 +809,9 @@ void check_proc_decl(CheckerContext *ctx, Entity *e, DeclInfo *d) {
if (ac.deferred_procedure.entity != nullptr) {
e->Procedure.deferred_procedure = ac.deferred_procedure;
gb_mutex_lock(&ctx->checker->procs_with_deferred_to_check_mutex);
array_add(&ctx->checker->procs_with_deferred_to_check, e);
gb_mutex_unlock(&ctx->checker->procs_with_deferred_to_check_mutex);
}
if (is_foreign) {