| ... | ... | @@ -6,6 +6,7 @@ const Value = @import("value.zig").Value; |
| 6 | 6 | const Type = @import("type.zig").Type; |
| 7 | 7 | const TypedValue = @import("TypedValue.zig"); |
| 8 | 8 | const assert = std.debug.assert; |
| 9 | const log = std.log; |
| 9 | 10 | const BigIntConst = std.math.big.int.Const; |
| 10 | 11 | const BigIntMutable = std.math.big.int.Mutable; |
| 11 | 12 | const Target = std.Target; |
| ... | ... | @@ -235,7 +236,7 @@ pub const Decl = struct { |
| 235 | 236 | |
| 236 | 237 | pub fn dump(self: *Decl) void { |
| 237 | 238 | const loc = std.zig.findLineColumn(self.scope.source.bytes, self.src); |
| 238 | | std.debug.warn("{}:{}:{} name={} status={}", .{ |
| 239 | std.debug.print("{}:{}:{} name={} status={}", .{ |
| 239 | 240 | self.scope.sub_file_path, |
| 240 | 241 | loc.line + 1, |
| 241 | 242 | loc.column + 1, |
| ... | ... | @@ -243,9 +244,9 @@ pub const Decl = struct { |
| 243 | 244 | @tagName(self.analysis), |
| 244 | 245 | }); |
| 245 | 246 | if (self.typedValueManaged()) |tvm| { |
| 246 | | std.debug.warn(" ty={} val={}", .{ tvm.typed_value.ty, tvm.typed_value.val }); |
| 247 | std.debug.print(" ty={} val={}", .{ tvm.typed_value.ty, tvm.typed_value.val }); |
| 247 | 248 | } |
| 248 | | std.debug.warn("\n", .{}); |
| 249 | std.debug.print("\n", .{}); |
| 249 | 250 | } |
| 250 | 251 | |
| 251 | 252 | pub fn typedValueManaged(self: *Decl) ?*TypedValue.Managed { |
| ... | ... | @@ -544,7 +545,7 @@ pub const Scope = struct { |
| 544 | 545 | |
| 545 | 546 | pub fn dumpSrc(self: *File, src: usize) void { |
| 546 | 547 | const loc = std.zig.findLineColumn(self.source.bytes, src); |
| 547 | | std.debug.warn("{}:{}:{}\n", .{ self.sub_file_path, loc.line + 1, loc.column + 1 }); |
| 548 | std.debug.print("{}:{}:{}\n", .{ self.sub_file_path, loc.line + 1, loc.column + 1 }); |
| 548 | 549 | } |
| 549 | 550 | |
| 550 | 551 | pub fn getSource(self: *File, module: *Module) ![:0]const u8 { |
| ... | ... | @@ -646,7 +647,7 @@ pub const Scope = struct { |
| 646 | 647 | |
| 647 | 648 | pub fn dumpSrc(self: *ZIRModule, src: usize) void { |
| 648 | 649 | const loc = std.zig.findLineColumn(self.source.bytes, src); |
| 649 | | std.debug.warn("{}:{}:{}\n", .{ self.sub_file_path, loc.line + 1, loc.column + 1 }); |
| 650 | std.debug.print("{}:{}:{}\n", .{ self.sub_file_path, loc.line + 1, loc.column + 1 }); |
| 650 | 651 | } |
| 651 | 652 | |
| 652 | 653 | pub fn getSource(self: *ZIRModule, module: *Module) ![:0]const u8 { |
| ... | ... | @@ -946,7 +947,6 @@ pub fn update(self: *Module) !void { |
| 946 | 947 | } |
| 947 | 948 | |
| 948 | 949 | self.link_error_flags = self.bin_file.errorFlags(); |
| 949 | | std.log.debug(.module, "link_error_flags: {}\n", .{self.link_error_flags}); |
| 950 | 950 | |
| 951 | 951 | // If there are any errors, we anticipate the source files being loaded |
| 952 | 952 | // to report error messages. Otherwise we unload all source files to save memory. |
| ... | ... | @@ -1109,7 +1109,7 @@ pub fn ensureDeclAnalyzed(self: *Module, decl: *Decl) InnerError!void { |
| 1109 | 1109 | assert(decl.analysis == .complete); |
| 1110 | 1110 | return; |
| 1111 | 1111 | } |
| 1112 | | //std.debug.warn("re-analyzing {}\n", .{decl.name}); |
| 1112 | log.debug(.module, "re-analyzing {}\n", .{decl.name}); |
| 1113 | 1113 | |
| 1114 | 1114 | // The exports this Decl performs will be re-discovered, so we remove them here |
| 1115 | 1115 | // prior to re-analysis. |
| ... | ... | @@ -1546,7 +1546,7 @@ fn analyzeRootSrcFile(self: *Module, root_scope: *Scope.File) !void { |
| 1546 | 1546 | // Handle explicitly deleted decls from the source code. Not to be confused |
| 1547 | 1547 | // with when we delete decls because they are no longer referenced. |
| 1548 | 1548 | for (deleted_decls.items()) |entry| { |
| 1549 | | //std.debug.warn("noticed '{}' deleted from source\n", .{entry.key.name}); |
| 1549 | log.debug(.module, "noticed '{}' deleted from source\n", .{entry.key.name}); |
| 1550 | 1550 | try self.deleteDecl(entry.key); |
| 1551 | 1551 | } |
| 1552 | 1552 | } |
| ... | ... | @@ -1575,7 +1575,6 @@ fn analyzeRootZIRModule(self: *Module, root_scope: *Scope.ZIRModule) !void { |
| 1575 | 1575 | const name_hash = root_scope.fullyQualifiedNameHash(src_decl.name); |
| 1576 | 1576 | if (self.decl_table.get(name_hash)) |decl| { |
| 1577 | 1577 | deleted_decls.removeAssertDiscard(decl); |
| 1578 | | //std.debug.warn("'{}' contents: '{}'\n", .{ src_decl.name, src_decl.contents }); |
| 1579 | 1578 | if (!srcHashEql(src_decl.contents_hash, decl.contents_hash)) { |
| 1580 | 1579 | try self.markOutdatedDecl(decl); |
| 1581 | 1580 | decl.contents_hash = src_decl.contents_hash; |
| ... | ... | @@ -1600,7 +1599,7 @@ fn analyzeRootZIRModule(self: *Module, root_scope: *Scope.ZIRModule) !void { |
| 1600 | 1599 | // Handle explicitly deleted decls from the source code. Not to be confused |
| 1601 | 1600 | // with when we delete decls because they are no longer referenced. |
| 1602 | 1601 | for (deleted_decls.items()) |entry| { |
| 1603 | | //std.debug.warn("noticed '{}' deleted from source\n", .{entry.key.name}); |
| 1602 | log.debug(.module, "noticed '{}' deleted from source\n", .{entry.key.name}); |
| 1604 | 1603 | try self.deleteDecl(entry.key); |
| 1605 | 1604 | } |
| 1606 | 1605 | } |
| ... | ... | @@ -1612,7 +1611,7 @@ fn deleteDecl(self: *Module, decl: *Decl) !void { |
| 1612 | 1611 | // not be present in the set, and this does nothing. |
| 1613 | 1612 | decl.scope.removeDecl(decl); |
| 1614 | 1613 | |
| 1615 | | //std.debug.warn("deleting decl '{}'\n", .{decl.name}); |
| 1614 | log.debug(.module, "deleting decl '{}'\n", .{decl.name}); |
| 1616 | 1615 | const name_hash = decl.fullyQualifiedNameHash(); |
| 1617 | 1616 | self.decl_table.removeAssertDiscard(name_hash); |
| 1618 | 1617 | // Remove itself from its dependencies, because we are about to destroy the decl pointer. |
| ... | ... | @@ -1698,17 +1697,17 @@ fn analyzeFnBody(self: *Module, decl: *Decl, func: *Fn) !void { |
| 1698 | 1697 | const fn_zir = func.analysis.queued; |
| 1699 | 1698 | defer fn_zir.arena.promote(self.gpa).deinit(); |
| 1700 | 1699 | func.analysis = .{ .in_progress = {} }; |
| 1701 | | //std.debug.warn("set {} to in_progress\n", .{decl.name}); |
| 1700 | log.debug(.module, "set {} to in_progress\n", .{decl.name}); |
| 1702 | 1701 | |
| 1703 | 1702 | try zir_sema.analyzeBody(self, &inner_block.base, fn_zir.body); |
| 1704 | 1703 | |
| 1705 | 1704 | const instructions = try arena.allocator.dupe(*Inst, inner_block.instructions.items); |
| 1706 | 1705 | func.analysis = .{ .success = .{ .instructions = instructions } }; |
| 1707 | | //std.debug.warn("set {} to success\n", .{decl.name}); |
| 1706 | log.debug(.module, "set {} to success\n", .{decl.name}); |
| 1708 | 1707 | } |
| 1709 | 1708 | |
| 1710 | 1709 | fn markOutdatedDecl(self: *Module, decl: *Decl) !void { |
| 1711 | | //std.debug.warn("mark {} outdated\n", .{decl.name}); |
| 1710 | log.debug(.module, "mark {} outdated\n", .{decl.name}); |
| 1712 | 1711 | try self.work_queue.writeItem(.{ .analyze_decl = decl }); |
| 1713 | 1712 | if (self.failed_decls.remove(decl)) |entry| { |
| 1714 | 1713 | entry.value.destroy(self.gpa); |
| ... | ... | @@ -2817,7 +2816,7 @@ pub fn dumpInst(self: *Module, scope: *Scope, inst: *Inst) void { |
| 2817 | 2816 | const source = zir_module.getSource(self) catch @panic("dumpInst failed to get source"); |
| 2818 | 2817 | const loc = std.zig.findLineColumn(source, inst.src); |
| 2819 | 2818 | if (inst.tag == .constant) { |
| 2820 | | std.debug.warn("constant ty={} val={} src={}:{}:{}\n", .{ |
| 2819 | std.debug.print("constant ty={} val={} src={}:{}:{}\n", .{ |
| 2821 | 2820 | inst.ty, |
| 2822 | 2821 | inst.castTag(.constant).?.val, |
| 2823 | 2822 | zir_module.subFilePath(), |
| ... | ... | @@ -2825,7 +2824,7 @@ pub fn dumpInst(self: *Module, scope: *Scope, inst: *Inst) void { |
| 2825 | 2824 | loc.column + 1, |
| 2826 | 2825 | }); |
| 2827 | 2826 | } else if (inst.deaths == 0) { |
| 2828 | | std.debug.warn("{} ty={} src={}:{}:{}\n", .{ |
| 2827 | std.debug.print("{} ty={} src={}:{}:{}\n", .{ |
| 2829 | 2828 | @tagName(inst.tag), |
| 2830 | 2829 | inst.ty, |
| 2831 | 2830 | zir_module.subFilePath(), |
| ... | ... | @@ -2833,7 +2832,7 @@ pub fn dumpInst(self: *Module, scope: *Scope, inst: *Inst) void { |
| 2833 | 2832 | loc.column + 1, |
| 2834 | 2833 | }); |
| 2835 | 2834 | } else { |
| 2836 | | std.debug.warn("{} ty={} deaths={b} src={}:{}:{}\n", .{ |
| 2835 | std.debug.print("{} ty={} deaths={b} src={}:{}:{}\n", .{ |
| 2837 | 2836 | @tagName(inst.tag), |
| 2838 | 2837 | inst.ty, |
| 2839 | 2838 | inst.deaths, |