aboutsummaryrefslogtreecommitdiff
path: root/src/types.cpp
diff options
context:
space:
mode:
authorgingerBill <bill@gingerbill.org>2021-10-07 21:23:37 +0100
committergingerBill <bill@gingerbill.org>2021-10-07 21:23:37 +0100
commitd3865633441f0e22626142a0f9fbfde0e9c2ef19 (patch)
treecf86edfa3cc00486475b00cb0b904041fe86cacf /src/types.cpp
parent9ecc2ab15b161cea506b93e7f5607cf13dbb21f5 (diff)
Correct issue with the generated `map` type internals; Simplify map rehash logic to utilize `resize`
Diffstat (limited to 'src/types.cpp')
-rw-r--r--src/types.cpp14
1 files changed, 9 insertions, 5 deletions
diff --git a/src/types.cpp b/src/types.cpp
index f3ac014d9..a808b54fb 100644
--- a/src/types.cpp
+++ b/src/types.cpp
@@ -3018,8 +3018,7 @@ i64 type_align_of_internal(Type *t, TypePath *path) {
} break;
case Type_Map:
- init_map_internal_types(t);
- return type_align_of_internal(t->Map.internal_type, path);
+ return build_context.word_size;
case Type_Enum:
return type_align_of_internal(t->Enum.base_type, path);
@@ -3248,11 +3247,16 @@ i64 type_size_of_internal(Type *t, TypePath *path) {
case Type_DynamicArray:
// data + len + cap + allocator(procedure+data)
- return 3*build_context.word_size + 2*build_context.word_size;
+ return (3 + 2)*build_context.word_size;
case Type_Map:
- init_map_internal_types(t);
- return type_size_of_internal(t->Map.internal_type, path);
+ /*
+ struct {
+ hashes: []int, // 2 words
+ entries: [dynamic]Entry_Type, // 5 words
+ }
+ */
+ return (2 + (3 + 2))*build_context.word_size;
case Type_Tuple: {
i64 count, align, size;