aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorgingerBill <bill@gingerbill.org>2023-07-24 13:06:01 +0100
committergingerBill <bill@gingerbill.org>2023-07-24 13:06:01 +0100
commit00a44d1ddb37736284ff3154d11587c0cf4c73af (patch)
tree3ad5027d46d801b444f1cd608c522620bb68cafe /src
parentd8445fd9dfe5bcf9b694c2b83791c88cafcdf322 (diff)
Mock out type info initialize stuff
Diffstat (limited to 'src')
-rw-r--r--src/tilde.cpp12
-rw-r--r--src/tilde.hpp2
-rw-r--r--src/tilde/tb.libbin4161494 -> 4393788 bytes
-rw-r--r--src/tilde_type_info.cpp27
4 files changed, 35 insertions, 6 deletions
diff --git a/src/tilde.cpp b/src/tilde.cpp
index 8bd7e0b43..7d7b028c1 100644
--- a/src/tilde.cpp
+++ b/src/tilde.cpp
@@ -489,15 +489,14 @@ gb_internal bool cg_global_variables_create(cgModule *m) {
char const *name = CG_TYPE_INFO_TYPES_NAME;
Type *t = alloc_type_array(t_type_info_ptr, count);
TB_Global *g = tb_global_create(m->mod, -1, name, nullptr, TB_LINKAGE_PRIVATE);
- tb_global_set_storage(m->mod, tb_module_get_rdata(m->mod), g, type_size_of(t), 16, count);
+ tb_global_set_storage(m->mod, tb_module_get_rdata(m->mod), g, type_size_of(t), 16, count*2);
cg_global_type_info_member_types = cg_addr(cg_value(g, alloc_type_pointer(t)));
-
}
{
char const *name = CG_TYPE_INFO_NAMES_NAME;
Type *t = alloc_type_array(t_string, count);
TB_Global *g = tb_global_create(m->mod, -1, name, nullptr, TB_LINKAGE_PRIVATE);
- tb_global_set_storage(m->mod, tb_module_get_rdata(m->mod), g, type_size_of(t), 16, count);
+ tb_global_set_storage(m->mod, tb_module_get_rdata(m->mod), g, type_size_of(t), 16, count*2);
cg_global_type_info_member_names = cg_addr(cg_value(g, alloc_type_pointer(t)));
}
{
@@ -520,10 +519,12 @@ gb_internal bool cg_global_variables_create(cgModule *m) {
char const *name = CG_TYPE_INFO_TAGS_NAME;
Type *t = alloc_type_array(t_string, count);
TB_Global *g = tb_global_create(m->mod, -1, name, nullptr, TB_LINKAGE_PRIVATE);
- tb_global_set_storage(m->mod, tb_module_get_rdata(m->mod), g, type_size_of(t), 16, count);
+ tb_global_set_storage(m->mod, tb_module_get_rdata(m->mod), g, type_size_of(t), 16, count*2);
cg_global_type_info_member_tags = cg_addr(cg_value(g, alloc_type_pointer(t)));
}
}
+
+ cg_setup_type_info_data(m);
}
return already_has_entry_point;
@@ -722,6 +723,7 @@ gb_internal String cg_get_entity_name(cgModule *m, Entity *e) {
#include "tilde_debug.cpp"
#include "tilde_expr.cpp"
#include "tilde_builtin.cpp"
+#include "tilde_type_info.cpp"
#include "tilde_proc.cpp"
#include "tilde_stmt.cpp"
@@ -808,7 +810,7 @@ gb_internal bool cg_generate_code(Checker *c, LinkerData *linker_data) {
cgModule *m = cg_module_create(c);
defer (cg_module_destroy(m));
- m->do_threading = true;
+ m->do_threading = false;
TIME_SECTION("Tilde Global Variables");
diff --git a/src/tilde.hpp b/src/tilde.hpp
index ce87f2dfe..289cc3e6e 100644
--- a/src/tilde.hpp
+++ b/src/tilde.hpp
@@ -199,7 +199,6 @@ struct cgProcedure {
isize split_returns_index;
bool return_by_ptr;
-
PtrMap<Entity *, cgAddr> variable_map;
};
@@ -255,6 +254,7 @@ gb_global isize cg_global_type_info_member_tags_index = 0;
gb_internal TB_Arena *cg_arena(void);
gb_internal void cg_add_procedure_to_queue(cgProcedure *p);
+gb_internal void cg_setup_type_info_data(cgModule *m);
gb_internal cgValue cg_value(TB_Global * g, Type *type);
gb_internal cgValue cg_value(TB_External *e, Type *type);
diff --git a/src/tilde/tb.lib b/src/tilde/tb.lib
index a60475d1c..56b9c339a 100644
--- a/src/tilde/tb.lib
+++ b/src/tilde/tb.lib
Binary files differ
diff --git a/src/tilde_type_info.cpp b/src/tilde_type_info.cpp
new file mode 100644
index 000000000..5d6a613b3
--- /dev/null
+++ b/src/tilde_type_info.cpp
@@ -0,0 +1,27 @@
+gb_internal void cg_setup_type_info_data(cgModule *m) {
+ if (build_context.no_rtti) {
+ return;
+ }
+ CheckerInfo *info = m->info;
+ gb_unused(info);
+
+
+ // i64 global_type_info_data_entity_count = 0;
+ // {
+ // // NOTE(bill): Set the type_table slice with the global backing array
+ // cgValue global_type_table = cg_find_runtime_value(m, str_lit("type_table"));
+ // Type *type = base_type(cg_global_type_info_data_entity->type);
+ // GB_ASSERT(is_type_array(type));
+ // global_type_info_data_entity_count = type->Array.count;
+
+ // LLVMValueRef indices[2] = {llvm_zero(m), llvm_zero(m)};
+ // LLVMValueRef data = LLVMConstInBoundsGEP2(cg_type(m, cg_global_type_info_data_entity->type), cg_global_type_info_data_ptr(m).value, indices, gb_count_of(indices));
+ // LLVMValueRef len = LLVMConstInt(cg_type(m, t_int), type->Array.count, true);
+ // Type *t = type_deref(global_type_table.type);
+ // GB_ASSERT(is_type_slice(t));
+ // LLVMValueRef slice = llvm_const_slice_internal(m, data, len);
+
+ // LLVMSetInitializer(global_type_table.value, slice);
+ // }
+
+} \ No newline at end of file