diff options
| author | gingerBill <bill@gingerbill.org> | 2025-02-17 13:46:17 +0000 |
|---|---|---|
| committer | gingerBill <bill@gingerbill.org> | 2025-02-17 13:46:17 +0000 |
| commit | b8f057951c47ccb07316fcd936dba9b71e052d1f (patch) | |
| tree | 6bcb8771db94c7c17ac60b2945c45a5412be45f5 /src/checker.hpp | |
| parent | 9b26bb2e6a1e32e17102550b481c6909549b87e5 (diff) | |
Begin work on `TypeSet`
Diffstat (limited to 'src/checker.hpp')
| -rw-r--r-- | src/checker.hpp | 21 |
1 files changed, 19 insertions, 2 deletions
diff --git a/src/checker.hpp b/src/checker.hpp index c9a0c3302..725c1ccf5 100644 --- a/src/checker.hpp +++ b/src/checker.hpp @@ -409,11 +409,27 @@ struct Defineable { String pos_str; }; -struct Type_Info_Type { +struct TypeInfoPair { Type *type; u64 hash; // see: type_hash_canonical_type }; +struct TypeSet { + TypeInfoPair *keys; + usize count; + usize capacity; +}; + +gb_internal void type_set_init (TypeSet *s, isize capacity = 16); +gb_internal void type_set_destroy(TypeSet *s); +gb_internal Type *type_set_add (TypeSet *s, Type *ptr); +gb_internal bool type_set_update (TypeSet *s, Type *ptr); // returns true if it previously existed +gb_internal bool type_set_update (TypeSet *s, TypeInfoPair pair); // returns true if it previously existed +gb_internal bool type_set_exists (TypeSet *s, Type *ptr); +gb_internal void type_set_remove (TypeSet *s, Type *ptr); +gb_internal void type_set_clear (TypeSet *s); +gb_internal TypeInfoPair *type_set_retrieve(TypeSet *s, Type *ptr); + // CheckerInfo stores all the symbol information for a type-checked program struct CheckerInfo { Checker *checker; @@ -458,8 +474,9 @@ struct CheckerInfo { PtrMap<Type *, GenTypesData *> gen_types; BlockingMutex type_info_mutex; // NOT recursive - Array<Type_Info_Type> type_info_types; + Array<TypeInfoPair> type_info_types; PtrMap<Type *, isize> type_info_map; + TypeSet type_info_set; BlockingMutex foreign_mutex; // NOT recursive StringMap<Entity *> foreigns; |