authorgravatar for andrew@ziglang.orgAndrew Kelley <andrew@ziglang.org> 2026-04-30 21:19:04-07:00
committergravatar for andrew@ziglang.orgAndrew Kelley <andrew@ziglang.org> 2026-05-25 18:54:35-07:00
logc57bf9904396c365191d25b9ce6410bb47daa96a
tree17fd3c630e10b36197f349c2b23acf03b52aad4f
parent364a1400ffb7c88539a34d86c83245478b096b84

Configuration: implement Storage.UnionList.tag


4 files changed, 16 insertions(+), 8 deletions(-)

BRANCH_TODO+3-1
...@@ -2,7 +2,6 @@...@@ -2,7 +2,6 @@
2* inspect b4ffb402c082605c4b324e88120306fc8fb3cf32 diff and apply changes as needed (merge conflict)2* inspect b4ffb402c082605c4b324e88120306fc8fb3cf32 diff and apply changes as needed (merge conflict)
3* make zig-pkg path root configurable in maker (make sure --system still works)3* make zig-pkg path root configurable in maker (make sure --system still works)
4* eliminate calls to getPath, getPath2, getPath34* eliminate calls to getPath, getPath2, getPath3
5* [build system compile step data races with getGraph function](https://codeberg.org/ziglang/zig/issues/31397)
6* test lazyImport5* test lazyImport
7* solve the TODOs added in this branch6* solve the TODOs added in this branch
8* get zig tests passing7* get zig tests passing
...@@ -17,6 +16,7 @@...@@ -17,6 +16,7 @@
17* refactor with DefaultingEnum16* refactor with DefaultingEnum
1817
19* implement {q} or delete {q} uses18* implement {q} or delete {q} uses
19* make the generated dependencies.zig be dependencies.zon and don't put absolute paths in there
2020
21## Followup Issues21## Followup Issues
22* reduce the size of Maker.Step.Extended (make Run smaller) probably by using an arena per make22* reduce the size of Maker.Step.Extended (make Run smaller) probably by using an arena per make
...@@ -49,3 +49,5 @@ run_cmd.addPassthruArgs();...@@ -49,3 +49,5 @@ run_cmd.addPassthruArgs();
49This removes a capability from build scripts since they can no longer observe49This removes a capability from build scripts since they can no longer observe
50those arguments. In exchange, it means that when changing those arguments,50those arguments. In exchange, it means that when changing those arguments,
51build scripts no longer must be rebuilt from source.51build scripts no longer must be rebuilt from source.
52
53closes #31397
lib/compiler/Maker/ScannedConfig.zig+9
...@@ -79,6 +79,15 @@ fn printValue(sc: *const ScannedConfig, s: *Serializer, comptime Field: type, fi...@@ -79,6 +79,15 @@ fn printValue(sc: *const ScannedConfig, s: *Serializer, comptime Field: type, fi
79 try printStruct(sc, &sub_struct, Configuration.Step.Run.Arg, field_value.get(c));79 try printStruct(sc, &sub_struct, Configuration.Step.Run.Arg, field_value.get(c));
80 try sub_struct.end();80 try sub_struct.end();
81 },81 },
82 Configuration.LazyPath.Index => {
83 switch (field_value.get(c)) {
84 inline else => |u| {
85 var sub_struct = try s.beginStruct(.{});
86 try printStruct(sc, &sub_struct, @TypeOf(u), u);
87 try sub_struct.end();
88 },
89 }
90 },
82 else => switch (@typeInfo(Field)) {91 else => switch (@typeInfo(Field)) {
83 .int => try s.int(field_value),92 .int => try s.int(field_value),
84 .pointer => |info| switch (info.size) {93 .pointer => |info| switch (info.size) {
lib/compiler/configurer.zig-2
...@@ -164,7 +164,6 @@ const Serialize = struct {...@@ -164,7 +164,6 @@ const Serialize = struct {
164 .src_path => |src_path| i: {164 .src_path => |src_path| i: {
165 const sub_path = try wc.addString(src_path.sub_path);165 const sub_path = try wc.addString(src_path.sub_path);
166 break :i try wc.addExtra(@as(Configuration.LazyPath.SourcePath, .{166 break :i try wc.addExtra(@as(Configuration.LazyPath.SourcePath, .{
167 .flags = .{},
168 .owner = try s.builderToPackage(src_path.owner),167 .owner = try s.builderToPackage(src_path.owner),
169 .sub_path = sub_path,168 .sub_path = sub_path,
170 }));169 }));
...@@ -187,7 +186,6 @@ const Serialize = struct {...@@ -187,7 +186,6 @@ const Serialize = struct {
187 .dependency => |dependency| i: {186 .dependency => |dependency| i: {
188 const sub_path = try wc.addString(dependency.sub_path);187 const sub_path = try wc.addString(dependency.sub_path);
189 break :i try wc.addExtra(@as(Configuration.LazyPath.SourcePath, .{188 break :i try wc.addExtra(@as(Configuration.LazyPath.SourcePath, .{
190 .flags = .{},
191 .owner = try s.builderToPackage(dependency.dependency.builder),189 .owner = try s.builderToPackage(dependency.dependency.builder),
192 .sub_path = sub_path,190 .sub_path = sub_path,
193 }));191 }));
lib/std/Build/Configuration.zig+4-5
...@@ -1173,7 +1173,7 @@ pub const LazyPath = union(@This().Tag) {...@@ -1173,7 +1173,7 @@ pub const LazyPath = union(@This().Tag) {
1173 };1173 };
11741174
1175 pub const SourcePath = struct {1175 pub const SourcePath = struct {
1176 flags: @This().Flags,1176 flags: @This().Flags = .{},
1177 owner: Package.Index,1177 owner: Package.Index,
1178 sub_path: String,1178 sub_path: String,
11791179
...@@ -2318,10 +2318,9 @@ pub const Storage = enum {...@@ -2318,10 +2318,9 @@ pub const Storage = enum {
23182318
2319 /// Valid to call only when deserializing.2319 /// Valid to call only when deserializing.
2320 pub fn tag(this: *const @This(), extra: []const u32, i: usize) Tag {2320 pub fn tag(this: *const @This(), extra: []const u32, i: usize) Tag {
2321 _ = this;2321 const start = @intFromPtr(this.data);
2322 _ = extra;2322 const meta_start = start - (this.len * @bitSizeOf(Meta) + 31) / 32;
2323 _ = i;2323 return loadBits(u32, extra[meta_start..], i * @bitSizeOf(Meta), Meta).tag;
2324 @panic("TODO implement UnionList.tag");
2325 }2324 }
23262325
2327 fn extraLen(len: usize) usize {2326 fn extraLen(len: usize) usize {