diff options
| author | Jacob Young <jacobly0@users.noreply.github.com> | 2024-07-10 21:39:11 -0400 |
|---|---|---|
| committer | Jacob Young <jacobly0@users.noreply.github.com> | 2024-07-10 21:39:55 -0400 |
| commit | c2316c52285b1319d7b44a7f7135d9e79786fd77 (patch) | |
| tree | 966c3af5bb0ede2e3f1e7ec69a3bf920c0122914 /src/Value.zig | |
| parent | 98f3a262a7aec25e0a7f0872dc7fafc9008be1d2 (diff) | |
| download | zig-c2316c52285b1319d7b44a7f7135d9e79786fd77.tar.gz zig-c2316c52285b1319d7b44a7f7135d9e79786fd77.zip | |
InternPool: make `global_error_set` thread-safe
Diffstat (limited to 'src/Value.zig')
| -rw-r--r-- | src/Value.zig | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/src/Value.zig b/src/Value.zig index f114a2c7fa..da1151139f 100644 --- a/src/Value.zig +++ b/src/Value.zig @@ -417,7 +417,7 @@ pub fn writeToMemory(val: Value, ty: Type, pt: Zcu.PerThread, buffer: []u8) erro var bigint_buffer: BigIntSpace = undefined; const bigint = BigIntMutable.init( &bigint_buffer.limbs, - mod.global_error_set.getIndex(name).?, + ip.getErrorValueIfExists(name).?, ).toConst(); bigint.writeTwosComplement(buffer[0..byte_count], endian); }, @@ -427,7 +427,7 @@ pub fn writeToMemory(val: Value, ty: Type, pt: Zcu.PerThread, buffer: []u8) erro if (val.unionTag(mod)) |union_tag| { const union_obj = mod.typeToUnion(ty).?; const field_index = mod.unionTagFieldIndex(union_obj, union_tag).?; - const field_type = Type.fromInterned(union_obj.field_types.get(&mod.intern_pool)[field_index]); + const field_type = Type.fromInterned(union_obj.field_types.get(ip)[field_index]); const field_val = try val.fieldValue(pt, field_index); const byte_count: usize = @intCast(field_type.abiSize(pt)); return writeToMemory(field_val, field_type, pt, buffer[0..byte_count]); @@ -1455,9 +1455,9 @@ pub fn getErrorName(val: Value, mod: *const Module) InternPool.OptionalNullTermi }; } -pub fn getErrorInt(val: Value, mod: *const Module) Module.ErrorInt { - return if (getErrorName(val, mod).unwrap()) |err_name| - @intCast(mod.global_error_set.getIndex(err_name).?) +pub fn getErrorInt(val: Value, zcu: *Zcu) Module.ErrorInt { + return if (getErrorName(val, zcu).unwrap()) |err_name| + zcu.intern_pool.getErrorValueIfExists(err_name).? else 0; } |
