authorgravatar for andrew@ziglang.orgAndrew Kelley <andrew@ziglang.org> 2020-07-30 23:51:14-07:00
committergravatar for andrew@ziglang.orgAndrew Kelley <andrew@ziglang.org> 2020-07-30 23:51:14-07:00
logacd0dabab29e2e771e65919366fa8914d97f6e60
tree84aedcf85557867f685cddac2facba7405cbc80c
parentf1c1b8c02d489b9ebd9c55bfce2345b8c9bbf01a

stage2: add some tracy calls to link.zig functions


1 files changed, 10 insertions(+), 0 deletions(-)

src-self-hosted/link.zig+10
...@@ -10,6 +10,7 @@ const codegen = @import("codegen.zig");...@@ -10,6 +10,7 @@ const codegen = @import("codegen.zig");
10const c_codegen = @import("codegen/c.zig");10const c_codegen = @import("codegen/c.zig");
11const log = std.log;11const log = std.log;
12const DW = std.dwarf;12const DW = std.dwarf;
13const trace = @import("tracy.zig").trace;
1314
14// TODO Turn back on zig fmt when https://github.com/ziglang/zig/issues/5948 is implemented.15// TODO Turn back on zig fmt when https://github.com/ziglang/zig/issues/5948 is implemented.
15// zig fmt: off16// zig fmt: off
...@@ -186,6 +187,9 @@ pub const File = struct {...@@ -186,6 +187,9 @@ pub const File = struct {
186 }187 }
187188
188 pub fn flush(base: *File) !void {189 pub fn flush(base: *File) !void {
190 const tracy = trace(@src());
191 defer tracy.end();
192
189 try switch (base.tag) {193 try switch (base.tag) {
190 .elf => @fieldParentPtr(Elf, "base", base).flush(),194 .elf => @fieldParentPtr(Elf, "base", base).flush(),
191 .c => @fieldParentPtr(C, "base", base).flush(),195 .c => @fieldParentPtr(C, "base", base).flush(),
...@@ -1464,6 +1468,9 @@ pub const File = struct {...@@ -1464,6 +1468,9 @@ pub const File = struct {
1464 }1468 }
14651469
1466 pub fn updateDecl(self: *Elf, module: *Module, decl: *Module.Decl) !void {1470 pub fn updateDecl(self: *Elf, module: *Module, decl: *Module.Decl) !void {
1471 const tracy = trace(@src());
1472 defer tracy.end();
1473
1467 var code_buffer = std.ArrayList(u8).init(self.allocator);1474 var code_buffer = std.ArrayList(u8).init(self.allocator);
1468 defer code_buffer.deinit();1475 defer code_buffer.deinit();
14691476
...@@ -1548,6 +1555,9 @@ pub const File = struct {...@@ -1548,6 +1555,9 @@ pub const File = struct {
1548 decl: *const Module.Decl,1555 decl: *const Module.Decl,
1549 exports: []const *Module.Export,1556 exports: []const *Module.Export,
1550 ) !void {1557 ) !void {
1558 const tracy = trace(@src());
1559 defer tracy.end();
1560
1551 // In addition to ensuring capacity for global_symbols, we also ensure capacity for freeing all of1561 // In addition to ensuring capacity for global_symbols, we also ensure capacity for freeing all of
1552 // them, so that deleting exports is guaranteed to succeed.1562 // them, so that deleting exports is guaranteed to succeed.
1553 try self.global_symbols.ensureCapacity(self.allocator, self.global_symbols.items.len + exports.len);1563 try self.global_symbols.ensureCapacity(self.allocator, self.global_symbols.items.len + exports.len);