mirror of
https://github.com/ziglang/zig.git
synced 2026-01-10 01:15:14 +00:00
InternPool: implement thread-safe hash map
This commit is contained in:
parent
ca02266157
commit
cda716ecc4
@ -291,3 +291,7 @@ pub fn waitAndWork(pool: *Pool, wait_group: *WaitGroup) void {
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
pub fn getIdCount(pool: *Pool) usize {
|
||||
return 1 + pool.threads.len;
|
||||
}
|
||||
|
||||
@ -1397,7 +1397,7 @@ pub fn create(gpa: Allocator, arena: Allocator, options: CreateOptions) !*Compil
|
||||
.error_limit = error_limit,
|
||||
.llvm_object = null,
|
||||
};
|
||||
try zcu.init();
|
||||
try zcu.init(options.thread_pool.getIdCount());
|
||||
break :blk zcu;
|
||||
} else blk: {
|
||||
if (options.emit_h != null) return error.NoZigModuleForCHeader;
|
||||
@ -2156,7 +2156,7 @@ pub fn update(comp: *Compilation, main_progress_node: std.Progress.Node) !void {
|
||||
if (build_options.enable_debug_extensions and comp.verbose_generic_instances) {
|
||||
std.debug.print("generic instances for '{s}:0x{x}':\n", .{
|
||||
comp.root_name,
|
||||
@as(usize, @intFromPtr(zcu)),
|
||||
@intFromPtr(zcu),
|
||||
});
|
||||
zcu.intern_pool.dumpGenericInstances(gpa);
|
||||
}
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@ -2394,9 +2394,9 @@ pub const CompileError = error{
|
||||
ComptimeBreak,
|
||||
};
|
||||
|
||||
pub fn init(mod: *Module) !void {
|
||||
pub fn init(mod: *Module, thread_count: usize) !void {
|
||||
const gpa = mod.gpa;
|
||||
try mod.intern_pool.init(gpa);
|
||||
try mod.intern_pool.init(gpa, thread_count);
|
||||
try mod.global_error_set.put(gpa, .empty, {});
|
||||
}
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user