Remove need for scope mutex, make Scope singly linked list tree with atomic pointers

This commit is contained in:
gingerBill
2021-07-14 23:49:35 +01:00
parent 10f4d8df32
commit 981b9fb7a8
2 changed files with 9 additions and 18 deletions
+2 -6
View File
@@ -187,11 +187,8 @@ enum { DEFAULT_SCOPE_CAPACITY = 29 };
struct Scope {
Ast * node;
Scope * parent;
// TODO(bill): make this is an ATOMIC singular linked list
Scope * prev;
Scope * next;
Scope * first_child;
Scope * last_child;
std::atomic<Scope *> next;
std::atomic<Scope *> head_child;
StringMap<Entity *> elements;
Array<Ast *> delayed_directives;
@@ -299,7 +296,6 @@ struct CheckerInfo {
// these variables will be of contention
BlockingMutex deps_mutex; // NOT recursive & Only used in `check_proc_body`
BlockingMutex scope_mutex; // NOT recursive & Only used in `create_scope`
gbMutex gen_procs_mutex; // Possibly recursive
gbMutex gen_types_mutex; // Possibly recursive