aboutsummaryrefslogtreecommitdiff
path: root/src/check_type.cpp
diff options
context:
space:
mode:
authorgingerBill <gingerBill@users.noreply.github.com>2025-09-10 20:45:26 +0100
committergingerBill <gingerBill@users.noreply.github.com>2025-09-10 20:45:26 +0100
commit0476d33a6c3b0c730b0e0defc10b571b1037c14c (patch)
tree03c6fcd5a86fc8abd69e443c97263c14cc16b805 /src/check_type.cpp
parentd3602ca634061bda4561a05c37f4fe3a828ad1e6 (diff)
Remove global `PtrMap<Type *, GenTypesData *>` and store on the `TypeNamed` directly
Diffstat (limited to 'src/check_type.cpp')
-rw-r--r--src/check_type.cpp18
1 files changed, 9 insertions, 9 deletions
diff --git a/src/check_type.cpp b/src/check_type.cpp
index e99909d6b..aec416921 100644
--- a/src/check_type.cpp
+++ b/src/check_type.cpp
@@ -267,19 +267,19 @@ gb_internal bool check_custom_align(CheckerContext *ctx, Ast *node, i64 *align_,
gb_internal GenTypesData *ensure_polymorphic_record_entity_has_gen_types(CheckerContext *ctx, Type *original_type) {
- mutex_lock(&ctx->info->gen_types_mutex); // @@global
-
GenTypesData *found_gen_types = nullptr;
- auto *found_gen_types_ptr = map_get(&ctx->info->gen_types, original_type);
- if (found_gen_types_ptr == nullptr) {
+
+ GB_ASSERT(original_type->kind == Type_Named);
+ mutex_lock(&original_type->Named.gen_types_data_mutex);
+ if (original_type->Named.gen_types_data == nullptr) {
GenTypesData *gen_types = gb_alloc_item(permanent_allocator(), GenTypesData);
gen_types->types = array_make<Entity *>(heap_allocator());
- map_set(&ctx->info->gen_types, original_type, gen_types);
- found_gen_types_ptr = map_get(&ctx->info->gen_types, original_type);
+ original_type->Named.gen_types_data = gen_types;
}
- found_gen_types = *found_gen_types_ptr;
- GB_ASSERT(found_gen_types != nullptr);
- mutex_unlock(&ctx->info->gen_types_mutex); // @@global
+ found_gen_types = original_type->Named.gen_types_data;
+
+ mutex_unlock(&original_type->Named.gen_types_data_mutex);
+
return found_gen_types;
}