authorgravatar for andrew@ziglang.orgAndrew Kelley <andrew@ziglang.org> 2021-06-27 22:36:56-07:00
committergravatar for andrew@ziglang.orgAndrew Kelley <andrew@ziglang.org> 2021-06-29 14:25:04-07:00
log3d7ae63c6f0b01456a411b31bad2322166634868
treefb935efa944c6c78b79c3b52dcf677381536dba3
parent4e61af404e87d76d1428dd46f85f08afe4ad4a93

stage2: remove c_object_cache_digest_set

This logic was a workaround to prevent cache deadlocks which happened from always using exclusive file locks. Now that the Cache system supports sharing cached artifacts, this workaround is no longer needed. Closes #7596

1 files changed, 0 insertions(+), 22 deletions(-)

src/Compilation.zig-22
......@@ -39,7 +39,6 @@ gpa: *Allocator,
3939arena_state: std.heap.ArenaAllocator.State,
4040bin_file: *link.File,
4141c_object_table: std.AutoArrayHashMapUnmanaged(*CObject, void) = .{},
42c_object_cache_digest_set: std.AutoHashMapUnmanaged(Cache.BinDigest, void) = .{},
4342stage1_lock: ?Cache.Lock = null,
4443stage1_cache_manifest: *Cache.Manifest = undefined,
4544
......@@ -1590,7 +1589,6 @@ pub fn destroy(self: *Compilation) void {
15901589 key.destroy(gpa);
15911590 }
15921591 self.c_object_table.deinit(gpa);
1593 self.c_object_cache_digest_set.deinit(gpa);
15941592
15951593 for (self.failed_c_objects.values()) |value| {
15961594 value.destroy(gpa);
......@@ -1627,7 +1625,6 @@ pub fn update(self: *Compilation) !void {
16271625 defer tracy.end();
16281626
16291627 self.clearMiscFailures();
1630 self.c_object_cache_digest_set.clearRetainingCapacity();
16311628
16321629 // For compiling C objects, we rely on the cache hash system to avoid duplicating work.
16331630 // Add a Job for each C object.
......@@ -2615,25 +2612,6 @@ fn updateCObject(comp: *Compilation, c_object: *CObject, c_obj_prog_node: *std.P
26152612
26162613 try man.hashCSource(c_object.src);
26172614
2618 {
2619 const is_collision = blk: {
2620 const bin_digest = man.hash.peekBin();
2621
2622 const lock = comp.mutex.acquire();
2623 defer lock.release();
2624
2625 const gop = try comp.c_object_cache_digest_set.getOrPut(comp.gpa, bin_digest);
2626 break :blk gop.found_existing;
2627 };
2628 if (is_collision) {
2629 return comp.failCObj(
2630 c_object,
2631 "the same source file was already added to the same compilation with the same flags",
2632 .{},
2633 );
2634 }
2635 }
2636
26372615 var arena_allocator = std.heap.ArenaAllocator.init(comp.gpa);
26382616 defer arena_allocator.deinit();
26392617 const arena = &arena_allocator.allocator;