| ... | @@ -1882,10 +1882,18 @@ const targets = [_]ArchTarget{ | ... | @@ -1882,10 +1882,18 @@ const targets = [_]ArchTarget{ |
| 1882 | }; | 1882 | }; |
| 1883 | | 1883 | |
| 1884 | pub fn main() anyerror!void { | 1884 | pub fn main() anyerror!void { |
| 1885 | var arena_state = std.heap.ArenaAllocator.init(std.heap.page_allocator); | 1885 | var debug_allocator: std.heap.DebugAllocator(.{}) = .init; |
| | 1886 | defer _ = debug_allocator.deinit(); |
| | 1887 | const gpa = debug_allocator.allocator(); |
| | 1888 | |
| | 1889 | var arena_state: std.heap.ArenaAllocator = .init(gpa); |
| 1886 | defer arena_state.deinit(); | 1890 | defer arena_state.deinit(); |
| 1887 | const arena = arena_state.allocator(); | 1891 | const arena = arena_state.allocator(); |
| 1888 | | 1892 | |
| | 1893 | var threaded: std.Io.Threaded = .init(gpa); |
| | 1894 | defer threaded.deinit(); |
| | 1895 | const io = threaded.io(); |
| | 1896 | |
| 1889 | var args = try std.process.argsWithAllocator(arena); | 1897 | var args = try std.process.argsWithAllocator(arena); |
| 1890 | const args0 = args.next().?; | 1898 | const args0 = args.next().?; |
| 1891 | | 1899 | |
| ... | @@ -1925,34 +1933,23 @@ pub fn main() anyerror!void { | ... | @@ -1925,34 +1933,23 @@ pub fn main() anyerror!void { |
| 1925 | const root_progress = std.Progress.start(.{ .estimated_total_items = targets.len }); | 1933 | const root_progress = std.Progress.start(.{ .estimated_total_items = targets.len }); |
| 1926 | defer root_progress.end(); | 1934 | defer root_progress.end(); |
| 1927 | | 1935 | |
| 1928 | if (builtin.single_threaded) { | 1936 | var group: std.Io.Group = .init; |
| 1929 | for (targets) |target| { | 1937 | defer group.cancel(io); |
| 1930 | if (filter) |zig_name| if (!std.mem.eql(u8, target.zig_name, zig_name)) continue; | 1938 | |
| 1931 | try processOneTarget(.{ | 1939 | for (targets) |target| { |
| 1932 | .llvm_tblgen_exe = llvm_tblgen_exe, | 1940 | if (filter) |zig_name| { |
| 1933 | .llvm_src_root = llvm_src_root, | 1941 | if (!std.mem.eql(u8, target.zig_name, zig_name)) continue; |
| 1934 | .zig_src_dir = zig_src_dir, | | |
| 1935 | .root_progress = root_progress, | | |
| 1936 | .target = target, | | |
| 1937 | }); | | |
| 1938 | } | | |
| 1939 | } else { | | |
| 1940 | var pool: std.Thread.Pool = undefined; | | |
| 1941 | try pool.init(.{ .allocator = arena, .n_jobs = targets.len }); | | |
| 1942 | defer pool.deinit(); | | |
| 1943 | | | |
| 1944 | for (targets) |target| { | | |
| 1945 | if (filter) |zig_name| if (!std.mem.eql(u8, target.zig_name, zig_name)) continue; | | |
| 1946 | const job = Job{ | | |
| 1947 | .llvm_tblgen_exe = llvm_tblgen_exe, | | |
| 1948 | .llvm_src_root = llvm_src_root, | | |
| 1949 | .zig_src_dir = zig_src_dir, | | |
| 1950 | .root_progress = root_progress, | | |
| 1951 | .target = target, | | |
| 1952 | }; | | |
| 1953 | try pool.spawn(processOneTarget, .{job}); | | |
| 1954 | } | 1942 | } |
| | 1943 | group.async(io, processOneTarget, .{.{ |
| | 1944 | .llvm_tblgen_exe = llvm_tblgen_exe, |
| | 1945 | .llvm_src_root = llvm_src_root, |
| | 1946 | .zig_src_dir = zig_src_dir, |
| | 1947 | .root_progress = root_progress, |
| | 1948 | .target = target, |
| | 1949 | }}); |
| 1955 | } | 1950 | } |
| | 1951 | |
| | 1952 | group.wait(io); |
| 1956 | } | 1953 | } |
| 1957 | | 1954 | |
| 1958 | const Job = struct { | 1955 | const Job = struct { |