aboutsummaryrefslogtreecommitdiff
path: root/src/ir.cpp
diff options
context:
space:
mode:
authorgingerBill <bill@gingerbill.org>2018-01-28 15:43:58 +0000
committergingerBill <bill@gingerbill.org>2018-01-28 15:43:58 +0000
commit8c360b2a3c33eab6d2b86e7145b14f3ac1353473 (patch)
tree78610fe08bb4a011f40ad26164bf7dc9952cb122 /src/ir.cpp
parentb66e7bed45702ad54d160c9f59fd19c503357630 (diff)
Reduce type info data size in IR
Diffstat (limited to 'src/ir.cpp')
-rw-r--r--src/ir.cpp19
1 files changed, 4 insertions, 15 deletions
diff --git a/src/ir.cpp b/src/ir.cpp
index 068ed50f4..d68cae587 100644
--- a/src/ir.cpp
+++ b/src/ir.cpp
@@ -7628,22 +7628,12 @@ void ir_init_module(irModule *m, Checker *c) {
{
// Add type info data
{
- isize max_index = -1;
- for_array(type_info_map_index, m->info->type_info_map.entries) {
- auto *entry = &m->info->type_info_map.entries[type_info_map_index];
- Type *t = cast(Type *)entry->key.ptr;
- t = default_type(t);
- isize entry_index = type_info_index(m->info, t);
- if (max_index < entry_index) {
- max_index = entry_index;
- }
- }
- isize max_type_info_count = max_index+1;
+ isize max_type_info_count = m->info->type_info_types.count;
String name = str_lit(IR_TYPE_INFO_DATA_NAME);
Entity *e = make_entity_variable(m->allocator, nullptr, make_token_ident(name), make_type_array(m->allocator, t_type_info, max_type_info_count), false);
irValue *g = ir_value_global(m->allocator, e, nullptr);
- g->Global.is_private = true;
+ g->Global.is_private = true;
ir_module_add_value(m, e, g);
map_set(&m->members, hash_string(name), g);
ir_global_type_info_data = g;
@@ -7654,9 +7644,8 @@ void ir_init_module(irModule *m, Checker *c) {
// NOTE(bill): Removes need for heap allocation by making it global memory
isize count = 0;
- for_array(entry_index, m->info->type_info_map.entries) {
- auto *entry = &m->info->type_info_map.entries[entry_index];
- Type *t = cast(Type *)entry->key.ptr;
+ for_array(entry_index, m->info->type_info_types) {
+ Type *t = m->info->type_info_types[entry_index];
switch (t->kind) {
case Type_Union: