diff options
| author | mlugg <mlugg@mlugg.co.uk> | 2024-03-26 04:06:39 +0000 |
|---|---|---|
| committer | mlugg <mlugg@mlugg.co.uk> | 2024-03-26 13:48:06 +0000 |
| commit | 26a94e8481385619ae049143dd67e551f333fa3f (patch) | |
| tree | 2106272eed6fb7b15a8309c6fc5137e6fec93234 /src/Compilation.zig | |
| parent | 152a2ceaf738301cd59165a4f17d915391321bdc (diff) | |
| download | zig-26a94e8481385619ae049143dd67e551f333fa3f.tar.gz zig-26a94e8481385619ae049143dd67e551f333fa3f.zip | |
Zcu: eliminate `Decl.alive` field
Legacy anon decls now have three uses:
* Type owner decls
* Function owner decls
* `@export` and `@extern`
Therefore, there are no longer any cases where we wish to explicitly
omit legacy anon decls from the binary. This means we can remove the
concept of an "alive" vs "dead" `Decl`, which also allows us to remove
the separate `anon_work_queue` in `Compilation`.
Diffstat (limited to 'src/Compilation.zig')
| -rw-r--r-- | src/Compilation.zig | 19 |
1 files changed, 1 insertions, 18 deletions
diff --git a/src/Compilation.zig b/src/Compilation.zig index b95a50cc59..5bbca51ede 100644 --- a/src/Compilation.zig +++ b/src/Compilation.zig @@ -102,7 +102,6 @@ link_errors: std.ArrayListUnmanaged(link.File.ErrorMsg) = .{}, lld_errors: std.ArrayListUnmanaged(LldError) = .{}, work_queue: std.fifo.LinearFifo(Job, .Dynamic), -anon_work_queue: std.fifo.LinearFifo(Job, .Dynamic), /// These jobs are to invoke the Clang compiler to create an object file, which /// gets linked with the Compilation. @@ -1417,7 +1416,6 @@ pub fn create(gpa: Allocator, arena: Allocator, options: CreateOptions) !*Compil .emit_llvm_ir = options.emit_llvm_ir, .emit_llvm_bc = options.emit_llvm_bc, .work_queue = std.fifo.LinearFifo(Job, .Dynamic).init(gpa), - .anon_work_queue = std.fifo.LinearFifo(Job, .Dynamic).init(gpa), .c_object_work_queue = std.fifo.LinearFifo(*CObject, .Dynamic).init(gpa), .win32_resource_work_queue = if (build_options.only_core_functionality) {} else std.fifo.LinearFifo(*Win32Resource, .Dynamic).init(gpa), .astgen_work_queue = std.fifo.LinearFifo(*Module.File, .Dynamic).init(gpa), @@ -1840,7 +1838,6 @@ pub fn destroy(comp: *Compilation) void { if (comp.module) |zcu| zcu.deinit(); comp.cache_use.deinit(); comp.work_queue.deinit(); - comp.anon_work_queue.deinit(); comp.c_object_work_queue.deinit(); if (!build_options.only_core_functionality) { comp.win32_resource_work_queue.deinit(); @@ -3354,18 +3351,11 @@ pub fn performAllTheWork( mod.sema_prog_node = undefined; }; - // In this main loop we give priority to non-anonymous Decls in the work queue, so - // that they can establish references to anonymous Decls, setting alive=true in the - // backend, preventing anonymous Decls from being prematurely destroyed. while (true) { if (comp.work_queue.readItem()) |work_item| { try processOneJob(comp, work_item, main_progress_node); continue; } - if (comp.anon_work_queue.readItem()) |work_item| { - try processOneJob(comp, work_item, main_progress_node); - continue; - } if (comp.module) |zcu| { // If there's no work queued, check if there's anything outdated // which we need to work on, and queue it if so. @@ -3413,14 +3403,7 @@ fn processOneJob(comp: *Compilation, job: Job, prog_node: *std.Progress.Node) !v assert(decl.has_tv); - if (decl.alive) { - try module.linkerUpdateDecl(decl_index); - return; - } - - // Instead of sending this decl to the linker, we actually will delete it - // because we found out that it in fact was never referenced. - module.deleteUnusedDecl(decl_index); + try module.linkerUpdateDecl(decl_index); return; }, } |
