Add -internal-cached

This commit is contained in:
gingerBill
2024-07-08 23:39:14 +01:00
parent 48aef50164
commit 87ac68fcf2
6 changed files with 265 additions and 17 deletions

View File

@@ -126,16 +126,17 @@ gb_internal bool lb_init_generator(lbGenerator *gen, Checker *c) {
m->gen = gen;
map_set(&gen->modules, cast(void *)pkg, m);
lb_init_module(m, c);
if (module_per_file) {
// NOTE(bill): Probably per file is not a good idea, so leave this for later
for (AstFile *file : pkg->files) {
auto m = gb_alloc_item(permanent_allocator(), lbModule);
m->file = file;
m->pkg = pkg;
m->gen = gen;
map_set(&gen->modules, cast(void *)file, m);
lb_init_module(m, c);
}
if (!module_per_file) {
continue;
}
// NOTE(bill): Probably per file is not a good idea, so leave this for later
for (AstFile *file : pkg->files) {
auto m = gb_alloc_item(permanent_allocator(), lbModule);
m->file = file;
m->pkg = pkg;
m->gen = gen;
map_set(&gen->modules, cast(void *)file, m);
lb_init_module(m, c);
}
}
}
@@ -144,7 +145,6 @@ gb_internal bool lb_init_generator(lbGenerator *gen, Checker *c) {
map_set(&gen->modules, cast(void *)1, &gen->default_module);
lb_init_module(&gen->default_module, c);
for (auto const &entry : gen->modules) {
lbModule *m = entry.value;
LLVMContextRef ctx = LLVMGetModuleContext(m->mod);