| author | |
| committer | |
| log | 08b2d491bcd8c79c68495267cc71967661caea1e |
| tree | f6c8436094170f3dd197ffec479aec575c875d19 |
| parent | 7b2a936173165002105ba5e76bed69654e132fea |
21 files changed, 103 insertions(+), 109 deletions(-)
lib/compiler_rt/stack_probe.zig+7-7| ... | @@ -236,27 +236,27 @@ fn win_probe_stack_adjust_sp() void { | ... | @@ -236,27 +236,27 @@ fn win_probe_stack_adjust_sp() void { |
| 236 | 236 | ||
| 237 | pub fn _chkstk() callconv(.Naked) void { | 237 | pub fn _chkstk() callconv(.Naked) void { |
| 238 | @setRuntimeSafety(false); | 238 | @setRuntimeSafety(false); |
| 239 | @call(.{ .modifier = .always_inline }, win_probe_stack_adjust_sp, .{}); | 239 | @call(.always_inline, win_probe_stack_adjust_sp, .{}); |
| 240 | } | 240 | } |
| 241 | pub fn __chkstk() callconv(.Naked) void { | 241 | pub fn __chkstk() callconv(.Naked) void { |
| 242 | @setRuntimeSafety(false); | 242 | @setRuntimeSafety(false); |
| 243 | if (comptime arch.isAARCH64()) { | 243 | if (comptime arch.isAARCH64()) { |
| 244 | @call(.{ .modifier = .always_inline }, win_probe_stack_only, .{}); | 244 | @call(.always_inline, win_probe_stack_only, .{}); |
| 245 | } else switch (arch) { | 245 | } else switch (arch) { |
| 246 | .x86 => @call(.{ .modifier = .always_inline }, win_probe_stack_adjust_sp, .{}), | 246 | .x86 => @call(.always_inline, win_probe_stack_adjust_sp, .{}), |
| 247 | .x86_64 => @call(.{ .modifier = .always_inline }, win_probe_stack_only, .{}), | 247 | .x86_64 => @call(.always_inline, win_probe_stack_only, .{}), |
| 248 | else => unreachable, | 248 | else => unreachable, |
| 249 | } | 249 | } |
| 250 | } | 250 | } |
| 251 | pub fn ___chkstk() callconv(.Naked) void { | 251 | pub fn ___chkstk() callconv(.Naked) void { |
| 252 | @setRuntimeSafety(false); | 252 | @setRuntimeSafety(false); |
| 253 | @call(.{ .modifier = .always_inline }, win_probe_stack_adjust_sp, .{}); | 253 | @call(.always_inline, win_probe_stack_adjust_sp, .{}); |
| 254 | } | 254 | } |
| 255 | pub fn __chkstk_ms() callconv(.Naked) void { | 255 | pub fn __chkstk_ms() callconv(.Naked) void { |
| 256 | @setRuntimeSafety(false); | 256 | @setRuntimeSafety(false); |
| 257 | @call(.{ .modifier = .always_inline }, win_probe_stack_only, .{}); | 257 | @call(.always_inline, win_probe_stack_only, .{}); |
| 258 | } | 258 | } |
| 259 | pub fn ___chkstk_ms() callconv(.Naked) void { | 259 | pub fn ___chkstk_ms() callconv(.Naked) void { |
| 260 | @setRuntimeSafety(false); | 260 | @setRuntimeSafety(false); |
| 261 | @call(.{ .modifier = .always_inline }, win_probe_stack_only, .{}); | 261 | @call(.always_inline, win_probe_stack_only, .{}); |
| 262 | } | 262 | } |
lib/std/Thread.zig+4-4| ... | @@ -387,10 +387,10 @@ fn callFn(comptime f: anytype, args: anytype) switch (Impl) { | ... | @@ -387,10 +387,10 @@ fn callFn(comptime f: anytype, args: anytype) switch (Impl) { |
| 387 | 387 | ||
| 388 | switch (@typeInfo(@typeInfo(@TypeOf(f)).Fn.return_type.?)) { | 388 | switch (@typeInfo(@typeInfo(@TypeOf(f)).Fn.return_type.?)) { |
| 389 | .NoReturn => { | 389 | .NoReturn => { |
| 390 | @call(.{}, f, args); | 390 | @call(.auto, f, args); |
| 391 | }, | 391 | }, |
| 392 | .Void => { | 392 | .Void => { |
| 393 | @call(.{}, f, args); | 393 | @call(.auto, f, args); |
| 394 | return default_value; | 394 | return default_value; |
| 395 | }, | 395 | }, |
| 396 | .Int => |info| { | 396 | .Int => |info| { |
| ... | @@ -398,7 +398,7 @@ fn callFn(comptime f: anytype, args: anytype) switch (Impl) { | ... | @@ -398,7 +398,7 @@ fn callFn(comptime f: anytype, args: anytype) switch (Impl) { |
| 398 | @compileError(bad_fn_ret); | 398 | @compileError(bad_fn_ret); |
| 399 | } | 399 | } |
| 400 | 400 | ||
| 401 | const status = @call(.{}, f, args); | 401 | const status = @call(.auto, f, args); |
| 402 | if (Impl != PosixThreadImpl) { | 402 | if (Impl != PosixThreadImpl) { |
| 403 | return status; | 403 | return status; |
| 404 | } | 404 | } |
| ... | @@ -411,7 +411,7 @@ fn callFn(comptime f: anytype, args: anytype) switch (Impl) { | ... | @@ -411,7 +411,7 @@ fn callFn(comptime f: anytype, args: anytype) switch (Impl) { |
| 411 | @compileError(bad_fn_ret); | 411 | @compileError(bad_fn_ret); |
| 412 | } | 412 | } |
| 413 | 413 | ||
| 414 | @call(.{}, f, args) catch |err| { | 414 | @call(.auto, f, args) catch |err| { |
| 415 | std.debug.print("error: {s}\n", .{@errorName(err)}); | 415 | std.debug.print("error: {s}\n", .{@errorName(err)}); |
| 416 | if (@errorReturnTrace()) |trace| { | 416 | if (@errorReturnTrace()) |trace| { |
| 417 | std.debug.dumpStackTrace(trace.*); | 417 | std.debug.dumpStackTrace(trace.*); |
lib/std/crypto/siphash.zig+6-13| ... | @@ -78,12 +78,10 @@ fn SipHashStateless(comptime T: type, comptime c_rounds: usize, comptime d_round | ... | @@ -78,12 +78,10 @@ fn SipHashStateless(comptime T: type, comptime c_rounds: usize, comptime d_round |
| 78 | pub fn update(self: *Self, b: []const u8) void { | 78 | pub fn update(self: *Self, b: []const u8) void { |
| 79 | std.debug.assert(b.len % 8 == 0); | 79 | std.debug.assert(b.len % 8 == 0); |
| 80 | 80 | ||
| 81 | const inl = std.builtin.CallOptions{ .modifier = .always_inline }; | ||
| 82 | |||
| 83 | var off: usize = 0; | 81 | var off: usize = 0; |
| 84 | while (off < b.len) : (off += 8) { | 82 | while (off < b.len) : (off += 8) { |
| 85 | const blob = b[off..][0..8].*; | 83 | const blob = b[off..][0..8].*; |
| 86 | @call(inl, round, .{ self, blob }); | 84 | @call(.always_inline, round, .{ self, blob }); |
| 87 | } | 85 | } |
| 88 | 86 | ||
| 89 | self.msg_len +%= @truncate(u8, b.len); | 87 | self.msg_len +%= @truncate(u8, b.len); |
| ... | @@ -105,12 +103,9 @@ fn SipHashStateless(comptime T: type, comptime c_rounds: usize, comptime d_round | ... | @@ -105,12 +103,9 @@ fn SipHashStateless(comptime T: type, comptime c_rounds: usize, comptime d_round |
| 105 | self.v2 ^= 0xff; | 103 | self.v2 ^= 0xff; |
| 106 | } | 104 | } |
| 107 | 105 | ||
| 108 | // TODO this is a workaround, should be able to supply the value without a separate variable | ||
| 109 | const inl = std.builtin.CallOptions{ .modifier = .always_inline }; | ||
| 110 | |||
| 111 | comptime var i: usize = 0; | 106 | comptime var i: usize = 0; |
| 112 | inline while (i < d_rounds) : (i += 1) { | 107 | inline while (i < d_rounds) : (i += 1) { |
| 113 | @call(inl, sipRound, .{self}); | 108 | @call(.always_inline, sipRound, .{self}); |
| 114 | } | 109 | } |
| 115 | 110 | ||
| 116 | const b1 = self.v0 ^ self.v1 ^ self.v2 ^ self.v3; | 111 | const b1 = self.v0 ^ self.v1 ^ self.v2 ^ self.v3; |
| ... | @@ -122,7 +117,7 @@ fn SipHashStateless(comptime T: type, comptime c_rounds: usize, comptime d_round | ... | @@ -122,7 +117,7 @@ fn SipHashStateless(comptime T: type, comptime c_rounds: usize, comptime d_round |
| 122 | 117 | ||
| 123 | comptime var j: usize = 0; | 118 | comptime var j: usize = 0; |
| 124 | inline while (j < d_rounds) : (j += 1) { | 119 | inline while (j < d_rounds) : (j += 1) { |
| 125 | @call(inl, sipRound, .{self}); | 120 | @call(.always_inline, sipRound, .{self}); |
| 126 | } | 121 | } |
| 127 | 122 | ||
| 128 | const b2 = self.v0 ^ self.v1 ^ self.v2 ^ self.v3; | 123 | const b2 = self.v0 ^ self.v1 ^ self.v2 ^ self.v3; |
| ... | @@ -133,11 +128,9 @@ fn SipHashStateless(comptime T: type, comptime c_rounds: usize, comptime d_round | ... | @@ -133,11 +128,9 @@ fn SipHashStateless(comptime T: type, comptime c_rounds: usize, comptime d_round |
| 133 | const m = mem.readIntLittle(u64, b[0..8]); | 128 | const m = mem.readIntLittle(u64, b[0..8]); |
| 134 | self.v3 ^= m; | 129 | self.v3 ^= m; |
| 135 | 130 | ||
| 136 | // TODO this is a workaround, should be able to supply the value without a separate variable | ||
| 137 | const inl = std.builtin.CallOptions{ .modifier = .always_inline }; | ||
| 138 | comptime var i: usize = 0; | 131 | comptime var i: usize = 0; |
| 139 | inline while (i < c_rounds) : (i += 1) { | 132 | inline while (i < c_rounds) : (i += 1) { |
| 140 | @call(inl, sipRound, .{self}); | 133 | @call(.always_inline, sipRound, .{self}); |
| 141 | } | 134 | } |
| 142 | 135 | ||
| 143 | self.v0 ^= m; | 136 | self.v0 ^= m; |
| ... | @@ -163,8 +156,8 @@ fn SipHashStateless(comptime T: type, comptime c_rounds: usize, comptime d_round | ... | @@ -163,8 +156,8 @@ fn SipHashStateless(comptime T: type, comptime c_rounds: usize, comptime d_round |
| 163 | pub fn hash(msg: []const u8, key: *const [key_length]u8) T { | 156 | pub fn hash(msg: []const u8, key: *const [key_length]u8) T { |
| 164 | const aligned_len = msg.len - (msg.len % 8); | 157 | const aligned_len = msg.len - (msg.len % 8); |
| 165 | var c = Self.init(key); | 158 | var c = Self.init(key); |
| 166 | @call(.{ .modifier = .always_inline }, c.update, .{msg[0..aligned_len]}); | 159 | @call(.always_inline, c.update, .{msg[0..aligned_len]}); |
| 167 | return @call(.{ .modifier = .always_inline }, c.final, .{msg[aligned_len..]}); | 160 | return @call(.always_inline, c.final, .{msg[aligned_len..]}); |
| 168 | } | 161 | } |
| 169 | }; | 162 | }; |
| 170 | } | 163 | } |
lib/std/dynamic_library.zig+1-1| ... | @@ -381,7 +381,7 @@ pub const DlDynlib = struct { | ... | @@ -381,7 +381,7 @@ pub const DlDynlib = struct { |
| 381 | pub fn lookup(self: *DlDynlib, comptime T: type, name: [:0]const u8) ?T { | 381 | pub fn lookup(self: *DlDynlib, comptime T: type, name: [:0]const u8) ?T { |
| 382 | // dlsym (and other dl-functions) secretly take shadow parameter - return address on stack | 382 | // dlsym (and other dl-functions) secretly take shadow parameter - return address on stack |
| 383 | // https://gcc.gnu.org/bugzilla/show_bug.cgi?id=66826 | 383 | // https://gcc.gnu.org/bugzilla/show_bug.cgi?id=66826 |
| 384 | if (@call(.{ .modifier = .never_tail }, system.dlsym, .{ self.handle, name.ptr })) |symbol| { | 384 | if (@call(.never_tail, system.dlsym, .{ self.handle, name.ptr })) |symbol| { |
| 385 | return @ptrCast(T, symbol); | 385 | return @ptrCast(T, symbol); |
| 386 | } else { | 386 | } else { |
| 387 | return null; | 387 | return null; |
lib/std/hash/auto_hash.zig+4-4| ... | @@ -66,7 +66,7 @@ pub fn hash(hasher: anytype, key: anytype, comptime strat: HashStrategy) void { | ... | @@ -66,7 +66,7 @@ pub fn hash(hasher: anytype, key: anytype, comptime strat: HashStrategy) void { |
| 66 | const Key = @TypeOf(key); | 66 | const Key = @TypeOf(key); |
| 67 | 67 | ||
| 68 | if (strat == .Shallow and comptime meta.trait.hasUniqueRepresentation(Key)) { | 68 | if (strat == .Shallow and comptime meta.trait.hasUniqueRepresentation(Key)) { |
| 69 | @call(.{ .modifier = .always_inline }, hasher.update, .{mem.asBytes(&key)}); | 69 | @call(.always_inline, hasher.update, .{mem.asBytes(&key)}); |
| 70 | return; | 70 | return; |
| 71 | } | 71 | } |
| 72 | 72 | ||
| ... | @@ -89,12 +89,12 @@ pub fn hash(hasher: anytype, key: anytype, comptime strat: HashStrategy) void { | ... | @@ -89,12 +89,12 @@ pub fn hash(hasher: anytype, key: anytype, comptime strat: HashStrategy) void { |
| 89 | // TODO Check if the situation is better after #561 is resolved. | 89 | // TODO Check if the situation is better after #561 is resolved. |
| 90 | .Int => { | 90 | .Int => { |
| 91 | if (comptime meta.trait.hasUniqueRepresentation(Key)) { | 91 | if (comptime meta.trait.hasUniqueRepresentation(Key)) { |
| 92 | @call(.{ .modifier = .always_inline }, hasher.update, .{std.mem.asBytes(&key)}); | 92 | @call(.always_inline, hasher.update, .{std.mem.asBytes(&key)}); |
| 93 | } else { | 93 | } else { |
| 94 | // Take only the part containing the key value, the remaining | 94 | // Take only the part containing the key value, the remaining |
| 95 | // bytes are undefined and must not be hashed! | 95 | // bytes are undefined and must not be hashed! |
| 96 | const byte_size = comptime std.math.divCeil(comptime_int, @bitSizeOf(Key), 8) catch unreachable; | 96 | const byte_size = comptime std.math.divCeil(comptime_int, @bitSizeOf(Key), 8) catch unreachable; |
| 97 | @call(.{ .modifier = .always_inline }, hasher.update, .{std.mem.asBytes(&key)[0..byte_size]}); | 97 | @call(.always_inline, hasher.update, .{std.mem.asBytes(&key)[0..byte_size]}); |
| 98 | } | 98 | } |
| 99 | }, | 99 | }, |
| 100 | 100 | ||
| ... | @@ -103,7 +103,7 @@ pub fn hash(hasher: anytype, key: anytype, comptime strat: HashStrategy) void { | ... | @@ -103,7 +103,7 @@ pub fn hash(hasher: anytype, key: anytype, comptime strat: HashStrategy) void { |
| 103 | .ErrorSet => hash(hasher, @errorToInt(key), strat), | 103 | .ErrorSet => hash(hasher, @errorToInt(key), strat), |
| 104 | .AnyFrame, .Fn => hash(hasher, @ptrToInt(key), strat), | 104 | .AnyFrame, .Fn => hash(hasher, @ptrToInt(key), strat), |
| 105 | 105 | ||
| 106 | .Pointer => @call(.{ .modifier = .always_inline }, hashPointer, .{ hasher, key, strat }), | 106 | .Pointer => @call(.always_inline, hashPointer, .{ hasher, key, strat }), |
| 107 | 107 | ||
| 108 | .Optional => if (key) |k| hash(hasher, k, strat), | 108 | .Optional => if (key) |k| hash(hasher, k, strat), |
| 109 | 109 |
lib/std/hash/cityhash.zig+4-4| ... | @@ -185,7 +185,7 @@ pub const CityHash64 = struct { | ... | @@ -185,7 +185,7 @@ pub const CityHash64 = struct { |
| 185 | } | 185 | } |
| 186 | 186 | ||
| 187 | fn hashLen16(u: u64, v: u64) u64 { | 187 | fn hashLen16(u: u64, v: u64) u64 { |
| 188 | return @call(.{ .modifier = .always_inline }, hash128To64, .{ u, v }); | 188 | return @call(.always_inline, hash128To64, .{ u, v }); |
| 189 | } | 189 | } |
| 190 | 190 | ||
| 191 | fn hashLen16Mul(low: u64, high: u64, mul: u64) u64 { | 191 | fn hashLen16Mul(low: u64, high: u64, mul: u64) u64 { |
| ... | @@ -198,7 +198,7 @@ pub const CityHash64 = struct { | ... | @@ -198,7 +198,7 @@ pub const CityHash64 = struct { |
| 198 | } | 198 | } |
| 199 | 199 | ||
| 200 | fn hash128To64(low: u64, high: u64) u64 { | 200 | fn hash128To64(low: u64, high: u64) u64 { |
| 201 | return @call(.{ .modifier = .always_inline }, hashLen16Mul, .{ low, high, 0x9ddfea08eb382d69 }); | 201 | return @call(.always_inline, hashLen16Mul, .{ low, high, 0x9ddfea08eb382d69 }); |
| 202 | } | 202 | } |
| 203 | 203 | ||
| 204 | fn hashLen0To16(str: []const u8) u64 { | 204 | fn hashLen0To16(str: []const u8) u64 { |
| ... | @@ -279,7 +279,7 @@ pub const CityHash64 = struct { | ... | @@ -279,7 +279,7 @@ pub const CityHash64 = struct { |
| 279 | } | 279 | } |
| 280 | 280 | ||
| 281 | fn weakHashLen32WithSeeds(ptr: [*]const u8, a: u64, b: u64) WeakPair { | 281 | fn weakHashLen32WithSeeds(ptr: [*]const u8, a: u64, b: u64) WeakPair { |
| 282 | return @call(.{ .modifier = .always_inline }, weakHashLen32WithSeedsHelper, .{ | 282 | return @call(.always_inline, weakHashLen32WithSeedsHelper, .{ |
| 283 | fetch64(ptr, 0), | 283 | fetch64(ptr, 0), |
| 284 | fetch64(ptr, 8), | 284 | fetch64(ptr, 8), |
| 285 | fetch64(ptr, 16), | 285 | fetch64(ptr, 16), |
| ... | @@ -334,7 +334,7 @@ pub const CityHash64 = struct { | ... | @@ -334,7 +334,7 @@ pub const CityHash64 = struct { |
| 334 | } | 334 | } |
| 335 | 335 | ||
| 336 | pub fn hashWithSeed(str: []const u8, seed: u64) u64 { | 336 | pub fn hashWithSeed(str: []const u8, seed: u64) u64 { |
| 337 | return @call(.{ .modifier = .always_inline }, Self.hashWithSeeds, .{ str, k2, seed }); | 337 | return @call(.always_inline, Self.hashWithSeeds, .{ str, k2, seed }); |
| 338 | } | 338 | } |
| 339 | 339 | ||
| 340 | pub fn hashWithSeeds(str: []const u8, seed0: u64, seed1: u64) u64 { | 340 | pub fn hashWithSeeds(str: []const u8, seed0: u64, seed1: u64) u64 { |
lib/std/hash/murmur.zig+9-9| ... | @@ -9,7 +9,7 @@ pub const Murmur2_32 = struct { | ... | @@ -9,7 +9,7 @@ pub const Murmur2_32 = struct { |
| 9 | const Self = @This(); | 9 | const Self = @This(); |
| 10 | 10 | ||
| 11 | pub fn hash(str: []const u8) u32 { | 11 | pub fn hash(str: []const u8) u32 { |
| 12 | return @call(.{ .modifier = .always_inline }, Self.hashWithSeed, .{ str, default_seed }); | 12 | return @call(.always_inline, Self.hashWithSeed, .{ str, default_seed }); |
| 13 | } | 13 | } |
| 14 | 14 | ||
| 15 | pub fn hashWithSeed(str: []const u8, seed: u32) u32 { | 15 | pub fn hashWithSeed(str: []const u8, seed: u32) u32 { |
| ... | @@ -45,7 +45,7 @@ pub const Murmur2_32 = struct { | ... | @@ -45,7 +45,7 @@ pub const Murmur2_32 = struct { |
| 45 | } | 45 | } |
| 46 | 46 | ||
| 47 | pub fn hashUint32(v: u32) u32 { | 47 | pub fn hashUint32(v: u32) u32 { |
| 48 | return @call(.{ .modifier = .always_inline }, Self.hashUint32WithSeed, .{ v, default_seed }); | 48 | return @call(.always_inline, Self.hashUint32WithSeed, .{ v, default_seed }); |
| 49 | } | 49 | } |
| 50 | 50 | ||
| 51 | pub fn hashUint32WithSeed(v: u32, seed: u32) u32 { | 51 | pub fn hashUint32WithSeed(v: u32, seed: u32) u32 { |
| ... | @@ -65,7 +65,7 @@ pub const Murmur2_32 = struct { | ... | @@ -65,7 +65,7 @@ pub const Murmur2_32 = struct { |
| 65 | } | 65 | } |
| 66 | 66 | ||
| 67 | pub fn hashUint64(v: u64) u32 { | 67 | pub fn hashUint64(v: u64) u32 { |
| 68 | return @call(.{ .modifier = .always_inline }, Self.hashUint64WithSeed, .{ v, default_seed }); | 68 | return @call(.always_inline, Self.hashUint64WithSeed, .{ v, default_seed }); |
| 69 | } | 69 | } |
| 70 | 70 | ||
| 71 | pub fn hashUint64WithSeed(v: u64, seed: u32) u32 { | 71 | pub fn hashUint64WithSeed(v: u64, seed: u32) u32 { |
| ... | @@ -94,7 +94,7 @@ pub const Murmur2_64 = struct { | ... | @@ -94,7 +94,7 @@ pub const Murmur2_64 = struct { |
| 94 | const Self = @This(); | 94 | const Self = @This(); |
| 95 | 95 | ||
| 96 | pub fn hash(str: []const u8) u64 { | 96 | pub fn hash(str: []const u8) u64 { |
| 97 | return @call(.{ .modifier = .always_inline }, Self.hashWithSeed, .{ str, default_seed }); | 97 | return @call(.always_inline, Self.hashWithSeed, .{ str, default_seed }); |
| 98 | } | 98 | } |
| 99 | 99 | ||
| 100 | pub fn hashWithSeed(str: []const u8, seed: u64) u64 { | 100 | pub fn hashWithSeed(str: []const u8, seed: u64) u64 { |
| ... | @@ -128,7 +128,7 @@ pub const Murmur2_64 = struct { | ... | @@ -128,7 +128,7 @@ pub const Murmur2_64 = struct { |
| 128 | } | 128 | } |
| 129 | 129 | ||
| 130 | pub fn hashUint32(v: u32) u64 { | 130 | pub fn hashUint32(v: u32) u64 { |
| 131 | return @call(.{ .modifier = .always_inline }, Self.hashUint32WithSeed, .{ v, default_seed }); | 131 | return @call(.always_inline, Self.hashUint32WithSeed, .{ v, default_seed }); |
| 132 | } | 132 | } |
| 133 | 133 | ||
| 134 | pub fn hashUint32WithSeed(v: u32, seed: u64) u64 { | 134 | pub fn hashUint32WithSeed(v: u32, seed: u64) u64 { |
| ... | @@ -145,7 +145,7 @@ pub const Murmur2_64 = struct { | ... | @@ -145,7 +145,7 @@ pub const Murmur2_64 = struct { |
| 145 | } | 145 | } |
| 146 | 146 | ||
| 147 | pub fn hashUint64(v: u64) u64 { | 147 | pub fn hashUint64(v: u64) u64 { |
| 148 | return @call(.{ .modifier = .always_inline }, Self.hashUint64WithSeed, .{ v, default_seed }); | 148 | return @call(.always_inline, Self.hashUint64WithSeed, .{ v, default_seed }); |
| 149 | } | 149 | } |
| 150 | 150 | ||
| 151 | pub fn hashUint64WithSeed(v: u64, seed: u64) u64 { | 151 | pub fn hashUint64WithSeed(v: u64, seed: u64) u64 { |
| ... | @@ -173,7 +173,7 @@ pub const Murmur3_32 = struct { | ... | @@ -173,7 +173,7 @@ pub const Murmur3_32 = struct { |
| 173 | } | 173 | } |
| 174 | 174 | ||
| 175 | pub fn hash(str: []const u8) u32 { | 175 | pub fn hash(str: []const u8) u32 { |
| 176 | return @call(.{ .modifier = .always_inline }, Self.hashWithSeed, .{ str, default_seed }); | 176 | return @call(.always_inline, Self.hashWithSeed, .{ str, default_seed }); |
| 177 | } | 177 | } |
| 178 | 178 | ||
| 179 | pub fn hashWithSeed(str: []const u8, seed: u32) u32 { | 179 | pub fn hashWithSeed(str: []const u8, seed: u32) u32 { |
| ... | @@ -221,7 +221,7 @@ pub const Murmur3_32 = struct { | ... | @@ -221,7 +221,7 @@ pub const Murmur3_32 = struct { |
| 221 | } | 221 | } |
| 222 | 222 | ||
| 223 | pub fn hashUint32(v: u32) u32 { | 223 | pub fn hashUint32(v: u32) u32 { |
| 224 | return @call(.{ .modifier = .always_inline }, Self.hashUint32WithSeed, .{ v, default_seed }); | 224 | return @call(.always_inline, Self.hashUint32WithSeed, .{ v, default_seed }); |
| 225 | } | 225 | } |
| 226 | 226 | ||
| 227 | pub fn hashUint32WithSeed(v: u32, seed: u32) u32 { | 227 | pub fn hashUint32WithSeed(v: u32, seed: u32) u32 { |
| ... | @@ -247,7 +247,7 @@ pub const Murmur3_32 = struct { | ... | @@ -247,7 +247,7 @@ pub const Murmur3_32 = struct { |
| 247 | } | 247 | } |
| 248 | 248 | ||
| 249 | pub fn hashUint64(v: u64) u32 { | 249 | pub fn hashUint64(v: u64) u32 { |
| 250 | return @call(.{ .modifier = .always_inline }, Self.hashUint64WithSeed, .{ v, default_seed }); | 250 | return @call(.always_inline, Self.hashUint64WithSeed, .{ v, default_seed }); |
| 251 | } | 251 | } |
| 252 | 252 | ||
| 253 | pub fn hashUint64WithSeed(v: u64, seed: u32) u32 { | 253 | pub fn hashUint64WithSeed(v: u64, seed: u32) u32 { |
lib/std/hash/wyhash.zig+3-3| ... | @@ -65,7 +65,7 @@ const WyhashStateless = struct { | ... | @@ -65,7 +65,7 @@ const WyhashStateless = struct { |
| 65 | 65 | ||
| 66 | var off: usize = 0; | 66 | var off: usize = 0; |
| 67 | while (off < b.len) : (off += 32) { | 67 | while (off < b.len) : (off += 32) { |
| 68 | @call(.{ .modifier = .always_inline }, self.round, .{b[off .. off + 32]}); | 68 | @call(.always_inline, self.round, .{b[off .. off + 32]}); |
| 69 | } | 69 | } |
| 70 | 70 | ||
| 71 | self.msg_len += b.len; | 71 | self.msg_len += b.len; |
| ... | @@ -121,8 +121,8 @@ const WyhashStateless = struct { | ... | @@ -121,8 +121,8 @@ const WyhashStateless = struct { |
| 121 | const aligned_len = input.len - (input.len % 32); | 121 | const aligned_len = input.len - (input.len % 32); |
| 122 | 122 | ||
| 123 | var c = WyhashStateless.init(seed); | 123 | var c = WyhashStateless.init(seed); |
| 124 | @call(.{ .modifier = .always_inline }, c.update, .{input[0..aligned_len]}); | 124 | @call(.always_inline, c.update, .{input[0..aligned_len]}); |
| 125 | return @call(.{ .modifier = .always_inline }, c.final, .{input[aligned_len..]}); | 125 | return @call(.always_inline, c.final, .{input[aligned_len..]}); |
| 126 | } | 126 | } |
| 127 | }; | 127 | }; |
| 128 | 128 |
lib/std/math/big/int.zig+2-2| ... | @@ -3587,7 +3587,7 @@ fn llshl(r: []Limb, a: []const Limb, shift: usize) void { | ... | @@ -3587,7 +3587,7 @@ fn llshl(r: []Limb, a: []const Limb, shift: usize) void { |
| 3587 | const dst_i = src_i + limb_shift; | 3587 | const dst_i = src_i + limb_shift; |
| 3588 | 3588 | ||
| 3589 | const src_digit = a[src_i]; | 3589 | const src_digit = a[src_i]; |
| 3590 | r[dst_i] = carry | @call(.{ .modifier = .always_inline }, math.shr, .{ | 3590 | r[dst_i] = carry | @call(.always_inline, math.shr, .{ |
| 3591 | Limb, | 3591 | Limb, |
| 3592 | src_digit, | 3592 | src_digit, |
| 3593 | limb_bits - @intCast(Limb, interior_limb_shift), | 3593 | limb_bits - @intCast(Limb, interior_limb_shift), |
| ... | @@ -3615,7 +3615,7 @@ fn llshr(r: []Limb, a: []const Limb, shift: usize) void { | ... | @@ -3615,7 +3615,7 @@ fn llshr(r: []Limb, a: []const Limb, shift: usize) void { |
| 3615 | 3615 | ||
| 3616 | const src_digit = a[src_i]; | 3616 | const src_digit = a[src_i]; |
| 3617 | r[dst_i] = carry | (src_digit >> interior_limb_shift); | 3617 | r[dst_i] = carry | (src_digit >> interior_limb_shift); |
| 3618 | carry = @call(.{ .modifier = .always_inline }, math.shl, .{ | 3618 | carry = @call(.always_inline, math.shl, .{ |
| 3619 | Limb, | 3619 | Limb, |
| 3620 | src_digit, | 3620 | src_digit, |
| 3621 | limb_bits - @intCast(Limb, interior_limb_shift), | 3621 | limb_bits - @intCast(Limb, interior_limb_shift), |
lib/std/os/linux.zig+1-1| ... | @@ -263,7 +263,7 @@ pub fn fork() usize { | ... | @@ -263,7 +263,7 @@ pub fn fork() usize { |
| 263 | /// the compiler is not aware of how vfork affects control flow and you may | 263 | /// the compiler is not aware of how vfork affects control flow and you may |
| 264 | /// see different results in optimized builds. | 264 | /// see different results in optimized builds. |
| 265 | pub inline fn vfork() usize { | 265 | pub inline fn vfork() usize { |
| 266 | return @call(.{ .modifier = .always_inline }, syscall0, .{.vfork}); | 266 | return @call(.always_inline, syscall0, .{.vfork}); |
| 267 | } | 267 | } |
| 268 | 268 | ||
| 269 | pub fn futimens(fd: i32, times: *const [2]timespec) usize { | 269 | pub fn futimens(fd: i32, times: *const [2]timespec) usize { |
lib/std/start.zig+9-9| ... | @@ -229,15 +229,15 @@ fn _DllMainCRTStartup( | ... | @@ -229,15 +229,15 @@ fn _DllMainCRTStartup( |
| 229 | fn wasm_freestanding_start() callconv(.C) void { | 229 | fn wasm_freestanding_start() callconv(.C) void { |
| 230 | // This is marked inline because for some reason LLVM in | 230 | // This is marked inline because for some reason LLVM in |
| 231 | // release mode fails to inline it, and we want fewer call frames in stack traces. | 231 | // release mode fails to inline it, and we want fewer call frames in stack traces. |
| 232 | _ = @call(.{ .modifier = .always_inline }, callMain, .{}); | 232 | _ = @call(.always_inline, callMain, .{}); |
| 233 | } | 233 | } |
| 234 | 234 | ||
| 235 | fn wasi_start() callconv(.C) void { | 235 | fn wasi_start() callconv(.C) void { |
| 236 | // The function call is marked inline because for some reason LLVM in | 236 | // The function call is marked inline because for some reason LLVM in |
| 237 | // release mode fails to inline it, and we want fewer call frames in stack traces. | 237 | // release mode fails to inline it, and we want fewer call frames in stack traces. |
| 238 | switch (builtin.wasi_exec_model) { | 238 | switch (builtin.wasi_exec_model) { |
| 239 | .reactor => _ = @call(.{ .modifier = .always_inline }, callMain, .{}), | 239 | .reactor => _ = @call(.always_inline, callMain, .{}), |
| 240 | .command => std.os.wasi.proc_exit(@call(.{ .modifier = .always_inline }, callMain, .{})), | 240 | .command => std.os.wasi.proc_exit(@call(.always_inline, callMain, .{})), |
| 241 | } | 241 | } |
| 242 | } | 242 | } |
| 243 | 243 | ||
| ... | @@ -373,7 +373,7 @@ fn _start() callconv(.Naked) noreturn { | ... | @@ -373,7 +373,7 @@ fn _start() callconv(.Naked) noreturn { |
| 373 | } | 373 | } |
| 374 | // If LLVM inlines stack variables into _start, they will overwrite | 374 | // If LLVM inlines stack variables into _start, they will overwrite |
| 375 | // the command line argument data. | 375 | // the command line argument data. |
| 376 | @call(.{ .modifier = .never_inline }, posixCallMainAndExit, .{}); | 376 | @call(.never_inline, posixCallMainAndExit, .{}); |
| 377 | } | 377 | } |
| 378 | 378 | ||
| 379 | fn WinStartup() callconv(std.os.windows.WINAPI) noreturn { | 379 | fn WinStartup() callconv(std.os.windows.WINAPI) noreturn { |
| ... | @@ -459,7 +459,7 @@ fn posixCallMainAndExit() callconv(.C) noreturn { | ... | @@ -459,7 +459,7 @@ fn posixCallMainAndExit() callconv(.C) noreturn { |
| 459 | expandStackSize(phdrs); | 459 | expandStackSize(phdrs); |
| 460 | } | 460 | } |
| 461 | 461 | ||
| 462 | std.os.exit(@call(.{ .modifier = .always_inline }, callMainWithArgs, .{ argc, argv, envp })); | 462 | std.os.exit(@call(.always_inline, callMainWithArgs, .{ argc, argv, envp })); |
| 463 | } | 463 | } |
| 464 | 464 | ||
| 465 | fn expandStackSize(phdrs: []elf.Phdr) void { | 465 | fn expandStackSize(phdrs: []elf.Phdr) void { |
| ... | @@ -510,12 +510,12 @@ fn main(c_argc: c_int, c_argv: [*c][*c]u8, c_envp: [*c][*c]u8) callconv(.C) c_in | ... | @@ -510,12 +510,12 @@ fn main(c_argc: c_int, c_argv: [*c][*c]u8, c_envp: [*c][*c]u8) callconv(.C) c_in |
| 510 | expandStackSize(phdrs); | 510 | expandStackSize(phdrs); |
| 511 | } | 511 | } |
| 512 | 512 | ||
| 513 | return @call(.{ .modifier = .always_inline }, callMainWithArgs, .{ @intCast(usize, c_argc), @ptrCast([*][*:0]u8, c_argv), envp }); | 513 | return @call(.always_inline, callMainWithArgs, .{ @intCast(usize, c_argc), @ptrCast([*][*:0]u8, c_argv), envp }); |
| 514 | } | 514 | } |
| 515 | 515 | ||
| 516 | fn mainWithoutEnv(c_argc: c_int, c_argv: [*c][*c]u8) callconv(.C) c_int { | 516 | fn mainWithoutEnv(c_argc: c_int, c_argv: [*c][*c]u8) callconv(.C) c_int { |
| 517 | std.os.argv = @ptrCast([*][*:0]u8, c_argv)[0..@intCast(usize, c_argc)]; | 517 | std.os.argv = @ptrCast([*][*:0]u8, c_argv)[0..@intCast(usize, c_argc)]; |
| 518 | return @call(.{ .modifier = .always_inline }, callMain, .{}); | 518 | return @call(.always_inline, callMain, .{}); |
| 519 | } | 519 | } |
| 520 | 520 | ||
| 521 | // General error message for a malformed return type | 521 | // General error message for a malformed return type |
| ... | @@ -545,7 +545,7 @@ inline fn initEventLoopAndCallMain() u8 { | ... | @@ -545,7 +545,7 @@ inline fn initEventLoopAndCallMain() u8 { |
| 545 | 545 | ||
| 546 | // This is marked inline because for some reason LLVM in release mode fails to inline it, | 546 | // This is marked inline because for some reason LLVM in release mode fails to inline it, |
| 547 | // and we want fewer call frames in stack traces. | 547 | // and we want fewer call frames in stack traces. |
| 548 | return @call(.{ .modifier = .always_inline }, callMain, .{}); | 548 | return @call(.always_inline, callMain, .{}); |
| 549 | } | 549 | } |
| 550 | 550 | ||
| 551 | // This is marked inline because for some reason LLVM in release mode fails to inline it, | 551 | // This is marked inline because for some reason LLVM in release mode fails to inline it, |
| ... | @@ -574,7 +574,7 @@ inline fn initEventLoopAndCallWinMain() std.os.windows.INT { | ... | @@ -574,7 +574,7 @@ inline fn initEventLoopAndCallWinMain() std.os.windows.INT { |
| 574 | 574 | ||
| 575 | // This is marked inline because for some reason LLVM in release mode fails to inline it, | 575 | // This is marked inline because for some reason LLVM in release mode fails to inline it, |
| 576 | // and we want fewer call frames in stack traces. | 576 | // and we want fewer call frames in stack traces. |
| 577 | return @call(.{ .modifier = .always_inline }, call_wWinMain, .{}); | 577 | return @call(.always_inline, call_wWinMain, .{}); |
| 578 | } | 578 | } |
| 579 | 579 | ||
| 580 | fn callMainAsync(loop: *std.event.Loop) callconv(.Async) u8 { | 580 | fn callMainAsync(loop: *std.event.Loop) callconv(.Async) u8 { |
lib/std/testing.zig+2-2| ... | @@ -828,7 +828,7 @@ pub fn checkAllAllocationFailures(backing_allocator: std.mem.Allocator, comptime | ... | @@ -828,7 +828,7 @@ pub fn checkAllAllocationFailures(backing_allocator: std.mem.Allocator, comptime |
| 828 | var failing_allocator_inst = std.testing.FailingAllocator.init(backing_allocator, std.math.maxInt(usize)); | 828 | var failing_allocator_inst = std.testing.FailingAllocator.init(backing_allocator, std.math.maxInt(usize)); |
| 829 | args.@"0" = failing_allocator_inst.allocator(); | 829 | args.@"0" = failing_allocator_inst.allocator(); |
| 830 | 830 | ||
| 831 | try @call(.{}, test_fn, args); | 831 | try @call(.auto, test_fn, args); |
| 832 | break :x failing_allocator_inst.index; | 832 | break :x failing_allocator_inst.index; |
| 833 | }; | 833 | }; |
| 834 | 834 | ||
| ... | @@ -837,7 +837,7 @@ pub fn checkAllAllocationFailures(backing_allocator: std.mem.Allocator, comptime | ... | @@ -837,7 +837,7 @@ pub fn checkAllAllocationFailures(backing_allocator: std.mem.Allocator, comptime |
| 837 | var failing_allocator_inst = std.testing.FailingAllocator.init(backing_allocator, fail_index); | 837 | var failing_allocator_inst = std.testing.FailingAllocator.init(backing_allocator, fail_index); |
| 838 | args.@"0" = failing_allocator_inst.allocator(); | 838 | args.@"0" = failing_allocator_inst.allocator(); |
| 839 | 839 | ||
| 840 | if (@call(.{}, test_fn, args)) |_| { | 840 | if (@call(.auto, test_fn, args)) |_| { |
| 841 | if (failing_allocator_inst.has_induced_failure) { | 841 | if (failing_allocator_inst.has_induced_failure) { |
| 842 | return error.SwallowedOutOfMemoryError; | 842 | return error.SwallowedOutOfMemoryError; |
| 843 | } else { | 843 | } else { |
lib/std/unicode/throughput_test.zig+1-1| ... | @@ -25,7 +25,7 @@ fn benchmarkCodepointCount(buf: []const u8) !ResultCount { | ... | @@ -25,7 +25,7 @@ fn benchmarkCodepointCount(buf: []const u8) !ResultCount { |
| 25 | var r: usize = undefined; | 25 | var r: usize = undefined; |
| 26 | while (i < N) : (i += 1) { | 26 | while (i < N) : (i += 1) { |
| 27 | r = try @call( | 27 | r = try @call( |
| 28 | .{ .modifier = .never_inline }, | 28 | .never_inline, |
| 29 | std.unicode.utf8CountCodepoints, | 29 | std.unicode.utf8CountCodepoints, |
| 30 | .{buf}, | 30 | .{buf}, |
| 31 | ); | 31 | ); |
src/ThreadPool.zig+2-2| ... | @@ -71,7 +71,7 @@ fn join(pool: *ThreadPool, spawned: usize) void { | ... | @@ -71,7 +71,7 @@ fn join(pool: *ThreadPool, spawned: usize) void { |
| 71 | 71 | ||
| 72 | pub fn spawn(pool: *ThreadPool, comptime func: anytype, args: anytype) !void { | 72 | pub fn spawn(pool: *ThreadPool, comptime func: anytype, args: anytype) !void { |
| 73 | if (builtin.single_threaded) { | 73 | if (builtin.single_threaded) { |
| 74 | @call(.{}, func, args); | 74 | @call(.auto, func, args); |
| 75 | return; | 75 | return; |
| 76 | } | 76 | } |
| 77 | 77 | ||
| ... | @@ -84,7 +84,7 @@ pub fn spawn(pool: *ThreadPool, comptime func: anytype, args: anytype) !void { | ... | @@ -84,7 +84,7 @@ pub fn spawn(pool: *ThreadPool, comptime func: anytype, args: anytype) !void { |
| 84 | fn runFn(runnable: *Runnable) void { | 84 | fn runFn(runnable: *Runnable) void { |
| 85 | const run_node = @fieldParentPtr(RunQueue.Node, "data", runnable); | 85 | const run_node = @fieldParentPtr(RunQueue.Node, "data", runnable); |
| 86 | const closure = @fieldParentPtr(@This(), "run_node", run_node); | 86 | const closure = @fieldParentPtr(@This(), "run_node", run_node); |
| 87 | @call(.{}, func, closure.arguments); | 87 | @call(.auto, func, closure.arguments); |
| 88 | 88 | ||
| 89 | // The thread pool's allocator is protected by the mutex. | 89 | // The thread pool's allocator is protected by the mutex. |
| 90 | const mutex = &closure.pool.mutex; | 90 | const mutex = &closure.pool.mutex; |
src/crash_report.zig+2-2| ... | @@ -549,8 +549,8 @@ const PanicSwitch = struct { | ... | @@ -549,8 +549,8 @@ const PanicSwitch = struct { |
| 549 | // TODO: Tailcall is broken right now, but eventually this should be used | 549 | // TODO: Tailcall is broken right now, but eventually this should be used |
| 550 | // to avoid blowing up the stack. It's ok for now though, there are no | 550 | // to avoid blowing up the stack. It's ok for now though, there are no |
| 551 | // cycles in the state machine so the max stack usage is bounded. | 551 | // cycles in the state machine so the max stack usage is bounded. |
| 552 | //@call(.{.modifier = .always_tail}, func, args); | 552 | //@call(.always_tail, func, args); |
| 553 | @call(.{}, func, args); | 553 | @call(.auto, func, args); |
| 554 | } | 554 | } |
| 555 | 555 | ||
| 556 | fn recover( | 556 | fn recover( |
test/behavior/basic.zig+2-2| ... | @@ -966,8 +966,8 @@ test "generic function uses return type of other generic function" { | ... | @@ -966,8 +966,8 @@ test "generic function uses return type of other generic function" { |
| 966 | fn call( | 966 | fn call( |
| 967 | f: anytype, | 967 | f: anytype, |
| 968 | args: anytype, | 968 | args: anytype, |
| 969 | ) @TypeOf(@call(.{}, f, @as(@TypeOf(args), undefined))) { | 969 | ) @TypeOf(@call(.auto, f, @as(@TypeOf(args), undefined))) { |
| 970 | return @call(.{}, f, args); | 970 | return @call(.auto, f, args); |
| 971 | } | 971 | } |
| 972 | 972 | ||
| 973 | fn func(arg: anytype) @TypeOf(arg) { | 973 | fn func(arg: anytype) @TypeOf(arg) { |
test/behavior/call.zig+26-26| ... | @@ -9,11 +9,11 @@ test "super basic invocations" { | ... | @@ -9,11 +9,11 @@ test "super basic invocations" { |
| 9 | return 1234; | 9 | return 1234; |
| 10 | } | 10 | } |
| 11 | }.foo; | 11 | }.foo; |
| 12 | try expect(@call(.{}, foo, .{}) == 1234); | 12 | try expect(@call(.auto, foo, .{}) == 1234); |
| 13 | comptime try expect(@call(.{ .modifier = .always_inline }, foo, .{}) == 1234); | 13 | comptime try expect(@call(.always_inline, foo, .{}) == 1234); |
| 14 | { | 14 | { |
| 15 | // comptime call without comptime keyword | 15 | // comptime call without comptime keyword |
| 16 | const result = @call(.{ .modifier = .compile_time }, foo, .{}) == 1234; | 16 | const result = @call(.compile_time, foo, .{}) == 1234; |
| 17 | comptime try expect(result); | 17 | comptime try expect(result); |
| 18 | } | 18 | } |
| 19 | } | 19 | } |
| ... | @@ -31,25 +31,25 @@ test "basic invocations" { | ... | @@ -31,25 +31,25 @@ test "basic invocations" { |
| 31 | return 1234; | 31 | return 1234; |
| 32 | } | 32 | } |
| 33 | }.foo; | 33 | }.foo; |
| 34 | try expect(@call(.{}, foo, .{}) == 1234); | 34 | try expect(@call(.auto, foo, .{}) == 1234); |
| 35 | comptime { | 35 | comptime { |
| 36 | // modifiers that allow comptime calls | 36 | // modifiers that allow comptime calls |
| 37 | try expect(@call(.{}, foo, .{}) == 1234); | 37 | try expect(@call(.auto, foo, .{}) == 1234); |
| 38 | try expect(@call(.{ .modifier = .no_async }, foo, .{}) == 1234); | 38 | try expect(@call(.no_async, foo, .{}) == 1234); |
| 39 | try expect(@call(.{ .modifier = .always_tail }, foo, .{}) == 1234); | 39 | try expect(@call(.always_tail, foo, .{}) == 1234); |
| 40 | try expect(@call(.{ .modifier = .always_inline }, foo, .{}) == 1234); | 40 | try expect(@call(.always_inline, foo, .{}) == 1234); |
| 41 | } | 41 | } |
| 42 | { | 42 | { |
| 43 | // comptime call without comptime keyword | 43 | // comptime call without comptime keyword |
| 44 | const result = @call(.{ .modifier = .compile_time }, foo, .{}) == 1234; | 44 | const result = @call(.compile_time, foo, .{}) == 1234; |
| 45 | comptime try expect(result); | 45 | comptime try expect(result); |
| 46 | } | 46 | } |
| 47 | { | 47 | { |
| 48 | // call of non comptime-known function | 48 | // call of non comptime-known function |
| 49 | var alias_foo = &foo; | 49 | var alias_foo = &foo; |
| 50 | try expect(@call(.{ .modifier = .no_async }, alias_foo, .{}) == 1234); | 50 | try expect(@call(.no_async, alias_foo, .{}) == 1234); |
| 51 | try expect(@call(.{ .modifier = .never_tail }, alias_foo, .{}) == 1234); | 51 | try expect(@call(.never_tail, alias_foo, .{}) == 1234); |
| 52 | try expect(@call(.{ .modifier = .never_inline }, alias_foo, .{}) == 1234); | 52 | try expect(@call(.never_inline, alias_foo, .{}) == 1234); |
| 53 | } | 53 | } |
| 54 | } | 54 | } |
| 55 | 55 | ||
| ... | @@ -66,23 +66,23 @@ test "tuple parameters" { | ... | @@ -66,23 +66,23 @@ test "tuple parameters" { |
| 66 | }.add; | 66 | }.add; |
| 67 | var a: i32 = 12; | 67 | var a: i32 = 12; |
| 68 | var b: i32 = 34; | 68 | var b: i32 = 34; |
| 69 | try expect(@call(.{}, add, .{ a, 34 }) == 46); | 69 | try expect(@call(.auto, add, .{ a, 34 }) == 46); |
| 70 | try expect(@call(.{}, add, .{ 12, b }) == 46); | 70 | try expect(@call(.auto, add, .{ 12, b }) == 46); |
| 71 | try expect(@call(.{}, add, .{ a, b }) == 46); | 71 | try expect(@call(.auto, add, .{ a, b }) == 46); |
| 72 | try expect(@call(.{}, add, .{ 12, 34 }) == 46); | 72 | try expect(@call(.auto, add, .{ 12, 34 }) == 46); |
| 73 | if (false) { | 73 | if (false) { |
| 74 | comptime try expect(@call(.{}, add, .{ 12, 34 }) == 46); // TODO | 74 | comptime try expect(@call(.auto, add, .{ 12, 34 }) == 46); // TODO |
| 75 | } | 75 | } |
| 76 | try expect(comptime @call(.{}, add, .{ 12, 34 }) == 46); | 76 | try expect(comptime @call(.auto, add, .{ 12, 34 }) == 46); |
| 77 | { | 77 | { |
| 78 | const separate_args0 = .{ a, b }; | 78 | const separate_args0 = .{ a, b }; |
| 79 | const separate_args1 = .{ a, 34 }; | 79 | const separate_args1 = .{ a, 34 }; |
| 80 | const separate_args2 = .{ 12, 34 }; | 80 | const separate_args2 = .{ 12, 34 }; |
| 81 | const separate_args3 = .{ 12, b }; | 81 | const separate_args3 = .{ 12, b }; |
| 82 | try expect(@call(.{ .modifier = .always_inline }, add, separate_args0) == 46); | 82 | try expect(@call(.always_inline, add, separate_args0) == 46); |
| 83 | try expect(@call(.{ .modifier = .always_inline }, add, separate_args1) == 46); | 83 | try expect(@call(.always_inline, add, separate_args1) == 46); |
| 84 | try expect(@call(.{ .modifier = .always_inline }, add, separate_args2) == 46); | 84 | try expect(@call(.always_inline, add, separate_args2) == 46); |
| 85 | try expect(@call(.{ .modifier = .always_inline }, add, separate_args3) == 46); | 85 | try expect(@call(.always_inline, add, separate_args3) == 46); |
| 86 | } | 86 | } |
| 87 | } | 87 | } |
| 88 | 88 | ||
| ... | @@ -281,7 +281,7 @@ test "forced tail call" { | ... | @@ -281,7 +281,7 @@ test "forced tail call" { |
| 281 | if (n == 0) return a; | 281 | if (n == 0) return a; |
| 282 | if (n == 1) return b; | 282 | if (n == 1) return b; |
| 283 | return @call( | 283 | return @call( |
| 284 | .{ .modifier = .always_tail }, | 284 | .always_tail, |
| 285 | fibonacciTailInternal, | 285 | fibonacciTailInternal, |
| 286 | .{ n - 1, b, a + b }, | 286 | .{ n - 1, b, a + b }, |
| 287 | ); | 287 | ); |
| ... | @@ -322,7 +322,7 @@ test "inline call preserves tail call" { | ... | @@ -322,7 +322,7 @@ test "inline call preserves tail call" { |
| 322 | var buf: [max]u16 = undefined; | 322 | var buf: [max]u16 = undefined; |
| 323 | buf[a] = a; | 323 | buf[a] = a; |
| 324 | a += 1; | 324 | a += 1; |
| 325 | return @call(.{ .modifier = .always_tail }, foo, .{}); | 325 | return @call(.always_tail, foo, .{}); |
| 326 | } | 326 | } |
| 327 | }; | 327 | }; |
| 328 | S.foo(); | 328 | S.foo(); |
| ... | @@ -341,6 +341,6 @@ test "inline call doesn't re-evaluate non generic struct" { | ... | @@ -341,6 +341,6 @@ test "inline call doesn't re-evaluate non generic struct" { |
| 341 | } | 341 | } |
| 342 | }; | 342 | }; |
| 343 | const ArgTuple = std.meta.ArgsTuple(@TypeOf(S.foo)); | 343 | const ArgTuple = std.meta.ArgsTuple(@TypeOf(S.foo)); |
| 344 | try @call(.{ .modifier = .always_inline }, S.foo, ArgTuple{.{ .a = 123, .b = 45 }}); | 344 | try @call(.always_inline, S.foo, ArgTuple{.{ .a = 123, .b = 45 }}); |
| 345 | comptime try @call(.{ .modifier = .always_inline }, S.foo, ArgTuple{.{ .a = 123, .b = 45 }}); | 345 | comptime try @call(.always_inline, S.foo, ArgTuple{.{ .a = 123, .b = 45 }}); |
| 346 | } | 346 | } |
test/cases/compile_errors/bad_usage_of_call.zig+12-11| ... | @@ -1,22 +1,22 @@ | ... | @@ -1,22 +1,22 @@ |
| 1 | export fn entry1() void { | 1 | export fn entry1() void { |
| 2 | @call(.{}, foo, {}); | 2 | @call(.auto, foo, {}); |
| 3 | } | 3 | } |
| 4 | export fn entry2() void { | 4 | export fn entry2() void { |
| 5 | comptime @call(.{ .modifier = .never_inline }, foo, .{}); | 5 | comptime @call(.never_inline, foo, .{}); |
| 6 | } | 6 | } |
| 7 | export fn entry3() void { | 7 | export fn entry3() void { |
| 8 | comptime @call(.{ .modifier = .never_tail }, foo, .{}); | 8 | comptime @call(.never_tail, foo, .{}); |
| 9 | } | 9 | } |
| 10 | export fn entry4() void { | 10 | export fn entry4() void { |
| 11 | @call(.{ .modifier = .never_inline }, bar, .{}); | 11 | @call(.never_inline, bar, .{}); |
| 12 | } | 12 | } |
| 13 | export fn entry5(c: bool) void { | 13 | export fn entry5(c: bool) void { |
| 14 | var baz = if (c) &baz1 else &baz2; | 14 | var baz = if (c) &baz1 else &baz2; |
| 15 | @call(.{ .modifier = .compile_time }, baz, .{}); | 15 | @call(.compile_time, baz, .{}); |
| 16 | } | 16 | } |
| 17 | pub export fn entry() void { | 17 | pub export fn entry() void { |
| 18 | var call_me: *const fn () void = undefined; | 18 | var call_me: *const fn () void = undefined; |
| 19 | @call(.{ .modifier = .always_inline }, call_me, .{}); | 19 | @call(.always_inline, call_me, .{}); |
| 20 | } | 20 | } |
| 21 | fn foo() void {} | 21 | fn foo() void {} |
| 22 | fn bar() callconv(.Inline) void {} | 22 | fn bar() callconv(.Inline) void {} |
| ... | @@ -27,9 +27,10 @@ fn baz2() void {} | ... | @@ -27,9 +27,10 @@ fn baz2() void {} |
| 27 | // backend=stage2 | 27 | // backend=stage2 |
| 28 | // target=native | 28 | // target=native |
| 29 | // | 29 | // |
| 30 | // :2:21: error: expected a tuple, found 'void' | 30 | // :2:23: error: expected a tuple, found 'void' |
| 31 | // :5:33: error: unable to perform 'never_inline' call at compile-time | 31 | // :5:21: error: unable to perform 'never_inline' call at compile-time |
| 32 | // :8:33: error: unable to perform 'never_tail' call at compile-time | 32 | // :8:21: error: unable to perform 'never_tail' call at compile-time |
| 33 | // :11:5: error: no-inline call of inline function | 33 | // :11:5: error: no-inline call of inline function |
| 34 | // :15:43: error: modifier 'compile_time' requires a comptime-known function | 34 | // :15:26: error: modifier 'compile_time' requires a comptime-known function |
| 35 | // :19:44: error: modifier 'always_inline' requires a comptime-known function | 35 | // :19:27: error: modifier 'always_inline' requires a comptime-known function |
| 36 |
test/cases/compile_errors/error_in_call_builtin_args.zig+4-4| ... | @@ -1,15 +1,15 @@ | ... | @@ -1,15 +1,15 @@ |
| 1 | fn foo(_: u32, _: u32) void {} | 1 | fn foo(_: u32, _: u32) void {} |
| 2 | pub export fn entry() void { | 2 | pub export fn entry() void { |
| 3 | @call(.{}, foo, .{ 12, 12.34 }); | 3 | @call(.auto, foo, .{ 12, 12.34 }); |
| 4 | } | 4 | } |
| 5 | pub export fn entry1() void { | 5 | pub export fn entry1() void { |
| 6 | const args = .{ 12, 12.34 }; | 6 | const args = .{ 12, 12.34 }; |
| 7 | @call(.{}, foo, args); | 7 | @call(.auto, foo, args); |
| 8 | } | 8 | } |
| 9 | 9 | ||
| 10 | // error | 10 | // error |
| 11 | // backend=stage2 | 11 | // backend=stage2 |
| 12 | // target=native | 12 | // target=native |
| 13 | // | 13 | // |
| 14 | // :3:28: error: fractional component prevents float value '12.34' from coercion to type 'u32' | 14 | // :3:30: error: fractional component prevents float value '12.34' from coercion to type 'u32' |
| 15 | // :7:21: error: fractional component prevents float value '12.34' from coercion to type 'u32' | 15 | // :7:23: error: fractional component prevents float value '12.34' from coercion to type 'u32' |
test/cases/compile_errors/invalid_tail_call.zig+1-1| ... | @@ -2,7 +2,7 @@ fn myFn(_: usize) void { | ... | @@ -2,7 +2,7 @@ fn myFn(_: usize) void { |
| 2 | return; | 2 | return; |
| 3 | } | 3 | } |
| 4 | pub export fn entry() void { | 4 | pub export fn entry() void { |
| 5 | @call(.{ .modifier = .always_tail }, myFn, .{0}); | 5 | @call(.always_tail, myFn, .{0}); |
| 6 | } | 6 | } |
| 7 | 7 | ||
| 8 | // error | 8 | // error |
test/cases/taill_call_noreturn.zig+1-1| ... | @@ -1,7 +1,7 @@ | ... | @@ -1,7 +1,7 @@ |
| 1 | const std = @import("std"); | 1 | const std = @import("std"); |
| 2 | const builtin = std.builtin; | 2 | const builtin = std.builtin; |
| 3 | pub fn foo(message: []const u8, stack_trace: ?*builtin.StackTrace) noreturn { | 3 | pub fn foo(message: []const u8, stack_trace: ?*builtin.StackTrace) noreturn { |
| 4 | @call(.{ .modifier = .always_tail }, bar, .{ message, stack_trace }); | 4 | @call(.always_tail, bar, .{ message, stack_trace }); |
| 5 | } | 5 | } |
| 6 | pub fn bar(message: []const u8, stack_trace: ?*builtin.StackTrace) noreturn { | 6 | pub fn bar(message: []const u8, stack_trace: ?*builtin.StackTrace) noreturn { |
| 7 | _ = message; | 7 | _ = message; |