diff options
| author | Jakub Konka <kubkon@jakubkonka.com> | 2023-01-28 22:33:56 +0100 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2023-01-28 22:33:56 +0100 |
| commit | 5a67ae506a381aa0494b4b066a8c54ba7ed9fc31 (patch) | |
| tree | c262a934444ee566af839d3a002b97e21690baa0 /src/Module.zig | |
| parent | 4c116841840bfa7f0068bef23984dd832da8a54d (diff) | |
| parent | a8987291390d80ad9e2bb45ba225313a108eed0b (diff) | |
| download | zig-5a67ae506a381aa0494b4b066a8c54ba7ed9fc31.tar.gz zig-5a67ae506a381aa0494b4b066a8c54ba7ed9fc31.zip | |
Merge pull request #14472 from ziglang/alloc-decls
self-hosted: remove allocateDeclIndexes from the linker API
Diffstat (limited to 'src/Module.zig')
| -rw-r--r-- | src/Module.zig | 20 |
1 files changed, 0 insertions, 20 deletions
diff --git a/src/Module.zig b/src/Module.zig index b17c140231..dcdbeec322 100644 --- a/src/Module.zig +++ b/src/Module.zig @@ -4585,7 +4585,6 @@ fn semaDecl(mod: *Module, decl_index: Decl.Index) !bool { // We don't fully codegen the decl until later, but we do need to reserve a global // offset table index for it. This allows us to codegen decls out of dependency // order, increasing how many computations can be done in parallel. - try mod.comp.bin_file.allocateDeclIndexes(decl_index); try mod.comp.work_queue.writeItem(.{ .codegen_func = func }); if (type_changed and mod.emit_h != null) { try mod.comp.work_queue.writeItem(.{ .emit_h_decl = decl_index }); @@ -4697,7 +4696,6 @@ fn semaDecl(mod: *Module, decl_index: Decl.Index) !bool { // codegen backend wants full access to the Decl Type. try sema.resolveTypeFully(decl.ty); - try mod.comp.bin_file.allocateDeclIndexes(decl_index); try mod.comp.work_queue.writeItem(.{ .codegen_decl = decl_index }); if (type_changed and mod.emit_h != null) { @@ -5315,23 +5313,6 @@ pub fn deleteUnusedDecl(mod: *Module, decl_index: Decl.Index) void { const decl = mod.declPtr(decl_index); log.debug("deleteUnusedDecl {d} ({s})", .{ decl_index, decl.name }); - // TODO: remove `allocateDeclIndexes` and make the API that the linker backends - // are required to notice the first time `updateDecl` happens and keep track - // of it themselves. However they can rely on getting a `freeDecl` call if any - // `updateDecl` or `updateFunc` calls happen. This will allow us to avoid any call - // into the linker backend here, since the linker backend will never have been told - // about the Decl in the first place. - // Until then, we did call `allocateDeclIndexes` on this anonymous Decl and so we - // must call `freeDecl` in the linker backend now. - switch (mod.comp.bin_file.tag) { - .c => {}, // this linker backend has already migrated to the new API - else => if (decl.has_tv) { - if (decl.ty.isFnOrHasRuntimeBits()) { - mod.comp.bin_file.freeDecl(decl_index); - } - }, - } - assert(!mod.declIsRoot(decl_index)); assert(decl.src_namespace.anon_decls.swapRemove(decl_index)); @@ -5816,7 +5797,6 @@ pub fn initNewAnonDecl( // the Decl will be garbage collected by the `codegen_decl` task instead of sent // to the linker. if (typed_value.ty.isFnOrHasRuntimeBits()) { - try mod.comp.bin_file.allocateDeclIndexes(new_decl_index); try mod.comp.anon_work_queue.writeItem(.{ .codegen_decl = new_decl_index }); } } |
