| ... | ... | @@ -314,7 +314,9 @@ pub fn rehashTrackedInsts( |
| 314 | 314 | |
| 315 | 315 | // We know how big each shard must be, so ensure we have the capacity we need. |
| 316 | 316 | for (ip.shards) |*shard| { |
| 317 | | const want_capacity = std.math.ceilPowerOfTwo(u32, shard.mutate.tracked_inst_map.len * 5 / 3) catch unreachable; |
| 317 | const want_capacity = if (shard.mutate.tracked_inst_map.len == 0) 0 else cap: { |
| 318 | break :cap std.math.ceilPowerOfTwo(u32, shard.mutate.tracked_inst_map.len * 5 / 3) catch unreachable; |
| 319 | }; |
| 318 | 320 | const have_capacity = shard.shared.tracked_inst_map.header().capacity; // no acquire because we hold the mutex |
| 319 | 321 | if (have_capacity >= want_capacity) { |
| 320 | 322 | @memset(shard.shared.tracked_inst_map.entries[0..have_capacity], .{ .value = .none, .hash = undefined }); |