| author | |
| committer | |
| log | 9f59189c954298fd2be576b7e3dd26388d07751d |
| tree | ff21bd4c7d054562c2823a306c8c9269b7c51289 |
| parent | 7a92b89a9d19f3e6d258c848f1be13a6e31fec97 |
4 files changed, 13 insertions(+), 24 deletions(-)
lib/std/Progress.zig+1-6| ... | @@ -269,12 +269,7 @@ fn refreshWithHeldLock(self: *Progress) void { | ... | @@ -269,12 +269,7 @@ fn refreshWithHeldLock(self: *Progress) void { |
| 269 | } | 269 | } |
| 270 | if (eti > 0) { | 270 | if (eti > 0) { |
| 271 | if (need_ellipse) self.bufWrite(&end, " ", .{}); | 271 | if (need_ellipse) self.bufWrite(&end, " ", .{}); |
| 272 | if (builtin.zig_backend == .stage2_llvm) { | 272 | self.bufWrite(&end, "[{d}/{d}] ", .{ current_item, eti }); |
| 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 | } | ||
| 278 | need_ellipse = false; | 273 | need_ellipse = false; |
| 279 | } else if (completed_items != 0) { | 274 | } else if (completed_items != 0) { |
| 280 | if (need_ellipse) self.bufWrite(&end, " ", .{}); | 275 | if (need_ellipse) self.bufWrite(&end, " ", .{}); |
lib/std/special/test_runner.zig+2-14| ... | @@ -58,13 +58,7 @@ pub fn main() void { | ... | @@ -58,13 +58,7 @@ pub fn main() void { |
| 58 | test_node.activate(); | 58 | test_node.activate(); |
| 59 | progress.refresh(); | 59 | progress.refresh(); |
| 60 | if (!have_tty) { | 60 | if (!have_tty) { |
| 61 | if (builtin.zig_backend == .stage2_llvm) { | 61 | std.debug.print("{d}/{d} {s}... ", .{ i + 1, test_fn_list.len, test_fn.name }); |
| 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 | } | ||
| 68 | } | 62 | } |
| 69 | const result = if (test_fn.async_frame_size) |size| switch (io_mode) { | 63 | const result = if (test_fn.async_frame_size) |size| switch (io_mode) { |
| 70 | .evented => blk: { | 64 | .evented => blk: { |
| ... | @@ -109,13 +103,7 @@ pub fn main() void { | ... | @@ -109,13 +103,7 @@ pub fn main() void { |
| 109 | if (ok_count == test_fn_list.len) { | 103 | if (ok_count == test_fn_list.len) { |
| 110 | std.debug.print("All {d} tests passed.\n", .{ok_count}); | 104 | std.debug.print("All {d} tests passed.\n", .{ok_count}); |
| 111 | } else { | 105 | } else { |
| 112 | if (builtin.zig_backend == .stage2_llvm) { | 106 | std.debug.print("{d} passed; {d} skipped; {d} failed.\n", .{ ok_count, skip_count, fail_count }); |
| 113 | std.debug.print("{d} passed; ", .{ok_count}); | ||
| 114 | std.debug.print("{d} skipped; ", .{skip_count}); | ||
| 115 | std.debug.print("{d} failed.\n", .{fail_count}); | ||
| 116 | } else { | ||
| 117 | std.debug.print("{d} passed; {d} skipped; {d} failed.\n", .{ ok_count, skip_count, fail_count }); | ||
| 118 | } | ||
| 119 | } | 107 | } |
| 120 | if (log_err_count != 0) { | 108 | if (log_err_count != 0) { |
| 121 | std.debug.print("{d} errors were logged.\n", .{log_err_count}); | 109 | std.debug.print("{d} errors were logged.\n", .{log_err_count}); |
src/Sema.zig+8-2| ... | @@ -4494,6 +4494,10 @@ fn analyzeCall( | ... | @@ -4494,6 +4494,10 @@ fn analyzeCall( |
| 4494 | 4494 | ||
| 4495 | try sema.emitBackwardBranch(&child_block, call_src); | 4495 | try sema.emitBackwardBranch(&child_block, call_src); |
| 4496 | 4496 | ||
| 4497 | // Whether this call should be memoized, set to false if the call can mutate | ||
| 4498 | // comptime state. | ||
| 4499 | var should_memoize = true; | ||
| 4500 | |||
| 4497 | // This will have return instructions analyzed as break instructions to | 4501 | // This will have return instructions analyzed as break instructions to |
| 4498 | // the block_inst above. Here we are performing "comptime/inline semantic analysis" | 4502 | // the block_inst above. Here we are performing "comptime/inline semantic analysis" |
| 4499 | // for a function body, which means we must map the parameter ZIR instructions to | 4503 | // for a function body, which means we must map the parameter ZIR instructions to |
| ... | @@ -4527,6 +4531,7 @@ fn analyzeCall( | ... | @@ -4527,6 +4531,7 @@ fn analyzeCall( |
| 4527 | }, | 4531 | }, |
| 4528 | else => {}, | 4532 | else => {}, |
| 4529 | } | 4533 | } |
| 4534 | should_memoize = should_memoize and !arg_val.isComptimeMutablePtr(); | ||
| 4530 | memoized_call_key.args[arg_i] = .{ | 4535 | memoized_call_key.args[arg_i] = .{ |
| 4531 | .ty = param_ty, | 4536 | .ty = param_ty, |
| 4532 | .val = arg_val, | 4537 | .val = arg_val, |
| ... | @@ -4552,6 +4557,7 @@ fn analyzeCall( | ... | @@ -4552,6 +4557,7 @@ fn analyzeCall( |
| 4552 | }, | 4557 | }, |
| 4553 | else => {}, | 4558 | else => {}, |
| 4554 | } | 4559 | } |
| 4560 | should_memoize = should_memoize and !arg_val.isComptimeMutablePtr(); | ||
| 4555 | memoized_call_key.args[arg_i] = .{ | 4561 | memoized_call_key.args[arg_i] = .{ |
| 4556 | .ty = sema.typeOf(uncasted_arg), | 4562 | .ty = sema.typeOf(uncasted_arg), |
| 4557 | .val = arg_val, | 4563 | .val = arg_val, |
| ... | @@ -4597,7 +4603,7 @@ fn analyzeCall( | ... | @@ -4597,7 +4603,7 @@ fn analyzeCall( |
| 4597 | // This `res2` is here instead of directly breaking from `res` due to a stage1 | 4603 | // This `res2` is here instead of directly breaking from `res` due to a stage1 |
| 4598 | // bug generating invalid LLVM IR. | 4604 | // bug generating invalid LLVM IR. |
| 4599 | const res2: Air.Inst.Ref = res2: { | 4605 | const res2: Air.Inst.Ref = res2: { |
| 4600 | if (is_comptime_call) { | 4606 | if (should_memoize and is_comptime_call) { |
| 4601 | if (mod.memoized_calls.get(memoized_call_key)) |result| { | 4607 | if (mod.memoized_calls.get(memoized_call_key)) |result| { |
| 4602 | const ty_inst = try sema.addType(fn_ret_ty); | 4608 | const ty_inst = try sema.addType(fn_ret_ty); |
| 4603 | try sema.air_values.append(gpa, result.val); | 4609 | try sema.air_values.append(gpa, result.val); |
| ... | @@ -4621,7 +4627,7 @@ fn analyzeCall( | ... | @@ -4621,7 +4627,7 @@ fn analyzeCall( |
| 4621 | break :result try sema.analyzeBlockBody(block, call_src, &child_block, merges); | 4627 | break :result try sema.analyzeBlockBody(block, call_src, &child_block, merges); |
| 4622 | }; | 4628 | }; |
| 4623 | 4629 | ||
| 4624 | if (is_comptime_call) { | 4630 | if (should_memoize and is_comptime_call) { |
| 4625 | const result_val = try sema.resolveConstMaybeUndefVal(block, call_src, result); | 4631 | const result_val = try sema.resolveConstMaybeUndefVal(block, call_src, result); |
| 4626 | 4632 | ||
| 4627 | // TODO: check whether any external comptime memory was mutated by the | 4633 | // TODO: check whether any external comptime memory was mutated by the |
test/behavior.zig+2-2| ... | @@ -125,6 +125,7 @@ test { | ... | @@ -125,6 +125,7 @@ test { |
| 125 | _ = @import("behavior/widening.zig"); | 125 | _ = @import("behavior/widening.zig"); |
| 126 | _ = @import("behavior/bugs/421.zig"); | 126 | _ = @import("behavior/bugs/421.zig"); |
| 127 | _ = @import("behavior/bugs/726.zig"); | 127 | _ = @import("behavior/bugs/726.zig"); |
| 128 | _ = @import("behavior/bugs/828.zig"); | ||
| 128 | _ = @import("behavior/bugs/1421.zig"); | 129 | _ = @import("behavior/bugs/1421.zig"); |
| 129 | _ = @import("behavior/bugs/1442.zig"); | 130 | _ = @import("behavior/bugs/1442.zig"); |
| 130 | _ = @import("behavior/bugs/1607.zig"); | 131 | _ = @import("behavior/bugs/1607.zig"); |
| ... | @@ -132,6 +133,7 @@ test { | ... | @@ -132,6 +133,7 @@ test { |
| 132 | _ = @import("behavior/bugs/3384.zig"); | 133 | _ = @import("behavior/bugs/3384.zig"); |
| 133 | _ = @import("behavior/bugs/3742.zig"); | 134 | _ = @import("behavior/bugs/3742.zig"); |
| 134 | _ = @import("behavior/bugs/5398.zig"); | 135 | _ = @import("behavior/bugs/5398.zig"); |
| 136 | _ = @import("behavior/bugs/5413.zig"); | ||
| 135 | _ = @import("behavior/bugs/5487.zig"); | 137 | _ = @import("behavior/bugs/5487.zig"); |
| 136 | _ = @import("behavior/struct_contains_null_ptr_itself.zig"); | 138 | _ = @import("behavior/struct_contains_null_ptr_itself.zig"); |
| 137 | _ = @import("behavior/switch_prong_err_enum.zig"); | 139 | _ = @import("behavior/switch_prong_err_enum.zig"); |
| ... | @@ -148,12 +150,10 @@ test { | ... | @@ -148,12 +150,10 @@ test { |
| 148 | _ = @import("behavior/await_struct.zig"); | 150 | _ = @import("behavior/await_struct.zig"); |
| 149 | _ = @import("behavior/bugs/529.zig"); | 151 | _ = @import("behavior/bugs/529.zig"); |
| 150 | _ = @import("behavior/bugs/718.zig"); | 152 | _ = @import("behavior/bugs/718.zig"); |
| 151 | _ = @import("behavior/bugs/828.zig"); | ||
| 152 | _ = @import("behavior/bugs/920.zig"); | 153 | _ = @import("behavior/bugs/920.zig"); |
| 153 | _ = @import("behavior/bugs/1120.zig"); | 154 | _ = @import("behavior/bugs/1120.zig"); |
| 154 | _ = @import("behavior/bugs/1851.zig"); | 155 | _ = @import("behavior/bugs/1851.zig"); |
| 155 | _ = @import("behavior/bugs/3779.zig"); | 156 | _ = @import("behavior/bugs/3779.zig"); |
| 156 | _ = @import("behavior/bugs/5413.zig"); | ||
| 157 | _ = @import("behavior/bugs/6456.zig"); | 157 | _ = @import("behavior/bugs/6456.zig"); |
| 158 | _ = @import("behavior/bugs/6781.zig"); | 158 | _ = @import("behavior/bugs/6781.zig"); |
| 159 | _ = @import("behavior/bugs/7003.zig"); | 159 | _ = @import("behavior/bugs/7003.zig"); |