| author | |
| committer | |
| log | 6378644d4ea561a79edf44056609681e6d1438d1 |
| tree | 84094f36ee3dd9e3befaf33a5a7da82fc5388da7 |
| parent | 65270cdc3345e9840427179168a09ef6e4dd34b9 |
| parent | 51ed5416ab2969a366c8c6bdc487f357bad267c3 |
| signature |
Remove `stack` option from `@call`38 files changed, 248 insertions(+), 320 deletions(-)
doc/langref.html.in+30-37| ... | @@ -4270,7 +4270,7 @@ test "using @typeInfo with runtime values" { | ... | @@ -4270,7 +4270,7 @@ test "using @typeInfo with runtime values" { |
| 4270 | } | 4270 | } |
| 4271 | 4271 | ||
| 4272 | // Calls to `isFieldOptional` on `Struct1` get unrolled to an equivalent | 4272 | // Calls to `isFieldOptional` on `Struct1` get unrolled to an equivalent |
| 4273 | // of this function: | 4273 | // of this function: |
| 4274 | fn isFieldOptionalUnrolled(field_index: usize) !bool { | 4274 | fn isFieldOptionalUnrolled(field_index: usize) !bool { |
| 4275 | return switch (field_index) { | 4275 | return switch (field_index) { |
| 4276 | 0 => false, | 4276 | 0 => false, |
| ... | @@ -7801,7 +7801,7 @@ comptime { | ... | @@ -7801,7 +7801,7 @@ comptime { |
| 7801 | {#header_close#} | 7801 | {#header_close#} |
| 7802 | 7802 | ||
| 7803 | {#header_open|@call#} | 7803 | {#header_open|@call#} |
| 7804 | <pre>{#syntax#}@call(options: std.builtin.CallOptions, function: anytype, args: anytype) anytype{#endsyntax#}</pre> | 7804 | <pre>{#syntax#}@call(modifier: std.builtin.CallModifier, function: anytype, args: anytype) anytype{#endsyntax#}</pre> |
| 7805 | <p> | 7805 | <p> |
| 7806 | Calls a function, in the same way that invoking an expression with parentheses does: | 7806 | Calls a function, in the same way that invoking an expression with parentheses does: |
| 7807 | </p> | 7807 | </p> |
| ... | @@ -7809,7 +7809,7 @@ comptime { | ... | @@ -7809,7 +7809,7 @@ comptime { |
| 7809 | const expect = @import("std").testing.expect; | 7809 | const expect = @import("std").testing.expect; |
| 7810 | 7810 | ||
| 7811 | test "noinline function call" { | 7811 | test "noinline function call" { |
| 7812 | try expect(@call(.{}, add, .{3, 9}) == 12); | 7812 | try expect(@call(.auto, add, .{3, 9}) == 12); |
| 7813 | } | 7813 | } |
| 7814 | 7814 | ||
| 7815 | fn add(a: i32, b: i32) i32 { | 7815 | fn add(a: i32, b: i32) i32 { |
| ... | @@ -7818,48 +7818,41 @@ fn add(a: i32, b: i32) i32 { | ... | @@ -7818,48 +7818,41 @@ fn add(a: i32, b: i32) i32 { |
| 7818 | {#code_end#} | 7818 | {#code_end#} |
| 7819 | <p> | 7819 | <p> |
| 7820 | {#syntax#}@call{#endsyntax#} allows more flexibility than normal function call syntax does. The | 7820 | {#syntax#}@call{#endsyntax#} allows more flexibility than normal function call syntax does. The |
| 7821 | {#syntax#}CallOptions{#endsyntax#} struct is reproduced here: | 7821 | {#syntax#}CallModifier{#endsyntax#} enum is reproduced here: |
| 7822 | </p> | 7822 | </p> |
| 7823 | {#syntax_block|zig|builtin.CallOptions struct#} | 7823 | {#syntax_block|zig|builtin.CallModifier struct#} |
| 7824 | pub const CallOptions = struct { | 7824 | pub const CallModifier = enum { |
| 7825 | modifier: Modifier = .auto, | 7825 | /// Equivalent to function call syntax. |
| 7826 | 7826 | auto, | |
| 7827 | /// Only valid when `Modifier` is `Modifier.async_kw`. | ||
| 7828 | stack: ?[]align(std.Target.stack_align) u8 = null, | ||
| 7829 | |||
| 7830 | pub const Modifier = enum { | ||
| 7831 | /// Equivalent to function call syntax. | ||
| 7832 | auto, | ||
| 7833 | 7827 | ||
| 7834 | /// Equivalent to async keyword used with function call syntax. | 7828 | /// Equivalent to async keyword used with function call syntax. |
| 7835 | async_kw, | 7829 | async_kw, |
| 7836 | 7830 | ||
| 7837 | /// Prevents tail call optimization. This guarantees that the return | 7831 | /// Prevents tail call optimization. This guarantees that the return |
| 7838 | /// address will point to the callsite, as opposed to the callsite's | 7832 | /// address will point to the callsite, as opposed to the callsite's |
| 7839 | /// callsite. If the call is otherwise required to be tail-called | 7833 | /// callsite. If the call is otherwise required to be tail-called |
| 7840 | /// or inlined, a compile error is emitted instead. | 7834 | /// or inlined, a compile error is emitted instead. |
| 7841 | never_tail, | 7835 | never_tail, |
| 7842 | 7836 | ||
| 7843 | /// Guarantees that the call will not be inlined. If the call is | 7837 | /// Guarantees that the call will not be inlined. If the call is |
| 7844 | /// otherwise required to be inlined, a compile error is emitted instead. | 7838 | /// otherwise required to be inlined, a compile error is emitted instead. |
| 7845 | never_inline, | 7839 | never_inline, |
| 7846 | 7840 | ||
| 7847 | /// Asserts that the function call will not suspend. This allows a | 7841 | /// Asserts that the function call will not suspend. This allows a |
| 7848 | /// non-async function to call an async function. | 7842 | /// non-async function to call an async function. |
| 7849 | no_async, | 7843 | no_async, |
| 7850 | 7844 | ||
| 7851 | /// Guarantees that the call will be generated with tail call optimization. | 7845 | /// Guarantees that the call will be generated with tail call optimization. |
| 7852 | /// If this is not possible, a compile error is emitted instead. | 7846 | /// If this is not possible, a compile error is emitted instead. |
| 7853 | always_tail, | 7847 | always_tail, |
| 7854 | 7848 | ||
| 7855 | /// Guarantees that the call will inlined at the callsite. | 7849 | /// Guarantees that the call will inlined at the callsite. |
| 7856 | /// If this is not possible, a compile error is emitted instead. | 7850 | /// If this is not possible, a compile error is emitted instead. |
| 7857 | always_inline, | 7851 | always_inline, |
| 7858 | 7852 | ||
| 7859 | /// Evaluates the call at compile-time. If the call cannot be completed at | 7853 | /// Evaluates the call at compile-time. If the call cannot be completed at |
| 7860 | /// compile-time, a compile error is emitted instead. | 7854 | /// compile-time, a compile error is emitted instead. |
| 7861 | compile_time, | 7855 | compile_time, |
| 7862 | }; | ||
| 7863 | }; | 7856 | }; |
| 7864 | {#end_syntax_block#} | 7857 | {#end_syntax_block#} |
| 7865 | {#header_close#} | 7858 | {#header_close#} |
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/builtin.zig+32-39| ... | @@ -591,45 +591,38 @@ fn testVersionParse() !void { | ... | @@ -591,45 +591,38 @@ fn testVersionParse() !void { |
| 591 | 591 | ||
| 592 | /// This data structure is used by the Zig language code generation and | 592 | /// This data structure is used by the Zig language code generation and |
| 593 | /// therefore must be kept in sync with the compiler implementation. | 593 | /// therefore must be kept in sync with the compiler implementation. |
| 594 | pub const CallOptions = struct { | 594 | pub const CallModifier = enum { |
| 595 | modifier: Modifier = .auto, | 595 | /// Equivalent to function call syntax. |
| 596 | 596 | auto, | |
| 597 | /// Only valid when `Modifier` is `Modifier.async_kw`. | 597 | |
| 598 | stack: ?[]align(std.Target.stack_align) u8 = null, | 598 | /// Equivalent to async keyword used with function call syntax. |
| 599 | 599 | async_kw, | |
| 600 | pub const Modifier = enum { | 600 | |
| 601 | /// Equivalent to function call syntax. | 601 | /// Prevents tail call optimization. This guarantees that the return |
| 602 | auto, | 602 | /// address will point to the callsite, as opposed to the callsite's |
| 603 | 603 | /// callsite. If the call is otherwise required to be tail-called | |
| 604 | /// Equivalent to async keyword used with function call syntax. | 604 | /// or inlined, a compile error is emitted instead. |
| 605 | async_kw, | 605 | never_tail, |
| 606 | 606 | ||
| 607 | /// Prevents tail call optimization. This guarantees that the return | 607 | /// Guarantees that the call will not be inlined. If the call is |
| 608 | /// address will point to the callsite, as opposed to the callsite's | 608 | /// otherwise required to be inlined, a compile error is emitted instead. |
| 609 | /// callsite. If the call is otherwise required to be tail-called | 609 | never_inline, |
| 610 | /// or inlined, a compile error is emitted instead. | 610 | |
| 611 | never_tail, | 611 | /// Asserts that the function call will not suspend. This allows a |
| 612 | 612 | /// non-async function to call an async function. | |
| 613 | /// Guarantees that the call will not be inlined. If the call is | 613 | no_async, |
| 614 | /// otherwise required to be inlined, a compile error is emitted instead. | 614 | |
| 615 | never_inline, | 615 | /// Guarantees that the call will be generated with tail call optimization. |
| 616 | 616 | /// If this is not possible, a compile error is emitted instead. | |
| 617 | /// Asserts that the function call will not suspend. This allows a | 617 | always_tail, |
| 618 | /// non-async function to call an async function. | 618 | |
| 619 | no_async, | 619 | /// Guarantees that the call will inlined at the callsite. |
| 620 | 620 | /// If this is not possible, a compile error is emitted instead. | |
| 621 | /// Guarantees that the call will be generated with tail call optimization. | 621 | always_inline, |
| 622 | /// If this is not possible, a compile error is emitted instead. | 622 | |
| 623 | always_tail, | 623 | /// Evaluates the call at compile-time. If the call cannot be completed at |
| 624 | 624 | /// compile-time, a compile error is emitted instead. | |
| 625 | /// Guarantees that the call will inlined at the callsite. | 625 | compile_time, |
| 626 | /// If this is not possible, a compile error is emitted instead. | ||
| 627 | always_inline, | ||
| 628 | |||
| 629 | /// Evaluates the call at compile-time. If the call cannot be completed at | ||
| 630 | /// compile-time, a compile error is emitted instead. | ||
| 631 | compile_time, | ||
| 632 | }; | ||
| 633 | }; | 626 | }; |
| 634 | 627 | ||
| 635 | /// This data structure is used by the Zig language code generation and | 628 | /// This data structure is used by the Zig language code generation and |
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/AstGen.zig+3-3| ... | @@ -8297,11 +8297,11 @@ fn builtinCall( | ... | @@ -8297,11 +8297,11 @@ fn builtinCall( |
| 8297 | return rvalue(gz, ri, result, node); | 8297 | return rvalue(gz, ri, result, node); |
| 8298 | }, | 8298 | }, |
| 8299 | .call => { | 8299 | .call => { |
| 8300 | const options = try comptimeExpr(gz, scope, .{ .rl = .{ .ty = .call_options_type } }, params[0]); | 8300 | const modifier = try comptimeExpr(gz, scope, .{ .rl = .{ .coerced_ty = .modifier_type } }, params[0]); |
| 8301 | const callee = try calleeExpr(gz, scope, params[1]); | 8301 | const callee = try calleeExpr(gz, scope, params[1]); |
| 8302 | const args = try expr(gz, scope, .{ .rl = .none }, params[2]); | 8302 | const args = try expr(gz, scope, .{ .rl = .none }, params[2]); |
| 8303 | const result = try gz.addPlNode(.builtin_call, node, Zir.Inst.BuiltinCall{ | 8303 | const result = try gz.addPlNode(.builtin_call, node, Zir.Inst.BuiltinCall{ |
| 8304 | .options = options, | 8304 | .modifier = modifier, |
| 8305 | .callee = callee, | 8305 | .callee = callee, |
| 8306 | .args = args, | 8306 | .args = args, |
| 8307 | .flags = .{ | 8307 | .flags = .{ |
| ... | @@ -8674,7 +8674,7 @@ fn callExpr( | ... | @@ -8674,7 +8674,7 @@ fn callExpr( |
| 8674 | const astgen = gz.astgen; | 8674 | const astgen = gz.astgen; |
| 8675 | 8675 | ||
| 8676 | const callee = try calleeExpr(gz, scope, call.ast.fn_expr); | 8676 | const callee = try calleeExpr(gz, scope, call.ast.fn_expr); |
| 8677 | const modifier: std.builtin.CallOptions.Modifier = blk: { | 8677 | const modifier: std.builtin.CallModifier = blk: { |
| 8678 | if (gz.force_comptime) { | 8678 | if (gz.force_comptime) { |
| 8679 | break :blk .compile_time; | 8679 | break :blk .compile_time; |
| 8680 | } | 8680 | } |
src/Sema.zig+37-89| ... | @@ -5986,7 +5986,7 @@ fn zirCall( | ... | @@ -5986,7 +5986,7 @@ fn zirCall( |
| 5986 | const extra = sema.code.extraData(Zir.Inst.Call, inst_data.payload_index); | 5986 | const extra = sema.code.extraData(Zir.Inst.Call, inst_data.payload_index); |
| 5987 | const args_len = extra.data.flags.args_len; | 5987 | const args_len = extra.data.flags.args_len; |
| 5988 | 5988 | ||
| 5989 | const modifier = @intToEnum(std.builtin.CallOptions.Modifier, extra.data.flags.packed_modifier); | 5989 | const modifier = @intToEnum(std.builtin.CallModifier, extra.data.flags.packed_modifier); |
| 5990 | const ensure_result_used = extra.data.flags.ensure_result_used; | 5990 | const ensure_result_used = extra.data.flags.ensure_result_used; |
| 5991 | const pop_error_return_trace = extra.data.flags.pop_error_return_trace; | 5991 | const pop_error_return_trace = extra.data.flags.pop_error_return_trace; |
| 5992 | 5992 | ||
| ... | @@ -6222,7 +6222,7 @@ fn analyzeCall( | ... | @@ -6222,7 +6222,7 @@ fn analyzeCall( |
| 6222 | func: Air.Inst.Ref, | 6222 | func: Air.Inst.Ref, |
| 6223 | func_src: LazySrcLoc, | 6223 | func_src: LazySrcLoc, |
| 6224 | call_src: LazySrcLoc, | 6224 | call_src: LazySrcLoc, |
| 6225 | modifier: std.builtin.CallOptions.Modifier, | 6225 | modifier: std.builtin.CallModifier, |
| 6226 | ensure_result_used: bool, | 6226 | ensure_result_used: bool, |
| 6227 | uncasted_args: []const Air.Inst.Ref, | 6227 | uncasted_args: []const Air.Inst.Ref, |
| 6228 | bound_arg_src: ?LazySrcLoc, | 6228 | bound_arg_src: ?LazySrcLoc, |
| ... | @@ -20751,118 +20751,66 @@ fn zirMulAdd(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileError!Air. | ... | @@ -20751,118 +20751,66 @@ fn zirMulAdd(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileError!Air. |
| 20751 | }); | 20751 | }); |
| 20752 | } | 20752 | } |
| 20753 | 20753 | ||
| 20754 | fn resolveCallOptions( | 20754 | fn zirBuiltinCall(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileError!Air.Inst.Ref { |
| 20755 | sema: *Sema, | 20755 | const tracy = trace(@src()); |
| 20756 | block: *Block, | 20756 | defer tracy.end(); |
| 20757 | src: LazySrcLoc, | ||
| 20758 | zir_ref: Zir.Inst.Ref, | ||
| 20759 | is_comptime: bool, | ||
| 20760 | is_nosuspend: bool, | ||
| 20761 | func: Air.Inst.Ref, | ||
| 20762 | func_src: LazySrcLoc, | ||
| 20763 | ) CompileError!std.builtin.CallOptions.Modifier { | ||
| 20764 | const call_options_ty = try sema.getBuiltinType("CallOptions"); | ||
| 20765 | const air_ref = try sema.resolveInst(zir_ref); | ||
| 20766 | const options = try sema.coerce(block, call_options_ty, air_ref, src); | ||
| 20767 | |||
| 20768 | const modifier_src = sema.maybeOptionsSrc(block, src, "modifier"); | ||
| 20769 | const stack_src = sema.maybeOptionsSrc(block, src, "stack"); | ||
| 20770 | |||
| 20771 | const modifier = try sema.fieldVal(block, src, options, "modifier", modifier_src); | ||
| 20772 | const modifier_val = try sema.resolveConstValue(block, modifier_src, modifier, "call modifier must be comptime-known"); | ||
| 20773 | const wanted_modifier = modifier_val.toEnum(std.builtin.CallOptions.Modifier); | ||
| 20774 | 20757 | ||
| 20775 | const stack = try sema.fieldVal(block, src, options, "stack", stack_src); | 20758 | const inst_data = sema.code.instructions.items(.data)[inst].pl_node; |
| 20776 | const stack_val = try sema.resolveConstValue(block, stack_src, stack, "call stack value must be comptime-known"); | 20759 | const modifier_src: LazySrcLoc = .{ .node_offset_builtin_call_arg0 = inst_data.src_node }; |
| 20760 | const func_src: LazySrcLoc = .{ .node_offset_builtin_call_arg1 = inst_data.src_node }; | ||
| 20761 | const args_src: LazySrcLoc = .{ .node_offset_builtin_call_arg2 = inst_data.src_node }; | ||
| 20762 | const call_src = inst_data.src(); | ||
| 20777 | 20763 | ||
| 20778 | if (!stack_val.isNull()) { | 20764 | const extra = sema.code.extraData(Zir.Inst.BuiltinCall, inst_data.payload_index).data; |
| 20779 | return sema.fail(block, stack_src, "TODO: implement @call with stack", .{}); | 20765 | var func = try sema.resolveInst(extra.callee); |
| 20780 | } | ||
| 20781 | 20766 | ||
| 20782 | switch (wanted_modifier) { | 20767 | const modifier_ty = try sema.getBuiltinType("CallModifier"); |
| 20768 | const air_ref = try sema.resolveInst(extra.modifier); | ||
| 20769 | const modifier_ref = try sema.coerce(block, modifier_ty, air_ref, modifier_src); | ||
| 20770 | const modifier_val = try sema.resolveConstValue(block, modifier_src, modifier_ref, "call modifier must be comptime-known"); | ||
| 20771 | var modifier = modifier_val.toEnum(std.builtin.CallModifier); | ||
| 20772 | switch (modifier) { | ||
| 20783 | // These can be upgraded to comptime or nosuspend calls. | 20773 | // These can be upgraded to comptime or nosuspend calls. |
| 20784 | .auto, .never_tail, .no_async => { | 20774 | .auto, .never_tail, .no_async => { |
| 20785 | if (is_comptime) { | 20775 | if (extra.flags.is_comptime) { |
| 20786 | if (wanted_modifier == .never_tail) { | 20776 | if (modifier == .never_tail) { |
| 20787 | return sema.fail(block, modifier_src, "unable to perform 'never_tail' call at compile-time", .{}); | 20777 | return sema.fail(block, modifier_src, "unable to perform 'never_tail' call at compile-time", .{}); |
| 20788 | } | 20778 | } |
| 20789 | return .compile_time; | 20779 | modifier = .compile_time; |
| 20790 | } | 20780 | } else if (extra.flags.is_nosuspend) { |
| 20791 | if (is_nosuspend) { | 20781 | modifier = .no_async; |
| 20792 | return .no_async; | ||
| 20793 | } | 20782 | } |
| 20794 | return wanted_modifier; | ||
| 20795 | }, | 20783 | }, |
| 20796 | // These can be upgraded to comptime. nosuspend bit can be safely ignored. | 20784 | // These can be upgraded to comptime. nosuspend bit can be safely ignored. |
| 20797 | .always_inline, .compile_time => { | 20785 | .always_inline, .compile_time => { |
| 20798 | _ = (try sema.resolveDefinedValue(block, func_src, func)) orelse { | 20786 | _ = (try sema.resolveDefinedValue(block, func_src, func)) orelse { |
| 20799 | return sema.fail(block, func_src, "modifier '{s}' requires a comptime-known function", .{@tagName(wanted_modifier)}); | 20787 | return sema.fail(block, func_src, "modifier '{s}' requires a comptime-known function", .{@tagName(modifier)}); |
| 20800 | }; | 20788 | }; |
| 20801 | 20789 | ||
| 20802 | if (is_comptime) { | 20790 | if (extra.flags.is_comptime) { |
| 20803 | return .compile_time; | 20791 | modifier = .compile_time; |
| 20804 | } | 20792 | } |
| 20805 | return wanted_modifier; | ||
| 20806 | }, | 20793 | }, |
| 20807 | .always_tail => { | 20794 | .always_tail => { |
| 20808 | if (is_comptime) { | 20795 | if (extra.flags.is_comptime) { |
| 20809 | return .compile_time; | 20796 | modifier = .compile_time; |
| 20810 | } | 20797 | } |
| 20811 | return wanted_modifier; | ||
| 20812 | }, | 20798 | }, |
| 20813 | .async_kw => { | 20799 | .async_kw => { |
| 20814 | if (is_nosuspend) { | 20800 | if (extra.flags.is_nosuspend) { |
| 20815 | return sema.fail(block, modifier_src, "modifier 'async_kw' cannot be used inside nosuspend block", .{}); | 20801 | return sema.fail(block, modifier_src, "modifier 'async_kw' cannot be used inside nosuspend block", .{}); |
| 20816 | } | 20802 | } |
| 20817 | if (is_comptime) { | 20803 | if (extra.flags.is_comptime) { |
| 20818 | return sema.fail(block, modifier_src, "modifier 'async_kw' cannot be used in combination with comptime function call", .{}); | 20804 | return sema.fail(block, modifier_src, "modifier 'async_kw' cannot be used in combination with comptime function call", .{}); |
| 20819 | } | 20805 | } |
| 20820 | return wanted_modifier; | ||
| 20821 | }, | 20806 | }, |
| 20822 | .never_inline => { | 20807 | .never_inline => { |
| 20823 | if (is_comptime) { | 20808 | if (extra.flags.is_comptime) { |
| 20824 | return sema.fail(block, modifier_src, "unable to perform 'never_inline' call at compile-time", .{}); | 20809 | return sema.fail(block, modifier_src, "unable to perform 'never_inline' call at compile-time", .{}); |
| 20825 | } | 20810 | } |
| 20826 | return wanted_modifier; | ||
| 20827 | }, | 20811 | }, |
| 20828 | } | 20812 | } |
| 20829 | } | ||
| 20830 | |||
| 20831 | fn zirBuiltinCall(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileError!Air.Inst.Ref { | ||
| 20832 | const tracy = trace(@src()); | ||
| 20833 | defer tracy.end(); | ||
| 20834 | 20813 | ||
| 20835 | const inst_data = sema.code.instructions.items(.data)[inst].pl_node; | ||
| 20836 | const options_src: LazySrcLoc = .{ .node_offset_builtin_call_arg0 = inst_data.src_node }; | ||
| 20837 | const func_src: LazySrcLoc = .{ .node_offset_builtin_call_arg1 = inst_data.src_node }; | ||
| 20838 | const args_src: LazySrcLoc = .{ .node_offset_builtin_call_arg2 = inst_data.src_node }; | ||
| 20839 | const call_src = inst_data.src(); | ||
| 20840 | |||
| 20841 | const extra = sema.code.extraData(Zir.Inst.BuiltinCall, inst_data.payload_index).data; | ||
| 20842 | var func = try sema.resolveInst(extra.callee); | ||
| 20843 | const modifier = sema.resolveCallOptions( | ||
| 20844 | block, | ||
| 20845 | .unneeded, | ||
| 20846 | extra.options, | ||
| 20847 | extra.flags.is_comptime, | ||
| 20848 | extra.flags.is_nosuspend, | ||
| 20849 | func, | ||
| 20850 | func_src, | ||
| 20851 | ) catch |err| switch (err) { | ||
| 20852 | error.NeededSourceLocation => { | ||
| 20853 | _ = try sema.resolveCallOptions( | ||
| 20854 | block, | ||
| 20855 | options_src, | ||
| 20856 | extra.options, | ||
| 20857 | extra.flags.is_comptime, | ||
| 20858 | extra.flags.is_nosuspend, | ||
| 20859 | func, | ||
| 20860 | func_src, | ||
| 20861 | ); | ||
| 20862 | return error.AnalysisFail; | ||
| 20863 | }, | ||
| 20864 | else => |e| return e, | ||
| 20865 | }; | ||
| 20866 | const args = try sema.resolveInst(extra.args); | 20814 | const args = try sema.resolveInst(extra.args); |
| 20867 | 20815 | ||
| 20868 | const args_ty = sema.typeOf(args); | 20816 | const args_ty = sema.typeOf(args); |
| ... | @@ -29558,7 +29506,7 @@ pub fn resolveTypeRequiresComptime(sema: *Sema, ty: Type) CompileError!bool { | ... | @@ -29558,7 +29506,7 @@ pub fn resolveTypeRequiresComptime(sema: *Sema, ty: Type) CompileError!bool { |
| 29558 | .address_space, | 29506 | .address_space, |
| 29559 | .float_mode, | 29507 | .float_mode, |
| 29560 | .reduce_op, | 29508 | .reduce_op, |
| 29561 | .call_options, | 29509 | .modifier, |
| 29562 | .prefetch_options, | 29510 | .prefetch_options, |
| 29563 | .export_options, | 29511 | .export_options, |
| 29564 | .extern_options, | 29512 | .extern_options, |
| ... | @@ -29823,7 +29771,7 @@ pub fn resolveTypeFields(sema: *Sema, ty: Type) CompileError!Type { | ... | @@ -29823,7 +29771,7 @@ pub fn resolveTypeFields(sema: *Sema, ty: Type) CompileError!Type { |
| 29823 | .address_space => return sema.getBuiltinType("AddressSpace"), | 29771 | .address_space => return sema.getBuiltinType("AddressSpace"), |
| 29824 | .float_mode => return sema.getBuiltinType("FloatMode"), | 29772 | .float_mode => return sema.getBuiltinType("FloatMode"), |
| 29825 | .reduce_op => return sema.getBuiltinType("ReduceOp"), | 29773 | .reduce_op => return sema.getBuiltinType("ReduceOp"), |
| 29826 | .call_options => return sema.getBuiltinType("CallOptions"), | 29774 | .modifier => return sema.getBuiltinType("CallModifier"), |
| 29827 | .prefetch_options => return sema.getBuiltinType("PrefetchOptions"), | 29775 | .prefetch_options => return sema.getBuiltinType("PrefetchOptions"), |
| 29828 | 29776 | ||
| 29829 | else => return ty, | 29777 | else => return ty, |
| ... | @@ -30841,7 +30789,7 @@ pub fn typeHasOnePossibleValue(sema: *Sema, ty: Type) CompileError!?Value { | ... | @@ -30841,7 +30789,7 @@ pub fn typeHasOnePossibleValue(sema: *Sema, ty: Type) CompileError!?Value { |
| 30841 | .address_space, | 30789 | .address_space, |
| 30842 | .float_mode, | 30790 | .float_mode, |
| 30843 | .reduce_op, | 30791 | .reduce_op, |
| 30844 | .call_options, | 30792 | .modifier, |
| 30845 | .prefetch_options, | 30793 | .prefetch_options, |
| 30846 | .export_options, | 30794 | .export_options, |
| 30847 | .extern_options, | 30795 | .extern_options, |
| ... | @@ -31164,7 +31112,7 @@ pub fn addType(sema: *Sema, ty: Type) !Air.Inst.Ref { | ... | @@ -31164,7 +31112,7 @@ pub fn addType(sema: *Sema, ty: Type) !Air.Inst.Ref { |
| 31164 | .address_space => return .address_space_type, | 31112 | .address_space => return .address_space_type, |
| 31165 | .float_mode => return .float_mode_type, | 31113 | .float_mode => return .float_mode_type, |
| 31166 | .reduce_op => return .reduce_op_type, | 31114 | .reduce_op => return .reduce_op_type, |
| 31167 | .call_options => return .call_options_type, | 31115 | .modifier => return .modifier_type, |
| 31168 | .prefetch_options => return .prefetch_options_type, | 31116 | .prefetch_options => return .prefetch_options_type, |
| 31169 | .export_options => return .export_options_type, | 31117 | .export_options => return .export_options_type, |
| 31170 | .extern_options => return .extern_options_type, | 31118 | .extern_options => return .extern_options_type, |
| ... | @@ -31557,7 +31505,7 @@ pub fn typeRequiresComptime(sema: *Sema, ty: Type) CompileError!bool { | ... | @@ -31557,7 +31505,7 @@ pub fn typeRequiresComptime(sema: *Sema, ty: Type) CompileError!bool { |
| 31557 | .address_space, | 31505 | .address_space, |
| 31558 | .float_mode, | 31506 | .float_mode, |
| 31559 | .reduce_op, | 31507 | .reduce_op, |
| 31560 | .call_options, | 31508 | .modifier, |
| 31561 | .prefetch_options, | 31509 | .prefetch_options, |
| 31562 | .export_options, | 31510 | .export_options, |
| 31563 | .extern_options, | 31511 | .extern_options, |
| ... | @@ -32387,7 +32335,7 @@ fn enumHasInt( | ... | @@ -32387,7 +32335,7 @@ fn enumHasInt( |
| 32387 | .address_space, | 32335 | .address_space, |
| 32388 | .float_mode, | 32336 | .float_mode, |
| 32389 | .reduce_op, | 32337 | .reduce_op, |
| 32390 | .call_options, | 32338 | .modifier, |
| 32391 | .prefetch_options, | 32339 | .prefetch_options, |
| 32392 | .export_options, | 32340 | .export_options, |
| 32393 | .extern_options, | 32341 | .extern_options, |
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/TypedValue.zig+1-1| ... | @@ -136,7 +136,7 @@ pub fn print( | ... | @@ -136,7 +136,7 @@ pub fn print( |
| 136 | .address_space_type => return writer.writeAll("std.builtin.AddressSpace"), | 136 | .address_space_type => return writer.writeAll("std.builtin.AddressSpace"), |
| 137 | .float_mode_type => return writer.writeAll("std.builtin.FloatMode"), | 137 | .float_mode_type => return writer.writeAll("std.builtin.FloatMode"), |
| 138 | .reduce_op_type => return writer.writeAll("std.builtin.ReduceOp"), | 138 | .reduce_op_type => return writer.writeAll("std.builtin.ReduceOp"), |
| 139 | .call_options_type => return writer.writeAll("std.builtin.CallOptions"), | 139 | .modifier_type => return writer.writeAll("std.builtin.CallModifier"), |
| 140 | .prefetch_options_type => return writer.writeAll("std.builtin.PrefetchOptions"), | 140 | .prefetch_options_type => return writer.writeAll("std.builtin.PrefetchOptions"), |
| 141 | .export_options_type => return writer.writeAll("std.builtin.ExportOptions"), | 141 | .export_options_type => return writer.writeAll("std.builtin.ExportOptions"), |
| 142 | .extern_options_type => return writer.writeAll("std.builtin.ExternOptions"), | 142 | .extern_options_type => return writer.writeAll("std.builtin.ExternOptions"), |
src/Zir.zig+6-6| ... | @@ -2070,7 +2070,7 @@ pub const Inst = struct { | ... | @@ -2070,7 +2070,7 @@ pub const Inst = struct { |
| 2070 | address_space_type, | 2070 | address_space_type, |
| 2071 | float_mode_type, | 2071 | float_mode_type, |
| 2072 | reduce_op_type, | 2072 | reduce_op_type, |
| 2073 | call_options_type, | 2073 | modifier_type, |
| 2074 | prefetch_options_type, | 2074 | prefetch_options_type, |
| 2075 | export_options_type, | 2075 | export_options_type, |
| 2076 | extern_options_type, | 2076 | extern_options_type, |
| ... | @@ -2345,9 +2345,9 @@ pub const Inst = struct { | ... | @@ -2345,9 +2345,9 @@ pub const Inst = struct { |
| 2345 | .ty = Type.initTag(.type), | 2345 | .ty = Type.initTag(.type), |
| 2346 | .val = Value.initTag(.reduce_op_type), | 2346 | .val = Value.initTag(.reduce_op_type), |
| 2347 | }, | 2347 | }, |
| 2348 | .call_options_type = .{ | 2348 | .modifier_type = .{ |
| 2349 | .ty = Type.initTag(.type), | 2349 | .ty = Type.initTag(.type), |
| 2350 | .val = Value.initTag(.call_options_type), | 2350 | .val = Value.initTag(.modifier_type), |
| 2351 | }, | 2351 | }, |
| 2352 | .prefetch_options_type = .{ | 2352 | .prefetch_options_type = .{ |
| 2353 | .ty = Type.initTag(.type), | 2353 | .ty = Type.initTag(.type), |
| ... | @@ -2832,7 +2832,7 @@ pub const Inst = struct { | ... | @@ -2832,7 +2832,7 @@ pub const Inst = struct { |
| 2832 | callee: Ref, | 2832 | callee: Ref, |
| 2833 | 2833 | ||
| 2834 | pub const Flags = packed struct { | 2834 | pub const Flags = packed struct { |
| 2835 | /// std.builtin.CallOptions.Modifier in packed form | 2835 | /// std.builtin.CallModifier in packed form |
| 2836 | pub const PackedModifier = u3; | 2836 | pub const PackedModifier = u3; |
| 2837 | pub const PackedArgsLen = u27; | 2837 | pub const PackedArgsLen = u27; |
| 2838 | 2838 | ||
| ... | @@ -2844,7 +2844,7 @@ pub const Inst = struct { | ... | @@ -2844,7 +2844,7 @@ pub const Inst = struct { |
| 2844 | comptime { | 2844 | comptime { |
| 2845 | if (@sizeOf(Flags) != 4 or @bitSizeOf(Flags) != 32) | 2845 | if (@sizeOf(Flags) != 4 or @bitSizeOf(Flags) != 32) |
| 2846 | @compileError("Layout of Call.Flags needs to be updated!"); | 2846 | @compileError("Layout of Call.Flags needs to be updated!"); |
| 2847 | if (@bitSizeOf(std.builtin.CallOptions.Modifier) != @bitSizeOf(PackedModifier)) | 2847 | if (@bitSizeOf(std.builtin.CallModifier) != @bitSizeOf(PackedModifier)) |
| 2848 | @compileError("Call.Flags.PackedModifier needs to be updated!"); | 2848 | @compileError("Call.Flags.PackedModifier needs to be updated!"); |
| 2849 | } | 2849 | } |
| 2850 | }; | 2850 | }; |
| ... | @@ -2860,7 +2860,7 @@ pub const Inst = struct { | ... | @@ -2860,7 +2860,7 @@ pub const Inst = struct { |
| 2860 | // Note: Flags *must* come first so that unusedResultExpr | 2860 | // Note: Flags *must* come first so that unusedResultExpr |
| 2861 | // can find it when it goes to modify them. | 2861 | // can find it when it goes to modify them. |
| 2862 | flags: Flags, | 2862 | flags: Flags, |
| 2863 | options: Ref, | 2863 | modifier: Ref, |
| 2864 | callee: Ref, | 2864 | callee: Ref, |
| 2865 | args: Ref, | 2865 | args: Ref, |
| 2866 | 2866 |
src/arch/aarch64/CodeGen.zig+1-1| ... | @@ -4110,7 +4110,7 @@ fn airFence(self: *Self) !void { | ... | @@ -4110,7 +4110,7 @@ fn airFence(self: *Self) !void { |
| 4110 | //return self.finishAirBookkeeping(); | 4110 | //return self.finishAirBookkeeping(); |
| 4111 | } | 4111 | } |
| 4112 | 4112 | ||
| 4113 | fn airCall(self: *Self, inst: Air.Inst.Index, modifier: std.builtin.CallOptions.Modifier) !void { | 4113 | fn airCall(self: *Self, inst: Air.Inst.Index, modifier: std.builtin.CallModifier) !void { |
| 4114 | if (modifier == .always_tail) return self.fail("TODO implement tail calls for aarch64", .{}); | 4114 | if (modifier == .always_tail) return self.fail("TODO implement tail calls for aarch64", .{}); |
| 4115 | const pl_op = self.air.instructions.items(.data)[inst].pl_op; | 4115 | const pl_op = self.air.instructions.items(.data)[inst].pl_op; |
| 4116 | const callee = pl_op.operand; | 4116 | const callee = pl_op.operand; |
src/arch/arm/CodeGen.zig+1-1| ... | @@ -4097,7 +4097,7 @@ fn airFence(self: *Self) !void { | ... | @@ -4097,7 +4097,7 @@ fn airFence(self: *Self) !void { |
| 4097 | //return self.finishAirBookkeeping(); | 4097 | //return self.finishAirBookkeeping(); |
| 4098 | } | 4098 | } |
| 4099 | 4099 | ||
| 4100 | fn airCall(self: *Self, inst: Air.Inst.Index, modifier: std.builtin.CallOptions.Modifier) !void { | 4100 | fn airCall(self: *Self, inst: Air.Inst.Index, modifier: std.builtin.CallModifier) !void { |
| 4101 | if (modifier == .always_tail) return self.fail("TODO implement tail calls for arm", .{}); | 4101 | if (modifier == .always_tail) return self.fail("TODO implement tail calls for arm", .{}); |
| 4102 | const pl_op = self.air.instructions.items(.data)[inst].pl_op; | 4102 | const pl_op = self.air.instructions.items(.data)[inst].pl_op; |
| 4103 | const callee = pl_op.operand; | 4103 | const callee = pl_op.operand; |
src/arch/riscv64/CodeGen.zig+1-1| ... | @@ -1672,7 +1672,7 @@ fn airFence(self: *Self) !void { | ... | @@ -1672,7 +1672,7 @@ fn airFence(self: *Self) !void { |
| 1672 | //return self.finishAirBookkeeping(); | 1672 | //return self.finishAirBookkeeping(); |
| 1673 | } | 1673 | } |
| 1674 | 1674 | ||
| 1675 | fn airCall(self: *Self, inst: Air.Inst.Index, modifier: std.builtin.CallOptions.Modifier) !void { | 1675 | fn airCall(self: *Self, inst: Air.Inst.Index, modifier: std.builtin.CallModifier) !void { |
| 1676 | if (modifier == .always_tail) return self.fail("TODO implement tail calls for riscv64", .{}); | 1676 | if (modifier == .always_tail) return self.fail("TODO implement tail calls for riscv64", .{}); |
| 1677 | const pl_op = self.air.instructions.items(.data)[inst].pl_op; | 1677 | const pl_op = self.air.instructions.items(.data)[inst].pl_op; |
| 1678 | const fn_ty = self.air.typeOf(pl_op.operand); | 1678 | const fn_ty = self.air.typeOf(pl_op.operand); |
src/arch/sparc64/CodeGen.zig+1-1| ... | @@ -1155,7 +1155,7 @@ fn airBreakpoint(self: *Self) !void { | ... | @@ -1155,7 +1155,7 @@ fn airBreakpoint(self: *Self) !void { |
| 1155 | return self.finishAirBookkeeping(); | 1155 | return self.finishAirBookkeeping(); |
| 1156 | } | 1156 | } |
| 1157 | 1157 | ||
| 1158 | fn airCall(self: *Self, inst: Air.Inst.Index, modifier: std.builtin.CallOptions.Modifier) !void { | 1158 | fn airCall(self: *Self, inst: Air.Inst.Index, modifier: std.builtin.CallModifier) !void { |
| 1159 | if (modifier == .always_tail) return self.fail("TODO implement tail calls for {}", .{self.target.cpu.arch}); | 1159 | if (modifier == .always_tail) return self.fail("TODO implement tail calls for {}", .{self.target.cpu.arch}); |
| 1160 | 1160 | ||
| 1161 | const pl_op = self.air.instructions.items(.data)[inst].pl_op; | 1161 | const pl_op = self.air.instructions.items(.data)[inst].pl_op; |
src/arch/wasm/CodeGen.zig+1-1| ... | @@ -2099,7 +2099,7 @@ fn airRetLoad(func: *CodeGen, inst: Air.Inst.Index) InnerError!void { | ... | @@ -2099,7 +2099,7 @@ fn airRetLoad(func: *CodeGen, inst: Air.Inst.Index) InnerError!void { |
| 2099 | return func.finishAir(inst, .none, &.{un_op}); | 2099 | return func.finishAir(inst, .none, &.{un_op}); |
| 2100 | } | 2100 | } |
| 2101 | 2101 | ||
| 2102 | fn airCall(func: *CodeGen, inst: Air.Inst.Index, modifier: std.builtin.CallOptions.Modifier) InnerError!void { | 2102 | fn airCall(func: *CodeGen, inst: Air.Inst.Index, modifier: std.builtin.CallModifier) InnerError!void { |
| 2103 | if (modifier == .always_tail) return func.fail("TODO implement tail calls for wasm", .{}); | 2103 | if (modifier == .always_tail) return func.fail("TODO implement tail calls for wasm", .{}); |
| 2104 | const pl_op = func.air.instructions.items(.data)[inst].pl_op; | 2104 | const pl_op = func.air.instructions.items(.data)[inst].pl_op; |
| 2105 | const extra = func.air.extraData(Air.Call, pl_op.payload); | 2105 | const extra = func.air.extraData(Air.Call, pl_op.payload); |
src/arch/x86_64/CodeGen.zig+1-1| ... | @@ -3899,7 +3899,7 @@ fn airFence(self: *Self) !void { | ... | @@ -3899,7 +3899,7 @@ fn airFence(self: *Self) !void { |
| 3899 | //return self.finishAirBookkeeping(); | 3899 | //return self.finishAirBookkeeping(); |
| 3900 | } | 3900 | } |
| 3901 | 3901 | ||
| 3902 | fn airCall(self: *Self, inst: Air.Inst.Index, modifier: std.builtin.CallOptions.Modifier) !void { | 3902 | fn airCall(self: *Self, inst: Air.Inst.Index, modifier: std.builtin.CallModifier) !void { |
| 3903 | if (modifier == .always_tail) return self.fail("TODO implement tail calls for x86_64", .{}); | 3903 | if (modifier == .always_tail) return self.fail("TODO implement tail calls for x86_64", .{}); |
| 3904 | const pl_op = self.air.instructions.items(.data)[inst].pl_op; | 3904 | const pl_op = self.air.instructions.items(.data)[inst].pl_op; |
| 3905 | const callee = pl_op.operand; | 3905 | const callee = pl_op.operand; |
src/codegen/c.zig+1-1| ... | @@ -3874,7 +3874,7 @@ fn airSlice(f: *Function, inst: Air.Inst.Index) !CValue { | ... | @@ -3874,7 +3874,7 @@ fn airSlice(f: *Function, inst: Air.Inst.Index) !CValue { |
| 3874 | fn airCall( | 3874 | fn airCall( |
| 3875 | f: *Function, | 3875 | f: *Function, |
| 3876 | inst: Air.Inst.Index, | 3876 | inst: Air.Inst.Index, |
| 3877 | modifier: std.builtin.CallOptions.Modifier, | 3877 | modifier: std.builtin.CallModifier, |
| 3878 | ) !CValue { | 3878 | ) !CValue { |
| 3879 | // Not even allowed to call panic in a naked function. | 3879 | // Not even allowed to call panic in a naked function. |
| 3880 | if (f.object.dg.decl.ty.fnCallingConvention() == .Naked) return .none; | 3880 | if (f.object.dg.decl.ty.fnCallingConvention() == .Naked) return .none; |
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( |
src/print_zir.zig+2-2| ... | @@ -801,7 +801,7 @@ const Writer = struct { | ... | @@ -801,7 +801,7 @@ const Writer = struct { |
| 801 | try self.writeFlag(stream, "nosuspend ", extra.flags.is_nosuspend); | 801 | try self.writeFlag(stream, "nosuspend ", extra.flags.is_nosuspend); |
| 802 | try self.writeFlag(stream, "comptime ", extra.flags.is_comptime); | 802 | try self.writeFlag(stream, "comptime ", extra.flags.is_comptime); |
| 803 | 803 | ||
| 804 | try self.writeInstRef(stream, extra.options); | 804 | try self.writeInstRef(stream, extra.modifier); |
| 805 | try stream.writeAll(", "); | 805 | try stream.writeAll(", "); |
| 806 | try self.writeInstRef(stream, extra.callee); | 806 | try self.writeInstRef(stream, extra.callee); |
| 807 | try stream.writeAll(", "); | 807 | try stream.writeAll(", "); |
| ... | @@ -1170,7 +1170,7 @@ const Writer = struct { | ... | @@ -1170,7 +1170,7 @@ const Writer = struct { |
| 1170 | if (extra.data.flags.ensure_result_used) { | 1170 | if (extra.data.flags.ensure_result_used) { |
| 1171 | try stream.writeAll("nodiscard "); | 1171 | try stream.writeAll("nodiscard "); |
| 1172 | } | 1172 | } |
| 1173 | try stream.print(".{s}, ", .{@tagName(@intToEnum(std.builtin.CallOptions.Modifier, extra.data.flags.packed_modifier))}); | 1173 | try stream.print(".{s}, ", .{@tagName(@intToEnum(std.builtin.CallModifier, extra.data.flags.packed_modifier))}); |
| 1174 | try self.writeInstRef(stream, extra.data.callee); | 1174 | try self.writeInstRef(stream, extra.data.callee); |
| 1175 | try stream.writeAll(", ["); | 1175 | try stream.writeAll(", ["); |
| 1176 | 1176 |
src/type.zig+22-22| ... | @@ -129,7 +129,6 @@ pub const Type = extern union { | ... | @@ -129,7 +129,6 @@ pub const Type = extern union { |
| 129 | .empty_struct, | 129 | .empty_struct, |
| 130 | .empty_struct_literal, | 130 | .empty_struct_literal, |
| 131 | .@"struct", | 131 | .@"struct", |
| 132 | .call_options, | ||
| 133 | .prefetch_options, | 132 | .prefetch_options, |
| 134 | .export_options, | 133 | .export_options, |
| 135 | .extern_options, | 134 | .extern_options, |
| ... | @@ -147,6 +146,7 @@ pub const Type = extern union { | ... | @@ -147,6 +146,7 @@ pub const Type = extern union { |
| 147 | .address_space, | 146 | .address_space, |
| 148 | .float_mode, | 147 | .float_mode, |
| 149 | .reduce_op, | 148 | .reduce_op, |
| 149 | .modifier, | ||
| 150 | => return .Enum, | 150 | => return .Enum, |
| 151 | 151 | ||
| 152 | .@"union", | 152 | .@"union", |
| ... | @@ -885,7 +885,6 @@ pub const Type = extern union { | ... | @@ -885,7 +885,6 @@ pub const Type = extern union { |
| 885 | 885 | ||
| 886 | // we can't compare these based on tags because it wouldn't detect if, | 886 | // we can't compare these based on tags because it wouldn't detect if, |
| 887 | // for example, a was resolved into .@"struct" but b was one of these tags. | 887 | // for example, a was resolved into .@"struct" but b was one of these tags. |
| 888 | .call_options, | ||
| 889 | .prefetch_options, | 888 | .prefetch_options, |
| 890 | .export_options, | 889 | .export_options, |
| 891 | .extern_options, | 890 | .extern_options, |
| ... | @@ -914,6 +913,7 @@ pub const Type = extern union { | ... | @@ -914,6 +913,7 @@ pub const Type = extern union { |
| 914 | .address_space, | 913 | .address_space, |
| 915 | .float_mode, | 914 | .float_mode, |
| 916 | .reduce_op, | 915 | .reduce_op, |
| 916 | .modifier, | ||
| 917 | => unreachable, // needed to resolve the type before now | 917 | => unreachable, // needed to resolve the type before now |
| 918 | 918 | ||
| 919 | .@"union", .union_safety_tagged, .union_tagged => { | 919 | .@"union", .union_safety_tagged, .union_tagged => { |
| ... | @@ -1194,7 +1194,6 @@ pub const Type = extern union { | ... | @@ -1194,7 +1194,6 @@ pub const Type = extern union { |
| 1194 | }, | 1194 | }, |
| 1195 | 1195 | ||
| 1196 | // we can't hash these based on tags because they wouldn't match the expanded version. | 1196 | // we can't hash these based on tags because they wouldn't match the expanded version. |
| 1197 | .call_options, | ||
| 1198 | .prefetch_options, | 1197 | .prefetch_options, |
| 1199 | .export_options, | 1198 | .export_options, |
| 1200 | .extern_options, | 1199 | .extern_options, |
| ... | @@ -1222,6 +1221,7 @@ pub const Type = extern union { | ... | @@ -1222,6 +1221,7 @@ pub const Type = extern union { |
| 1222 | .address_space, | 1221 | .address_space, |
| 1223 | .float_mode, | 1222 | .float_mode, |
| 1224 | .reduce_op, | 1223 | .reduce_op, |
| 1224 | .modifier, | ||
| 1225 | => unreachable, // needed to resolve the type before now | 1225 | => unreachable, // needed to resolve the type before now |
| 1226 | 1226 | ||
| 1227 | .@"union", .union_safety_tagged, .union_tagged => { | 1227 | .@"union", .union_safety_tagged, .union_tagged => { |
| ... | @@ -1333,7 +1333,7 @@ pub const Type = extern union { | ... | @@ -1333,7 +1333,7 @@ pub const Type = extern union { |
| 1333 | .address_space, | 1333 | .address_space, |
| 1334 | .float_mode, | 1334 | .float_mode, |
| 1335 | .reduce_op, | 1335 | .reduce_op, |
| 1336 | .call_options, | 1336 | .modifier, |
| 1337 | .prefetch_options, | 1337 | .prefetch_options, |
| 1338 | .export_options, | 1338 | .export_options, |
| 1339 | .extern_options, | 1339 | .extern_options, |
| ... | @@ -1665,7 +1665,7 @@ pub const Type = extern union { | ... | @@ -1665,7 +1665,7 @@ pub const Type = extern union { |
| 1665 | .address_space => return writer.writeAll("std.builtin.AddressSpace"), | 1665 | .address_space => return writer.writeAll("std.builtin.AddressSpace"), |
| 1666 | .float_mode => return writer.writeAll("std.builtin.FloatMode"), | 1666 | .float_mode => return writer.writeAll("std.builtin.FloatMode"), |
| 1667 | .reduce_op => return writer.writeAll("std.builtin.ReduceOp"), | 1667 | .reduce_op => return writer.writeAll("std.builtin.ReduceOp"), |
| 1668 | .call_options => return writer.writeAll("std.builtin.CallOptions"), | 1668 | .modifier => return writer.writeAll("std.builtin.CallModifier"), |
| 1669 | .prefetch_options => return writer.writeAll("std.builtin.PrefetchOptions"), | 1669 | .prefetch_options => return writer.writeAll("std.builtin.PrefetchOptions"), |
| 1670 | .export_options => return writer.writeAll("std.builtin.ExportOptions"), | 1670 | .export_options => return writer.writeAll("std.builtin.ExportOptions"), |
| 1671 | .extern_options => return writer.writeAll("std.builtin.ExternOptions"), | 1671 | .extern_options => return writer.writeAll("std.builtin.ExternOptions"), |
| ... | @@ -1943,7 +1943,7 @@ pub const Type = extern union { | ... | @@ -1943,7 +1943,7 @@ pub const Type = extern union { |
| 1943 | .address_space => unreachable, | 1943 | .address_space => unreachable, |
| 1944 | .float_mode => unreachable, | 1944 | .float_mode => unreachable, |
| 1945 | .reduce_op => unreachable, | 1945 | .reduce_op => unreachable, |
| 1946 | .call_options => unreachable, | 1946 | .modifier => unreachable, |
| 1947 | .prefetch_options => unreachable, | 1947 | .prefetch_options => unreachable, |
| 1948 | .export_options => unreachable, | 1948 | .export_options => unreachable, |
| 1949 | .extern_options => unreachable, | 1949 | .extern_options => unreachable, |
| ... | @@ -2311,7 +2311,7 @@ pub const Type = extern union { | ... | @@ -2311,7 +2311,7 @@ pub const Type = extern union { |
| 2311 | .address_space => return Value.initTag(.address_space_type), | 2311 | .address_space => return Value.initTag(.address_space_type), |
| 2312 | .float_mode => return Value.initTag(.float_mode_type), | 2312 | .float_mode => return Value.initTag(.float_mode_type), |
| 2313 | .reduce_op => return Value.initTag(.reduce_op_type), | 2313 | .reduce_op => return Value.initTag(.reduce_op_type), |
| 2314 | .call_options => return Value.initTag(.call_options_type), | 2314 | .modifier => return Value.initTag(.modifier_type), |
| 2315 | .prefetch_options => return Value.initTag(.prefetch_options_type), | 2315 | .prefetch_options => return Value.initTag(.prefetch_options_type), |
| 2316 | .export_options => return Value.initTag(.export_options_type), | 2316 | .export_options => return Value.initTag(.export_options_type), |
| 2317 | .extern_options => return Value.initTag(.extern_options_type), | 2317 | .extern_options => return Value.initTag(.extern_options_type), |
| ... | @@ -2385,7 +2385,7 @@ pub const Type = extern union { | ... | @@ -2385,7 +2385,7 @@ pub const Type = extern union { |
| 2385 | .address_space, | 2385 | .address_space, |
| 2386 | .float_mode, | 2386 | .float_mode, |
| 2387 | .reduce_op, | 2387 | .reduce_op, |
| 2388 | .call_options, | 2388 | .modifier, |
| 2389 | .prefetch_options, | 2389 | .prefetch_options, |
| 2390 | .export_options, | 2390 | .export_options, |
| 2391 | .extern_options, | 2391 | .extern_options, |
| ... | @@ -2631,7 +2631,7 @@ pub const Type = extern union { | ... | @@ -2631,7 +2631,7 @@ pub const Type = extern union { |
| 2631 | .address_space, | 2631 | .address_space, |
| 2632 | .float_mode, | 2632 | .float_mode, |
| 2633 | .reduce_op, | 2633 | .reduce_op, |
| 2634 | .call_options, | 2634 | .modifier, |
| 2635 | .prefetch_options, | 2635 | .prefetch_options, |
| 2636 | .export_options, | 2636 | .export_options, |
| 2637 | .extern_options, | 2637 | .extern_options, |
| ... | @@ -2873,7 +2873,7 @@ pub const Type = extern union { | ... | @@ -2873,7 +2873,7 @@ pub const Type = extern union { |
| 2873 | .address_space, | 2873 | .address_space, |
| 2874 | .float_mode, | 2874 | .float_mode, |
| 2875 | .reduce_op, | 2875 | .reduce_op, |
| 2876 | .call_options, | 2876 | .modifier, |
| 2877 | .prefetch_options, | 2877 | .prefetch_options, |
| 2878 | .export_options, | 2878 | .export_options, |
| 2879 | .extern_options, | 2879 | .extern_options, |
| ... | @@ -3257,7 +3257,7 @@ pub const Type = extern union { | ... | @@ -3257,7 +3257,7 @@ pub const Type = extern union { |
| 3257 | .inferred_alloc_mut => unreachable, | 3257 | .inferred_alloc_mut => unreachable, |
| 3258 | .var_args_param => unreachable, | 3258 | .var_args_param => unreachable, |
| 3259 | .generic_poison => unreachable, | 3259 | .generic_poison => unreachable, |
| 3260 | .call_options => unreachable, // missing call to resolveTypeFields | 3260 | .modifier => unreachable, // missing call to resolveTypeFields |
| 3261 | .prefetch_options => unreachable, // missing call to resolveTypeFields | 3261 | .prefetch_options => unreachable, // missing call to resolveTypeFields |
| 3262 | .export_options => unreachable, // missing call to resolveTypeFields | 3262 | .export_options => unreachable, // missing call to resolveTypeFields |
| 3263 | .extern_options => unreachable, // missing call to resolveTypeFields | 3263 | .extern_options => unreachable, // missing call to resolveTypeFields |
| ... | @@ -3753,7 +3753,7 @@ pub const Type = extern union { | ... | @@ -3753,7 +3753,7 @@ pub const Type = extern union { |
| 3753 | .address_space, | 3753 | .address_space, |
| 3754 | .float_mode, | 3754 | .float_mode, |
| 3755 | .reduce_op, | 3755 | .reduce_op, |
| 3756 | .call_options, | 3756 | .modifier, |
| 3757 | .prefetch_options, | 3757 | .prefetch_options, |
| 3758 | .export_options, | 3758 | .export_options, |
| 3759 | .extern_options, | 3759 | .extern_options, |
| ... | @@ -4279,7 +4279,7 @@ pub const Type = extern union { | ... | @@ -4279,7 +4279,7 @@ pub const Type = extern union { |
| 4279 | .address_space, | 4279 | .address_space, |
| 4280 | .float_mode, | 4280 | .float_mode, |
| 4281 | .reduce_op, | 4281 | .reduce_op, |
| 4282 | .call_options, | 4282 | .modifier, |
| 4283 | .prefetch_options, | 4283 | .prefetch_options, |
| 4284 | .export_options, | 4284 | .export_options, |
| 4285 | .extern_options, | 4285 | .extern_options, |
| ... | @@ -4306,7 +4306,7 @@ pub const Type = extern union { | ... | @@ -4306,7 +4306,7 @@ pub const Type = extern union { |
| 4306 | .address_space, | 4306 | .address_space, |
| 4307 | .float_mode, | 4307 | .float_mode, |
| 4308 | .reduce_op, | 4308 | .reduce_op, |
| 4309 | .call_options, | 4309 | .modifier, |
| 4310 | .prefetch_options, | 4310 | .prefetch_options, |
| 4311 | .export_options, | 4311 | .export_options, |
| 4312 | .extern_options, | 4312 | .extern_options, |
| ... | @@ -4990,7 +4990,7 @@ pub const Type = extern union { | ... | @@ -4990,7 +4990,7 @@ pub const Type = extern union { |
| 4990 | .address_space, | 4990 | .address_space, |
| 4991 | .float_mode, | 4991 | .float_mode, |
| 4992 | .reduce_op, | 4992 | .reduce_op, |
| 4993 | .call_options, | 4993 | .modifier, |
| 4994 | .prefetch_options, | 4994 | .prefetch_options, |
| 4995 | .export_options, | 4995 | .export_options, |
| 4996 | .extern_options, | 4996 | .extern_options, |
| ... | @@ -5165,7 +5165,7 @@ pub const Type = extern union { | ... | @@ -5165,7 +5165,7 @@ pub const Type = extern union { |
| 5165 | .address_space, | 5165 | .address_space, |
| 5166 | .float_mode, | 5166 | .float_mode, |
| 5167 | .reduce_op, | 5167 | .reduce_op, |
| 5168 | .call_options, | 5168 | .modifier, |
| 5169 | .prefetch_options, | 5169 | .prefetch_options, |
| 5170 | .export_options, | 5170 | .export_options, |
| 5171 | .extern_options, | 5171 | .extern_options, |
| ... | @@ -5483,7 +5483,7 @@ pub const Type = extern union { | ... | @@ -5483,7 +5483,7 @@ pub const Type = extern union { |
| 5483 | .address_space, | 5483 | .address_space, |
| 5484 | .float_mode, | 5484 | .float_mode, |
| 5485 | .reduce_op, | 5485 | .reduce_op, |
| 5486 | .call_options, | 5486 | .modifier, |
| 5487 | .prefetch_options, | 5487 | .prefetch_options, |
| 5488 | .export_options, | 5488 | .export_options, |
| 5489 | .extern_options, | 5489 | .extern_options, |
| ... | @@ -5565,7 +5565,7 @@ pub const Type = extern union { | ... | @@ -5565,7 +5565,7 @@ pub const Type = extern union { |
| 5565 | .address_space, | 5565 | .address_space, |
| 5566 | .float_mode, | 5566 | .float_mode, |
| 5567 | .reduce_op, | 5567 | .reduce_op, |
| 5568 | .call_options, | 5568 | .modifier, |
| 5569 | .prefetch_options, | 5569 | .prefetch_options, |
| 5570 | .export_options, | 5570 | .export_options, |
| 5571 | .extern_options, | 5571 | .extern_options, |
| ... | @@ -5878,7 +5878,7 @@ pub const Type = extern union { | ... | @@ -5878,7 +5878,7 @@ pub const Type = extern union { |
| 5878 | .address_space, | 5878 | .address_space, |
| 5879 | .float_mode, | 5879 | .float_mode, |
| 5880 | .reduce_op, | 5880 | .reduce_op, |
| 5881 | .call_options, | 5881 | .modifier, |
| 5882 | .prefetch_options, | 5882 | .prefetch_options, |
| 5883 | .export_options, | 5883 | .export_options, |
| 5884 | .extern_options, | 5884 | .extern_options, |
| ... | @@ -5926,7 +5926,7 @@ pub const Type = extern union { | ... | @@ -5926,7 +5926,7 @@ pub const Type = extern union { |
| 5926 | .address_space, | 5926 | .address_space, |
| 5927 | .float_mode, | 5927 | .float_mode, |
| 5928 | .reduce_op, | 5928 | .reduce_op, |
| 5929 | .call_options, | 5929 | .modifier, |
| 5930 | .prefetch_options, | 5930 | .prefetch_options, |
| 5931 | .export_options, | 5931 | .export_options, |
| 5932 | .extern_options, | 5932 | .extern_options, |
| ... | @@ -5991,7 +5991,7 @@ pub const Type = extern union { | ... | @@ -5991,7 +5991,7 @@ pub const Type = extern union { |
| 5991 | address_space, | 5991 | address_space, |
| 5992 | float_mode, | 5992 | float_mode, |
| 5993 | reduce_op, | 5993 | reduce_op, |
| 5994 | call_options, | 5994 | modifier, |
| 5995 | prefetch_options, | 5995 | prefetch_options, |
| 5996 | export_options, | 5996 | export_options, |
| 5997 | extern_options, | 5997 | extern_options, |
| ... | @@ -6131,7 +6131,7 @@ pub const Type = extern union { | ... | @@ -6131,7 +6131,7 @@ pub const Type = extern union { |
| 6131 | .address_space, | 6131 | .address_space, |
| 6132 | .float_mode, | 6132 | .float_mode, |
| 6133 | .reduce_op, | 6133 | .reduce_op, |
| 6134 | .call_options, | 6134 | .modifier, |
| 6135 | .prefetch_options, | 6135 | .prefetch_options, |
| 6136 | .export_options, | 6136 | .export_options, |
| 6137 | .extern_options, | 6137 | .extern_options, |
src/value.zig+5-5| ... | @@ -71,7 +71,7 @@ pub const Value = extern union { | ... | @@ -71,7 +71,7 @@ pub const Value = extern union { |
| 71 | address_space_type, | 71 | address_space_type, |
| 72 | float_mode_type, | 72 | float_mode_type, |
| 73 | reduce_op_type, | 73 | reduce_op_type, |
| 74 | call_options_type, | 74 | modifier_type, |
| 75 | prefetch_options_type, | 75 | prefetch_options_type, |
| 76 | export_options_type, | 76 | export_options_type, |
| 77 | extern_options_type, | 77 | extern_options_type, |
| ... | @@ -264,7 +264,7 @@ pub const Value = extern union { | ... | @@ -264,7 +264,7 @@ pub const Value = extern union { |
| 264 | .address_space_type, | 264 | .address_space_type, |
| 265 | .float_mode_type, | 265 | .float_mode_type, |
| 266 | .reduce_op_type, | 266 | .reduce_op_type, |
| 267 | .call_options_type, | 267 | .modifier_type, |
| 268 | .prefetch_options_type, | 268 | .prefetch_options_type, |
| 269 | .export_options_type, | 269 | .export_options_type, |
| 270 | .extern_options_type, | 270 | .extern_options_type, |
| ... | @@ -467,7 +467,7 @@ pub const Value = extern union { | ... | @@ -467,7 +467,7 @@ pub const Value = extern union { |
| 467 | .address_space_type, | 467 | .address_space_type, |
| 468 | .float_mode_type, | 468 | .float_mode_type, |
| 469 | .reduce_op_type, | 469 | .reduce_op_type, |
| 470 | .call_options_type, | 470 | .modifier_type, |
| 471 | .prefetch_options_type, | 471 | .prefetch_options_type, |
| 472 | .export_options_type, | 472 | .export_options_type, |
| 473 | .extern_options_type, | 473 | .extern_options_type, |
| ... | @@ -723,7 +723,7 @@ pub const Value = extern union { | ... | @@ -723,7 +723,7 @@ pub const Value = extern union { |
| 723 | .address_space_type => return out_stream.writeAll("std.builtin.AddressSpace"), | 723 | .address_space_type => return out_stream.writeAll("std.builtin.AddressSpace"), |
| 724 | .float_mode_type => return out_stream.writeAll("std.builtin.FloatMode"), | 724 | .float_mode_type => return out_stream.writeAll("std.builtin.FloatMode"), |
| 725 | .reduce_op_type => return out_stream.writeAll("std.builtin.ReduceOp"), | 725 | .reduce_op_type => return out_stream.writeAll("std.builtin.ReduceOp"), |
| 726 | .call_options_type => return out_stream.writeAll("std.builtin.CallOptions"), | 726 | .modifier_type => return out_stream.writeAll("std.builtin.CallModifier"), |
| 727 | .prefetch_options_type => return out_stream.writeAll("std.builtin.PrefetchOptions"), | 727 | .prefetch_options_type => return out_stream.writeAll("std.builtin.PrefetchOptions"), |
| 728 | .export_options_type => return out_stream.writeAll("std.builtin.ExportOptions"), | 728 | .export_options_type => return out_stream.writeAll("std.builtin.ExportOptions"), |
| 729 | .extern_options_type => return out_stream.writeAll("std.builtin.ExternOptions"), | 729 | .extern_options_type => return out_stream.writeAll("std.builtin.ExternOptions"), |
| ... | @@ -963,7 +963,7 @@ pub const Value = extern union { | ... | @@ -963,7 +963,7 @@ pub const Value = extern union { |
| 963 | .address_space_type => Type.initTag(.address_space), | 963 | .address_space_type => Type.initTag(.address_space), |
| 964 | .float_mode_type => Type.initTag(.float_mode), | 964 | .float_mode_type => Type.initTag(.float_mode), |
| 965 | .reduce_op_type => Type.initTag(.reduce_op), | 965 | .reduce_op_type => Type.initTag(.reduce_op), |
| 966 | .call_options_type => Type.initTag(.call_options), | 966 | .modifier_type => Type.initTag(.modifier), |
| 967 | .prefetch_options_type => Type.initTag(.prefetch_options), | 967 | .prefetch_options_type => Type.initTag(.prefetch_options), |
| 968 | .export_options_type => Type.initTag(.export_options), | 968 | .export_options_type => Type.initTag(.export_options), |
| 969 | .extern_options_type => Type.initTag(.extern_options), | 969 | .extern_options_type => Type.initTag(.extern_options), |
stage1/zig1.wasm| Binary files a/stage1/zig1.wasm and b/stage1/zig1.wasm differ | |||
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; |