mirror of
https://github.com/Ed94/Odin.git
synced 2026-08-05 23:28:48 +00:00
Add type_and_value_mutex to DeclInfo
This commit is contained in:
+6
-2
@@ -1453,7 +1453,9 @@ gb_internal void add_type_and_value(CheckerContext *ctx, Ast *expr, AddressingMo
|
|||||||
}
|
}
|
||||||
|
|
||||||
BlockingMutex *mutex = &ctx->info->type_and_value_mutex;
|
BlockingMutex *mutex = &ctx->info->type_and_value_mutex;
|
||||||
if (ctx->pkg) {
|
if (ctx->decl) {
|
||||||
|
mutex = &ctx->decl->type_and_value_mutex;
|
||||||
|
} else if (ctx->pkg) {
|
||||||
// TODO(bill): is a per package mutex is a good idea here?
|
// TODO(bill): is a per package mutex is a good idea here?
|
||||||
mutex = &ctx->pkg->type_and_value_mutex;
|
mutex = &ctx->pkg->type_and_value_mutex;
|
||||||
}
|
}
|
||||||
@@ -1749,7 +1751,7 @@ gb_internal void add_type_info_type_internal(CheckerContext *c, Type *t) {
|
|||||||
if (is_type_untyped(t)) {
|
if (is_type_untyped(t)) {
|
||||||
return; // Could be nil
|
return; // Could be nil
|
||||||
}
|
}
|
||||||
if (is_type_polymorphic(base_type(t))) {
|
if (is_type_polymorphic(t)) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1764,6 +1766,8 @@ gb_internal void add_type_info_type_internal(CheckerContext *c, Type *t) {
|
|||||||
|
|
||||||
bool prev = false;
|
bool prev = false;
|
||||||
isize ti_index = -1;
|
isize ti_index = -1;
|
||||||
|
// NOTE(bill): this is a linear lookup, and is most likely very costly
|
||||||
|
// as this map keeps growing linearly
|
||||||
for (auto const &e : c->info->type_info_map) {
|
for (auto const &e : c->info->type_info_map) {
|
||||||
if (are_types_identical_unique_tuples(t, e.key)) {
|
if (are_types_identical_unique_tuples(t, e.key)) {
|
||||||
// Duplicate entry
|
// Duplicate entry
|
||||||
|
|||||||
@@ -185,6 +185,8 @@ struct DeclInfo {
|
|||||||
RwMutex type_info_deps_mutex;
|
RwMutex type_info_deps_mutex;
|
||||||
PtrSet<Type *> type_info_deps;
|
PtrSet<Type *> type_info_deps;
|
||||||
|
|
||||||
|
BlockingMutex type_and_value_mutex;
|
||||||
|
|
||||||
Array<BlockLabel> labels;
|
Array<BlockLabel> labels;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user