Fix fields_wait_signal futex.

This commit is contained in:
rick-masters
2024-03-24 16:28:55 +00:00
parent cab53e12b7
commit 6d4f30de1a
4 changed files with 8 additions and 1 deletions
+2
View File
@@ -3393,6 +3393,7 @@ gb_internal bool check_builtin_procedure(CheckerContext *c, Operand *operand, As
elem->Struct.tags = gb_alloc_array(permanent_allocator(), String, fields.count);
elem->Struct.node = dummy_node_struct;
type_set_offsets(elem);
wait_signal_set(&elem->Struct.fields_wait_signal);
}
Type *soa_type = make_soa_struct_slice(c, dummy_node_soa, nullptr, elem);
@@ -3766,6 +3767,7 @@ gb_internal bool check_builtin_procedure(CheckerContext *c, Operand *operand, As
soa_struct->Struct.tags[i] = old_struct->Struct.tags[i];
}
}
wait_signal_set(&soa_struct->Struct.fields_wait_signal);
Token token = {};
token.string = str_lit("Base_Type");
+1
View File
@@ -8873,6 +8873,7 @@ gb_internal ExprKind check_compound_literal(CheckerContext *c, Operand *o, Ast *
break;
}
wait_signal_until_available(&t->Struct.fields_wait_signal);
isize field_count = t->Struct.fields.count;
isize min_field_count = t->Struct.fields.count;
for (isize i = min_field_count-1; i >= 0; i--) {
+4
View File
@@ -2490,6 +2490,7 @@ gb_internal Type *get_map_cell_type(Type *type) {
s->Struct.fields[0] = alloc_entity_field(scope, make_token_ident("v"), alloc_type_array(type, len), false, 0, EntityState_Resolved);
s->Struct.fields[1] = alloc_entity_field(scope, make_token_ident("_"), alloc_type_array(t_u8, padding), false, 1, EntityState_Resolved);
s->Struct.scope = scope;
wait_signal_set(&s->Struct.fields_wait_signal);
gb_unused(type_size_of(s));
return s;
@@ -2520,6 +2521,7 @@ gb_internal void init_map_internal_types(Type *type) {
metadata_type->Struct.fields[4] = alloc_entity_field(metadata_scope, make_token_ident("value_cell"), value_cell, false, 4, EntityState_Resolved);
metadata_type->Struct.scope = metadata_scope;
metadata_type->Struct.node = nullptr;
wait_signal_set(&metadata_type->Struct.fields_wait_signal);
gb_unused(type_size_of(metadata_type));
@@ -2537,6 +2539,7 @@ gb_internal void init_map_internal_types(Type *type) {
debug_type->Struct.fields[3] = alloc_entity_field(scope, make_token_ident("__metadata"), metadata_type, false, 3, EntityState_Resolved);
debug_type->Struct.scope = scope;
debug_type->Struct.node = nullptr;
wait_signal_set(&debug_type->Struct.fields_wait_signal);
gb_unused(type_size_of(debug_type));
@@ -2832,6 +2835,7 @@ gb_internal Type *make_soa_struct_internal(CheckerContext *ctx, Ast *array_typ_e
add_entity(ctx, scope, nullptr, base_type_entity);
add_type_info_type(ctx, soa_struct);
wait_signal_set(&soa_struct->Struct.fields_wait_signal);
return soa_struct;
}
+1 -1
View File
@@ -113,7 +113,7 @@ struct Wait_Signal {
gb_internal void wait_signal_until_available(Wait_Signal *ws) {
if (ws->futex.load() == 0) {
futex_wait(&ws->futex, 1);
futex_wait(&ws->futex, 0);
}
}