diff options
| author | gingerBill <bill@gingerbill.org> | 2021-09-13 01:23:37 +0100 |
|---|---|---|
| committer | gingerBill <bill@gingerbill.org> | 2021-09-13 01:23:37 +0100 |
| commit | 2d7aea79b94721362f4fc5285c2a99ab37f52a58 (patch) | |
| tree | d4184c02929cf0da395c7f4296c89489889948c0 /src/check_builtin.cpp | |
| parent | 31ed4f15a8af851d392fe71732eb025422a38c97 (diff) | |
Make `TypeStructl.tags` a pointer from a slice (reduce memory usage)
Diffstat (limited to 'src/check_builtin.cpp')
| -rw-r--r-- | src/check_builtin.cpp | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/src/check_builtin.cpp b/src/check_builtin.cpp index 4e8eed1fc..96feb6701 100644 --- a/src/check_builtin.cpp +++ b/src/check_builtin.cpp @@ -1789,7 +1789,7 @@ bool check_builtin_procedure(CheckerContext *c, Operand *operand, Ast *call, i32 elem = alloc_type_struct(); elem->Struct.scope = s; elem->Struct.fields = slice_from_array(fields); - elem->Struct.tags = slice_make<String>(permanent_allocator(), fields.count); + elem->Struct.tags = gb_alloc_array(permanent_allocator(), String, fields.count); elem->Struct.node = dummy_node_struct; type_set_offsets(elem); } @@ -1939,7 +1939,7 @@ bool check_builtin_procedure(CheckerContext *c, Operand *operand, Ast *call, i32 Type *old_array = base_type(elem); soa_struct = alloc_type_struct(); soa_struct->Struct.fields = slice_make<Entity *>(heap_allocator(), cast(isize)old_array->Array.count); - soa_struct->Struct.tags = slice_make<String>(heap_allocator(), cast(isize)old_array->Array.count); + soa_struct->Struct.tags = gb_alloc_array(permanent_allocator(), String, cast(isize)old_array->Array.count); soa_struct->Struct.node = operand->expr; soa_struct->Struct.soa_kind = StructSoa_Fixed; soa_struct->Struct.soa_elem = elem; @@ -1972,7 +1972,7 @@ bool check_builtin_procedure(CheckerContext *c, Operand *operand, Ast *call, i32 Type *old_struct = base_type(elem); soa_struct = alloc_type_struct(); soa_struct->Struct.fields = slice_make<Entity *>(heap_allocator(), old_struct->Struct.fields.count); - soa_struct->Struct.tags = slice_make<String>(heap_allocator(), old_struct->Struct.tags.count); + soa_struct->Struct.tags = gb_alloc_array(permanent_allocator(), String, old_struct->Struct.fields.count); soa_struct->Struct.node = operand->expr; soa_struct->Struct.soa_kind = StructSoa_Fixed; soa_struct->Struct.soa_elem = elem; |