Skip to content

Commit 5140f27

Browse files
authored
Merge pull request #19437 from mlugg/value-cleanups
Follow-up to #19414
2 parents 341857e + 5132549 commit 5140f27

40 files changed

+2016
-2706
lines changed

CMakeLists.txt

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -526,7 +526,6 @@ set(ZIG_STAGE2_SOURCES
526526
"${CMAKE_SOURCE_DIR}/src/Package/Fetch.zig"
527527
"${CMAKE_SOURCE_DIR}/src/RangeSet.zig"
528528
"${CMAKE_SOURCE_DIR}/src/Sema.zig"
529-
"${CMAKE_SOURCE_DIR}/src/TypedValue.zig"
530529
"${CMAKE_SOURCE_DIR}/src/Value.zig"
531530
"${CMAKE_SOURCE_DIR}/src/arch/aarch64/CodeGen.zig"
532531
"${CMAKE_SOURCE_DIR}/src/arch/aarch64/Emit.zig"
@@ -634,9 +633,11 @@ set(ZIG_STAGE2_SOURCES
634633
"${CMAKE_SOURCE_DIR}/src/main.zig"
635634
"${CMAKE_SOURCE_DIR}/src/mingw.zig"
636635
"${CMAKE_SOURCE_DIR}/src/musl.zig"
636+
"${CMAKE_SOURCE_DIR}/src/mutable_value.zig"
637637
"${CMAKE_SOURCE_DIR}/src/print_air.zig"
638638
"${CMAKE_SOURCE_DIR}/src/print_env.zig"
639639
"${CMAKE_SOURCE_DIR}/src/print_targets.zig"
640+
"${CMAKE_SOURCE_DIR}/src/print_value.zig"
640641
"${CMAKE_SOURCE_DIR}/src/print_zir.zig"
641642
"${CMAKE_SOURCE_DIR}/src/register_manager.zig"
642643
"${CMAKE_SOURCE_DIR}/src/target.zig"

src/Compilation.zig

Lines changed: 1 addition & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -102,7 +102,6 @@ link_errors: std.ArrayListUnmanaged(link.File.ErrorMsg) = .{},
102102
lld_errors: std.ArrayListUnmanaged(LldError) = .{},
103103

104104
work_queue: std.fifo.LinearFifo(Job, .Dynamic),
105-
anon_work_queue: std.fifo.LinearFifo(Job, .Dynamic),
106105

107106
/// These jobs are to invoke the Clang compiler to create an object file, which
108107
/// gets linked with the Compilation.
@@ -1417,7 +1416,6 @@ pub fn create(gpa: Allocator, arena: Allocator, options: CreateOptions) !*Compil
14171416
.emit_llvm_ir = options.emit_llvm_ir,
14181417
.emit_llvm_bc = options.emit_llvm_bc,
14191418
.work_queue = std.fifo.LinearFifo(Job, .Dynamic).init(gpa),
1420-
.anon_work_queue = std.fifo.LinearFifo(Job, .Dynamic).init(gpa),
14211419
.c_object_work_queue = std.fifo.LinearFifo(*CObject, .Dynamic).init(gpa),
14221420
.win32_resource_work_queue = if (build_options.only_core_functionality) {} else std.fifo.LinearFifo(*Win32Resource, .Dynamic).init(gpa),
14231421
.astgen_work_queue = std.fifo.LinearFifo(*Module.File, .Dynamic).init(gpa),
@@ -1840,7 +1838,6 @@ pub fn destroy(comp: *Compilation) void {
18401838
if (comp.module) |zcu| zcu.deinit();
18411839
comp.cache_use.deinit();
18421840
comp.work_queue.deinit();
1843-
comp.anon_work_queue.deinit();
18441841
comp.c_object_work_queue.deinit();
18451842
if (!build_options.only_core_functionality) {
18461843
comp.win32_resource_work_queue.deinit();
@@ -3354,18 +3351,11 @@ pub fn performAllTheWork(
33543351
mod.sema_prog_node = undefined;
33553352
};
33563353

3357-
// In this main loop we give priority to non-anonymous Decls in the work queue, so
3358-
// that they can establish references to anonymous Decls, setting alive=true in the
3359-
// backend, preventing anonymous Decls from being prematurely destroyed.
33603354
while (true) {
33613355
if (comp.work_queue.readItem()) |work_item| {
33623356
try processOneJob(comp, work_item, main_progress_node);
33633357
continue;
33643358
}
3365-
if (comp.anon_work_queue.readItem()) |work_item| {
3366-
try processOneJob(comp, work_item, main_progress_node);
3367-
continue;
3368-
}
33693359
if (comp.module) |zcu| {
33703360
// If there's no work queued, check if there's anything outdated
33713361
// 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
34133403

34143404
assert(decl.has_tv);
34153405

3416-
if (decl.alive) {
3417-
try module.linkerUpdateDecl(decl_index);
3418-
return;
3419-
}
3420-
3421-
// Instead of sending this decl to the linker, we actually will delete it
3422-
// because we found out that it in fact was never referenced.
3423-
module.deleteUnusedDecl(decl_index);
3406+
try module.linkerUpdateDecl(decl_index);
34243407
return;
34253408
},
34263409
}

src/InternPool.zig

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -6581,7 +6581,6 @@ pub fn getFuncInstance(ip: *InternPool, gpa: Allocator, arg: GetFuncInstanceKey)
65816581
generic_owner,
65826582
func_index,
65836583
func_extra_index,
6584-
func_ty,
65856584
arg.alignment,
65866585
arg.section,
65876586
);
@@ -6711,7 +6710,6 @@ pub fn getFuncInstanceIes(
67116710
generic_owner,
67126711
func_index,
67136712
func_extra_index,
6714-
func_ty,
67156713
arg.alignment,
67166714
arg.section,
67176715
);
@@ -6723,7 +6721,6 @@ fn finishFuncInstance(
67236721
generic_owner: Index,
67246722
func_index: Index,
67256723
func_extra_index: u32,
6726-
func_ty: Index,
67276724
alignment: Alignment,
67286725
section: OptionalNullTerminatedString,
67296726
) Allocator.Error!Index {
@@ -6735,7 +6732,6 @@ fn finishFuncInstance(
67356732
.src_line = fn_owner_decl.src_line,
67366733
.has_tv = true,
67376734
.owns_tv = true,
6738-
.ty = @import("type.zig").Type.fromInterned(func_ty),
67396735
.val = @import("Value.zig").fromInterned(func_index),
67406736
.alignment = alignment,
67416737
.@"linksection" = section,
@@ -6744,7 +6740,6 @@ fn finishFuncInstance(
67446740
.zir_decl_index = fn_owner_decl.zir_decl_index,
67456741
.is_pub = fn_owner_decl.is_pub,
67466742
.is_exported = fn_owner_decl.is_exported,
6747-
.alive = true,
67486743
.kind = .anon,
67496744
});
67506745
errdefer ip.destroyDecl(gpa, decl_index);

0 commit comments

Comments
 (0)