diff options
| author | Andrew Kelley <andrew@ziglang.org> | 2019-12-06 15:49:47 -0500 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2019-12-06 15:49:47 -0500 |
| commit | 525b1e8fb4abc38143a6ae47272fd5d016ba7eeb (patch) | |
| tree | ee16b05de3828936971df6d977e75d5825b10547 /lib/std/special | |
| parent | d28aa38db71a861fd2036efbb22e57c1d34a5615 (diff) | |
| parent | 656cc33f8d49cb5e79cd3f9f8f56963747d43ed6 (diff) | |
| download | zig-525b1e8fb4abc38143a6ae47272fd5d016ba7eeb.tar.gz zig-525b1e8fb4abc38143a6ae47272fd5d016ba7eeb.zip | |
Merge pull request #3856 from ziglang/builtin-call
introduce `@call` and remove other builtin calls
Diffstat (limited to 'lib/std/special')
| -rw-r--r-- | lib/std/special/compiler_rt/arm/aeabi_dcmp.zig | 10 | ||||
| -rw-r--r-- | lib/std/special/compiler_rt/arm/aeabi_fcmp.zig | 10 | ||||
| -rw-r--r-- | lib/std/special/compiler_rt/divti3.zig | 5 | ||||
| -rw-r--r-- | lib/std/special/compiler_rt/extendXfYf2.zig | 8 | ||||
| -rw-r--r-- | lib/std/special/compiler_rt/floatsiXf.zig | 6 | ||||
| -rw-r--r-- | lib/std/special/compiler_rt/modti3.zig | 5 | ||||
| -rw-r--r-- | lib/std/special/compiler_rt/multi3.zig | 5 | ||||
| -rw-r--r-- | lib/std/special/compiler_rt/stack_probe.zig | 12 | ||||
| -rw-r--r-- | lib/std/special/compiler_rt/umodti3.zig | 5 | ||||
| -rw-r--r-- | lib/std/special/start.zig | 14 |
10 files changed, 46 insertions, 34 deletions
diff --git a/lib/std/special/compiler_rt/arm/aeabi_dcmp.zig b/lib/std/special/compiler_rt/arm/aeabi_dcmp.zig index 33bfdabcfb..7463c49931 100644 --- a/lib/std/special/compiler_rt/arm/aeabi_dcmp.zig +++ b/lib/std/special/compiler_rt/arm/aeabi_dcmp.zig @@ -14,31 +14,31 @@ const ConditionalOperator = enum { pub nakedcc fn __aeabi_dcmpeq() noreturn { @setRuntimeSafety(false); - @inlineCall(aeabi_dcmp, .Eq); + @call(.{ .modifier = .always_inline }, aeabi_dcmp, .{.Eq}); unreachable; } pub nakedcc fn __aeabi_dcmplt() noreturn { @setRuntimeSafety(false); - @inlineCall(aeabi_dcmp, .Lt); + @call(.{ .modifier = .always_inline }, aeabi_dcmp, .{.Lt}); unreachable; } pub nakedcc fn __aeabi_dcmple() noreturn { @setRuntimeSafety(false); - @inlineCall(aeabi_dcmp, .Le); + @call(.{ .modifier = .always_inline }, aeabi_dcmp, .{.Le}); unreachable; } pub nakedcc fn __aeabi_dcmpge() noreturn { @setRuntimeSafety(false); - @inlineCall(aeabi_dcmp, .Ge); + @call(.{ .modifier = .always_inline }, aeabi_dcmp, .{.Ge}); unreachable; } pub nakedcc fn __aeabi_dcmpgt() noreturn { @setRuntimeSafety(false); - @inlineCall(aeabi_dcmp, .Gt); + @call(.{ .modifier = .always_inline }, aeabi_dcmp, .{.Gt}); unreachable; } diff --git a/lib/std/special/compiler_rt/arm/aeabi_fcmp.zig b/lib/std/special/compiler_rt/arm/aeabi_fcmp.zig index cc5efc64fc..9a24641d9a 100644 --- a/lib/std/special/compiler_rt/arm/aeabi_fcmp.zig +++ b/lib/std/special/compiler_rt/arm/aeabi_fcmp.zig @@ -14,31 +14,31 @@ const ConditionalOperator = enum { pub nakedcc fn __aeabi_fcmpeq() noreturn { @setRuntimeSafety(false); - @inlineCall(aeabi_fcmp, .Eq); + @call(.{ .modifier = .always_inline }, aeabi_fcmp, .{.Eq}); unreachable; } pub nakedcc fn __aeabi_fcmplt() noreturn { @setRuntimeSafety(false); - @inlineCall(aeabi_fcmp, .Lt); + @call(.{ .modifier = .always_inline }, aeabi_fcmp, .{.Lt}); unreachable; } pub nakedcc fn __aeabi_fcmple() noreturn { @setRuntimeSafety(false); - @inlineCall(aeabi_fcmp, .Le); + @call(.{ .modifier = .always_inline }, aeabi_fcmp, .{.Le}); unreachable; } pub nakedcc fn __aeabi_fcmpge() noreturn { @setRuntimeSafety(false); - @inlineCall(aeabi_fcmp, .Ge); + @call(.{ .modifier = .always_inline }, aeabi_fcmp, .{.Ge}); unreachable; } pub nakedcc fn __aeabi_fcmpgt() noreturn { @setRuntimeSafety(false); - @inlineCall(aeabi_fcmp, .Gt); + @call(.{ .modifier = .always_inline }, aeabi_fcmp, .{.Gt}); unreachable; } diff --git a/lib/std/special/compiler_rt/divti3.zig b/lib/std/special/compiler_rt/divti3.zig index 477ce2cb98..fcb23a50d9 100644 --- a/lib/std/special/compiler_rt/divti3.zig +++ b/lib/std/special/compiler_rt/divti3.zig @@ -17,7 +17,10 @@ pub extern fn __divti3(a: i128, b: i128) i128 { const v128 = @Vector(2, u64); pub extern fn __divti3_windows_x86_64(a: v128, b: v128) v128 { - return @bitCast(v128, @inlineCall(__divti3, @bitCast(i128, a), @bitCast(i128, b))); + return @bitCast(v128, @call(.{ .modifier = .always_inline }, __divti3, .{ + @bitCast(i128, a), + @bitCast(i128, b), + })); } test "import divti3" { diff --git a/lib/std/special/compiler_rt/extendXfYf2.zig b/lib/std/special/compiler_rt/extendXfYf2.zig index 3bdc5164e2..427bd4ec24 100644 --- a/lib/std/special/compiler_rt/extendXfYf2.zig +++ b/lib/std/special/compiler_rt/extendXfYf2.zig @@ -3,19 +3,19 @@ const builtin = @import("builtin"); const is_test = builtin.is_test; pub extern fn __extendsfdf2(a: f32) f64 { - return @inlineCall(extendXfYf2, f64, f32, @bitCast(u32, a)); + return @call(.{ .modifier = .always_inline }, extendXfYf2, .{ f64, f32, @bitCast(u32, a) }); } pub extern fn __extenddftf2(a: f64) f128 { - return @inlineCall(extendXfYf2, f128, f64, @bitCast(u64, a)); + return @call(.{ .modifier = .always_inline }, extendXfYf2, .{ f128, f64, @bitCast(u64, a) }); } pub extern fn __extendsftf2(a: f32) f128 { - return @inlineCall(extendXfYf2, f128, f32, @bitCast(u32, a)); + return @call(.{ .modifier = .always_inline }, extendXfYf2, .{ f128, f32, @bitCast(u32, a) }); } pub extern fn __extendhfsf2(a: u16) f32 { - return @inlineCall(extendXfYf2, f32, f16, a); + return @call(.{ .modifier = .always_inline }, extendXfYf2, .{ f32, f16, a }); } const CHAR_BIT = 8; diff --git a/lib/std/special/compiler_rt/floatsiXf.zig b/lib/std/special/compiler_rt/floatsiXf.zig index 714681834d..917dfb47fc 100644 --- a/lib/std/special/compiler_rt/floatsiXf.zig +++ b/lib/std/special/compiler_rt/floatsiXf.zig @@ -55,17 +55,17 @@ fn floatsiXf(comptime T: type, a: i32) T { pub extern fn __floatsisf(arg: i32) f32 { @setRuntimeSafety(builtin.is_test); - return @inlineCall(floatsiXf, f32, arg); + return @call(.{ .modifier = .always_inline }, floatsiXf, .{ f32, arg }); } pub extern fn __floatsidf(arg: i32) f64 { @setRuntimeSafety(builtin.is_test); - return @inlineCall(floatsiXf, f64, arg); + return @call(.{ .modifier = .always_inline }, floatsiXf, .{ f64, arg }); } pub extern fn __floatsitf(arg: i32) f128 { @setRuntimeSafety(builtin.is_test); - return @inlineCall(floatsiXf, f128, arg); + return @call(.{ .modifier = .always_inline }, floatsiXf, .{ f128, arg }); } fn test_one_floatsitf(a: i32, expected: u128) void { diff --git a/lib/std/special/compiler_rt/modti3.zig b/lib/std/special/compiler_rt/modti3.zig index 16f2f38ba3..d983ecba5f 100644 --- a/lib/std/special/compiler_rt/modti3.zig +++ b/lib/std/special/compiler_rt/modti3.zig @@ -22,7 +22,10 @@ pub extern fn __modti3(a: i128, b: i128) i128 { const v128 = @Vector(2, u64); pub extern fn __modti3_windows_x86_64(a: v128, b: v128) v128 { - return @bitCast(v128, @inlineCall(__modti3, @bitCast(i128, a), @bitCast(i128, b))); + return @bitCast(v128, @call(.{ .modifier = .always_inline }, __modti3, .{ + @bitCast(i128, a), + @bitCast(i128, b), + })); } test "import modti3" { diff --git a/lib/std/special/compiler_rt/multi3.zig b/lib/std/special/compiler_rt/multi3.zig index f3b74b85d9..56ff56cbb2 100644 --- a/lib/std/special/compiler_rt/multi3.zig +++ b/lib/std/special/compiler_rt/multi3.zig @@ -16,7 +16,10 @@ pub extern fn __multi3(a: i128, b: i128) i128 { const v128 = @Vector(2, u64); pub extern fn __multi3_windows_x86_64(a: v128, b: v128) v128 { - return @bitCast(v128, @inlineCall(__multi3, @bitCast(i128, a), @bitCast(i128, b))); + return @bitCast(v128, @call(.{ .modifier = .always_inline }, __multi3, .{ + @bitCast(i128, a), + @bitCast(i128, b), + })); } fn __mulddi3(a: u64, b: u64) i128 { diff --git a/lib/std/special/compiler_rt/stack_probe.zig b/lib/std/special/compiler_rt/stack_probe.zig index c3e534c8ec..6406f3977a 100644 --- a/lib/std/special/compiler_rt/stack_probe.zig +++ b/lib/std/special/compiler_rt/stack_probe.zig @@ -182,25 +182,25 @@ fn win_probe_stack_adjust_sp() void { pub nakedcc fn _chkstk() void { @setRuntimeSafety(false); - @inlineCall(win_probe_stack_adjust_sp); + @call(.{ .modifier = .always_inline }, win_probe_stack_adjust_sp, .{}); } pub nakedcc fn __chkstk() void { @setRuntimeSafety(false); switch (builtin.arch) { - .i386 => @inlineCall(win_probe_stack_adjust_sp), - .x86_64 => @inlineCall(win_probe_stack_only), + .i386 => @call(.{ .modifier = .always_inline }, win_probe_stack_adjust_sp, .{}), + .x86_64 => @call(.{ .modifier = .always_inline }, win_probe_stack_only, .{}), else => unreachable, } } pub nakedcc fn ___chkstk() void { @setRuntimeSafety(false); - @inlineCall(win_probe_stack_adjust_sp); + @call(.{ .modifier = .always_inline }, win_probe_stack_adjust_sp, .{}); } pub nakedcc fn __chkstk_ms() void { @setRuntimeSafety(false); - @inlineCall(win_probe_stack_only); + @call(.{ .modifier = .always_inline }, win_probe_stack_only, .{}); } pub nakedcc fn ___chkstk_ms() void { @setRuntimeSafety(false); - @inlineCall(win_probe_stack_only); + @call(.{ .modifier = .always_inline }, win_probe_stack_only, .{}); } diff --git a/lib/std/special/compiler_rt/umodti3.zig b/lib/std/special/compiler_rt/umodti3.zig index 7add0b2ffe..9d4a42147c 100644 --- a/lib/std/special/compiler_rt/umodti3.zig +++ b/lib/std/special/compiler_rt/umodti3.zig @@ -11,5 +11,8 @@ pub extern fn __umodti3(a: u128, b: u128) u128 { const v128 = @Vector(2, u64); pub extern fn __umodti3_windows_x86_64(a: v128, b: v128) v128 { - return @bitCast(v128, @inlineCall(__umodti3, @bitCast(u128, a), @bitCast(u128, b))); + return @bitCast(v128, @call(.{ .modifier = .always_inline }, __umodti3, .{ + @bitCast(u128, a), + @bitCast(u128, b), + })); } diff --git a/lib/std/special/start.zig b/lib/std/special/start.zig index 9c24e38137..d6c6350ff4 100644 --- a/lib/std/special/start.zig +++ b/lib/std/special/start.zig @@ -61,7 +61,7 @@ stdcallcc fn _DllMainCRTStartup( extern fn wasm_freestanding_start() void { // This is marked inline because for some reason LLVM in release mode fails to inline it, // and we want fewer call frames in stack traces. - _ = @inlineCall(callMain); + _ = @call(.{ .modifier = .always_inline }, callMain, .{}); } extern fn EfiMain(handle: uefi.Handle, system_table: *uefi.tables.SystemTable) usize { @@ -91,7 +91,7 @@ nakedcc fn _start() noreturn { if (builtin.os == builtin.Os.wasi) { // This is marked inline because for some reason LLVM in release mode fails to inline it, // and we want fewer call frames in stack traces. - std.os.wasi.proc_exit(@inlineCall(callMain)); + std.os.wasi.proc_exit(@call(.{ .modifier = .always_inline }, callMain, .{})); } switch (builtin.arch) { @@ -127,7 +127,7 @@ nakedcc fn _start() noreturn { } // If LLVM inlines stack variables into _start, they will overwrite // the command line argument data. - @noInlineCall(posixCallMainAndExit); + @call(.{ .modifier = .never_inline }, posixCallMainAndExit, .{}); } stdcallcc fn WinMainCRTStartup() noreturn { @@ -186,10 +186,10 @@ fn posixCallMainAndExit() noreturn { // 0, //) catch @panic("out of memory"); //std.os.mprotect(new_stack[0..std.mem.page_size], std.os.PROT_NONE) catch {}; - //std.os.exit(@newStackCall(new_stack, callMainWithArgs, argc, argv, envp)); + //std.os.exit(@call(.{.stack = new_stack}, callMainWithArgs, .{argc, argv, envp})); } - std.os.exit(@inlineCall(callMainWithArgs, argc, argv, envp)); + std.os.exit(@call(.{ .modifier = .always_inline }, callMainWithArgs, .{ argc, argv, envp })); } fn callMainWithArgs(argc: usize, argv: [*][*:0]u8, envp: [][*:0]u8) u8 { @@ -205,7 +205,7 @@ extern fn main(c_argc: i32, c_argv: [*][*:0]u8, c_envp: [*:null]?[*:0]u8) i32 { var env_count: usize = 0; while (c_envp[env_count] != null) : (env_count += 1) {} const envp = @ptrCast([*][*:0]u8, c_envp)[0..env_count]; - return @inlineCall(callMainWithArgs, @intCast(usize, c_argc), c_argv, envp); + return @call(.{ .modifier = .always_inline }, callMainWithArgs, .{ @intCast(usize, c_argc), c_argv, envp }); } // General error message for a malformed return type @@ -235,7 +235,7 @@ inline fn initEventLoopAndCallMain() u8 { // This is marked inline because for some reason LLVM in release mode fails to inline it, // and we want fewer call frames in stack traces. - return @inlineCall(callMain); + return @call(.{ .modifier = .always_inline }, callMain, .{}); } async fn callMainAsync(loop: *std.event.Loop) u8 { |
