aboutsummaryrefslogtreecommitdiff
path: root/src/Zcu/PerThread.zig
diff options
context:
space:
mode:
authorJustus Klausecker <justus@klausecker.de>2025-08-07 19:42:40 +0200
committerJustus Klausecker <justus@klausecker.de>2025-08-12 16:33:57 +0200
commit79e5c138c6474713776caf25cbc21923471ff759 (patch)
treede185dfb6047e9ab3f3723672c35df61fc74611c /src/Zcu/PerThread.zig
parent7756fa66411d88f8e280d6d5e91d809ea536cbff (diff)
downloadzig-79e5c138c6474713776caf25cbc21923471ff759.tar.gz
zig-79e5c138c6474713776caf25cbc21923471ff759.zip
replace even more aggregate interns
Diffstat (limited to 'src/Zcu/PerThread.zig')
-rw-r--r--src/Zcu/PerThread.zig17
1 files changed, 5 insertions, 12 deletions
diff --git a/src/Zcu/PerThread.zig b/src/Zcu/PerThread.zig
index 6a86bb76a1..92ef34c6cd 100644
--- a/src/Zcu/PerThread.zig
+++ b/src/Zcu/PerThread.zig
@@ -3327,10 +3327,7 @@ pub fn populateTestFunctions(pt: Zcu.PerThread) Allocator.Error!void {
.byte_offset = 0,
} }),
};
- test_fn_val.* = try pt.intern(.{ .aggregate = .{
- .ty = test_fn_ty.toIntern(),
- .storage = .{ .elems = &test_fn_fields },
- } });
+ test_fn_val.* = (try pt.aggregateValue(test_fn_ty, &test_fn_fields)).toIntern();
}
const array_ty = try pt.arrayType(.{
@@ -3338,13 +3335,9 @@ pub fn populateTestFunctions(pt: Zcu.PerThread) Allocator.Error!void {
.child = test_fn_ty.toIntern(),
.sentinel = .none,
});
- const array_val = try pt.intern(.{ .aggregate = .{
- .ty = array_ty.toIntern(),
- .storage = .{ .elems = test_fn_vals },
- } });
break :array .{
.orig_ty = (try pt.singleConstPtrType(array_ty)).toIntern(),
- .val = array_val,
+ .val = (try pt.aggregateValue(array_ty, test_fn_vals)).toIntern(),
};
};
@@ -3685,15 +3678,15 @@ pub fn aggregateValue(pt: Zcu.PerThread, ty: Type, elems: []const InternPool.Ind
}
/// Asserts that `ty` is either an array or a vector.
-pub fn aggregateSplatValue(pt: Zcu.PerThread, ty: Type, repeated: Value) Allocator.Error!Value {
+pub fn aggregateSplatValue(pt: Zcu.PerThread, ty: Type, repeated_elem: Value) Allocator.Error!Value {
switch (ty.zigTypeTag(pt.zcu)) {
.array, .vector => {},
else => unreachable,
}
- if (repeated.isUndef(pt.zcu)) return pt.undefValue(ty);
+ if (repeated_elem.isUndef(pt.zcu)) return pt.undefValue(ty);
return .fromInterned(try pt.intern(.{ .aggregate = .{
.ty = ty.toIntern(),
- .storage = .{ .repeated_elem = repeated.toIntern() },
+ .storage = .{ .repeated_elem = repeated_elem.toIntern() },
} }));
}