authorgravatar for andrew@ziglang.orgAndrew Kelley <andrew@ziglang.org> 2021-05-17 11:33:21-07:00
committergravatar for andrew@ziglang.orgAndrew Kelley <andrew@ziglang.org> 2021-05-17 11:33:21-07:00
logd83983527323201c44f90a2f57ff58c746116e11
tree3d021b9e778543056b34cf4f5fc8274abfea7885
parent751bb12a9612c092541a63db72eb9ecc5eb1c4bd

stage2: add some debug logs for when link functions are called


2 files changed, 7 insertions(+), 3 deletions(-)

src/Compilation.zig-3
...@@ -1944,9 +1944,6 @@ pub fn performAllTheWork(self: *Compilation) error{ TimerUnsupported, OutOfMemor...@@ -1944,9 +1944,6 @@ pub fn performAllTheWork(self: *Compilation) error{ TimerUnsupported, OutOfMemor
1944 }1944 }
1945 }1945 }
19461946
1947 log.debug("calling updateDecl on '{s}', type={}", .{
1948 decl.name, decl.ty,
1949 });
1950 assert(decl.ty.hasCodeGenBits());1947 assert(decl.ty.hasCodeGenBits());
19511948
1952 self.bin_file.updateDecl(module, decl) catch |err| switch (err) {1949 self.bin_file.updateDecl(module, decl) catch |err| switch (err) {
src/link.zig+7
...@@ -301,6 +301,7 @@ pub const File = struct {...@@ -301,6 +301,7 @@ pub const File = struct {
301 /// May be called before or after updateDeclExports but must be called301 /// May be called before or after updateDeclExports but must be called
302 /// after allocateDeclIndexes for any given Decl.302 /// after allocateDeclIndexes for any given Decl.
303 pub fn updateDecl(base: *File, module: *Module, decl: *Module.Decl) !void {303 pub fn updateDecl(base: *File, module: *Module, decl: *Module.Decl) !void {
304 log.debug("updateDecl {*} ({s}), type={}", .{ decl, decl.name, decl.ty });
304 assert(decl.has_tv);305 assert(decl.has_tv);
305 switch (base.tag) {306 switch (base.tag) {
306 .coff => return @fieldParentPtr(Coff, "base", base).updateDecl(module, decl),307 .coff => return @fieldParentPtr(Coff, "base", base).updateDecl(module, decl),
...@@ -313,6 +314,9 @@ pub const File = struct {...@@ -313,6 +314,9 @@ pub const File = struct {
313 }314 }
314315
315 pub fn updateDeclLineNumber(base: *File, module: *Module, decl: *Module.Decl) !void {316 pub fn updateDeclLineNumber(base: *File, module: *Module, decl: *Module.Decl) !void {
317 log.debug("updateDeclLineNumber {*} ({s}), line={}", .{
318 decl, decl.name, decl.src_line + 1,
319 });
316 assert(decl.has_tv);320 assert(decl.has_tv);
317 switch (base.tag) {321 switch (base.tag) {
318 .coff => return @fieldParentPtr(Coff, "base", base).updateDeclLineNumber(module, decl),322 .coff => return @fieldParentPtr(Coff, "base", base).updateDeclLineNumber(module, decl),
...@@ -326,6 +330,7 @@ pub const File = struct {...@@ -326,6 +330,7 @@ pub const File = struct {
326 /// Must be called before any call to updateDecl or updateDeclExports for330 /// Must be called before any call to updateDecl or updateDeclExports for
327 /// any given Decl.331 /// any given Decl.
328 pub fn allocateDeclIndexes(base: *File, decl: *Module.Decl) !void {332 pub fn allocateDeclIndexes(base: *File, decl: *Module.Decl) !void {
333 log.debug("allocateDeclIndexes {*} ({s})", .{ decl, decl.name });
329 switch (base.tag) {334 switch (base.tag) {
330 .coff => return @fieldParentPtr(Coff, "base", base).allocateDeclIndexes(decl),335 .coff => return @fieldParentPtr(Coff, "base", base).allocateDeclIndexes(decl),
331 .elf => return @fieldParentPtr(Elf, "base", base).allocateDeclIndexes(decl),336 .elf => return @fieldParentPtr(Elf, "base", base).allocateDeclIndexes(decl),
...@@ -437,6 +442,7 @@ pub const File = struct {...@@ -437,6 +442,7 @@ pub const File = struct {
437442
438 /// Called when a Decl is deleted from the Module.443 /// Called when a Decl is deleted from the Module.
439 pub fn freeDecl(base: *File, decl: *Module.Decl) void {444 pub fn freeDecl(base: *File, decl: *Module.Decl) void {
445 log.debug("freeDecl {*} ({s})", .{ decl, decl.name });
440 switch (base.tag) {446 switch (base.tag) {
441 .coff => @fieldParentPtr(Coff, "base", base).freeDecl(decl),447 .coff => @fieldParentPtr(Coff, "base", base).freeDecl(decl),
442 .elf => @fieldParentPtr(Elf, "base", base).freeDecl(decl),448 .elf => @fieldParentPtr(Elf, "base", base).freeDecl(decl),
...@@ -465,6 +471,7 @@ pub const File = struct {...@@ -465,6 +471,7 @@ pub const File = struct {
465 decl: *Module.Decl,471 decl: *Module.Decl,
466 exports: []const *Module.Export,472 exports: []const *Module.Export,
467 ) !void {473 ) !void {
474 log.debug("updateDeclExports {*} ({s})", .{ decl, decl.name });
468 assert(decl.has_tv);475 assert(decl.has_tv);
469 switch (base.tag) {476 switch (base.tag) {
470 .coff => return @fieldParentPtr(Coff, "base", base).updateDeclExports(module, decl, exports),477 .coff => return @fieldParentPtr(Coff, "base", base).updateDeclExports(module, decl, exports),