|
@@ -144,7 +144,7 @@ struct TypeStruct {
|
|
Type * soa_elem;
|
|
Type * soa_elem;
|
|
i32 soa_count;
|
|
i32 soa_count;
|
|
StructSoaKind soa_kind;
|
|
StructSoaKind soa_kind;
|
|
- RwMutex fields_mutex;
|
|
|
|
|
|
+ Wait_Signal fields_wait_signal;
|
|
BlockingMutex offset_mutex; // for settings offsets
|
|
BlockingMutex offset_mutex; // for settings offsets
|
|
|
|
|
|
bool is_polymorphic;
|
|
bool is_polymorphic;
|
|
@@ -2969,9 +2969,8 @@ gb_internal Selection lookup_field_from_index(Type *type, i64 index) {
|
|
isize max_count = 0;
|
|
isize max_count = 0;
|
|
switch (type->kind) {
|
|
switch (type->kind) {
|
|
case Type_Struct:
|
|
case Type_Struct:
|
|
- rw_mutex_shared_lock(&type->Struct.fields_mutex);
|
|
|
|
|
|
+ wait_signal_until_available(&type->Struct.fields_wait_signal);
|
|
max_count = type->Struct.fields.count;
|
|
max_count = type->Struct.fields.count;
|
|
- rw_mutex_shared_unlock(&type->Struct.fields_mutex);
|
|
|
|
break;
|
|
break;
|
|
case Type_Tuple: max_count = type->Tuple.variables.count; break;
|
|
case Type_Tuple: max_count = type->Tuple.variables.count; break;
|
|
}
|
|
}
|
|
@@ -2982,8 +2981,7 @@ gb_internal Selection lookup_field_from_index(Type *type, i64 index) {
|
|
|
|
|
|
switch (type->kind) {
|
|
switch (type->kind) {
|
|
case Type_Struct: {
|
|
case Type_Struct: {
|
|
- rw_mutex_shared_lock(&type->Struct.fields_mutex);
|
|
|
|
- defer (rw_mutex_shared_unlock(&type->Struct.fields_mutex));
|
|
|
|
|
|
+ wait_signal_until_available(&type->Struct.fields_wait_signal);
|
|
for (isize i = 0; i < max_count; i++) {
|
|
for (isize i = 0; i < max_count; i++) {
|
|
Entity *f = type->Struct.fields[i];
|
|
Entity *f = type->Struct.fields[i];
|
|
if (f->kind == Entity_Variable) {
|
|
if (f->kind == Entity_Variable) {
|
|
@@ -3048,9 +3046,8 @@ gb_internal Selection lookup_field_with_selection(Type *type_, String field_name
|
|
}
|
|
}
|
|
}
|
|
}
|
|
if (type->kind == Type_Struct) {
|
|
if (type->kind == Type_Struct) {
|
|
- rw_mutex_shared_lock(&type->Struct.fields_mutex);
|
|
|
|
|
|
+ wait_signal_until_available(&type->Struct.fields_wait_signal);
|
|
isize field_count = type->Struct.fields.count;
|
|
isize field_count = type->Struct.fields.count;
|
|
- rw_mutex_shared_unlock(&type->Struct.fields_mutex);
|
|
|
|
if (field_count != 0) for_array(i, type->Struct.fields) {
|
|
if (field_count != 0) for_array(i, type->Struct.fields) {
|
|
Entity *f = type->Struct.fields[i];
|
|
Entity *f = type->Struct.fields[i];
|
|
if (f->flags&EntityFlag_Using) {
|
|
if (f->flags&EntityFlag_Using) {
|
|
@@ -3079,9 +3076,8 @@ gb_internal Selection lookup_field_with_selection(Type *type_, String field_name
|
|
}
|
|
}
|
|
|
|
|
|
if (type->kind == Type_Struct) {
|
|
if (type->kind == Type_Struct) {
|
|
- rw_mutex_shared_lock(&type->Struct.fields_mutex);
|
|
|
|
|
|
+ wait_signal_until_available(&type->Struct.fields_wait_signal);
|
|
Scope *s = type->Struct.scope;
|
|
Scope *s = type->Struct.scope;
|
|
- rw_mutex_shared_unlock(&type->Struct.fields_mutex);
|
|
|
|
if (s != nullptr) {
|
|
if (s != nullptr) {
|
|
Entity *found = scope_lookup_current(s, field_name);
|
|
Entity *found = scope_lookup_current(s, field_name);
|
|
if (found != nullptr && found->kind != Entity_Variable) {
|
|
if (found != nullptr && found->kind != Entity_Variable) {
|
|
@@ -3129,9 +3125,8 @@ gb_internal Selection lookup_field_with_selection(Type *type_, String field_name
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
- rw_mutex_shared_lock(&type->Struct.fields_mutex);
|
|
|
|
|
|
+ wait_signal_until_available(&type->Struct.fields_wait_signal);
|
|
isize field_count = type->Struct.fields.count;
|
|
isize field_count = type->Struct.fields.count;
|
|
- rw_mutex_shared_unlock(&type->Struct.fields_mutex);
|
|
|
|
if (field_count != 0) for_array(i, type->Struct.fields) {
|
|
if (field_count != 0) for_array(i, type->Struct.fields) {
|
|
Entity *f = type->Struct.fields[i];
|
|
Entity *f = type->Struct.fields[i];
|
|
if (f->kind != Entity_Variable || (f->flags & EntityFlag_Field) == 0) {
|
|
if (f->kind != Entity_Variable || (f->flags & EntityFlag_Field) == 0) {
|