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
+10 -2
View File
@@ -290,6 +290,11 @@ struct CheckerInfo {
// NOTE(bill): If the semantic checker (check_proc_body) is to ever to be multithreaded,
// these variables will be of contention
gbMutex untyped_mutex;
gbMutex gen_procs_mutex;
gbMutex gen_types_mutex;
gbMutex type_info_mutex;
Map<ExprInfo *> untyped; // Key: Ast * | Expression -> ExprInfo *
// NOTE(bill): This needs to be a map and not on the Ast
// as it needs to be iterated across
@@ -346,8 +351,11 @@ struct Checker {
CheckerContext builtin_ctx;
Array<ProcInfo> procs_to_check;
Array<Entity *> procs_with_deferred_to_check;
gbMutex procs_to_check_mutex;
gbMutex procs_with_deferred_to_check_mutex;
Array<ProcInfo *> procs_to_check;
Array<Entity *> procs_with_deferred_to_check;
};