| author | |
| committer | |
| log | 950d840be66deb9239c0effa90ee41a7c0884f95 |
| tree | 50c2f0f8c60bab3586e889a9ff4d457480ec4482 |
| parent | 593d23c0d746deae1036b5209c683c1984dd0203 |
5 files changed, 50 insertions(+), 32 deletions(-)
lib/std/Progress.zig+8-2| ... | ... | @@ -269,7 +269,12 @@ fn refreshWithHeldLock(self: *Progress) void { |
| 269 | 269 | } |
| 270 | 270 | if (eti > 0) { |
| 271 | 271 | if (need_ellipse) self.bufWrite(&end, " ", .{}); |
| 272 | self.bufWrite(&end, "[{d}/{d}] ", .{ current_item, eti }); | |
| 272 | if (builtin.zig_backend == .stage2_llvm) { | |
| 273 | self.bufWrite(&end, "[{d}/ ", .{current_item}); | |
| 274 | self.bufWrite(&end, "{d}] ", .{eti}); | |
| 275 | } else { | |
| 276 | self.bufWrite(&end, "[{d}/{d}] ", .{ current_item, eti }); | |
| 277 | } | |
| 273 | 278 | need_ellipse = false; |
| 274 | 279 | } else if (completed_items != 0) { |
| 275 | 280 | if (need_ellipse) self.bufWrite(&end, " ", .{}); |
| ... | ... | @@ -284,9 +289,10 @@ fn refreshWithHeldLock(self: *Progress) void { |
| 284 | 289 | } |
| 285 | 290 | } |
| 286 | 291 | |
| 287 | _ = file.write(self.output_buffer[0..end]) catch { | |
| 292 | _ = file.write(self.output_buffer[0..end]) catch blk: { | |
| 288 | 293 | // Stop trying to write to this file once it errors. |
| 289 | 294 | self.terminal = null; |
| 295 | break :blk 0; // TODO stage2 requires this | |
| 290 | 296 | }; |
| 291 | 297 | if (self.timer) |*timer| { |
| 292 | 298 | self.prev_refresh_timestamp = timer.read(); |
lib/std/os/linux.zig+1-1| ... | ... | @@ -871,7 +871,7 @@ var vdso_clock_gettime = @ptrCast(?*const anyopaque, init_vdso_clock_gettime); |
| 871 | 871 | const vdso_clock_gettime_ty = fn (i32, *timespec) callconv(.C) usize; |
| 872 | 872 | |
| 873 | 873 | pub fn clock_gettime(clk_id: i32, tp: *timespec) usize { |
| 874 | if (@hasDecl(VDSO, "CGT_SYM")) { | |
| 874 | if (@hasDecl(VDSO, "CGT_SYM") and builtin.zig_backend == .stage1) { | |
| 875 | 875 | const ptr = @atomicLoad(?*const anyopaque, &vdso_clock_gettime, .Unordered); |
| 876 | 876 | if (ptr) |fn_ptr| { |
| 877 | 877 | const f = @ptrCast(vdso_clock_gettime_ty, fn_ptr); |
lib/std/special/test_runner.zig+26-23| ... | ... | @@ -23,10 +23,12 @@ fn processArgs() void { |
| 23 | 23 | } |
| 24 | 24 | |
| 25 | 25 | pub fn main() void { |
| 26 | if (builtin.zig_backend != .stage1) { | |
| 26 | if (builtin.zig_backend != .stage1 and | |
| 27 | builtin.zig_backend != .stage2_llvm) | |
| 28 | { | |
| 27 | 29 | return main2() catch @panic("test failure"); |
| 28 | 30 | } |
| 29 | processArgs(); | |
| 31 | if (builtin.zig_backend == .stage1) processArgs(); | |
| 30 | 32 | const test_fn_list = builtin.test_functions; |
| 31 | 33 | var ok_count: usize = 0; |
| 32 | 34 | var skip_count: usize = 0; |
| ... | ... | @@ -44,9 +46,9 @@ pub fn main() void { |
| 44 | 46 | |
| 45 | 47 | var leaks: usize = 0; |
| 46 | 48 | for (test_fn_list) |test_fn, i| { |
| 47 | std.testing.allocator_instance = .{}; | |
| 49 | if (builtin.zig_backend != .stage2_llvm) std.testing.allocator_instance = .{}; | |
| 48 | 50 | defer { |
| 49 | if (std.testing.allocator_instance.deinit()) { | |
| 51 | if (builtin.zig_backend != .stage2_llvm and std.testing.allocator_instance.deinit()) { | |
| 50 | 52 | leaks += 1; |
| 51 | 53 | } |
| 52 | 54 | } |
| ... | ... | @@ -56,9 +58,17 @@ pub fn main() void { |
| 56 | 58 | test_node.activate(); |
| 57 | 59 | progress.refresh(); |
| 58 | 60 | if (!have_tty) { |
| 59 | std.debug.print("{d}/{d} {s}... ", .{ i + 1, test_fn_list.len, test_fn.name }); | |
| 61 | if (builtin.zig_backend == .stage2_llvm) { | |
| 62 | std.debug.print("{d}/", .{i + 1}); | |
| 63 | std.debug.print("{d} ", .{test_fn_list.len}); | |
| 64 | std.debug.print("{s}... ", .{test_fn.name}); | |
| 65 | } else { | |
| 66 | std.debug.print("{d}/{d} {s}... ", .{ i + 1, test_fn_list.len, test_fn.name }); | |
| 67 | } | |
| 60 | 68 | } |
| 61 | const result = if (test_fn.async_frame_size) |size| switch (io_mode) { | |
| 69 | const result = if (builtin.zig_backend == .stage2_llvm) | |
| 70 | test_fn.func() | |
| 71 | else if (test_fn.async_frame_size) |size| switch (io_mode) { | |
| 62 | 72 | .evented => blk: { |
| 63 | 73 | if (async_frame_buffer.len < size) { |
| 64 | 74 | std.heap.page_allocator.free(async_frame_buffer); |
| ... | ... | @@ -90,9 +100,9 @@ pub fn main() void { |
| 90 | 100 | fail_count += 1; |
| 91 | 101 | progress.log("FAIL ({s})\n", .{@errorName(err)}); |
| 92 | 102 | if (!have_tty) std.debug.print("FAIL ({s})\n", .{@errorName(err)}); |
| 93 | if (@errorReturnTrace()) |trace| { | |
| 103 | if (builtin.zig_backend != .stage2_llvm) if (@errorReturnTrace()) |trace| { | |
| 94 | 104 | std.debug.dumpStackTrace(trace.*); |
| 95 | } | |
| 105 | }; | |
| 96 | 106 | test_node.end(); |
| 97 | 107 | }, |
| 98 | 108 | } |
| ... | ... | @@ -101,7 +111,13 @@ pub fn main() void { |
| 101 | 111 | if (ok_count == test_fn_list.len) { |
| 102 | 112 | std.debug.print("All {d} tests passed.\n", .{ok_count}); |
| 103 | 113 | } else { |
| 104 | std.debug.print("{d} passed; {d} skipped; {d} failed.\n", .{ ok_count, skip_count, fail_count }); | |
| 114 | if (builtin.zig_backend == .stage2_llvm) { | |
| 115 | std.debug.print("{d} passed; ", .{ok_count}); | |
| 116 | std.debug.print("{d} skipped; ", .{skip_count}); | |
| 117 | std.debug.print("{d} failed.\n", .{fail_count}); | |
| 118 | } else { | |
| 119 | std.debug.print("{d} passed; {d} skipped; {d} failed.\n", .{ ok_count, skip_count, fail_count }); | |
| 120 | } | |
| 105 | 121 | } |
| 106 | 122 | if (log_err_count != 0) { |
| 107 | 123 | std.debug.print("{d} errors were logged.\n", .{log_err_count}); |
| ... | ... | @@ -141,20 +157,7 @@ pub fn main2() anyerror!void { |
| 141 | 157 | } |
| 142 | 158 | }; |
| 143 | 159 | } |
| 144 | if (builtin.zig_backend == .stage2_llvm) { | |
| 145 | const stderr = std.io.getStdErr().writer(); | |
| 146 | const ok_count = builtin.test_functions.len - skipped - failed; | |
| 147 | if (ok_count == builtin.test_functions.len) { | |
| 148 | try stderr.print("All {d} tests passed.\n", .{ok_count}); | |
| 149 | } else { | |
| 150 | try stderr.print("{d} passed; ", .{ok_count}); | |
| 151 | try stderr.print("{d} skipped; ", .{skipped}); | |
| 152 | try stderr.print("{d} failed.\n", .{failed}); | |
| 153 | } | |
| 154 | if (failed != 0) { | |
| 155 | std.process.exit(1); | |
| 156 | } | |
| 157 | } else if (builtin.zig_backend == .stage2_wasm or | |
| 160 | if (builtin.zig_backend == .stage2_wasm or | |
| 158 | 161 | builtin.zig_backend == .stage2_x86_64) |
| 159 | 162 | { |
| 160 | 163 | const passed = builtin.test_functions.len - skipped - failed; |
src/Module.zig+1-1| ... | ... | @@ -3762,7 +3762,7 @@ fn semaDecl(mod: *Module, decl: *Decl) !bool { |
| 3762 | 3762 | // Note this resolves the type of the Decl, not the value; if this Decl |
| 3763 | 3763 | // is a struct, for example, this resolves `type` (which needs no resolution), |
| 3764 | 3764 | // not the struct itself. |
| 3765 | try sema.resolveTypeLayout(&block_scope, src, decl_tv.ty); | |
| 3765 | try sema.resolveTypeFully(&block_scope, src, decl_tv.ty); | |
| 3766 | 3766 | |
| 3767 | 3767 | const decl_arena_state = try decl_arena_allocator.create(std.heap.ArenaAllocator.State); |
| 3768 | 3768 |
src/Sema.zig+14-5| ... | ... | @@ -11947,19 +11947,27 @@ fn zirReify(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileError!Air.I |
| 11947 | 11947 | var buffer: Value.ToTypeBuffer = undefined; |
| 11948 | 11948 | const child_ty = child_val.toType(&buffer); |
| 11949 | 11949 | |
| 11950 | const ptr_size = size_val.toEnum(std.builtin.TypeInfo.Pointer.Size); | |
| 11951 | ||
| 11952 | var actual_sentinel: ?Value = null; | |
| 11950 | 11953 | if (!sentinel_val.isNull()) { |
| 11951 | return sema.fail(block, src, "TODO: implement zirReify for pointer with non-null sentinel", .{}); | |
| 11954 | if (ptr_size == .One or ptr_size == .C) { | |
| 11955 | return sema.fail(block, src, "sentinels are only allowed on slices and unknown-length pointers", .{}); | |
| 11956 | } | |
| 11957 | const sentinel_ptr_val = sentinel_val.castTag(.opt_payload).?.data; | |
| 11958 | const ptr_ty = try Type.ptr(sema.arena, .{ .@"addrspace" = .generic, .pointee_type = child_ty }); | |
| 11959 | actual_sentinel = (try sema.pointerDeref(block, src, sentinel_ptr_val, ptr_ty)).?; | |
| 11952 | 11960 | } |
| 11953 | 11961 | |
| 11954 | 11962 | const ty = try Type.ptr(sema.arena, .{ |
| 11955 | .size = size_val.toEnum(std.builtin.TypeInfo.Pointer.Size), | |
| 11963 | .size = ptr_size, | |
| 11956 | 11964 | .mutable = !is_const_val.toBool(), |
| 11957 | 11965 | .@"volatile" = is_volatile_val.toBool(), |
| 11958 | 11966 | .@"align" = @intCast(u8, alignment_val.toUnsignedInt()), // TODO: Validate this value. |
| 11959 | 11967 | .@"addrspace" = address_space_val.toEnum(std.builtin.AddressSpace), |
| 11960 | 11968 | .pointee_type = try child_ty.copy(sema.arena), |
| 11961 | 11969 | .@"allowzero" = is_allowzero_val.toBool(), |
| 11962 | .sentinel = null, | |
| 11970 | .sentinel = actual_sentinel, | |
| 11963 | 11971 | }); |
| 11964 | 11972 | return sema.addType(ty); |
| 11965 | 11973 | }, |
| ... | ... | @@ -12069,6 +12077,7 @@ fn zirIntToPtr(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileError!Ai |
| 12069 | 12077 | const type_src: LazySrcLoc = .{ .node_offset_builtin_call_arg0 = inst_data.src_node }; |
| 12070 | 12078 | const type_res = try sema.resolveType(block, src, extra.lhs); |
| 12071 | 12079 | try sema.checkPtrType(block, type_src, type_res); |
| 12080 | _ = try sema.resolveTypeLayout(block, src, type_res.childType()); | |
| 12072 | 12081 | const ptr_align = type_res.ptrAlignment(sema.mod.getTarget()); |
| 12073 | 12082 | |
| 12074 | 12083 | if (try sema.resolveDefinedValue(block, operand_src, operand_coerced)) |val| { |
| ... | ... | @@ -17586,7 +17595,7 @@ fn resolvePeerTypes( |
| 17586 | 17595 | return chosen_ty; |
| 17587 | 17596 | } |
| 17588 | 17597 | |
| 17589 | pub fn resolveTypeLayout( | |
| 17598 | fn resolveTypeLayout( | |
| 17590 | 17599 | sema: *Sema, |
| 17591 | 17600 | block: *Block, |
| 17592 | 17601 | src: LazySrcLoc, |
| ... | ... | @@ -17659,7 +17668,7 @@ fn resolveUnionLayout( |
| 17659 | 17668 | union_obj.status = .have_layout; |
| 17660 | 17669 | } |
| 17661 | 17670 | |
| 17662 | fn resolveTypeFully( | |
| 17671 | pub fn resolveTypeFully( | |
| 17663 | 17672 | sema: *Sema, |
| 17664 | 17673 | block: *Block, |
| 17665 | 17674 | src: LazySrcLoc, |