From ea25590f72717e12c0d3e9749aa340dcd736a362 Mon Sep 17 00:00:00 2001 From: Evan Haas Date: Wed, 28 Aug 2024 08:37:13 -0700 Subject: [PATCH] Zig update: change setCold to branchHint (#763) Closes #762 --- deps/zig/arch/x86_64/Lower.zig | 2 +- src/aro/Driver/Filesystem.zig | 8 ++++---- src/aro/Parser.zig | 10 +++++----- 3 files changed, 10 insertions(+), 10 deletions(-) diff --git a/deps/zig/arch/x86_64/Lower.zig b/deps/zig/arch/x86_64/Lower.zig index ccfef4de..148ba3af 100644 --- a/deps/zig/arch/x86_64/Lower.zig +++ b/deps/zig/arch/x86_64/Lower.zig @@ -271,7 +271,7 @@ pub fn lowerMir(lower: *Lower, index: Mir.Inst.Index) Error!struct { } pub fn fail(lower: *Lower, comptime format: []const u8, args: anytype) Error { - @setCold(true); + @branchHint(.cold); assert(lower.err_msg == null); lower.err_msg = try std.fmt.allocPrint(lower.gpa, format, args); return error.LowerFail; diff --git a/src/aro/Driver/Filesystem.zig b/src/aro/Driver/Filesystem.zig index 0de52e19..07cbeac0 100644 --- a/src/aro/Driver/Filesystem.zig +++ b/src/aro/Driver/Filesystem.zig @@ -4,7 +4,7 @@ const builtin = @import("builtin"); const is_windows = builtin.os.tag == .windows; fn readFileFake(entries: []const Filesystem.Entry, path: []const u8, buf: []u8) ?[]const u8 { - @setCold(true); + @branchHint(.cold); for (entries) |entry| { if (mem.eql(u8, entry.path, path)) { const len = @min(entry.contents.len, buf.len); @@ -16,7 +16,7 @@ fn readFileFake(entries: []const Filesystem.Entry, path: []const u8, buf: []u8) } fn findProgramByNameFake(entries: []const Filesystem.Entry, name: []const u8, path: ?[]const u8, buf: []u8) ?[]const u8 { - @setCold(true); + @branchHint(.cold); if (mem.indexOfScalar(u8, name, '/') != null) { @memcpy(buf[0..name.len], name); return buf[0..name.len]; @@ -35,7 +35,7 @@ fn findProgramByNameFake(entries: []const Filesystem.Entry, name: []const u8, pa } fn canExecuteFake(entries: []const Filesystem.Entry, path: []const u8) bool { - @setCold(true); + @branchHint(.cold); for (entries) |entry| { if (mem.eql(u8, entry.path, path)) { return entry.executable; @@ -45,7 +45,7 @@ fn canExecuteFake(entries: []const Filesystem.Entry, path: []const u8) bool { } fn existsFake(entries: []const Filesystem.Entry, path: []const u8) bool { - @setCold(true); + @branchHint(.cold); var buf: [std.fs.max_path_bytes]u8 = undefined; var fib = std.heap.FixedBufferAllocator.init(&buf); const resolved = std.fs.path.resolvePosix(fib.allocator(), &.{path}) catch return false; diff --git a/src/aro/Parser.zig b/src/aro/Parser.zig index ebd4afe4..89800985 100644 --- a/src/aro/Parser.zig +++ b/src/aro/Parser.zig @@ -390,12 +390,12 @@ fn errExpectedToken(p: *Parser, expected: Token.Id, actual: Token.Id) Error { } pub fn errStr(p: *Parser, tag: Diagnostics.Tag, tok_i: TokenIndex, str: []const u8) Compilation.Error!void { - @setCold(true); + @branchHint(.cold); return p.errExtra(tag, tok_i, .{ .str = str }); } pub fn errExtra(p: *Parser, tag: Diagnostics.Tag, tok_i: TokenIndex, extra: Diagnostics.Message.Extra) Compilation.Error!void { - @setCold(true); + @branchHint(.cold); const tok = p.pp.tokens.get(tok_i); var loc = tok.loc; if (tok_i != 0 and tok.id == .eof) { @@ -412,12 +412,12 @@ pub fn errExtra(p: *Parser, tag: Diagnostics.Tag, tok_i: TokenIndex, extra: Diag } pub fn errTok(p: *Parser, tag: Diagnostics.Tag, tok_i: TokenIndex) Compilation.Error!void { - @setCold(true); + @branchHint(.cold); return p.errExtra(tag, tok_i, .{ .none = {} }); } pub fn err(p: *Parser, tag: Diagnostics.Tag) Compilation.Error!void { - @setCold(true); + @branchHint(.cold); return p.errExtra(tag, p.tok_i, .{ .none = {} }); } @@ -651,7 +651,7 @@ fn pragma(p: *Parser) Compilation.Error!bool { /// Issue errors for top-level definitions whose type was never completed. fn diagnoseIncompleteDefinitions(p: *Parser) !void { - @setCold(true); + @branchHint(.cold); const node_slices = p.nodes.slice(); const tags = node_slices.items(.tag);