authorgravatar for david@vortan.devDavid Rubin <david@vortan.dev> 2024-11-25 01:28:38-08:00
committergravatar for andrew@ziglang.orgAndrew Kelley <andrew@ziglang.org> 2024-11-25 18:41:36-05:00
loga6af55cc6e81dd09e03d4b87e8079ce1fe57a36c
treeb83d04a7a996ea201c5114b2aeac9d98d826d5a4
parentf4e042a4c3e8e299d273f00b757ec9fce840c3a6

ip: cleanup `@constCast` usages


1 files changed, 33 insertions(+), 37 deletions(-)

src/InternPool.zig+33-37
...@@ -1431,16 +1431,12 @@ pub const OptionalMapIndex = enum(u32) {...@@ -1431,16 +1431,12 @@ pub const OptionalMapIndex = enum(u32) {
1431pub const MapIndex = enum(u32) {1431pub const MapIndex = enum(u32) {
1432 _,1432 _,
14331433
1434 pub fn get(map_index: MapIndex, ip: *InternPool) *FieldMap {1434 pub fn get(map_index: MapIndex, ip: *const InternPool) *FieldMap {
1435 const unwrapped_map_index = map_index.unwrap(ip);1435 const unwrapped_map_index = map_index.unwrap(ip);
1436 const maps = ip.getLocalShared(unwrapped_map_index.tid).maps.acquire();1436 const maps = ip.getLocalShared(unwrapped_map_index.tid).maps.acquire();
1437 return &maps.view().items(.@"0")[unwrapped_map_index.index];1437 return &maps.view().items(.@"0")[unwrapped_map_index.index];
1438 }1438 }
14391439
1440 pub fn getConst(map_index: MapIndex, ip: *const InternPool) FieldMap {
1441 return map_index.get(@constCast(ip)).*;
1442 }
1443
1444 pub fn toOptional(i: MapIndex) OptionalMapIndex {1440 pub fn toOptional(i: MapIndex) OptionalMapIndex {
1445 return @enumFromInt(@intFromEnum(i));1441 return @enumFromInt(@intFromEnum(i));
1446 }1442 }
...@@ -1853,7 +1849,7 @@ pub const Key = union(enum) {...@@ -1853,7 +1849,7 @@ pub const Key = union(enum) {
18531849
1854 /// Look up field index based on field name.1850 /// Look up field index based on field name.
1855 pub fn nameIndex(self: ErrorSetType, ip: *const InternPool, name: NullTerminatedString) ?u32 {1851 pub fn nameIndex(self: ErrorSetType, ip: *const InternPool, name: NullTerminatedString) ?u32 {
1856 const map = self.names_map.unwrap().?.getConst(ip);1852 const map = self.names_map.unwrap().?.get(ip);
1857 const adapter: NullTerminatedString.Adapter = .{ .strings = self.names.get(ip) };1853 const adapter: NullTerminatedString.Adapter = .{ .strings = self.names.get(ip) };
1858 const field_index = map.getIndexAdapted(name, adapter) orelse return null;1854 const field_index = map.getIndexAdapted(name, adapter) orelse return null;
1859 return @intCast(field_index);1855 return @intCast(field_index);
...@@ -2101,13 +2097,13 @@ pub const Key = union(enum) {...@@ -2101,13 +2097,13 @@ pub const Key = union(enum) {
2101 comptime_args: Index.Slice,2097 comptime_args: Index.Slice,
21022098
2103 /// Returns a pointer that becomes invalid after any additions to the `InternPool`.2099 /// Returns a pointer that becomes invalid after any additions to the `InternPool`.
2104 fn analysisPtr(func: Func, ip: *InternPool) *FuncAnalysis {2100 fn analysisPtr(func: Func, ip: *const InternPool) *FuncAnalysis {
2105 const extra = ip.getLocalShared(func.tid).extra.acquire();2101 const extra = ip.getLocalShared(func.tid).extra.acquire();
2106 return @ptrCast(&extra.view().items(.@"0")[func.analysis_extra_index]);2102 return @ptrCast(&extra.view().items(.@"0")[func.analysis_extra_index]);
2107 }2103 }
21082104
2109 pub fn analysisUnordered(func: Func, ip: *const InternPool) FuncAnalysis {2105 pub fn analysisUnordered(func: Func, ip: *const InternPool) FuncAnalysis {
2110 return @atomicLoad(FuncAnalysis, func.analysisPtr(@constCast(ip)), .unordered);2106 return @atomicLoad(FuncAnalysis, func.analysisPtr(ip), .unordered);
2111 }2107 }
21122108
2113 pub fn setAnalysisState(func: Func, ip: *InternPool, state: FuncAnalysis.State) void {2109 pub fn setAnalysisState(func: Func, ip: *InternPool, state: FuncAnalysis.State) void {
...@@ -2144,23 +2140,23 @@ pub const Key = union(enum) {...@@ -2144,23 +2140,23 @@ pub const Key = union(enum) {
2144 }2140 }
21452141
2146 /// Returns a pointer that becomes invalid after any additions to the `InternPool`.2142 /// Returns a pointer that becomes invalid after any additions to the `InternPool`.
2147 fn zirBodyInstPtr(func: Func, ip: *InternPool) *TrackedInst.Index {2143 fn zirBodyInstPtr(func: Func, ip: *const InternPool) *TrackedInst.Index {
2148 const extra = ip.getLocalShared(func.tid).extra.acquire();2144 const extra = ip.getLocalShared(func.tid).extra.acquire();
2149 return @ptrCast(&extra.view().items(.@"0")[func.zir_body_inst_extra_index]);2145 return @ptrCast(&extra.view().items(.@"0")[func.zir_body_inst_extra_index]);
2150 }2146 }
21512147
2152 pub fn zirBodyInstUnordered(func: Func, ip: *const InternPool) TrackedInst.Index {2148 pub fn zirBodyInstUnordered(func: Func, ip: *const InternPool) TrackedInst.Index {
2153 return @atomicLoad(TrackedInst.Index, func.zirBodyInstPtr(@constCast(ip)), .unordered);2149 return @atomicLoad(TrackedInst.Index, func.zirBodyInstPtr(ip), .unordered);
2154 }2150 }
21552151
2156 /// Returns a pointer that becomes invalid after any additions to the `InternPool`.2152 /// Returns a pointer that becomes invalid after any additions to the `InternPool`.
2157 fn branchQuotaPtr(func: Func, ip: *InternPool) *u32 {2153 fn branchQuotaPtr(func: Func, ip: *const InternPool) *u32 {
2158 const extra = ip.getLocalShared(func.tid).extra.acquire();2154 const extra = ip.getLocalShared(func.tid).extra.acquire();
2159 return &extra.view().items(.@"0")[func.branch_quota_extra_index];2155 return &extra.view().items(.@"0")[func.branch_quota_extra_index];
2160 }2156 }
21612157
2162 pub fn branchQuotaUnordered(func: Func, ip: *const InternPool) u32 {2158 pub fn branchQuotaUnordered(func: Func, ip: *const InternPool) u32 {
2163 return @atomicLoad(u32, func.branchQuotaPtr(@constCast(ip)), .unordered);2159 return @atomicLoad(u32, func.branchQuotaPtr(ip), .unordered);
2164 }2160 }
21652161
2166 pub fn maxBranchQuota(func: Func, ip: *InternPool, new_branch_quota: u32) void {2162 pub fn maxBranchQuota(func: Func, ip: *InternPool, new_branch_quota: u32) void {
...@@ -2173,14 +2169,14 @@ pub const Key = union(enum) {...@@ -2173,14 +2169,14 @@ pub const Key = union(enum) {
2173 }2169 }
21742170
2175 /// Returns a pointer that becomes invalid after any additions to the `InternPool`.2171 /// Returns a pointer that becomes invalid after any additions to the `InternPool`.
2176 fn resolvedErrorSetPtr(func: Func, ip: *InternPool) *Index {2172 fn resolvedErrorSetPtr(func: Func, ip: *const InternPool) *Index {
2177 const extra = ip.getLocalShared(func.tid).extra.acquire();2173 const extra = ip.getLocalShared(func.tid).extra.acquire();
2178 assert(func.analysisUnordered(ip).inferred_error_set);2174 assert(func.analysisUnordered(ip).inferred_error_set);
2179 return @ptrCast(&extra.view().items(.@"0")[func.resolved_error_set_extra_index]);2175 return @ptrCast(&extra.view().items(.@"0")[func.resolved_error_set_extra_index]);
2180 }2176 }
21812177
2182 pub fn resolvedErrorSetUnordered(func: Func, ip: *const InternPool) Index {2178 pub fn resolvedErrorSetUnordered(func: Func, ip: *const InternPool) Index {
2183 return @atomicLoad(Index, func.resolvedErrorSetPtr(@constCast(ip)), .unordered);2179 return @atomicLoad(Index, func.resolvedErrorSetPtr(ip), .unordered);
2184 }2180 }
21852181
2186 pub fn setResolvedErrorSet(func: Func, ip: *InternPool, ies: Index) void {2182 pub fn setResolvedErrorSet(func: Func, ip: *InternPool, ies: Index) void {
...@@ -3135,14 +3131,14 @@ pub const LoadedUnionType = struct {...@@ -3135,14 +3131,14 @@ pub const LoadedUnionType = struct {
3135 /// This accessor is provided so that the tag type can be mutated, and so that3131 /// This accessor is provided so that the tag type can be mutated, and so that
3136 /// when it is mutated, the mutations are observed.3132 /// when it is mutated, the mutations are observed.
3137 /// The returned pointer expires with any addition to the `InternPool`.3133 /// The returned pointer expires with any addition to the `InternPool`.
3138 fn tagTypePtr(self: LoadedUnionType, ip: *InternPool) *Index {3134 fn tagTypePtr(self: LoadedUnionType, ip: *const InternPool) *Index {
3139 const extra = ip.getLocalShared(self.tid).extra.acquire();3135 const extra = ip.getLocalShared(self.tid).extra.acquire();
3140 const field_index = std.meta.fieldIndex(Tag.TypeUnion, "tag_ty").?;3136 const field_index = std.meta.fieldIndex(Tag.TypeUnion, "tag_ty").?;
3141 return @ptrCast(&extra.view().items(.@"0")[self.extra_index + field_index]);3137 return @ptrCast(&extra.view().items(.@"0")[self.extra_index + field_index]);
3142 }3138 }
31433139
3144 pub fn tagTypeUnordered(u: LoadedUnionType, ip: *const InternPool) Index {3140 pub fn tagTypeUnordered(u: LoadedUnionType, ip: *const InternPool) Index {
3145 return @atomicLoad(Index, u.tagTypePtr(@constCast(ip)), .unordered);3141 return @atomicLoad(Index, u.tagTypePtr(ip), .unordered);
3146 }3142 }
31473143
3148 pub fn setTagType(u: LoadedUnionType, ip: *InternPool, tag_type: Index) void {3144 pub fn setTagType(u: LoadedUnionType, ip: *InternPool, tag_type: Index) void {
...@@ -3154,14 +3150,14 @@ pub const LoadedUnionType = struct {...@@ -3154,14 +3150,14 @@ pub const LoadedUnionType = struct {
3154 }3150 }
31553151
3156 /// The returned pointer expires with any addition to the `InternPool`.3152 /// The returned pointer expires with any addition to the `InternPool`.
3157 fn flagsPtr(self: LoadedUnionType, ip: *InternPool) *Tag.TypeUnion.Flags {3153 fn flagsPtr(self: LoadedUnionType, ip: *const InternPool) *Tag.TypeUnion.Flags {
3158 const extra = ip.getLocalShared(self.tid).extra.acquire();3154 const extra = ip.getLocalShared(self.tid).extra.acquire();
3159 const field_index = std.meta.fieldIndex(Tag.TypeUnion, "flags").?;3155 const field_index = std.meta.fieldIndex(Tag.TypeUnion, "flags").?;
3160 return @ptrCast(&extra.view().items(.@"0")[self.extra_index + field_index]);3156 return @ptrCast(&extra.view().items(.@"0")[self.extra_index + field_index]);
3161 }3157 }
31623158
3163 pub fn flagsUnordered(u: LoadedUnionType, ip: *const InternPool) Tag.TypeUnion.Flags {3159 pub fn flagsUnordered(u: LoadedUnionType, ip: *const InternPool) Tag.TypeUnion.Flags {
3164 return @atomicLoad(Tag.TypeUnion.Flags, u.flagsPtr(@constCast(ip)), .unordered);3160 return @atomicLoad(Tag.TypeUnion.Flags, u.flagsPtr(ip), .unordered);
3165 }3161 }
31663162
3167 pub fn setStatus(u: LoadedUnionType, ip: *InternPool, status: Status) void {3163 pub fn setStatus(u: LoadedUnionType, ip: *InternPool, status: Status) void {
...@@ -3254,25 +3250,25 @@ pub const LoadedUnionType = struct {...@@ -3254,25 +3250,25 @@ pub const LoadedUnionType = struct {
3254 }3250 }
32553251
3256 /// The returned pointer expires with any addition to the `InternPool`.3252 /// The returned pointer expires with any addition to the `InternPool`.
3257 fn sizePtr(self: LoadedUnionType, ip: *InternPool) *u32 {3253 fn sizePtr(self: LoadedUnionType, ip: *const InternPool) *u32 {
3258 const extra = ip.getLocalShared(self.tid).extra.acquire();3254 const extra = ip.getLocalShared(self.tid).extra.acquire();
3259 const field_index = std.meta.fieldIndex(Tag.TypeUnion, "size").?;3255 const field_index = std.meta.fieldIndex(Tag.TypeUnion, "size").?;
3260 return &extra.view().items(.@"0")[self.extra_index + field_index];3256 return &extra.view().items(.@"0")[self.extra_index + field_index];
3261 }3257 }
32623258
3263 pub fn sizeUnordered(u: LoadedUnionType, ip: *const InternPool) u32 {3259 pub fn sizeUnordered(u: LoadedUnionType, ip: *const InternPool) u32 {
3264 return @atomicLoad(u32, u.sizePtr(@constCast(ip)), .unordered);3260 return @atomicLoad(u32, u.sizePtr(ip), .unordered);
3265 }3261 }
32663262
3267 /// The returned pointer expires with any addition to the `InternPool`.3263 /// The returned pointer expires with any addition to the `InternPool`.
3268 fn paddingPtr(self: LoadedUnionType, ip: *InternPool) *u32 {3264 fn paddingPtr(self: LoadedUnionType, ip: *const InternPool) *u32 {
3269 const extra = ip.getLocalShared(self.tid).extra.acquire();3265 const extra = ip.getLocalShared(self.tid).extra.acquire();
3270 const field_index = std.meta.fieldIndex(Tag.TypeUnion, "padding").?;3266 const field_index = std.meta.fieldIndex(Tag.TypeUnion, "padding").?;
3271 return &extra.view().items(.@"0")[self.extra_index + field_index];3267 return &extra.view().items(.@"0")[self.extra_index + field_index];
3272 }3268 }
32733269
3274 pub fn paddingUnordered(u: LoadedUnionType, ip: *const InternPool) u32 {3270 pub fn paddingUnordered(u: LoadedUnionType, ip: *const InternPool) u32 {
3275 return @atomicLoad(u32, u.paddingPtr(@constCast(ip)), .unordered);3271 return @atomicLoad(u32, u.paddingPtr(ip), .unordered);
3276 }3272 }
32773273
3278 pub fn hasTag(self: LoadedUnionType, ip: *const InternPool) bool {3274 pub fn hasTag(self: LoadedUnionType, ip: *const InternPool) bool {
...@@ -3480,7 +3476,7 @@ pub const LoadedStructType = struct {...@@ -3480,7 +3476,7 @@ pub const LoadedStructType = struct {
3480 if (i >= s.field_types.len) return null;3476 if (i >= s.field_types.len) return null;
3481 return i;3477 return i;
3482 };3478 };
3483 const map = names_map.getConst(ip);3479 const map = names_map.get(ip);
3484 const adapter: NullTerminatedString.Adapter = .{ .strings = s.field_names.get(ip) };3480 const adapter: NullTerminatedString.Adapter = .{ .strings = s.field_names.get(ip) };
3485 const field_index = map.getIndexAdapted(name, adapter) orelse return null;3481 const field_index = map.getIndexAdapted(name, adapter) orelse return null;
3486 return @intCast(field_index);3482 return @intCast(field_index);
...@@ -3523,7 +3519,7 @@ pub const LoadedStructType = struct {...@@ -3523,7 +3519,7 @@ pub const LoadedStructType = struct {
35233519
3524 /// The returned pointer expires with any addition to the `InternPool`.3520 /// The returned pointer expires with any addition to the `InternPool`.
3525 /// Asserts the struct is not packed.3521 /// Asserts the struct is not packed.
3526 fn flagsPtr(s: LoadedStructType, ip: *InternPool) *Tag.TypeStruct.Flags {3522 fn flagsPtr(s: LoadedStructType, ip: *const InternPool) *Tag.TypeStruct.Flags {
3527 assert(s.layout != .@"packed");3523 assert(s.layout != .@"packed");
3528 const extra = ip.getLocalShared(s.tid).extra.acquire();3524 const extra = ip.getLocalShared(s.tid).extra.acquire();
3529 const flags_field_index = std.meta.fieldIndex(Tag.TypeStruct, "flags").?;3525 const flags_field_index = std.meta.fieldIndex(Tag.TypeStruct, "flags").?;
...@@ -3531,12 +3527,12 @@ pub const LoadedStructType = struct {...@@ -3531,12 +3527,12 @@ pub const LoadedStructType = struct {
3531 }3527 }
35323528
3533 pub fn flagsUnordered(s: LoadedStructType, ip: *const InternPool) Tag.TypeStruct.Flags {3529 pub fn flagsUnordered(s: LoadedStructType, ip: *const InternPool) Tag.TypeStruct.Flags {
3534 return @atomicLoad(Tag.TypeStruct.Flags, s.flagsPtr(@constCast(ip)), .unordered);3530 return @atomicLoad(Tag.TypeStruct.Flags, s.flagsPtr(ip), .unordered);
3535 }3531 }
35363532
3537 /// The returned pointer expires with any addition to the `InternPool`.3533 /// The returned pointer expires with any addition to the `InternPool`.
3538 /// Asserts that the struct is packed.3534 /// Asserts that the struct is packed.
3539 fn packedFlagsPtr(s: LoadedStructType, ip: *InternPool) *Tag.TypeStructPacked.Flags {3535 fn packedFlagsPtr(s: LoadedStructType, ip: *const InternPool) *Tag.TypeStructPacked.Flags {
3540 assert(s.layout == .@"packed");3536 assert(s.layout == .@"packed");
3541 const extra = ip.getLocalShared(s.tid).extra.acquire();3537 const extra = ip.getLocalShared(s.tid).extra.acquire();
3542 const flags_field_index = std.meta.fieldIndex(Tag.TypeStructPacked, "flags").?;3538 const flags_field_index = std.meta.fieldIndex(Tag.TypeStructPacked, "flags").?;
...@@ -3544,7 +3540,7 @@ pub const LoadedStructType = struct {...@@ -3544,7 +3540,7 @@ pub const LoadedStructType = struct {
3544 }3540 }
35453541
3546 pub fn packedFlagsUnordered(s: LoadedStructType, ip: *const InternPool) Tag.TypeStructPacked.Flags {3542 pub fn packedFlagsUnordered(s: LoadedStructType, ip: *const InternPool) Tag.TypeStructPacked.Flags {
3547 return @atomicLoad(Tag.TypeStructPacked.Flags, s.packedFlagsPtr(@constCast(ip)), .unordered);3543 return @atomicLoad(Tag.TypeStructPacked.Flags, s.packedFlagsPtr(ip), .unordered);
3548 }3544 }
35493545
3550 /// Reads the non-opv flag calculated during AstGen. Used to short-circuit more3546 /// Reads the non-opv flag calculated during AstGen. Used to short-circuit more
...@@ -3794,7 +3790,7 @@ pub const LoadedStructType = struct {...@@ -3794,7 +3790,7 @@ pub const LoadedStructType = struct {
37943790
3795 /// The returned pointer expires with any addition to the `InternPool`.3791 /// The returned pointer expires with any addition to the `InternPool`.
3796 /// Asserts the struct is not packed.3792 /// Asserts the struct is not packed.
3797 fn sizePtr(s: LoadedStructType, ip: *InternPool) *u32 {3793 fn sizePtr(s: LoadedStructType, ip: *const InternPool) *u32 {
3798 assert(s.layout != .@"packed");3794 assert(s.layout != .@"packed");
3799 const extra = ip.getLocalShared(s.tid).extra.acquire();3795 const extra = ip.getLocalShared(s.tid).extra.acquire();
3800 const size_field_index = std.meta.fieldIndex(Tag.TypeStruct, "size").?;3796 const size_field_index = std.meta.fieldIndex(Tag.TypeStruct, "size").?;
...@@ -3802,14 +3798,14 @@ pub const LoadedStructType = struct {...@@ -3802,14 +3798,14 @@ pub const LoadedStructType = struct {
3802 }3798 }
38033799
3804 pub fn sizeUnordered(s: LoadedStructType, ip: *const InternPool) u32 {3800 pub fn sizeUnordered(s: LoadedStructType, ip: *const InternPool) u32 {
3805 return @atomicLoad(u32, s.sizePtr(@constCast(ip)), .unordered);3801 return @atomicLoad(u32, s.sizePtr(ip), .unordered);
3806 }3802 }
38073803
3808 /// The backing integer type of the packed struct. Whether zig chooses3804 /// The backing integer type of the packed struct. Whether zig chooses
3809 /// this type or the user specifies it, it is stored here. This will be3805 /// this type or the user specifies it, it is stored here. This will be
3810 /// set to `none` until the layout is resolved.3806 /// set to `none` until the layout is resolved.
3811 /// Asserts the struct is packed.3807 /// Asserts the struct is packed.
3812 fn backingIntTypePtr(s: LoadedStructType, ip: *InternPool) *Index {3808 fn backingIntTypePtr(s: LoadedStructType, ip: *const InternPool) *Index {
3813 assert(s.layout == .@"packed");3809 assert(s.layout == .@"packed");
3814 const extra = ip.getLocalShared(s.tid).extra.acquire();3810 const extra = ip.getLocalShared(s.tid).extra.acquire();
3815 const field_index = std.meta.fieldIndex(Tag.TypeStructPacked, "backing_int_ty").?;3811 const field_index = std.meta.fieldIndex(Tag.TypeStructPacked, "backing_int_ty").?;
...@@ -3817,7 +3813,7 @@ pub const LoadedStructType = struct {...@@ -3817,7 +3813,7 @@ pub const LoadedStructType = struct {
3817 }3813 }
38183814
3819 pub fn backingIntTypeUnordered(s: LoadedStructType, ip: *const InternPool) Index {3815 pub fn backingIntTypeUnordered(s: LoadedStructType, ip: *const InternPool) Index {
3820 return @atomicLoad(Index, s.backingIntTypePtr(@constCast(ip)), .unordered);3816 return @atomicLoad(Index, s.backingIntTypePtr(ip), .unordered);
3821 }3817 }
38223818
3823 pub fn setBackingIntType(s: LoadedStructType, ip: *InternPool, backing_int_ty: Index) void {3819 pub fn setBackingIntType(s: LoadedStructType, ip: *InternPool, backing_int_ty: Index) void {
...@@ -4190,7 +4186,7 @@ pub const LoadedEnumType = struct {...@@ -4190,7 +4186,7 @@ pub const LoadedEnumType = struct {
41904186
4191 /// Look up field index based on field name.4187 /// Look up field index based on field name.
4192 pub fn nameIndex(self: LoadedEnumType, ip: *const InternPool, name: NullTerminatedString) ?u32 {4188 pub fn nameIndex(self: LoadedEnumType, ip: *const InternPool, name: NullTerminatedString) ?u32 {
4193 const map = self.names_map.getConst(ip);4189 const map = self.names_map.get(ip);
4194 const adapter: NullTerminatedString.Adapter = .{ .strings = self.names.get(ip) };4190 const adapter: NullTerminatedString.Adapter = .{ .strings = self.names.get(ip) };
4195 const field_index = map.getIndexAdapted(name, adapter) orelse return null;4191 const field_index = map.getIndexAdapted(name, adapter) orelse return null;
4196 return @intCast(field_index);4192 return @intCast(field_index);
...@@ -4210,7 +4206,7 @@ pub const LoadedEnumType = struct {...@@ -4210,7 +4206,7 @@ pub const LoadedEnumType = struct {
4210 else => unreachable,4206 else => unreachable,
4211 };4207 };
4212 if (self.values_map.unwrap()) |values_map| {4208 if (self.values_map.unwrap()) |values_map| {
4213 const map = values_map.getConst(ip);4209 const map = values_map.get(ip);
4214 const adapter: Index.Adapter = .{ .indexes = self.values.get(ip) };4210 const adapter: Index.Adapter = .{ .indexes = self.values.get(ip) };
4215 const field_index = map.getIndexAdapted(int_tag_val, adapter) orelse return null;4211 const field_index = map.getIndexAdapted(int_tag_val, adapter) orelse return null;
4216 return @intCast(field_index);4212 return @intCast(field_index);
...@@ -11731,7 +11727,7 @@ pub fn isFuncBody(ip: *const InternPool, func: Index) bool {...@@ -11731,7 +11727,7 @@ pub fn isFuncBody(ip: *const InternPool, func: Index) bool {
11731 };11727 };
11732}11728}
1173311729
11734fn funcAnalysisPtr(ip: *InternPool, func: Index) *FuncAnalysis {11730fn funcAnalysisPtr(ip: *const InternPool, func: Index) *FuncAnalysis {
11735 const unwrapped_func = func.unwrap(ip);11731 const unwrapped_func = func.unwrap(ip);
11736 const extra = unwrapped_func.getExtra(ip);11732 const extra = unwrapped_func.getExtra(ip);
11737 const item = unwrapped_func.getItem(ip);11733 const item = unwrapped_func.getItem(ip);
...@@ -11757,7 +11753,7 @@ fn funcAnalysisPtr(ip: *InternPool, func: Index) *FuncAnalysis {...@@ -11757,7 +11753,7 @@ fn funcAnalysisPtr(ip: *InternPool, func: Index) *FuncAnalysis {
11757}11753}
1175811754
11759pub fn funcAnalysisUnordered(ip: *const InternPool, func: Index) FuncAnalysis {11755pub fn funcAnalysisUnordered(ip: *const InternPool, func: Index) FuncAnalysis {
11760 return @atomicLoad(FuncAnalysis, @constCast(ip).funcAnalysisPtr(func), .unordered);11756 return @atomicLoad(FuncAnalysis, ip.funcAnalysisPtr(func), .unordered);
11761}11757}
1176211758
11763pub fn funcSetCallsOrAwaitsErrorableFn(ip: *InternPool, func: Index) void {11759pub fn funcSetCallsOrAwaitsErrorableFn(ip: *InternPool, func: Index) void {
...@@ -11833,7 +11829,7 @@ fn iesResolvedPtr(ip: *InternPool, ies_index: Index) *Index {...@@ -11833,7 +11829,7 @@ fn iesResolvedPtr(ip: *InternPool, ies_index: Index) *Index {
11833/// Returns a mutable pointer to the resolved error set type of an inferred11829/// Returns a mutable pointer to the resolved error set type of an inferred
11834/// error set function. The returned pointer is invalidated when anything is11830/// error set function. The returned pointer is invalidated when anything is
11835/// added to `ip`.11831/// added to `ip`.
11836fn funcIesResolvedPtr(ip: *InternPool, func_index: Index) *Index {11832fn funcIesResolvedPtr(ip: *const InternPool, func_index: Index) *Index {
11837 assert(ip.funcAnalysisUnordered(func_index).inferred_error_set);11833 assert(ip.funcAnalysisUnordered(func_index).inferred_error_set);
11838 const unwrapped_func = func_index.unwrap(ip);11834 const unwrapped_func = func_index.unwrap(ip);
11839 const func_extra = unwrapped_func.getExtra(ip);11835 const func_extra = unwrapped_func.getExtra(ip);
...@@ -11861,7 +11857,7 @@ fn funcIesResolvedPtr(ip: *InternPool, func_index: Index) *Index {...@@ -11861,7 +11857,7 @@ fn funcIesResolvedPtr(ip: *InternPool, func_index: Index) *Index {
11861}11857}
1186211858
11863pub fn funcIesResolvedUnordered(ip: *const InternPool, index: Index) Index {11859pub fn funcIesResolvedUnordered(ip: *const InternPool, index: Index) Index {
11864 return @atomicLoad(Index, @constCast(ip).funcIesResolvedPtr(index), .unordered);11860 return @atomicLoad(Index, ip.funcIesResolvedPtr(index), .unordered);
11865}11861}
1186611862
11867pub fn funcSetIesResolved(ip: *InternPool, index: Index, ies: Index) void {11863pub fn funcSetIesResolved(ip: *InternPool, index: Index, ies: Index) void {