| author | |
| committer | |
| log | e6955688ac2255d3813e8d2994b6661bc651369b |
| tree | 9879154a5e02b77e95c1cf04a7cde64cb7adc727 |
| parent | fde6d28c237fbeae2ace8f2834190c6f9752712a |
| parent | fdfdac493998a180eeffdcab66e579e7af250039 |
| signature | Signed by PGP key 4AEE18F83AFDEB23 |
Noasync to nosuspend28 files changed, 233 insertions(+), 208 deletions(-)
doc/docgen.zig+1-1| ... | @@ -802,8 +802,8 @@ fn tokenizeAndPrintRaw(docgen_tokenizer: *Tokenizer, out: var, source_token: Tok | ... | @@ -802,8 +802,8 @@ fn tokenizeAndPrintRaw(docgen_tokenizer: *Tokenizer, out: var, source_token: Tok |
| 802 | .Keyword_inline, | 802 | .Keyword_inline, |
| 803 | .Keyword_nakedcc, | 803 | .Keyword_nakedcc, |
| 804 | .Keyword_noalias, | 804 | .Keyword_noalias, |
| 805 | .Keyword_noasync, | ||
| 806 | .Keyword_noinline, | 805 | .Keyword_noinline, |
| 806 | .Keyword_nosuspend, | ||
| 807 | .Keyword_or, | 807 | .Keyword_or, |
| 808 | .Keyword_orelse, | 808 | .Keyword_orelse, |
| 809 | .Keyword_packed, | 809 | .Keyword_packed, |
lib/std/debug.zig+15-15| ... | @@ -62,7 +62,7 @@ pub fn warn(comptime fmt: []const u8, args: var) void { | ... | @@ -62,7 +62,7 @@ pub fn warn(comptime fmt: []const u8, args: var) void { |
| 62 | const held = stderr_mutex.acquire(); | 62 | const held = stderr_mutex.acquire(); |
| 63 | defer held.release(); | 63 | defer held.release(); |
| 64 | const stderr = getStderrStream(); | 64 | const stderr = getStderrStream(); |
| 65 | noasync stderr.print(fmt, args) catch return; | 65 | nosuspend stderr.print(fmt, args) catch return; |
| 66 | } | 66 | } |
| 67 | 67 | ||
| 68 | pub fn getStderrStream() *File.OutStream { | 68 | pub fn getStderrStream() *File.OutStream { |
| ... | @@ -112,7 +112,7 @@ pub fn detectTTYConfig() TTY.Config { | ... | @@ -112,7 +112,7 @@ pub fn detectTTYConfig() TTY.Config { |
| 112 | /// Tries to print the current stack trace to stderr, unbuffered, and ignores any error returned. | 112 | /// Tries to print the current stack trace to stderr, unbuffered, and ignores any error returned. |
| 113 | /// TODO multithreaded awareness | 113 | /// TODO multithreaded awareness |
| 114 | pub fn dumpCurrentStackTrace(start_addr: ?usize) void { | 114 | pub fn dumpCurrentStackTrace(start_addr: ?usize) void { |
| 115 | noasync { | 115 | nosuspend { |
| 116 | const stderr = getStderrStream(); | 116 | const stderr = getStderrStream(); |
| 117 | if (builtin.strip_debug_info) { | 117 | if (builtin.strip_debug_info) { |
| 118 | stderr.print("Unable to dump stack trace: debug info stripped\n", .{}) catch return; | 118 | stderr.print("Unable to dump stack trace: debug info stripped\n", .{}) catch return; |
| ... | @@ -133,7 +133,7 @@ pub fn dumpCurrentStackTrace(start_addr: ?usize) void { | ... | @@ -133,7 +133,7 @@ pub fn dumpCurrentStackTrace(start_addr: ?usize) void { |
| 133 | /// unbuffered, and ignores any error returned. | 133 | /// unbuffered, and ignores any error returned. |
| 134 | /// TODO multithreaded awareness | 134 | /// TODO multithreaded awareness |
| 135 | pub fn dumpStackTraceFromBase(bp: usize, ip: usize) void { | 135 | pub fn dumpStackTraceFromBase(bp: usize, ip: usize) void { |
| 136 | noasync { | 136 | nosuspend { |
| 137 | const stderr = getStderrStream(); | 137 | const stderr = getStderrStream(); |
| 138 | if (builtin.strip_debug_info) { | 138 | if (builtin.strip_debug_info) { |
| 139 | stderr.print("Unable to dump stack trace: debug info stripped\n", .{}) catch return; | 139 | stderr.print("Unable to dump stack trace: debug info stripped\n", .{}) catch return; |
| ... | @@ -203,7 +203,7 @@ pub fn captureStackTrace(first_address: ?usize, stack_trace: *builtin.StackTrace | ... | @@ -203,7 +203,7 @@ pub fn captureStackTrace(first_address: ?usize, stack_trace: *builtin.StackTrace |
| 203 | /// Tries to print a stack trace to stderr, unbuffered, and ignores any error returned. | 203 | /// Tries to print a stack trace to stderr, unbuffered, and ignores any error returned. |
| 204 | /// TODO multithreaded awareness | 204 | /// TODO multithreaded awareness |
| 205 | pub fn dumpStackTrace(stack_trace: builtin.StackTrace) void { | 205 | pub fn dumpStackTrace(stack_trace: builtin.StackTrace) void { |
| 206 | noasync { | 206 | nosuspend { |
| 207 | const stderr = getStderrStream(); | 207 | const stderr = getStderrStream(); |
| 208 | if (builtin.strip_debug_info) { | 208 | if (builtin.strip_debug_info) { |
| 209 | stderr.print("Unable to dump stack trace: debug info stripped\n", .{}) catch return; | 209 | stderr.print("Unable to dump stack trace: debug info stripped\n", .{}) catch return; |
| ... | @@ -261,7 +261,7 @@ pub fn panicExtra(trace: ?*const builtin.StackTrace, first_trace_addr: ?usize, c | ... | @@ -261,7 +261,7 @@ pub fn panicExtra(trace: ?*const builtin.StackTrace, first_trace_addr: ?usize, c |
| 261 | resetSegfaultHandler(); | 261 | resetSegfaultHandler(); |
| 262 | } | 262 | } |
| 263 | 263 | ||
| 264 | noasync switch (panic_stage) { | 264 | nosuspend switch (panic_stage) { |
| 265 | 0 => { | 265 | 0 => { |
| 266 | panic_stage = 1; | 266 | panic_stage = 1; |
| 267 | 267 | ||
| ... | @@ -447,7 +447,7 @@ pub const TTY = struct { | ... | @@ -447,7 +447,7 @@ pub const TTY = struct { |
| 447 | windows_api, | 447 | windows_api, |
| 448 | 448 | ||
| 449 | fn setColor(conf: Config, out_stream: var, color: Color) void { | 449 | fn setColor(conf: Config, out_stream: var, color: Color) void { |
| 450 | noasync switch (conf) { | 450 | nosuspend switch (conf) { |
| 451 | .no_color => return, | 451 | .no_color => return, |
| 452 | .escape_codes => switch (color) { | 452 | .escape_codes => switch (color) { |
| 453 | .Red => out_stream.writeAll(RED) catch return, | 453 | .Red => out_stream.writeAll(RED) catch return, |
| ... | @@ -604,7 +604,7 @@ fn printLineInfo( | ... | @@ -604,7 +604,7 @@ fn printLineInfo( |
| 604 | tty_config: TTY.Config, | 604 | tty_config: TTY.Config, |
| 605 | comptime printLineFromFile: var, | 605 | comptime printLineFromFile: var, |
| 606 | ) !void { | 606 | ) !void { |
| 607 | noasync { | 607 | nosuspend { |
| 608 | tty_config.setColor(out_stream, .White); | 608 | tty_config.setColor(out_stream, .White); |
| 609 | 609 | ||
| 610 | if (line_info) |*li| { | 610 | if (line_info) |*li| { |
| ... | @@ -651,7 +651,7 @@ pub const OpenSelfDebugInfoError = error{ | ... | @@ -651,7 +651,7 @@ pub const OpenSelfDebugInfoError = error{ |
| 651 | 651 | ||
| 652 | /// TODO resources https://github.com/ziglang/zig/issues/4353 | 652 | /// TODO resources https://github.com/ziglang/zig/issues/4353 |
| 653 | pub fn openSelfDebugInfo(allocator: *mem.Allocator) anyerror!DebugInfo { | 653 | pub fn openSelfDebugInfo(allocator: *mem.Allocator) anyerror!DebugInfo { |
| 654 | noasync { | 654 | nosuspend { |
| 655 | if (builtin.strip_debug_info) | 655 | if (builtin.strip_debug_info) |
| 656 | return error.MissingDebugInfo; | 656 | return error.MissingDebugInfo; |
| 657 | if (@hasDecl(root, "os") and @hasDecl(root.os, "debug") and @hasDecl(root.os.debug, "openSelfDebugInfo")) { | 657 | if (@hasDecl(root, "os") and @hasDecl(root.os, "debug") and @hasDecl(root.os.debug, "openSelfDebugInfo")) { |
| ... | @@ -672,7 +672,7 @@ pub fn openSelfDebugInfo(allocator: *mem.Allocator) anyerror!DebugInfo { | ... | @@ -672,7 +672,7 @@ pub fn openSelfDebugInfo(allocator: *mem.Allocator) anyerror!DebugInfo { |
| 672 | 672 | ||
| 673 | /// TODO resources https://github.com/ziglang/zig/issues/4353 | 673 | /// TODO resources https://github.com/ziglang/zig/issues/4353 |
| 674 | fn openCoffDebugInfo(allocator: *mem.Allocator, coff_file_path: [:0]const u16) !ModuleDebugInfo { | 674 | fn openCoffDebugInfo(allocator: *mem.Allocator, coff_file_path: [:0]const u16) !ModuleDebugInfo { |
| 675 | noasync { | 675 | nosuspend { |
| 676 | const coff_file = try std.fs.openFileAbsoluteW(coff_file_path, .{ .intended_io_mode = .blocking }); | 676 | const coff_file = try std.fs.openFileAbsoluteW(coff_file_path, .{ .intended_io_mode = .blocking }); |
| 677 | errdefer coff_file.close(); | 677 | errdefer coff_file.close(); |
| 678 | 678 | ||
| ... | @@ -853,7 +853,7 @@ fn chopSlice(ptr: []const u8, offset: u64, size: u64) ![]const u8 { | ... | @@ -853,7 +853,7 @@ fn chopSlice(ptr: []const u8, offset: u64, size: u64) ![]const u8 { |
| 853 | 853 | ||
| 854 | /// TODO resources https://github.com/ziglang/zig/issues/4353 | 854 | /// TODO resources https://github.com/ziglang/zig/issues/4353 |
| 855 | pub fn openElfDebugInfo(allocator: *mem.Allocator, elf_file_path: []const u8) !ModuleDebugInfo { | 855 | pub fn openElfDebugInfo(allocator: *mem.Allocator, elf_file_path: []const u8) !ModuleDebugInfo { |
| 856 | noasync { | 856 | nosuspend { |
| 857 | const mapped_mem = try mapWholeFile(elf_file_path); | 857 | const mapped_mem = try mapWholeFile(elf_file_path); |
| 858 | const hdr = @ptrCast(*const elf.Ehdr, &mapped_mem[0]); | 858 | const hdr = @ptrCast(*const elf.Ehdr, &mapped_mem[0]); |
| 859 | if (!mem.eql(u8, hdr.e_ident[0..4], "\x7fELF")) return error.InvalidElfMagic; | 859 | if (!mem.eql(u8, hdr.e_ident[0..4], "\x7fELF")) return error.InvalidElfMagic; |
| ... | @@ -1056,7 +1056,7 @@ const MachoSymbol = struct { | ... | @@ -1056,7 +1056,7 @@ const MachoSymbol = struct { |
| 1056 | }; | 1056 | }; |
| 1057 | 1057 | ||
| 1058 | fn mapWholeFile(path: []const u8) ![]align(mem.page_size) const u8 { | 1058 | fn mapWholeFile(path: []const u8) ![]align(mem.page_size) const u8 { |
| 1059 | noasync { | 1059 | nosuspend { |
| 1060 | const file = try fs.cwd().openFile(path, .{ .intended_io_mode = .blocking }); | 1060 | const file = try fs.cwd().openFile(path, .{ .intended_io_mode = .blocking }); |
| 1061 | defer file.close(); | 1061 | defer file.close(); |
| 1062 | 1062 | ||
| ... | @@ -1418,7 +1418,7 @@ pub const ModuleDebugInfo = switch (builtin.os.tag) { | ... | @@ -1418,7 +1418,7 @@ pub const ModuleDebugInfo = switch (builtin.os.tag) { |
| 1418 | } | 1418 | } |
| 1419 | 1419 | ||
| 1420 | fn getSymbolAtAddress(self: *@This(), address: usize) !SymbolInfo { | 1420 | fn getSymbolAtAddress(self: *@This(), address: usize) !SymbolInfo { |
| 1421 | noasync { | 1421 | nosuspend { |
| 1422 | // Translate the VA into an address into this object | 1422 | // Translate the VA into an address into this object |
| 1423 | const relocated_address = address - self.base_address; | 1423 | const relocated_address = address - self.base_address; |
| 1424 | assert(relocated_address >= 0x100000000); | 1424 | assert(relocated_address >= 0x100000000); |
| ... | @@ -1643,14 +1643,14 @@ pub const ModuleDebugInfo = switch (builtin.os.tag) { | ... | @@ -1643,14 +1643,14 @@ pub const ModuleDebugInfo = switch (builtin.os.tag) { |
| 1643 | // Translate the VA into an address into this object | 1643 | // Translate the VA into an address into this object |
| 1644 | const relocated_address = address - self.base_address; | 1644 | const relocated_address = address - self.base_address; |
| 1645 | 1645 | ||
| 1646 | if (noasync self.dwarf.findCompileUnit(relocated_address)) |compile_unit| { | 1646 | if (nosuspend self.dwarf.findCompileUnit(relocated_address)) |compile_unit| { |
| 1647 | return SymbolInfo{ | 1647 | return SymbolInfo{ |
| 1648 | .symbol_name = noasync self.dwarf.getSymbolName(relocated_address) orelse "???", | 1648 | .symbol_name = nosuspend self.dwarf.getSymbolName(relocated_address) orelse "???", |
| 1649 | .compile_unit_name = compile_unit.die.getAttrString(&self.dwarf, DW.AT_name) catch |err| switch (err) { | 1649 | .compile_unit_name = compile_unit.die.getAttrString(&self.dwarf, DW.AT_name) catch |err| switch (err) { |
| 1650 | error.MissingDebugInfo, error.InvalidDebugInfo => "???", | 1650 | error.MissingDebugInfo, error.InvalidDebugInfo => "???", |
| 1651 | else => return err, | 1651 | else => return err, |
| 1652 | }, | 1652 | }, |
| 1653 | .line_info = noasync self.dwarf.getLineNumberInfo(compile_unit.*, relocated_address) catch |err| switch (err) { | 1653 | .line_info = nosuspend self.dwarf.getLineNumberInfo(compile_unit.*, relocated_address) catch |err| switch (err) { |
| 1654 | error.MissingDebugInfo, error.InvalidDebugInfo => null, | 1654 | error.MissingDebugInfo, error.InvalidDebugInfo => null, |
| 1655 | else => return err, | 1655 | else => return err, |
| 1656 | }, | 1656 | }, |
lib/std/dwarf.zig+25-25| ... | @@ -248,17 +248,17 @@ fn readUnitLength(in_stream: var, endian: builtin.Endian, is_64: *bool) !u64 { | ... | @@ -248,17 +248,17 @@ fn readUnitLength(in_stream: var, endian: builtin.Endian, is_64: *bool) !u64 { |
| 248 | } | 248 | } |
| 249 | } | 249 | } |
| 250 | 250 | ||
| 251 | // TODO the noasyncs here are workarounds | 251 | // TODO the nosuspends here are workarounds |
| 252 | fn readAllocBytes(allocator: *mem.Allocator, in_stream: var, size: usize) ![]u8 { | 252 | fn readAllocBytes(allocator: *mem.Allocator, in_stream: var, size: usize) ![]u8 { |
| 253 | const buf = try allocator.alloc(u8, size); | 253 | const buf = try allocator.alloc(u8, size); |
| 254 | errdefer allocator.free(buf); | 254 | errdefer allocator.free(buf); |
| 255 | if ((try noasync in_stream.read(buf)) < size) return error.EndOfFile; | 255 | if ((try nosuspend in_stream.read(buf)) < size) return error.EndOfFile; |
| 256 | return buf; | 256 | return buf; |
| 257 | } | 257 | } |
| 258 | 258 | ||
| 259 | // TODO the noasyncs here are workarounds | 259 | // TODO the nosuspends here are workarounds |
| 260 | fn readAddress(in_stream: var, endian: builtin.Endian, is_64: bool) !u64 { | 260 | fn readAddress(in_stream: var, endian: builtin.Endian, is_64: bool) !u64 { |
| 261 | return noasync if (is_64) | 261 | return nosuspend if (is_64) |
| 262 | try in_stream.readInt(u64, endian) | 262 | try in_stream.readInt(u64, endian) |
| 263 | else | 263 | else |
| 264 | @as(u64, try in_stream.readInt(u32, endian)); | 264 | @as(u64, try in_stream.readInt(u32, endian)); |
| ... | @@ -269,29 +269,29 @@ fn parseFormValueBlockLen(allocator: *mem.Allocator, in_stream: var, size: usize | ... | @@ -269,29 +269,29 @@ fn parseFormValueBlockLen(allocator: *mem.Allocator, in_stream: var, size: usize |
| 269 | return FormValue{ .Block = buf }; | 269 | return FormValue{ .Block = buf }; |
| 270 | } | 270 | } |
| 271 | 271 | ||
| 272 | // TODO the noasyncs here are workarounds | 272 | // TODO the nosuspends here are workarounds |
| 273 | fn parseFormValueBlock(allocator: *mem.Allocator, in_stream: var, endian: builtin.Endian, size: usize) !FormValue { | 273 | fn parseFormValueBlock(allocator: *mem.Allocator, in_stream: var, endian: builtin.Endian, size: usize) !FormValue { |
| 274 | const block_len = try noasync in_stream.readVarInt(usize, endian, size); | 274 | const block_len = try nosuspend in_stream.readVarInt(usize, endian, size); |
| 275 | return parseFormValueBlockLen(allocator, in_stream, block_len); | 275 | return parseFormValueBlockLen(allocator, in_stream, block_len); |
| 276 | } | 276 | } |
| 277 | 277 | ||
| 278 | fn parseFormValueConstant(allocator: *mem.Allocator, in_stream: var, signed: bool, endian: builtin.Endian, comptime size: i32) !FormValue { | 278 | fn parseFormValueConstant(allocator: *mem.Allocator, in_stream: var, signed: bool, endian: builtin.Endian, comptime size: i32) !FormValue { |
| 279 | // TODO: Please forgive me, I've worked around zig not properly spilling some intermediate values here. | 279 | // TODO: Please forgive me, I've worked around zig not properly spilling some intermediate values here. |
| 280 | // `noasync` should be removed from all the function calls once it is fixed. | 280 | // `nosuspend` should be removed from all the function calls once it is fixed. |
| 281 | return FormValue{ | 281 | return FormValue{ |
| 282 | .Const = Constant{ | 282 | .Const = Constant{ |
| 283 | .signed = signed, | 283 | .signed = signed, |
| 284 | .payload = switch (size) { | 284 | .payload = switch (size) { |
| 285 | 1 => try noasync in_stream.readInt(u8, endian), | 285 | 1 => try nosuspend in_stream.readInt(u8, endian), |
| 286 | 2 => try noasync in_stream.readInt(u16, endian), | 286 | 2 => try nosuspend in_stream.readInt(u16, endian), |
| 287 | 4 => try noasync in_stream.readInt(u32, endian), | 287 | 4 => try nosuspend in_stream.readInt(u32, endian), |
| 288 | 8 => try noasync in_stream.readInt(u64, endian), | 288 | 8 => try nosuspend in_stream.readInt(u64, endian), |
| 289 | -1 => blk: { | 289 | -1 => blk: { |
| 290 | if (signed) { | 290 | if (signed) { |
| 291 | const x = try noasync leb.readILEB128(i64, in_stream); | 291 | const x = try nosuspend leb.readILEB128(i64, in_stream); |
| 292 | break :blk @bitCast(u64, x); | 292 | break :blk @bitCast(u64, x); |
| 293 | } else { | 293 | } else { |
| 294 | const x = try noasync leb.readULEB128(u64, in_stream); | 294 | const x = try nosuspend leb.readULEB128(u64, in_stream); |
| 295 | break :blk x; | 295 | break :blk x; |
| 296 | } | 296 | } |
| 297 | }, | 297 | }, |
| ... | @@ -301,21 +301,21 @@ fn parseFormValueConstant(allocator: *mem.Allocator, in_stream: var, signed: boo | ... | @@ -301,21 +301,21 @@ fn parseFormValueConstant(allocator: *mem.Allocator, in_stream: var, signed: boo |
| 301 | }; | 301 | }; |
| 302 | } | 302 | } |
| 303 | 303 | ||
| 304 | // TODO the noasyncs here are workarounds | 304 | // TODO the nosuspends here are workarounds |
| 305 | fn parseFormValueRef(allocator: *mem.Allocator, in_stream: var, endian: builtin.Endian, size: i32) !FormValue { | 305 | fn parseFormValueRef(allocator: *mem.Allocator, in_stream: var, endian: builtin.Endian, size: i32) !FormValue { |
| 306 | return FormValue{ | 306 | return FormValue{ |
| 307 | .Ref = switch (size) { | 307 | .Ref = switch (size) { |
| 308 | 1 => try noasync in_stream.readInt(u8, endian), | 308 | 1 => try nosuspend in_stream.readInt(u8, endian), |
| 309 | 2 => try noasync in_stream.readInt(u16, endian), | 309 | 2 => try nosuspend in_stream.readInt(u16, endian), |
| 310 | 4 => try noasync in_stream.readInt(u32, endian), | 310 | 4 => try nosuspend in_stream.readInt(u32, endian), |
| 311 | 8 => try noasync in_stream.readInt(u64, endian), | 311 | 8 => try nosuspend in_stream.readInt(u64, endian), |
| 312 | -1 => try noasync leb.readULEB128(u64, in_stream), | 312 | -1 => try nosuspend leb.readULEB128(u64, in_stream), |
| 313 | else => unreachable, | 313 | else => unreachable, |
| 314 | }, | 314 | }, |
| 315 | }; | 315 | }; |
| 316 | } | 316 | } |
| 317 | 317 | ||
| 318 | // TODO the noasyncs here are workarounds | 318 | // TODO the nosuspends here are workarounds |
| 319 | fn parseFormValue(allocator: *mem.Allocator, in_stream: var, form_id: u64, endian: builtin.Endian, is_64: bool) anyerror!FormValue { | 319 | fn parseFormValue(allocator: *mem.Allocator, in_stream: var, form_id: u64, endian: builtin.Endian, is_64: bool) anyerror!FormValue { |
| 320 | return switch (form_id) { | 320 | return switch (form_id) { |
| 321 | FORM_addr => FormValue{ .Address = try readAddress(in_stream, endian, @sizeOf(usize) == 8) }, | 321 | FORM_addr => FormValue{ .Address = try readAddress(in_stream, endian, @sizeOf(usize) == 8) }, |
| ... | @@ -323,7 +323,7 @@ fn parseFormValue(allocator: *mem.Allocator, in_stream: var, form_id: u64, endia | ... | @@ -323,7 +323,7 @@ fn parseFormValue(allocator: *mem.Allocator, in_stream: var, form_id: u64, endia |
| 323 | FORM_block2 => parseFormValueBlock(allocator, in_stream, endian, 2), | 323 | FORM_block2 => parseFormValueBlock(allocator, in_stream, endian, 2), |
| 324 | FORM_block4 => parseFormValueBlock(allocator, in_stream, endian, 4), | 324 | FORM_block4 => parseFormValueBlock(allocator, in_stream, endian, 4), |
| 325 | FORM_block => x: { | 325 | FORM_block => x: { |
| 326 | const block_len = try noasync leb.readULEB128(usize, in_stream); | 326 | const block_len = try nosuspend leb.readULEB128(usize, in_stream); |
| 327 | return parseFormValueBlockLen(allocator, in_stream, block_len); | 327 | return parseFormValueBlockLen(allocator, in_stream, block_len); |
| 328 | }, | 328 | }, |
| 329 | FORM_data1 => parseFormValueConstant(allocator, in_stream, false, endian, 1), | 329 | FORM_data1 => parseFormValueConstant(allocator, in_stream, false, endian, 1), |
| ... | @@ -335,11 +335,11 @@ fn parseFormValue(allocator: *mem.Allocator, in_stream: var, form_id: u64, endia | ... | @@ -335,11 +335,11 @@ fn parseFormValue(allocator: *mem.Allocator, in_stream: var, form_id: u64, endia |
| 335 | return parseFormValueConstant(allocator, in_stream, signed, endian, -1); | 335 | return parseFormValueConstant(allocator, in_stream, signed, endian, -1); |
| 336 | }, | 336 | }, |
| 337 | FORM_exprloc => { | 337 | FORM_exprloc => { |
| 338 | const size = try noasync leb.readULEB128(usize, in_stream); | 338 | const size = try nosuspend leb.readULEB128(usize, in_stream); |
| 339 | const buf = try readAllocBytes(allocator, in_stream, size); | 339 | const buf = try readAllocBytes(allocator, in_stream, size); |
| 340 | return FormValue{ .ExprLoc = buf }; | 340 | return FormValue{ .ExprLoc = buf }; |
| 341 | }, | 341 | }, |
| 342 | FORM_flag => FormValue{ .Flag = (try noasync in_stream.readByte()) != 0 }, | 342 | FORM_flag => FormValue{ .Flag = (try nosuspend in_stream.readByte()) != 0 }, |
| 343 | FORM_flag_present => FormValue{ .Flag = true }, | 343 | FORM_flag_present => FormValue{ .Flag = true }, |
| 344 | FORM_sec_offset => FormValue{ .SecOffset = try readAddress(in_stream, endian, is_64) }, | 344 | FORM_sec_offset => FormValue{ .SecOffset = try readAddress(in_stream, endian, is_64) }, |
| 345 | 345 | ||
| ... | @@ -350,12 +350,12 @@ fn parseFormValue(allocator: *mem.Allocator, in_stream: var, form_id: u64, endia | ... | @@ -350,12 +350,12 @@ fn parseFormValue(allocator: *mem.Allocator, in_stream: var, form_id: u64, endia |
| 350 | FORM_ref_udata => parseFormValueRef(allocator, in_stream, endian, -1), | 350 | FORM_ref_udata => parseFormValueRef(allocator, in_stream, endian, -1), |
| 351 | 351 | ||
| 352 | FORM_ref_addr => FormValue{ .RefAddr = try readAddress(in_stream, endian, is_64) }, | 352 | FORM_ref_addr => FormValue{ .RefAddr = try readAddress(in_stream, endian, is_64) }, |
| 353 | FORM_ref_sig8 => FormValue{ .Ref = try noasync in_stream.readInt(u64, endian) }, | 353 | FORM_ref_sig8 => FormValue{ .Ref = try nosuspend in_stream.readInt(u64, endian) }, |
| 354 | 354 | ||
| 355 | FORM_string => FormValue{ .String = try in_stream.readUntilDelimiterAlloc(allocator, 0, math.maxInt(usize)) }, | 355 | FORM_string => FormValue{ .String = try in_stream.readUntilDelimiterAlloc(allocator, 0, math.maxInt(usize)) }, |
| 356 | FORM_strp => FormValue{ .StrPtr = try readAddress(in_stream, endian, is_64) }, | 356 | FORM_strp => FormValue{ .StrPtr = try readAddress(in_stream, endian, is_64) }, |
| 357 | FORM_indirect => { | 357 | FORM_indirect => { |
| 358 | const child_form_id = try noasync leb.readULEB128(u64, in_stream); | 358 | const child_form_id = try nosuspend leb.readULEB128(u64, in_stream); |
| 359 | const F = @TypeOf(async parseFormValue(allocator, in_stream, child_form_id, endian, is_64)); | 359 | const F = @TypeOf(async parseFormValue(allocator, in_stream, child_form_id, endian, is_64)); |
| 360 | var frame = try allocator.create(F); | 360 | var frame = try allocator.create(F); |
| 361 | defer allocator.destroy(frame); | 361 | defer allocator.destroy(frame); |
lib/std/event/batch.zig+3-3| ... | @@ -21,7 +21,7 @@ pub fn Batch( | ... | @@ -21,7 +21,7 @@ pub fn Batch( |
| 21 | /// usual recommended option for this parameter. | 21 | /// usual recommended option for this parameter. |
| 22 | auto_async, | 22 | auto_async, |
| 23 | 23 | ||
| 24 | /// Always uses the `noasync` keyword when using `await` on the jobs, | 24 | /// Always uses the `nosuspend` keyword when using `await` on the jobs, |
| 25 | /// making `add` and `wait` non-async functions. Asserts that the jobs do not suspend. | 25 | /// making `add` and `wait` non-async functions. Asserts that the jobs do not suspend. |
| 26 | never_async, | 26 | never_async, |
| 27 | 27 | ||
| ... | @@ -75,7 +75,7 @@ pub fn Batch( | ... | @@ -75,7 +75,7 @@ pub fn Batch( |
| 75 | const job = &self.jobs[self.next_job_index]; | 75 | const job = &self.jobs[self.next_job_index]; |
| 76 | self.next_job_index = (self.next_job_index + 1) % max_jobs; | 76 | self.next_job_index = (self.next_job_index + 1) % max_jobs; |
| 77 | if (job.frame) |existing| { | 77 | if (job.frame) |existing| { |
| 78 | job.result = if (async_ok) await existing else noasync await existing; | 78 | job.result = if (async_ok) await existing else nosuspend await existing; |
| 79 | if (CollectedResult != void) { | 79 | if (CollectedResult != void) { |
| 80 | job.result catch |err| { | 80 | job.result catch |err| { |
| 81 | self.collected_result = err; | 81 | self.collected_result = err; |
| ... | @@ -94,7 +94,7 @@ pub fn Batch( | ... | @@ -94,7 +94,7 @@ pub fn Batch( |
| 94 | /// a time, however, it need not be the same thread. | 94 | /// a time, however, it need not be the same thread. |
| 95 | pub fn wait(self: *Self) CollectedResult { | 95 | pub fn wait(self: *Self) CollectedResult { |
| 96 | for (self.jobs) |*job| if (job.frame) |f| { | 96 | for (self.jobs) |*job| if (job.frame) |f| { |
| 97 | job.result = if (async_ok) await f else noasync await f; | 97 | job.result = if (async_ok) await f else nosuspend await f; |
| 98 | if (CollectedResult != void) { | 98 | if (CollectedResult != void) { |
| 99 | job.result catch |err| { | 99 | job.result catch |err| { |
| 100 | self.collected_result = err; | 100 | self.collected_result = err; |
lib/std/event/loop.zig+4-4| ... | @@ -195,7 +195,7 @@ pub const Loop = struct { | ... | @@ -195,7 +195,7 @@ pub const Loop = struct { |
| 195 | const wakeup_bytes = [_]u8{0x1} ** 8; | 195 | const wakeup_bytes = [_]u8{0x1} ** 8; |
| 196 | 196 | ||
| 197 | fn initOsData(self: *Loop, extra_thread_count: usize) InitOsDataError!void { | 197 | fn initOsData(self: *Loop, extra_thread_count: usize) InitOsDataError!void { |
| 198 | noasync switch (builtin.os.tag) { | 198 | nosuspend switch (builtin.os.tag) { |
| 199 | .linux => { | 199 | .linux => { |
| 200 | errdefer { | 200 | errdefer { |
| 201 | while (self.available_eventfd_resume_nodes.pop()) |node| os.close(node.data.eventfd); | 201 | while (self.available_eventfd_resume_nodes.pop()) |node| os.close(node.data.eventfd); |
| ... | @@ -371,7 +371,7 @@ pub const Loop = struct { | ... | @@ -371,7 +371,7 @@ pub const Loop = struct { |
| 371 | } | 371 | } |
| 372 | 372 | ||
| 373 | fn deinitOsData(self: *Loop) void { | 373 | fn deinitOsData(self: *Loop) void { |
| 374 | noasync switch (builtin.os.tag) { | 374 | nosuspend switch (builtin.os.tag) { |
| 375 | .linux => { | 375 | .linux => { |
| 376 | os.close(self.os_data.final_eventfd); | 376 | os.close(self.os_data.final_eventfd); |
| 377 | while (self.available_eventfd_resume_nodes.pop()) |node| os.close(node.data.eventfd); | 377 | while (self.available_eventfd_resume_nodes.pop()) |node| os.close(node.data.eventfd); |
| ... | @@ -663,7 +663,7 @@ pub const Loop = struct { | ... | @@ -663,7 +663,7 @@ pub const Loop = struct { |
| 663 | } | 663 | } |
| 664 | 664 | ||
| 665 | pub fn finishOneEvent(self: *Loop) void { | 665 | pub fn finishOneEvent(self: *Loop) void { |
| 666 | noasync { | 666 | nosuspend { |
| 667 | const prev = @atomicRmw(usize, &self.pending_event_count, .Sub, 1, .SeqCst); | 667 | const prev = @atomicRmw(usize, &self.pending_event_count, .Sub, 1, .SeqCst); |
| 668 | if (prev != 1) return; | 668 | if (prev != 1) return; |
| 669 | 669 | ||
| ... | @@ -1041,7 +1041,7 @@ pub const Loop = struct { | ... | @@ -1041,7 +1041,7 @@ pub const Loop = struct { |
| 1041 | } | 1041 | } |
| 1042 | 1042 | ||
| 1043 | fn posixFsRun(self: *Loop) void { | 1043 | fn posixFsRun(self: *Loop) void { |
| 1044 | noasync while (true) { | 1044 | nosuspend while (true) { |
| 1045 | self.fs_thread_wakeup.reset(); | 1045 | self.fs_thread_wakeup.reset(); |
| 1046 | while (self.fs_queue.get()) |node| { | 1046 | while (self.fs_queue.get()) |node| { |
| 1047 | switch (node.data.msg) { | 1047 | switch (node.data.msg) { |
lib/std/fs/file.zig+2-2| ... | @@ -66,7 +66,7 @@ pub const File = struct { | ... | @@ -66,7 +66,7 @@ pub const File = struct { |
| 66 | lock_nonblocking: bool = false, | 66 | lock_nonblocking: bool = false, |
| 67 | 67 | ||
| 68 | /// Setting this to `.blocking` prevents `O_NONBLOCK` from being passed even | 68 | /// Setting this to `.blocking` prevents `O_NONBLOCK` from being passed even |
| 69 | /// if `std.io.is_async`. It allows the use of `noasync` when calling functions | 69 | /// if `std.io.is_async`. It allows the use of `nosuspend` when calling functions |
| 70 | /// related to opening the file, reading, writing, and locking. | 70 | /// related to opening the file, reading, writing, and locking. |
| 71 | intended_io_mode: io.ModeOverride = io.default_mode, | 71 | intended_io_mode: io.ModeOverride = io.default_mode, |
| 72 | }; | 72 | }; |
| ... | @@ -112,7 +112,7 @@ pub const File = struct { | ... | @@ -112,7 +112,7 @@ pub const File = struct { |
| 112 | mode: Mode = default_mode, | 112 | mode: Mode = default_mode, |
| 113 | 113 | ||
| 114 | /// Setting this to `.blocking` prevents `O_NONBLOCK` from being passed even | 114 | /// Setting this to `.blocking` prevents `O_NONBLOCK` from being passed even |
| 115 | /// if `std.io.is_async`. It allows the use of `noasync` when calling functions | 115 | /// if `std.io.is_async`. It allows the use of `nosuspend` when calling functions |
| 116 | /// related to opening the file, reading, writing, and locking. | 116 | /// related to opening the file, reading, writing, and locking. |
| 117 | intended_io_mode: io.ModeOverride = io.default_mode, | 117 | intended_io_mode: io.ModeOverride = io.default_mode, |
| 118 | }; | 118 | }; |
lib/std/zig/ast.zig+11-11| ... | @@ -438,7 +438,7 @@ pub const Node = struct { | ... | @@ -438,7 +438,7 @@ pub const Node = struct { |
| 438 | ContainerDecl, | 438 | ContainerDecl, |
| 439 | Asm, | 439 | Asm, |
| 440 | Comptime, | 440 | Comptime, |
| 441 | Noasync, | 441 | Nosuspend, |
| 442 | Block, | 442 | Block, |
| 443 | 443 | ||
| 444 | // Misc | 444 | // Misc |
| ... | @@ -569,9 +569,9 @@ pub const Node = struct { | ... | @@ -569,9 +569,9 @@ pub const Node = struct { |
| 569 | 569 | ||
| 570 | return true; | 570 | return true; |
| 571 | }, | 571 | }, |
| 572 | .Noasync => { | 572 | .Nosuspend => { |
| 573 | const noasync_node = @fieldParentPtr(Noasync, "base", n); | 573 | const nosuspend_node = @fieldParentPtr(Nosuspend, "base", n); |
| 574 | return noasync_node.expr.id != .Block; | 574 | return nosuspend_node.expr.id != .Block; |
| 575 | }, | 575 | }, |
| 576 | else => return true, | 576 | else => return true, |
| 577 | } | 577 | } |
| ... | @@ -1084,12 +1084,12 @@ pub const Node = struct { | ... | @@ -1084,12 +1084,12 @@ pub const Node = struct { |
| 1084 | } | 1084 | } |
| 1085 | }; | 1085 | }; |
| 1086 | 1086 | ||
| 1087 | pub const Noasync = struct { | 1087 | pub const Nosuspend = struct { |
| 1088 | base: Node = Node{ .id = .Noasync }, | 1088 | base: Node = Node{ .id = .Nosuspend }, |
| 1089 | noasync_token: TokenIndex, | 1089 | nosuspend_token: TokenIndex, |
| 1090 | expr: *Node, | 1090 | expr: *Node, |
| 1091 | 1091 | ||
| 1092 | pub fn iterate(self: *Noasync, index: usize) ?*Node { | 1092 | pub fn iterate(self: *Nosuspend, index: usize) ?*Node { |
| 1093 | var i = index; | 1093 | var i = index; |
| 1094 | 1094 | ||
| 1095 | if (i < 1) return self.expr; | 1095 | if (i < 1) return self.expr; |
| ... | @@ -1098,11 +1098,11 @@ pub const Node = struct { | ... | @@ -1098,11 +1098,11 @@ pub const Node = struct { |
| 1098 | return null; | 1098 | return null; |
| 1099 | } | 1099 | } |
| 1100 | 1100 | ||
| 1101 | pub fn firstToken(self: *const Noasync) TokenIndex { | 1101 | pub fn firstToken(self: *const Nosuspend) TokenIndex { |
| 1102 | return self.noasync_token; | 1102 | return self.nosuspend_token; |
| 1103 | } | 1103 | } |
| 1104 | 1104 | ||
| 1105 | pub fn lastToken(self: *const Noasync) TokenIndex { | 1105 | pub fn lastToken(self: *const Nosuspend) TokenIndex { |
| 1106 | return self.expr.lastToken(); | 1106 | return self.expr.lastToken(); |
| 1107 | } | 1107 | } |
| 1108 | }; | 1108 | }; |
lib/std/zig/parse.zig+12-12| ... | @@ -495,7 +495,7 @@ fn parseContainerField(arena: *Allocator, it: *TokenIterator, tree: *Tree) !?*No | ... | @@ -495,7 +495,7 @@ fn parseContainerField(arena: *Allocator, it: *TokenIterator, tree: *Tree) !?*No |
| 495 | /// Statement | 495 | /// Statement |
| 496 | /// <- KEYWORD_comptime? VarDecl | 496 | /// <- KEYWORD_comptime? VarDecl |
| 497 | /// / KEYWORD_comptime BlockExprStatement | 497 | /// / KEYWORD_comptime BlockExprStatement |
| 498 | /// / KEYWORD_noasync BlockExprStatement | 498 | /// / KEYWORD_nosuspend BlockExprStatement |
| 499 | /// / KEYWORD_suspend (SEMICOLON / BlockExprStatement) | 499 | /// / KEYWORD_suspend (SEMICOLON / BlockExprStatement) |
| 500 | /// / KEYWORD_defer BlockExprStatement | 500 | /// / KEYWORD_defer BlockExprStatement |
| 501 | /// / KEYWORD_errdefer Payload? BlockExprStatement | 501 | /// / KEYWORD_errdefer Payload? BlockExprStatement |
| ... | @@ -527,14 +527,14 @@ fn parseStatement(arena: *Allocator, it: *TokenIterator, tree: *Tree) Error!?*No | ... | @@ -527,14 +527,14 @@ fn parseStatement(arena: *Allocator, it: *TokenIterator, tree: *Tree) Error!?*No |
| 527 | return &node.base; | 527 | return &node.base; |
| 528 | } | 528 | } |
| 529 | 529 | ||
| 530 | if (eatToken(it, .Keyword_noasync)) |noasync_token| { | 530 | if (eatToken(it, .Keyword_nosuspend)) |nosuspend_token| { |
| 531 | const block_expr = try expectNode(arena, it, tree, parseBlockExprStatement, .{ | 531 | const block_expr = try expectNode(arena, it, tree, parseBlockExprStatement, .{ |
| 532 | .ExpectedBlockOrAssignment = .{ .token = it.index }, | 532 | .ExpectedBlockOrAssignment = .{ .token = it.index }, |
| 533 | }); | 533 | }); |
| 534 | 534 | ||
| 535 | const node = try arena.create(Node.Noasync); | 535 | const node = try arena.create(Node.Nosuspend); |
| 536 | node.* = .{ | 536 | node.* = .{ |
| 537 | .noasync_token = noasync_token, | 537 | .nosuspend_token = nosuspend_token, |
| 538 | .expr = block_expr, | 538 | .expr = block_expr, |
| 539 | }; | 539 | }; |
| 540 | return &node.base; | 540 | return &node.base; |
| ... | @@ -908,7 +908,7 @@ fn parsePrefixExpr(arena: *Allocator, it: *TokenIterator, tree: *Tree) !?*Node { | ... | @@ -908,7 +908,7 @@ fn parsePrefixExpr(arena: *Allocator, it: *TokenIterator, tree: *Tree) !?*Node { |
| 908 | /// / IfExpr | 908 | /// / IfExpr |
| 909 | /// / KEYWORD_break BreakLabel? Expr? | 909 | /// / KEYWORD_break BreakLabel? Expr? |
| 910 | /// / KEYWORD_comptime Expr | 910 | /// / KEYWORD_comptime Expr |
| 911 | /// / KEYWORD_noasync Expr | 911 | /// / KEYWORD_nosuspend Expr |
| 912 | /// / KEYWORD_continue BreakLabel? | 912 | /// / KEYWORD_continue BreakLabel? |
| 913 | /// / KEYWORD_resume Expr | 913 | /// / KEYWORD_resume Expr |
| 914 | /// / KEYWORD_return Expr? | 914 | /// / KEYWORD_return Expr? |
| ... | @@ -944,13 +944,13 @@ fn parsePrimaryExpr(arena: *Allocator, it: *TokenIterator, tree: *Tree) !?*Node | ... | @@ -944,13 +944,13 @@ fn parsePrimaryExpr(arena: *Allocator, it: *TokenIterator, tree: *Tree) !?*Node |
| 944 | return &node.base; | 944 | return &node.base; |
| 945 | } | 945 | } |
| 946 | 946 | ||
| 947 | if (eatToken(it, .Keyword_noasync)) |token| { | 947 | if (eatToken(it, .Keyword_nosuspend)) |token| { |
| 948 | const expr_node = try expectNode(arena, it, tree, parseExpr, .{ | 948 | const expr_node = try expectNode(arena, it, tree, parseExpr, .{ |
| 949 | .ExpectedExpr = .{ .token = it.index }, | 949 | .ExpectedExpr = .{ .token = it.index }, |
| 950 | }); | 950 | }); |
| 951 | const node = try arena.create(Node.Noasync); | 951 | const node = try arena.create(Node.Nosuspend); |
| 952 | node.* = .{ | 952 | node.* = .{ |
| 953 | .noasync_token = token, | 953 | .nosuspend_token = token, |
| 954 | .expr = expr_node, | 954 | .expr = expr_node, |
| 955 | }; | 955 | }; |
| 956 | return &node.base; | 956 | return &node.base; |
| ... | @@ -1288,7 +1288,7 @@ fn parseSuffixExpr(arena: *Allocator, it: *TokenIterator, tree: *Tree) !?*Node { | ... | @@ -1288,7 +1288,7 @@ fn parseSuffixExpr(arena: *Allocator, it: *TokenIterator, tree: *Tree) !?*Node { |
| 1288 | /// / IfTypeExpr | 1288 | /// / IfTypeExpr |
| 1289 | /// / INTEGER | 1289 | /// / INTEGER |
| 1290 | /// / KEYWORD_comptime TypeExpr | 1290 | /// / KEYWORD_comptime TypeExpr |
| 1291 | /// / KEYWORD_noasync TypeExpr | 1291 | /// / KEYWORD_nosuspend TypeExpr |
| 1292 | /// / KEYWORD_error DOT IDENTIFIER | 1292 | /// / KEYWORD_error DOT IDENTIFIER |
| 1293 | /// / KEYWORD_false | 1293 | /// / KEYWORD_false |
| 1294 | /// / KEYWORD_null | 1294 | /// / KEYWORD_null |
| ... | @@ -1327,11 +1327,11 @@ fn parsePrimaryTypeExpr(arena: *Allocator, it: *TokenIterator, tree: *Tree) !?*N | ... | @@ -1327,11 +1327,11 @@ fn parsePrimaryTypeExpr(arena: *Allocator, it: *TokenIterator, tree: *Tree) !?*N |
| 1327 | }; | 1327 | }; |
| 1328 | return &node.base; | 1328 | return &node.base; |
| 1329 | } | 1329 | } |
| 1330 | if (eatToken(it, .Keyword_noasync)) |token| { | 1330 | if (eatToken(it, .Keyword_nosuspend)) |token| { |
| 1331 | const expr = (try parseTypeExpr(arena, it, tree)) orelse return null; | 1331 | const expr = (try parseTypeExpr(arena, it, tree)) orelse return null; |
| 1332 | const node = try arena.create(Node.Noasync); | 1332 | const node = try arena.create(Node.Nosuspend); |
| 1333 | node.* = .{ | 1333 | node.* = .{ |
| 1334 | .noasync_token = token, | 1334 | .nosuspend_token = token, |
| 1335 | .expr = expr, | 1335 | .expr = expr, |
| 1336 | }; | 1336 | }; |
| 1337 | return &node.base; | 1337 | return &node.base; |
lib/std/zig/parser_test.zig+20-6| ... | @@ -35,10 +35,10 @@ test "zig fmt: errdefer with payload" { | ... | @@ -35,10 +35,10 @@ test "zig fmt: errdefer with payload" { |
| 35 | ); | 35 | ); |
| 36 | } | 36 | } |
| 37 | 37 | ||
| 38 | test "zig fmt: noasync block" { | 38 | test "zig fmt: nosuspend block" { |
| 39 | try testCanonical( | 39 | try testCanonical( |
| 40 | \\pub fn main() anyerror!void { | 40 | \\pub fn main() anyerror!void { |
| 41 | \\ noasync { | 41 | \\ nosuspend { |
| 42 | \\ var foo: Foo = .{ .bar = 42 }; | 42 | \\ var foo: Foo = .{ .bar = 42 }; |
| 43 | \\ } | 43 | \\ } |
| 44 | \\} | 44 | \\} |
| ... | @@ -46,10 +46,10 @@ test "zig fmt: noasync block" { | ... | @@ -46,10 +46,10 @@ test "zig fmt: noasync block" { |
| 46 | ); | 46 | ); |
| 47 | } | 47 | } |
| 48 | 48 | ||
| 49 | test "zig fmt: noasync await" { | 49 | test "zig fmt: nosuspend await" { |
| 50 | try testCanonical( | 50 | try testCanonical( |
| 51 | \\fn foo() void { | 51 | \\fn foo() void { |
| 52 | \\ x = noasync await y; | 52 | \\ x = nosuspend await y; |
| 53 | \\} | 53 | \\} |
| 54 | \\ | 54 | \\ |
| 55 | ); | 55 | ); |
| ... | @@ -2519,9 +2519,9 @@ test "zig fmt: async functions" { | ... | @@ -2519,9 +2519,9 @@ test "zig fmt: async functions" { |
| 2519 | ); | 2519 | ); |
| 2520 | } | 2520 | } |
| 2521 | 2521 | ||
| 2522 | test "zig fmt: noasync" { | 2522 | test "zig fmt: nosuspend" { |
| 2523 | try testCanonical( | 2523 | try testCanonical( |
| 2524 | \\const a = noasync foo(); | 2524 | \\const a = nosuspend foo(); |
| 2525 | \\ | 2525 | \\ |
| 2526 | ); | 2526 | ); |
| 2527 | } | 2527 | } |
| ... | @@ -2926,6 +2926,20 @@ test "zig fmt: hexadeciaml float literals with underscore separators" { | ... | @@ -2926,6 +2926,20 @@ test "zig fmt: hexadeciaml float literals with underscore separators" { |
| 2926 | ); | 2926 | ); |
| 2927 | } | 2927 | } |
| 2928 | 2928 | ||
| 2929 | test "zig fmt: noasync to nosuspend" { | ||
| 2930 | // TODO: remove this | ||
| 2931 | try testTransform( | ||
| 2932 | \\pub fn main() void { | ||
| 2933 | \\ noasync call(); | ||
| 2934 | \\} | ||
| 2935 | , | ||
| 2936 | \\pub fn main() void { | ||
| 2937 | \\ nosuspend call(); | ||
| 2938 | \\} | ||
| 2939 | \\ | ||
| 2940 | ); | ||
| 2941 | } | ||
| 2942 | |||
| 2929 | const std = @import("std"); | 2943 | const std = @import("std"); |
| 2930 | const mem = std.mem; | 2944 | const mem = std.mem; |
| 2931 | const warn = std.debug.warn; | 2945 | const warn = std.debug.warn; |
lib/std/zig/render.zig+9-5| ... | @@ -391,11 +391,15 @@ fn renderExpression( | ... | @@ -391,11 +391,15 @@ fn renderExpression( |
| 391 | try renderToken(tree, stream, comptime_node.comptime_token, indent, start_col, Space.Space); | 391 | try renderToken(tree, stream, comptime_node.comptime_token, indent, start_col, Space.Space); |
| 392 | return renderExpression(allocator, stream, tree, indent, start_col, comptime_node.expr, space); | 392 | return renderExpression(allocator, stream, tree, indent, start_col, comptime_node.expr, space); |
| 393 | }, | 393 | }, |
| 394 | .Noasync => { | 394 | .Nosuspend => { |
| 395 | const noasync_node = @fieldParentPtr(ast.Node.Noasync, "base", base); | 395 | const nosuspend_node = @fieldParentPtr(ast.Node.Nosuspend, "base", base); |
| 396 | 396 | if (mem.eql(u8, tree.tokenSlice(nosuspend_node.nosuspend_token), "noasync")) { | |
| 397 | try renderToken(tree, stream, noasync_node.noasync_token, indent, start_col, Space.Space); | 397 | // TODO: remove this |
| 398 | return renderExpression(allocator, stream, tree, indent, start_col, noasync_node.expr, space); | 398 | try stream.writeAll("nosuspend "); |
| 399 | } else { | ||
| 400 | try renderToken(tree, stream, nosuspend_node.nosuspend_token, indent, start_col, Space.Space); | ||
| 401 | } | ||
| 402 | return renderExpression(allocator, stream, tree, indent, start_col, nosuspend_node.expr, space); | ||
| 399 | }, | 403 | }, |
| 400 | 404 | ||
| 401 | .Suspend => { | 405 | .Suspend => { |
lib/std/zig/system/macos.zig+9-4| ... | @@ -39,7 +39,7 @@ pub fn version_from_build(build: []const u8) !std.builtin.Version { | ... | @@ -39,7 +39,7 @@ pub fn version_from_build(build: []const u8) !std.builtin.Version { |
| 39 | zend += 1; | 39 | zend += 1; |
| 40 | } | 40 | } |
| 41 | if (zend == yindex + 1) return error.InvalidVersion; | 41 | if (zend == yindex + 1) return error.InvalidVersion; |
| 42 | const z = std.fmt.parseUnsigned(u16, build[yindex + 1..zend], 10) catch return error.InvalidVersion; | 42 | const z = std.fmt.parseUnsigned(u16, build[yindex + 1 .. zend], 10) catch return error.InvalidVersion; |
| 43 | 43 | ||
| 44 | result.patch = switch (result.minor) { | 44 | result.patch = switch (result.minor) { |
| 45 | // TODO: compiler complains without explicit @as() coercion | 45 | // TODO: compiler complains without explicit @as() coercion |
| ... | @@ -97,7 +97,9 @@ pub fn version_from_build(build: []const u8) !std.builtin.Version { | ... | @@ -97,7 +97,9 @@ pub fn version_from_build(build: []const u8) !std.builtin.Version { |
| 97 | 4 => @as(u32, switch (y) { // Tiger: 10.4 | 97 | 4 => @as(u32, switch (y) { // Tiger: 10.4 |
| 98 | 'A' => 0, | 98 | 'A' => 0, |
| 99 | 'B' => 1, | 99 | 'B' => 1, |
| 100 | 'C', 'E', => 2, | 100 | 'C', |
| 101 | 'E', | ||
| 102 | => 2, | ||
| 101 | 'F' => 3, | 103 | 'F' => 3, |
| 102 | 'G' => @as(u32, block: { | 104 | 'G' => @as(u32, block: { |
| 103 | if (z >= 1454) break :block 5; | 105 | if (z >= 1454) break :block 5; |
| ... | @@ -105,7 +107,10 @@ pub fn version_from_build(build: []const u8) !std.builtin.Version { | ... | @@ -105,7 +107,10 @@ pub fn version_from_build(build: []const u8) !std.builtin.Version { |
| 105 | }), | 107 | }), |
| 106 | 'H' => 5, | 108 | 'H' => 5, |
| 107 | 'I' => 6, | 109 | 'I' => 6, |
| 108 | 'J', 'K', 'N', => 7, | 110 | 'J', |
| 111 | 'K', | ||
| 112 | 'N', | ||
| 113 | => 7, | ||
| 109 | 'L' => 8, | 114 | 'L' => 8, |
| 110 | 'P' => 9, | 115 | 'P' => 9, |
| 111 | 'R' => 10, | 116 | 'R' => 10, |
| ... | @@ -438,7 +443,7 @@ test "version_from_build" { | ... | @@ -438,7 +443,7 @@ test "version_from_build" { |
| 438 | for (known) |pair| { | 443 | for (known) |pair| { |
| 439 | var buf: [32]u8 = undefined; | 444 | var buf: [32]u8 = undefined; |
| 440 | const ver = try version_from_build(pair[0]); | 445 | const ver = try version_from_build(pair[0]); |
| 441 | const sver = try std.fmt.bufPrint(buf[0..], "{}.{}.{}", .{ver.major, ver.minor, ver.patch}); | 446 | const sver = try std.fmt.bufPrint(buf[0..], "{}.{}.{}", .{ ver.major, ver.minor, ver.patch }); |
| 442 | std.testing.expect(std.mem.eql(u8, sver, pair[1])); | 447 | std.testing.expect(std.mem.eql(u8, sver, pair[1])); |
| 443 | } | 448 | } |
| 444 | } | 449 | } |
lib/std/zig/tokenizer.zig+4-3| ... | @@ -49,8 +49,9 @@ pub const Token = struct { | ... | @@ -49,8 +49,9 @@ pub const Token = struct { |
| 49 | Keyword.init("inline", .Keyword_inline), | 49 | Keyword.init("inline", .Keyword_inline), |
| 50 | Keyword.init("nakedcc", .Keyword_nakedcc), | 50 | Keyword.init("nakedcc", .Keyword_nakedcc), |
| 51 | Keyword.init("noalias", .Keyword_noalias), | 51 | Keyword.init("noalias", .Keyword_noalias), |
| 52 | Keyword.init("noasync", .Keyword_noasync), | 52 | Keyword.init("noasync", .Keyword_nosuspend), // TODO: remove this |
| 53 | Keyword.init("noinline", .Keyword_noinline), | 53 | Keyword.init("noinline", .Keyword_noinline), |
| 54 | Keyword.init("nosuspend", .Keyword_nosuspend), | ||
| 54 | Keyword.init("null", .Keyword_null), | 55 | Keyword.init("null", .Keyword_null), |
| 55 | Keyword.init("or", .Keyword_or), | 56 | Keyword.init("or", .Keyword_or), |
| 56 | Keyword.init("orelse", .Keyword_orelse), | 57 | Keyword.init("orelse", .Keyword_orelse), |
| ... | @@ -182,8 +183,8 @@ pub const Token = struct { | ... | @@ -182,8 +183,8 @@ pub const Token = struct { |
| 182 | Keyword_inline, | 183 | Keyword_inline, |
| 183 | Keyword_nakedcc, | 184 | Keyword_nakedcc, |
| 184 | Keyword_noalias, | 185 | Keyword_noalias, |
| 185 | Keyword_noasync, | ||
| 186 | Keyword_noinline, | 186 | Keyword_noinline, |
| 187 | Keyword_nosuspend, | ||
| 187 | Keyword_null, | 188 | Keyword_null, |
| 188 | Keyword_or, | 189 | Keyword_or, |
| 189 | Keyword_orelse, | 190 | Keyword_orelse, |
| ... | @@ -307,8 +308,8 @@ pub const Token = struct { | ... | @@ -307,8 +308,8 @@ pub const Token = struct { |
| 307 | .Keyword_inline => "inline", | 308 | .Keyword_inline => "inline", |
| 308 | .Keyword_nakedcc => "nakedcc", | 309 | .Keyword_nakedcc => "nakedcc", |
| 309 | .Keyword_noalias => "noalias", | 310 | .Keyword_noalias => "noalias", |
| 310 | .Keyword_noasync => "noasync", | ||
| 311 | .Keyword_noinline => "noinline", | 311 | .Keyword_noinline => "noinline", |
| 312 | .Keyword_nosuspend => "nosuspend", | ||
| 312 | .Keyword_null => "null", | 313 | .Keyword_null => "null", |
| 313 | .Keyword_or => "or", | 314 | .Keyword_or => "or", |
| 314 | .Keyword_orelse => "orelse", | 315 | .Keyword_orelse => "orelse", |
src/all_types.hpp+11-11| ... | @@ -672,7 +672,7 @@ enum NodeType { | ... | @@ -672,7 +672,7 @@ enum NodeType { |
| 672 | NodeTypeSwitchProng, | 672 | NodeTypeSwitchProng, |
| 673 | NodeTypeSwitchRange, | 673 | NodeTypeSwitchRange, |
| 674 | NodeTypeCompTime, | 674 | NodeTypeCompTime, |
| 675 | NodeTypeNoAsync, | 675 | NodeTypeNoSuspend, |
| 676 | NodeTypeBreak, | 676 | NodeTypeBreak, |
| 677 | NodeTypeContinue, | 677 | NodeTypeContinue, |
| 678 | NodeTypeAsmExpr, | 678 | NodeTypeAsmExpr, |
| ... | @@ -862,7 +862,7 @@ enum CallModifier { | ... | @@ -862,7 +862,7 @@ enum CallModifier { |
| 862 | CallModifierAsync, | 862 | CallModifierAsync, |
| 863 | CallModifierNeverTail, | 863 | CallModifierNeverTail, |
| 864 | CallModifierNeverInline, | 864 | CallModifierNeverInline, |
| 865 | CallModifierNoAsync, | 865 | CallModifierNoSuspend, |
| 866 | CallModifierAlwaysTail, | 866 | CallModifierAlwaysTail, |
| 867 | CallModifierAlwaysInline, | 867 | CallModifierAlwaysInline, |
| 868 | CallModifierCompileTime, | 868 | CallModifierCompileTime, |
| ... | @@ -1014,7 +1014,7 @@ struct AstNodeCompTime { | ... | @@ -1014,7 +1014,7 @@ struct AstNodeCompTime { |
| 1014 | AstNode *expr; | 1014 | AstNode *expr; |
| 1015 | }; | 1015 | }; |
| 1016 | 1016 | ||
| 1017 | struct AstNodeNoAsync { | 1017 | struct AstNodeNoSuspend { |
| 1018 | AstNode *expr; | 1018 | AstNode *expr; |
| 1019 | }; | 1019 | }; |
| 1020 | 1020 | ||
| ... | @@ -1225,7 +1225,7 @@ struct AstNode { | ... | @@ -1225,7 +1225,7 @@ struct AstNode { |
| 1225 | AstNodeSwitchProng switch_prong; | 1225 | AstNodeSwitchProng switch_prong; |
| 1226 | AstNodeSwitchRange switch_range; | 1226 | AstNodeSwitchRange switch_range; |
| 1227 | AstNodeCompTime comptime_expr; | 1227 | AstNodeCompTime comptime_expr; |
| 1228 | AstNodeNoAsync noasync_expr; | 1228 | AstNodeNoSuspend nosuspend_expr; |
| 1229 | AstNodeAsmExpr asm_expr; | 1229 | AstNodeAsmExpr asm_expr; |
| 1230 | AstNodeFieldAccessExpr field_access_expr; | 1230 | AstNodeFieldAccessExpr field_access_expr; |
| 1231 | AstNodePtrDerefExpr ptr_deref_expr; | 1231 | AstNodePtrDerefExpr ptr_deref_expr; |
| ... | @@ -1858,7 +1858,7 @@ enum PanicMsgId { | ... | @@ -1858,7 +1858,7 @@ enum PanicMsgId { |
| 1858 | PanicMsgIdResumedAnAwaitingFn, | 1858 | PanicMsgIdResumedAnAwaitingFn, |
| 1859 | PanicMsgIdFrameTooSmall, | 1859 | PanicMsgIdFrameTooSmall, |
| 1860 | PanicMsgIdResumedFnPendingAwait, | 1860 | PanicMsgIdResumedFnPendingAwait, |
| 1861 | PanicMsgIdBadNoAsyncCall, | 1861 | PanicMsgIdBadNoSuspendCall, |
| 1862 | PanicMsgIdResumeNotSuspendedFn, | 1862 | PanicMsgIdResumeNotSuspendedFn, |
| 1863 | PanicMsgIdBadSentinel, | 1863 | PanicMsgIdBadSentinel, |
| 1864 | PanicMsgIdShxTooBigRhs, | 1864 | PanicMsgIdShxTooBigRhs, |
| ... | @@ -2376,7 +2376,7 @@ enum ScopeId { | ... | @@ -2376,7 +2376,7 @@ enum ScopeId { |
| 2376 | ScopeIdRuntime, | 2376 | ScopeIdRuntime, |
| 2377 | ScopeIdTypeOf, | 2377 | ScopeIdTypeOf, |
| 2378 | ScopeIdExpr, | 2378 | ScopeIdExpr, |
| 2379 | ScopeIdNoAsync, | 2379 | ScopeIdNoSuspend, |
| 2380 | }; | 2380 | }; |
| 2381 | 2381 | ||
| 2382 | struct Scope { | 2382 | struct Scope { |
| ... | @@ -2510,9 +2510,9 @@ struct ScopeCompTime { | ... | @@ -2510,9 +2510,9 @@ struct ScopeCompTime { |
| 2510 | Scope base; | 2510 | Scope base; |
| 2511 | }; | 2511 | }; |
| 2512 | 2512 | ||
| 2513 | // This scope is created for a noasync expression. | 2513 | // This scope is created for a nosuspend expression. |
| 2514 | // NodeTypeNoAsync | 2514 | // NodeTypeNoSuspend |
| 2515 | struct ScopeNoAsync { | 2515 | struct ScopeNoSuspend { |
| 2516 | Scope base; | 2516 | Scope base; |
| 2517 | }; | 2517 | }; |
| 2518 | 2518 | ||
| ... | @@ -4488,7 +4488,7 @@ struct IrInstSrcAwait { | ... | @@ -4488,7 +4488,7 @@ struct IrInstSrcAwait { |
| 4488 | 4488 | ||
| 4489 | IrInstSrc *frame; | 4489 | IrInstSrc *frame; |
| 4490 | ResultLoc *result_loc; | 4490 | ResultLoc *result_loc; |
| 4491 | bool is_noasync; | 4491 | bool is_nosuspend; |
| 4492 | }; | 4492 | }; |
| 4493 | 4493 | ||
| 4494 | struct IrInstGenAwait { | 4494 | struct IrInstGenAwait { |
| ... | @@ -4497,7 +4497,7 @@ struct IrInstGenAwait { | ... | @@ -4497,7 +4497,7 @@ struct IrInstGenAwait { |
| 4497 | IrInstGen *frame; | 4497 | IrInstGen *frame; |
| 4498 | IrInstGen *result_loc; | 4498 | IrInstGen *result_loc; |
| 4499 | ZigFn *target_fn; | 4499 | ZigFn *target_fn; |
| 4500 | bool is_noasync; | 4500 | bool is_nosuspend; |
| 4501 | }; | 4501 | }; |
| 4502 | 4502 | ||
| 4503 | struct IrInstSrcResume { | 4503 | struct IrInstSrcResume { |
src/analyze.cpp+9-9| ... | @@ -106,7 +106,7 @@ static ScopeExpr *find_expr_scope(Scope *scope) { | ... | @@ -106,7 +106,7 @@ static ScopeExpr *find_expr_scope(Scope *scope) { |
| 106 | case ScopeIdDecls: | 106 | case ScopeIdDecls: |
| 107 | case ScopeIdFnDef: | 107 | case ScopeIdFnDef: |
| 108 | case ScopeIdCompTime: | 108 | case ScopeIdCompTime: |
| 109 | case ScopeIdNoAsync: | 109 | case ScopeIdNoSuspend: |
| 110 | case ScopeIdVarDecl: | 110 | case ScopeIdVarDecl: |
| 111 | case ScopeIdCImport: | 111 | case ScopeIdCImport: |
| 112 | case ScopeIdSuspend: | 112 | case ScopeIdSuspend: |
| ... | @@ -227,9 +227,9 @@ Scope *create_comptime_scope(CodeGen *g, AstNode *node, Scope *parent) { | ... | @@ -227,9 +227,9 @@ Scope *create_comptime_scope(CodeGen *g, AstNode *node, Scope *parent) { |
| 227 | return &scope->base; | 227 | return &scope->base; |
| 228 | } | 228 | } |
| 229 | 229 | ||
| 230 | Scope *create_noasync_scope(CodeGen *g, AstNode *node, Scope *parent) { | 230 | Scope *create_nosuspend_scope(CodeGen *g, AstNode *node, Scope *parent) { |
| 231 | ScopeNoAsync *scope = heap::c_allocator.create<ScopeNoAsync>(); | 231 | ScopeNoSuspend *scope = heap::c_allocator.create<ScopeNoSuspend>(); |
| 232 | init_scope(g, &scope->base, ScopeIdNoAsync, node, parent); | 232 | init_scope(g, &scope->base, ScopeIdNoSuspend, node, parent); |
| 233 | return &scope->base; | 233 | return &scope->base; |
| 234 | } | 234 | } |
| 235 | 235 | ||
| ... | @@ -3771,7 +3771,7 @@ void scan_decls(CodeGen *g, ScopeDecls *decls_scope, AstNode *node) { | ... | @@ -3771,7 +3771,7 @@ void scan_decls(CodeGen *g, ScopeDecls *decls_scope, AstNode *node) { |
| 3771 | case NodeTypeCompTime: | 3771 | case NodeTypeCompTime: |
| 3772 | preview_comptime_decl(g, node, decls_scope); | 3772 | preview_comptime_decl(g, node, decls_scope); |
| 3773 | break; | 3773 | break; |
| 3774 | case NodeTypeNoAsync: | 3774 | case NodeTypeNoSuspend: |
| 3775 | case NodeTypeParamDecl: | 3775 | case NodeTypeParamDecl: |
| 3776 | case NodeTypeReturnExpr: | 3776 | case NodeTypeReturnExpr: |
| 3777 | case NodeTypeDefer: | 3777 | case NodeTypeDefer: |
| ... | @@ -4689,7 +4689,7 @@ void add_async_error_notes(CodeGen *g, ErrorMsg *msg, ZigFn *fn) { | ... | @@ -4689,7 +4689,7 @@ void add_async_error_notes(CodeGen *g, ErrorMsg *msg, ZigFn *fn) { |
| 4689 | static Error analyze_callee_async(CodeGen *g, ZigFn *fn, ZigFn *callee, AstNode *call_node, | 4689 | static Error analyze_callee_async(CodeGen *g, ZigFn *fn, ZigFn *callee, AstNode *call_node, |
| 4690 | bool must_not_be_async, CallModifier modifier) | 4690 | bool must_not_be_async, CallModifier modifier) |
| 4691 | { | 4691 | { |
| 4692 | if (modifier == CallModifierNoAsync) | 4692 | if (modifier == CallModifierNoSuspend) |
| 4693 | return ErrorNone; | 4693 | return ErrorNone; |
| 4694 | bool callee_is_async = false; | 4694 | bool callee_is_async = false; |
| 4695 | switch (callee->type_entry->data.fn.fn_type_id.cc) { | 4695 | switch (callee->type_entry->data.fn.fn_type_id.cc) { |
| ... | @@ -4812,7 +4812,7 @@ static void analyze_fn_async(CodeGen *g, ZigFn *fn, bool resolve_frame) { | ... | @@ -4812,7 +4812,7 @@ static void analyze_fn_async(CodeGen *g, ZigFn *fn, bool resolve_frame) { |
| 4812 | } | 4812 | } |
| 4813 | for (size_t i = 0; i < fn->await_list.length; i += 1) { | 4813 | for (size_t i = 0; i < fn->await_list.length; i += 1) { |
| 4814 | IrInstGenAwait *await = fn->await_list.at(i); | 4814 | IrInstGenAwait *await = fn->await_list.at(i); |
| 4815 | if (await->is_noasync) continue; | 4815 | if (await->is_nosuspend) continue; |
| 4816 | switch (analyze_callee_async(g, fn, await->target_fn, await->base.base.source_node, must_not_be_async, | 4816 | switch (analyze_callee_async(g, fn, await->target_fn, await->base.base.source_node, must_not_be_async, |
| 4817 | CallModifierNone)) | 4817 | CallModifierNone)) |
| 4818 | { | 4818 | { |
| ... | @@ -6239,7 +6239,7 @@ static void mark_suspension_point(Scope *scope) { | ... | @@ -6239,7 +6239,7 @@ static void mark_suspension_point(Scope *scope) { |
| 6239 | case ScopeIdDecls: | 6239 | case ScopeIdDecls: |
| 6240 | case ScopeIdFnDef: | 6240 | case ScopeIdFnDef: |
| 6241 | case ScopeIdCompTime: | 6241 | case ScopeIdCompTime: |
| 6242 | case ScopeIdNoAsync: | 6242 | case ScopeIdNoSuspend: |
| 6243 | case ScopeIdCImport: | 6243 | case ScopeIdCImport: |
| 6244 | case ScopeIdSuspend: | 6244 | case ScopeIdSuspend: |
| 6245 | case ScopeIdTypeOf: | 6245 | case ScopeIdTypeOf: |
| ... | @@ -6472,7 +6472,7 @@ static Error resolve_async_frame(CodeGen *g, ZigType *frame_type) { | ... | @@ -6472,7 +6472,7 @@ static Error resolve_async_frame(CodeGen *g, ZigType *frame_type) { |
| 6472 | // The funtion call result of foo() must be spilled. | 6472 | // The funtion call result of foo() must be spilled. |
| 6473 | for (size_t i = 0; i < fn->await_list.length; i += 1) { | 6473 | for (size_t i = 0; i < fn->await_list.length; i += 1) { |
| 6474 | IrInstGenAwait *await = fn->await_list.at(i); | 6474 | IrInstGenAwait *await = fn->await_list.at(i); |
| 6475 | if (await->is_noasync) { | 6475 | if (await->is_nosuspend) { |
| 6476 | continue; | 6476 | continue; |
| 6477 | } | 6477 | } |
| 6478 | if (await->base.value->special != ConstValSpecialRuntime) { | 6478 | if (await->base.value->special != ConstValSpecialRuntime) { |
src/analyze.hpp+1-1| ... | @@ -125,7 +125,7 @@ ScopeLoop *create_loop_scope(CodeGen *g, AstNode *node, Scope *parent); | ... | @@ -125,7 +125,7 @@ ScopeLoop *create_loop_scope(CodeGen *g, AstNode *node, Scope *parent); |
| 125 | ScopeSuspend *create_suspend_scope(CodeGen *g, AstNode *node, Scope *parent); | 125 | ScopeSuspend *create_suspend_scope(CodeGen *g, AstNode *node, Scope *parent); |
| 126 | ScopeFnDef *create_fndef_scope(CodeGen *g, AstNode *node, Scope *parent, ZigFn *fn_entry); | 126 | ScopeFnDef *create_fndef_scope(CodeGen *g, AstNode *node, Scope *parent, ZigFn *fn_entry); |
| 127 | Scope *create_comptime_scope(CodeGen *g, AstNode *node, Scope *parent); | 127 | Scope *create_comptime_scope(CodeGen *g, AstNode *node, Scope *parent); |
| 128 | Scope *create_noasync_scope(CodeGen *g, AstNode *node, Scope *parent); | 128 | Scope *create_nosuspend_scope(CodeGen *g, AstNode *node, Scope *parent); |
| 129 | Scope *create_runtime_scope(CodeGen *g, AstNode *node, Scope *parent, IrInstSrc *is_comptime); | 129 | Scope *create_runtime_scope(CodeGen *g, AstNode *node, Scope *parent, IrInstSrc *is_comptime); |
| 130 | Scope *create_typeof_scope(CodeGen *g, AstNode *node, Scope *parent); | 130 | Scope *create_typeof_scope(CodeGen *g, AstNode *node, Scope *parent); |
| 131 | ScopeExpr *create_expr_scope(CodeGen *g, AstNode *node, Scope *parent); | 131 | ScopeExpr *create_expr_scope(CodeGen *g, AstNode *node, Scope *parent); |
src/ast_render.cpp+7-7| ... | @@ -220,8 +220,8 @@ static const char *node_type_str(NodeType node_type) { | ... | @@ -220,8 +220,8 @@ static const char *node_type_str(NodeType node_type) { |
| 220 | return "SwitchRange"; | 220 | return "SwitchRange"; |
| 221 | case NodeTypeCompTime: | 221 | case NodeTypeCompTime: |
| 222 | return "CompTime"; | 222 | return "CompTime"; |
| 223 | case NodeTypeNoAsync: | 223 | case NodeTypeNoSuspend: |
| 224 | return "NoAsync"; | 224 | return "NoSuspend"; |
| 225 | case NodeTypeBreak: | 225 | case NodeTypeBreak: |
| 226 | return "Break"; | 226 | return "Break"; |
| 227 | case NodeTypeContinue: | 227 | case NodeTypeContinue: |
| ... | @@ -709,8 +709,8 @@ static void render_node_extra(AstRender *ar, AstNode *node, bool grouped) { | ... | @@ -709,8 +709,8 @@ static void render_node_extra(AstRender *ar, AstNode *node, bool grouped) { |
| 709 | switch (node->data.fn_call_expr.modifier) { | 709 | switch (node->data.fn_call_expr.modifier) { |
| 710 | case CallModifierNone: | 710 | case CallModifierNone: |
| 711 | break; | 711 | break; |
| 712 | case CallModifierNoAsync: | 712 | case CallModifierNoSuspend: |
| 713 | fprintf(ar->f, "noasync "); | 713 | fprintf(ar->f, "nosuspend "); |
| 714 | break; | 714 | break; |
| 715 | case CallModifierAsync: | 715 | case CallModifierAsync: |
| 716 | fprintf(ar->f, "async "); | 716 | fprintf(ar->f, "async "); |
| ... | @@ -1093,10 +1093,10 @@ static void render_node_extra(AstRender *ar, AstNode *node, bool grouped) { | ... | @@ -1093,10 +1093,10 @@ static void render_node_extra(AstRender *ar, AstNode *node, bool grouped) { |
| 1093 | render_node_grouped(ar, node->data.comptime_expr.expr); | 1093 | render_node_grouped(ar, node->data.comptime_expr.expr); |
| 1094 | break; | 1094 | break; |
| 1095 | } | 1095 | } |
| 1096 | case NodeTypeNoAsync: | 1096 | case NodeTypeNoSuspend: |
| 1097 | { | 1097 | { |
| 1098 | fprintf(ar->f, "noasync "); | 1098 | fprintf(ar->f, "nosuspend "); |
| 1099 | render_node_grouped(ar, node->data.noasync_expr.expr); | 1099 | render_node_grouped(ar, node->data.nosuspend_expr.expr); |
| 1100 | break; | 1100 | break; |
| 1101 | } | 1101 | } |
| 1102 | case NodeTypeForExpr: | 1102 | case NodeTypeForExpr: |
src/codegen.cpp+15-15| ... | @@ -685,7 +685,7 @@ static ZigLLVMDIScope *get_di_scope(CodeGen *g, Scope *scope) { | ... | @@ -685,7 +685,7 @@ static ZigLLVMDIScope *get_di_scope(CodeGen *g, Scope *scope) { |
| 685 | case ScopeIdLoop: | 685 | case ScopeIdLoop: |
| 686 | case ScopeIdSuspend: | 686 | case ScopeIdSuspend: |
| 687 | case ScopeIdCompTime: | 687 | case ScopeIdCompTime: |
| 688 | case ScopeIdNoAsync: | 688 | case ScopeIdNoSuspend: |
| 689 | case ScopeIdRuntime: | 689 | case ScopeIdRuntime: |
| 690 | case ScopeIdTypeOf: | 690 | case ScopeIdTypeOf: |
| 691 | case ScopeIdExpr: | 691 | case ScopeIdExpr: |
| ... | @@ -966,8 +966,8 @@ static Buf *panic_msg_buf(PanicMsgId msg_id) { | ... | @@ -966,8 +966,8 @@ static Buf *panic_msg_buf(PanicMsgId msg_id) { |
| 966 | return buf_create_from_str("frame too small"); | 966 | return buf_create_from_str("frame too small"); |
| 967 | case PanicMsgIdResumedFnPendingAwait: | 967 | case PanicMsgIdResumedFnPendingAwait: |
| 968 | return buf_create_from_str("resumed an async function which can only be awaited"); | 968 | return buf_create_from_str("resumed an async function which can only be awaited"); |
| 969 | case PanicMsgIdBadNoAsyncCall: | 969 | case PanicMsgIdBadNoSuspendCall: |
| 970 | return buf_create_from_str("async function called in noasync scope suspended"); | 970 | return buf_create_from_str("async function called in nosuspend scope suspended"); |
| 971 | case PanicMsgIdResumeNotSuspendedFn: | 971 | case PanicMsgIdResumeNotSuspendedFn: |
| 972 | return buf_create_from_str("resumed a non-suspended function"); | 972 | return buf_create_from_str("resumed a non-suspended function"); |
| 973 | case PanicMsgIdBadSentinel: | 973 | case PanicMsgIdBadSentinel: |
| ... | @@ -4061,7 +4061,7 @@ static void render_async_var_decls(CodeGen *g, Scope *scope) { | ... | @@ -4061,7 +4061,7 @@ static void render_async_var_decls(CodeGen *g, Scope *scope) { |
| 4061 | case ScopeIdLoop: | 4061 | case ScopeIdLoop: |
| 4062 | case ScopeIdSuspend: | 4062 | case ScopeIdSuspend: |
| 4063 | case ScopeIdCompTime: | 4063 | case ScopeIdCompTime: |
| 4064 | case ScopeIdNoAsync: | 4064 | case ScopeIdNoSuspend: |
| 4065 | case ScopeIdRuntime: | 4065 | case ScopeIdRuntime: |
| 4066 | case ScopeIdTypeOf: | 4066 | case ScopeIdTypeOf: |
| 4067 | case ScopeIdExpr: | 4067 | case ScopeIdExpr: |
| ... | @@ -4212,9 +4212,9 @@ static LLVMValueRef ir_render_call(CodeGen *g, IrExecutableGen *executable, IrIn | ... | @@ -4212,9 +4212,9 @@ static LLVMValueRef ir_render_call(CodeGen *g, IrExecutableGen *executable, IrIn |
| 4212 | // even if prefix_arg_err_ret_stack is true, let the async function do its own | 4212 | // even if prefix_arg_err_ret_stack is true, let the async function do its own |
| 4213 | // initialization. | 4213 | // initialization. |
| 4214 | } else { | 4214 | } else { |
| 4215 | if (instruction->modifier == CallModifierNoAsync && !fn_is_async(g->cur_fn)) { | 4215 | if (instruction->modifier == CallModifierNoSuspend && !fn_is_async(g->cur_fn)) { |
| 4216 | // Async function called as a normal function, and calling function is not async. | 4216 | // Async function called as a normal function, and calling function is not async. |
| 4217 | // This is allowed because it was called with `noasync` which asserts that it will | 4217 | // This is allowed because it was called with `nosuspend` which asserts that it will |
| 4218 | // never suspend. | 4218 | // never suspend. |
| 4219 | awaiter_init_val = zero; | 4219 | awaiter_init_val = zero; |
| 4220 | } else { | 4220 | } else { |
| ... | @@ -4325,7 +4325,7 @@ static LLVMValueRef ir_render_call(CodeGen *g, IrExecutableGen *executable, IrIn | ... | @@ -4325,7 +4325,7 @@ static LLVMValueRef ir_render_call(CodeGen *g, IrExecutableGen *executable, IrIn |
| 4325 | case CallModifierCompileTime: | 4325 | case CallModifierCompileTime: |
| 4326 | zig_unreachable(); | 4326 | zig_unreachable(); |
| 4327 | case CallModifierNone: | 4327 | case CallModifierNone: |
| 4328 | case CallModifierNoAsync: | 4328 | case CallModifierNoSuspend: |
| 4329 | case CallModifierAsync: | 4329 | case CallModifierAsync: |
| 4330 | call_attr = ZigLLVM_CallAttrAuto; | 4330 | call_attr = ZigLLVM_CallAttrAuto; |
| 4331 | break; | 4331 | break; |
| ... | @@ -4401,7 +4401,7 @@ static LLVMValueRef ir_render_call(CodeGen *g, IrExecutableGen *executable, IrIn | ... | @@ -4401,7 +4401,7 @@ static LLVMValueRef ir_render_call(CodeGen *g, IrExecutableGen *executable, IrIn |
| 4401 | get_llvm_type(g, instruction->base.value->type), ""); | 4401 | get_llvm_type(g, instruction->base.value->type), ""); |
| 4402 | } | 4402 | } |
| 4403 | return nullptr; | 4403 | return nullptr; |
| 4404 | } else if (instruction->modifier == CallModifierNoAsync && !fn_is_async(g->cur_fn)) { | 4404 | } else if (instruction->modifier == CallModifierNoSuspend && !fn_is_async(g->cur_fn)) { |
| 4405 | gen_resume(g, fn_val, frame_result_loc, ResumeIdCall); | 4405 | gen_resume(g, fn_val, frame_result_loc, ResumeIdCall); |
| 4406 | 4406 | ||
| 4407 | if (ir_want_runtime_safety(g, &instruction->base)) { | 4407 | if (ir_want_runtime_safety(g, &instruction->base)) { |
| ... | @@ -4412,13 +4412,13 @@ static LLVMValueRef ir_render_call(CodeGen *g, IrExecutableGen *executable, IrIn | ... | @@ -4412,13 +4412,13 @@ static LLVMValueRef ir_render_call(CodeGen *g, IrExecutableGen *executable, IrIn |
| 4412 | all_ones, LLVMAtomicOrderingRelease); | 4412 | all_ones, LLVMAtomicOrderingRelease); |
| 4413 | LLVMValueRef ok_val = LLVMBuildICmp(g->builder, LLVMIntEQ, prev_val, all_ones, ""); | 4413 | LLVMValueRef ok_val = LLVMBuildICmp(g->builder, LLVMIntEQ, prev_val, all_ones, ""); |
| 4414 | 4414 | ||
| 4415 | LLVMBasicBlockRef bad_block = LLVMAppendBasicBlock(g->cur_fn_val, "NoAsyncPanic"); | 4415 | LLVMBasicBlockRef bad_block = LLVMAppendBasicBlock(g->cur_fn_val, "NoSuspendPanic"); |
| 4416 | LLVMBasicBlockRef ok_block = LLVMAppendBasicBlock(g->cur_fn_val, "NoAsyncOk"); | 4416 | LLVMBasicBlockRef ok_block = LLVMAppendBasicBlock(g->cur_fn_val, "NoSuspendOk"); |
| 4417 | LLVMBuildCondBr(g->builder, ok_val, ok_block, bad_block); | 4417 | LLVMBuildCondBr(g->builder, ok_val, ok_block, bad_block); |
| 4418 | 4418 | ||
| 4419 | // The async function suspended, but this noasync call asserted it wouldn't. | 4419 | // The async function suspended, but this nosuspend call asserted it wouldn't. |
| 4420 | LLVMPositionBuilderAtEnd(g->builder, bad_block); | 4420 | LLVMPositionBuilderAtEnd(g->builder, bad_block); |
| 4421 | gen_safety_crash(g, PanicMsgIdBadNoAsyncCall); | 4421 | gen_safety_crash(g, PanicMsgIdBadNoSuspendCall); |
| 4422 | 4422 | ||
| 4423 | LLVMPositionBuilderAtEnd(g->builder, ok_block); | 4423 | LLVMPositionBuilderAtEnd(g->builder, ok_block); |
| 4424 | } | 4424 | } |
| ... | @@ -6391,7 +6391,7 @@ static LLVMValueRef ir_render_await(CodeGen *g, IrExecutableGen *executable, IrI | ... | @@ -6391,7 +6391,7 @@ static LLVMValueRef ir_render_await(CodeGen *g, IrExecutableGen *executable, IrI |
| 6391 | LLVMValueRef result_loc = (instruction->result_loc == nullptr) ? | 6391 | LLVMValueRef result_loc = (instruction->result_loc == nullptr) ? |
| 6392 | nullptr : ir_llvm_value(g, instruction->result_loc); | 6392 | nullptr : ir_llvm_value(g, instruction->result_loc); |
| 6393 | 6393 | ||
| 6394 | if (instruction->is_noasync || | 6394 | if (instruction->is_nosuspend || |
| 6395 | (instruction->target_fn != nullptr && !fn_is_async(instruction->target_fn))) | 6395 | (instruction->target_fn != nullptr && !fn_is_async(instruction->target_fn))) |
| 6396 | { | 6396 | { |
| 6397 | return gen_await_early_return(g, &instruction->base, target_frame_ptr, result_type, | 6397 | return gen_await_early_return(g, &instruction->base, target_frame_ptr, result_type, |
| ... | @@ -7918,7 +7918,7 @@ static void do_code_gen(CodeGen *g) { | ... | @@ -7918,7 +7918,7 @@ static void do_code_gen(CodeGen *g) { |
| 7918 | } | 7918 | } |
| 7919 | 7919 | ||
| 7920 | if (!is_async) { | 7920 | if (!is_async) { |
| 7921 | // allocate async frames for noasync calls & awaits to async functions | 7921 | // allocate async frames for nosuspend calls & awaits to async functions |
| 7922 | ZigType *largest_call_frame_type = nullptr; | 7922 | ZigType *largest_call_frame_type = nullptr; |
| 7923 | IrInstGen *all_calls_alloca = ir_create_alloca(g, &fn_table_entry->fndef_scope->base, | 7923 | IrInstGen *all_calls_alloca = ir_create_alloca(g, &fn_table_entry->fndef_scope->base, |
| 7924 | fn_table_entry->body_node, fn_table_entry, g->builtin_types.entry_void, "@async_call_frame"); | 7924 | fn_table_entry->body_node, fn_table_entry, g->builtin_types.entry_void, "@async_call_frame"); |
| ... | @@ -7928,7 +7928,7 @@ static void do_code_gen(CodeGen *g) { | ... | @@ -7928,7 +7928,7 @@ static void do_code_gen(CodeGen *g) { |
| 7928 | continue; | 7928 | continue; |
| 7929 | if (!fn_is_async(call->fn_entry)) | 7929 | if (!fn_is_async(call->fn_entry)) |
| 7930 | continue; | 7930 | continue; |
| 7931 | if (call->modifier != CallModifierNoAsync) | 7931 | if (call->modifier != CallModifierNoSuspend) |
| 7932 | continue; | 7932 | continue; |
| 7933 | if (call->frame_result_loc != nullptr) | 7933 | if (call->frame_result_loc != nullptr) |
| 7934 | continue; | 7934 | continue; |
src/ir.cpp+30-30| ... | @@ -4846,12 +4846,12 @@ static IrInstGen *ir_build_suspend_finish_gen(IrAnalyze *ira, IrInst *source_ins | ... | @@ -4846,12 +4846,12 @@ static IrInstGen *ir_build_suspend_finish_gen(IrAnalyze *ira, IrInst *source_ins |
| 4846 | } | 4846 | } |
| 4847 | 4847 | ||
| 4848 | static IrInstSrc *ir_build_await_src(IrBuilderSrc *irb, Scope *scope, AstNode *source_node, | 4848 | static IrInstSrc *ir_build_await_src(IrBuilderSrc *irb, Scope *scope, AstNode *source_node, |
| 4849 | IrInstSrc *frame, ResultLoc *result_loc, bool is_noasync) | 4849 | IrInstSrc *frame, ResultLoc *result_loc, bool is_nosuspend) |
| 4850 | { | 4850 | { |
| 4851 | IrInstSrcAwait *instruction = ir_build_instruction<IrInstSrcAwait>(irb, scope, source_node); | 4851 | IrInstSrcAwait *instruction = ir_build_instruction<IrInstSrcAwait>(irb, scope, source_node); |
| 4852 | instruction->frame = frame; | 4852 | instruction->frame = frame; |
| 4853 | instruction->result_loc = result_loc; | 4853 | instruction->result_loc = result_loc; |
| 4854 | instruction->is_noasync = is_noasync; | 4854 | instruction->is_nosuspend = is_nosuspend; |
| 4855 | 4855 | ||
| 4856 | ir_ref_instruction(frame, irb->current_basic_block); | 4856 | ir_ref_instruction(frame, irb->current_basic_block); |
| 4857 | 4857 | ||
| ... | @@ -4859,14 +4859,14 @@ static IrInstSrc *ir_build_await_src(IrBuilderSrc *irb, Scope *scope, AstNode *s | ... | @@ -4859,14 +4859,14 @@ static IrInstSrc *ir_build_await_src(IrBuilderSrc *irb, Scope *scope, AstNode *s |
| 4859 | } | 4859 | } |
| 4860 | 4860 | ||
| 4861 | static IrInstGenAwait *ir_build_await_gen(IrAnalyze *ira, IrInst *source_instruction, | 4861 | static IrInstGenAwait *ir_build_await_gen(IrAnalyze *ira, IrInst *source_instruction, |
| 4862 | IrInstGen *frame, ZigType *result_type, IrInstGen *result_loc, bool is_noasync) | 4862 | IrInstGen *frame, ZigType *result_type, IrInstGen *result_loc, bool is_nosuspend) |
| 4863 | { | 4863 | { |
| 4864 | IrInstGenAwait *instruction = ir_build_inst_gen<IrInstGenAwait>(&ira->new_irb, | 4864 | IrInstGenAwait *instruction = ir_build_inst_gen<IrInstGenAwait>(&ira->new_irb, |
| 4865 | source_instruction->scope, source_instruction->source_node); | 4865 | source_instruction->scope, source_instruction->source_node); |
| 4866 | instruction->base.value->type = result_type; | 4866 | instruction->base.value->type = result_type; |
| 4867 | instruction->frame = frame; | 4867 | instruction->frame = frame; |
| 4868 | instruction->result_loc = result_loc; | 4868 | instruction->result_loc = result_loc; |
| 4869 | instruction->is_noasync = is_noasync; | 4869 | instruction->is_nosuspend = is_nosuspend; |
| 4870 | 4870 | ||
| 4871 | ir_ref_inst_gen(frame); | 4871 | ir_ref_inst_gen(frame); |
| 4872 | if (result_loc != nullptr) ir_ref_inst_gen(result_loc); | 4872 | if (result_loc != nullptr) ir_ref_inst_gen(result_loc); |
| ... | @@ -4982,7 +4982,7 @@ static void ir_count_defers(IrBuilderSrc *irb, Scope *inner_scope, Scope *outer_ | ... | @@ -4982,7 +4982,7 @@ static void ir_count_defers(IrBuilderSrc *irb, Scope *inner_scope, Scope *outer_ |
| 4982 | case ScopeIdLoop: | 4982 | case ScopeIdLoop: |
| 4983 | case ScopeIdSuspend: | 4983 | case ScopeIdSuspend: |
| 4984 | case ScopeIdCompTime: | 4984 | case ScopeIdCompTime: |
| 4985 | case ScopeIdNoAsync: | 4985 | case ScopeIdNoSuspend: |
| 4986 | case ScopeIdRuntime: | 4986 | case ScopeIdRuntime: |
| 4987 | case ScopeIdTypeOf: | 4987 | case ScopeIdTypeOf: |
| 4988 | case ScopeIdExpr: | 4988 | case ScopeIdExpr: |
| ... | @@ -5072,7 +5072,7 @@ static bool ir_gen_defers_for_block(IrBuilderSrc *irb, Scope *inner_scope, Scope | ... | @@ -5072,7 +5072,7 @@ static bool ir_gen_defers_for_block(IrBuilderSrc *irb, Scope *inner_scope, Scope |
| 5072 | case ScopeIdLoop: | 5072 | case ScopeIdLoop: |
| 5073 | case ScopeIdSuspend: | 5073 | case ScopeIdSuspend: |
| 5074 | case ScopeIdCompTime: | 5074 | case ScopeIdCompTime: |
| 5075 | case ScopeIdNoAsync: | 5075 | case ScopeIdNoSuspend: |
| 5076 | case ScopeIdRuntime: | 5076 | case ScopeIdRuntime: |
| 5077 | case ScopeIdTypeOf: | 5077 | case ScopeIdTypeOf: |
| 5078 | case ScopeIdExpr: | 5078 | case ScopeIdExpr: |
| ... | @@ -7335,10 +7335,10 @@ static IrInstSrc *ir_gen_builtin_fn_call(IrBuilderSrc *irb, Scope *scope, AstNod | ... | @@ -7335,10 +7335,10 @@ static IrInstSrc *ir_gen_builtin_fn_call(IrBuilderSrc *irb, Scope *scope, AstNod |
| 7335 | zig_unreachable(); | 7335 | zig_unreachable(); |
| 7336 | } | 7336 | } |
| 7337 | 7337 | ||
| 7338 | static ScopeNoAsync *get_scope_noasync(Scope *scope) { | 7338 | static ScopeNoSuspend *get_scope_nosuspend(Scope *scope) { |
| 7339 | while (scope) { | 7339 | while (scope) { |
| 7340 | if (scope->id == ScopeIdNoAsync) | 7340 | if (scope->id == ScopeIdNoSuspend) |
| 7341 | return (ScopeNoAsync *)scope; | 7341 | return (ScopeNoSuspend *)scope; |
| 7342 | if (scope->id == ScopeIdFnDef) | 7342 | if (scope->id == ScopeIdFnDef) |
| 7343 | return nullptr; | 7343 | return nullptr; |
| 7344 | 7344 | ||
| ... | @@ -7355,15 +7355,15 @@ static IrInstSrc *ir_gen_fn_call(IrBuilderSrc *irb, Scope *scope, AstNode *node, | ... | @@ -7355,15 +7355,15 @@ static IrInstSrc *ir_gen_fn_call(IrBuilderSrc *irb, Scope *scope, AstNode *node, |
| 7355 | if (node->data.fn_call_expr.modifier == CallModifierBuiltin) | 7355 | if (node->data.fn_call_expr.modifier == CallModifierBuiltin) |
| 7356 | return ir_gen_builtin_fn_call(irb, scope, node, lval, result_loc); | 7356 | return ir_gen_builtin_fn_call(irb, scope, node, lval, result_loc); |
| 7357 | 7357 | ||
| 7358 | bool is_noasync = get_scope_noasync(scope) != nullptr; | 7358 | bool is_nosuspend = get_scope_nosuspend(scope) != nullptr; |
| 7359 | CallModifier modifier = node->data.fn_call_expr.modifier; | 7359 | CallModifier modifier = node->data.fn_call_expr.modifier; |
| 7360 | if (is_noasync) { | 7360 | if (is_nosuspend) { |
| 7361 | if (modifier == CallModifierAsync) { | 7361 | if (modifier == CallModifierAsync) { |
| 7362 | add_node_error(irb->codegen, node, | 7362 | add_node_error(irb->codegen, node, |
| 7363 | buf_sprintf("async call in noasync scope")); | 7363 | buf_sprintf("async call in nosuspend scope")); |
| 7364 | return irb->codegen->invalid_inst_src; | 7364 | return irb->codegen->invalid_inst_src; |
| 7365 | } | 7365 | } |
| 7366 | modifier = CallModifierNoAsync; | 7366 | modifier = CallModifierNoSuspend; |
| 7367 | } | 7367 | } |
| 7368 | 7368 | ||
| 7369 | AstNode *fn_ref_node = node->data.fn_call_expr.fn_ref_expr; | 7369 | AstNode *fn_ref_node = node->data.fn_call_expr.fn_ref_expr; |
| ... | @@ -9222,10 +9222,10 @@ static IrInstSrc *ir_gen_comptime(IrBuilderSrc *irb, Scope *parent_scope, AstNod | ... | @@ -9222,10 +9222,10 @@ static IrInstSrc *ir_gen_comptime(IrBuilderSrc *irb, Scope *parent_scope, AstNod |
| 9222 | return ir_gen_node_extra(irb, node->data.comptime_expr.expr, child_scope, lval, nullptr); | 9222 | return ir_gen_node_extra(irb, node->data.comptime_expr.expr, child_scope, lval, nullptr); |
| 9223 | } | 9223 | } |
| 9224 | 9224 | ||
| 9225 | static IrInstSrc *ir_gen_noasync(IrBuilderSrc *irb, Scope *parent_scope, AstNode *node, LVal lval) { | 9225 | static IrInstSrc *ir_gen_nosuspend(IrBuilderSrc *irb, Scope *parent_scope, AstNode *node, LVal lval) { |
| 9226 | assert(node->type == NodeTypeNoAsync); | 9226 | assert(node->type == NodeTypeNoSuspend); |
| 9227 | 9227 | ||
| 9228 | Scope *child_scope = create_noasync_scope(irb->codegen, node, parent_scope); | 9228 | Scope *child_scope = create_nosuspend_scope(irb->codegen, node, parent_scope); |
| 9229 | // purposefully pass null for result_loc and let EndExpr handle it | 9229 | // purposefully pass null for result_loc and let EndExpr handle it |
| 9230 | return ir_gen_node_extra(irb, node->data.comptime_expr.expr, child_scope, lval, nullptr); | 9230 | return ir_gen_node_extra(irb, node->data.comptime_expr.expr, child_scope, lval, nullptr); |
| 9231 | } | 9231 | } |
| ... | @@ -9813,8 +9813,8 @@ static IrInstSrc *ir_gen_fn_proto(IrBuilderSrc *irb, Scope *parent_scope, AstNod | ... | @@ -9813,8 +9813,8 @@ static IrInstSrc *ir_gen_fn_proto(IrBuilderSrc *irb, Scope *parent_scope, AstNod |
| 9813 | 9813 | ||
| 9814 | static IrInstSrc *ir_gen_resume(IrBuilderSrc *irb, Scope *scope, AstNode *node) { | 9814 | static IrInstSrc *ir_gen_resume(IrBuilderSrc *irb, Scope *scope, AstNode *node) { |
| 9815 | assert(node->type == NodeTypeResume); | 9815 | assert(node->type == NodeTypeResume); |
| 9816 | if (get_scope_noasync(scope) != nullptr) { | 9816 | if (get_scope_nosuspend(scope) != nullptr) { |
| 9817 | add_node_error(irb->codegen, node, buf_sprintf("resume in noasync scope")); | 9817 | add_node_error(irb->codegen, node, buf_sprintf("resume in nosuspend scope")); |
| 9818 | return irb->codegen->invalid_inst_src; | 9818 | return irb->codegen->invalid_inst_src; |
| 9819 | } | 9819 | } |
| 9820 | 9820 | ||
| ... | @@ -9830,7 +9830,7 @@ static IrInstSrc *ir_gen_await_expr(IrBuilderSrc *irb, Scope *scope, AstNode *no | ... | @@ -9830,7 +9830,7 @@ static IrInstSrc *ir_gen_await_expr(IrBuilderSrc *irb, Scope *scope, AstNode *no |
| 9830 | { | 9830 | { |
| 9831 | assert(node->type == NodeTypeAwaitExpr); | 9831 | assert(node->type == NodeTypeAwaitExpr); |
| 9832 | 9832 | ||
| 9833 | bool is_noasync = get_scope_noasync(scope) != nullptr; | 9833 | bool is_nosuspend = get_scope_nosuspend(scope) != nullptr; |
| 9834 | 9834 | ||
| 9835 | AstNode *expr_node = node->data.await_expr.expr; | 9835 | AstNode *expr_node = node->data.await_expr.expr; |
| 9836 | if (expr_node->type == NodeTypeFnCallExpr && expr_node->data.fn_call_expr.modifier == CallModifierBuiltin) { | 9836 | if (expr_node->type == NodeTypeFnCallExpr && expr_node->data.fn_call_expr.modifier == CallModifierBuiltin) { |
| ... | @@ -9864,7 +9864,7 @@ static IrInstSrc *ir_gen_await_expr(IrBuilderSrc *irb, Scope *scope, AstNode *no | ... | @@ -9864,7 +9864,7 @@ static IrInstSrc *ir_gen_await_expr(IrBuilderSrc *irb, Scope *scope, AstNode *no |
| 9864 | if (target_inst == irb->codegen->invalid_inst_src) | 9864 | if (target_inst == irb->codegen->invalid_inst_src) |
| 9865 | return irb->codegen->invalid_inst_src; | 9865 | return irb->codegen->invalid_inst_src; |
| 9866 | 9866 | ||
| 9867 | IrInstSrc *await_inst = ir_build_await_src(irb, scope, node, target_inst, result_loc, is_noasync); | 9867 | IrInstSrc *await_inst = ir_build_await_src(irb, scope, node, target_inst, result_loc, is_nosuspend); |
| 9868 | return ir_lval_wrap(irb, scope, await_inst, lval, result_loc); | 9868 | return ir_lval_wrap(irb, scope, await_inst, lval, result_loc); |
| 9869 | } | 9869 | } |
| 9870 | 9870 | ||
| ... | @@ -9876,8 +9876,8 @@ static IrInstSrc *ir_gen_suspend(IrBuilderSrc *irb, Scope *parent_scope, AstNode | ... | @@ -9876,8 +9876,8 @@ static IrInstSrc *ir_gen_suspend(IrBuilderSrc *irb, Scope *parent_scope, AstNode |
| 9876 | add_node_error(irb->codegen, node, buf_sprintf("suspend outside function definition")); | 9876 | add_node_error(irb->codegen, node, buf_sprintf("suspend outside function definition")); |
| 9877 | return irb->codegen->invalid_inst_src; | 9877 | return irb->codegen->invalid_inst_src; |
| 9878 | } | 9878 | } |
| 9879 | if (get_scope_noasync(parent_scope) != nullptr) { | 9879 | if (get_scope_nosuspend(parent_scope) != nullptr) { |
| 9880 | add_node_error(irb->codegen, node, buf_sprintf("suspend in noasync scope")); | 9880 | add_node_error(irb->codegen, node, buf_sprintf("suspend in nosuspend scope")); |
| 9881 | return irb->codegen->invalid_inst_src; | 9881 | return irb->codegen->invalid_inst_src; |
| 9882 | } | 9882 | } |
| 9883 | 9883 | ||
| ... | @@ -10017,8 +10017,8 @@ static IrInstSrc *ir_gen_node_raw(IrBuilderSrc *irb, AstNode *node, Scope *scope | ... | @@ -10017,8 +10017,8 @@ static IrInstSrc *ir_gen_node_raw(IrBuilderSrc *irb, AstNode *node, Scope *scope |
| 10017 | return ir_gen_switch_expr(irb, scope, node, lval, result_loc); | 10017 | return ir_gen_switch_expr(irb, scope, node, lval, result_loc); |
| 10018 | case NodeTypeCompTime: | 10018 | case NodeTypeCompTime: |
| 10019 | return ir_expr_wrap(irb, scope, ir_gen_comptime(irb, scope, node, lval), result_loc); | 10019 | return ir_expr_wrap(irb, scope, ir_gen_comptime(irb, scope, node, lval), result_loc); |
| 10020 | case NodeTypeNoAsync: | 10020 | case NodeTypeNoSuspend: |
| 10021 | return ir_expr_wrap(irb, scope, ir_gen_noasync(irb, scope, node, lval), result_loc); | 10021 | return ir_expr_wrap(irb, scope, ir_gen_nosuspend(irb, scope, node, lval), result_loc); |
| 10022 | case NodeTypeErrorType: | 10022 | case NodeTypeErrorType: |
| 10023 | return ir_lval_wrap(irb, scope, ir_gen_error_type(irb, scope, node), lval, result_loc); | 10023 | return ir_lval_wrap(irb, scope, ir_gen_error_type(irb, scope, node), lval, result_loc); |
| 10024 | case NodeTypeBreak: | 10024 | case NodeTypeBreak: |
| ... | @@ -10105,7 +10105,7 @@ static IrInstSrc *ir_gen_node_extra(IrBuilderSrc *irb, AstNode *node, Scope *sco | ... | @@ -10105,7 +10105,7 @@ static IrInstSrc *ir_gen_node_extra(IrBuilderSrc *irb, AstNode *node, Scope *sco |
| 10105 | case NodeTypeIfOptional: | 10105 | case NodeTypeIfOptional: |
| 10106 | case NodeTypeSwitchExpr: | 10106 | case NodeTypeSwitchExpr: |
| 10107 | case NodeTypeCompTime: | 10107 | case NodeTypeCompTime: |
| 10108 | case NodeTypeNoAsync: | 10108 | case NodeTypeNoSuspend: |
| 10109 | case NodeTypeErrorType: | 10109 | case NodeTypeErrorType: |
| 10110 | case NodeTypeBreak: | 10110 | case NodeTypeBreak: |
| 10111 | case NodeTypeContinue: | 10111 | case NodeTypeContinue: |
| ... | @@ -20030,7 +20030,7 @@ static IrInstGen *ir_analyze_fn_call(IrAnalyze *ira, IrInst* source_instr, | ... | @@ -20030,7 +20030,7 @@ static IrInstGen *ir_analyze_fn_call(IrAnalyze *ira, IrInst* source_instr, |
| 20030 | 20030 | ||
| 20031 | if (impl_fn_type_id->cc == CallingConventionAsync && | 20031 | if (impl_fn_type_id->cc == CallingConventionAsync && |
| 20032 | parent_fn_entry->inferred_async_node == nullptr && | 20032 | parent_fn_entry->inferred_async_node == nullptr && |
| 20033 | modifier != CallModifierNoAsync) | 20033 | modifier != CallModifierNoSuspend) |
| 20034 | { | 20034 | { |
| 20035 | parent_fn_entry->inferred_async_node = fn_ref->base.source_node; | 20035 | parent_fn_entry->inferred_async_node = fn_ref->base.source_node; |
| 20036 | parent_fn_entry->inferred_async_fn = impl_fn; | 20036 | parent_fn_entry->inferred_async_fn = impl_fn; |
| ... | @@ -20128,7 +20128,7 @@ static IrInstGen *ir_analyze_fn_call(IrAnalyze *ira, IrInst* source_instr, | ... | @@ -20128,7 +20128,7 @@ static IrInstGen *ir_analyze_fn_call(IrAnalyze *ira, IrInst* source_instr, |
| 20128 | 20128 | ||
| 20129 | if (fn_type_id->cc == CallingConventionAsync && | 20129 | if (fn_type_id->cc == CallingConventionAsync && |
| 20130 | parent_fn_entry->inferred_async_node == nullptr && | 20130 | parent_fn_entry->inferred_async_node == nullptr && |
| 20131 | modifier != CallModifierNoAsync) | 20131 | modifier != CallModifierNoSuspend) |
| 20132 | { | 20132 | { |
| 20133 | parent_fn_entry->inferred_async_node = fn_ref->base.source_node; | 20133 | parent_fn_entry->inferred_async_node = fn_ref->base.source_node; |
| 20134 | parent_fn_entry->inferred_async_fn = fn_entry; | 20134 | parent_fn_entry->inferred_async_fn = fn_entry; |
| ... | @@ -20243,7 +20243,7 @@ static IrInstGen *ir_analyze_call_extra(IrAnalyze *ira, IrInst* source_instr, | ... | @@ -20243,7 +20243,7 @@ static IrInstGen *ir_analyze_call_extra(IrAnalyze *ira, IrInst* source_instr, |
| 20243 | case CallModifierNone: | 20243 | case CallModifierNone: |
| 20244 | case CallModifierAlwaysInline: | 20244 | case CallModifierAlwaysInline: |
| 20245 | case CallModifierAlwaysTail: | 20245 | case CallModifierAlwaysTail: |
| 20246 | case CallModifierNoAsync: | 20246 | case CallModifierNoSuspend: |
| 20247 | modifier = CallModifierCompileTime; | 20247 | modifier = CallModifierCompileTime; |
| 20248 | break; | 20248 | break; |
| 20249 | case CallModifierNeverInline: | 20249 | case CallModifierNeverInline: |
| ... | @@ -30287,7 +30287,7 @@ static IrInstGen *ir_analyze_instruction_await(IrAnalyze *ira, IrInstSrcAwait *i | ... | @@ -30287,7 +30287,7 @@ static IrInstGen *ir_analyze_instruction_await(IrAnalyze *ira, IrInstSrcAwait *i |
| 30287 | ir_assert(fn_entry != nullptr, &instruction->base.base); | 30287 | ir_assert(fn_entry != nullptr, &instruction->base.base); |
| 30288 | 30288 | ||
| 30289 | // If it's not @Frame(func) then it's definitely a suspend point | 30289 | // If it's not @Frame(func) then it's definitely a suspend point |
| 30290 | if (target_fn == nullptr && !instruction->is_noasync) { | 30290 | if (target_fn == nullptr && !instruction->is_nosuspend) { |
| 30291 | if (fn_entry->inferred_async_node == nullptr) { | 30291 | if (fn_entry->inferred_async_node == nullptr) { |
| 30292 | fn_entry->inferred_async_node = instruction->base.base.source_node; | 30292 | fn_entry->inferred_async_node = instruction->base.base.source_node; |
| 30293 | } | 30293 | } |
| ... | @@ -30311,7 +30311,7 @@ static IrInstGen *ir_analyze_instruction_await(IrAnalyze *ira, IrInstSrcAwait *i | ... | @@ -30311,7 +30311,7 @@ static IrInstGen *ir_analyze_instruction_await(IrAnalyze *ira, IrInstSrcAwait *i |
| 30311 | } | 30311 | } |
| 30312 | 30312 | ||
| 30313 | IrInstGenAwait *result = ir_build_await_gen(ira, &instruction->base.base, frame, result_type, result_loc, | 30313 | IrInstGenAwait *result = ir_build_await_gen(ira, &instruction->base.base, frame, result_type, result_loc, |
| 30314 | instruction->is_noasync); | 30314 | instruction->is_nosuspend); |
| 30315 | result->target_fn = target_fn; | 30315 | result->target_fn = target_fn; |
| 30316 | fn_entry->await_list.append(result); | 30316 | fn_entry->await_list.append(result); |
| 30317 | return ir_finish_anal(ira, &result->base); | 30317 | return ir_finish_anal(ira, &result->base); |
src/ir_print.cpp+4-4| ... | @@ -861,8 +861,8 @@ static void ir_print_call_src(IrPrintSrc *irp, IrInstSrcCall *call_instruction) | ... | @@ -861,8 +861,8 @@ static void ir_print_call_src(IrPrintSrc *irp, IrInstSrcCall *call_instruction) |
| 861 | switch (call_instruction->modifier) { | 861 | switch (call_instruction->modifier) { |
| 862 | case CallModifierNone: | 862 | case CallModifierNone: |
| 863 | break; | 863 | break; |
| 864 | case CallModifierNoAsync: | 864 | case CallModifierNoSuspend: |
| 865 | fprintf(irp->f, "noasync "); | 865 | fprintf(irp->f, "nosuspend "); |
| 866 | break; | 866 | break; |
| 867 | case CallModifierAsync: | 867 | case CallModifierAsync: |
| 868 | fprintf(irp->f, "async "); | 868 | fprintf(irp->f, "async "); |
| ... | @@ -906,8 +906,8 @@ static void ir_print_call_gen(IrPrintGen *irp, IrInstGenCall *call_instruction) | ... | @@ -906,8 +906,8 @@ static void ir_print_call_gen(IrPrintGen *irp, IrInstGenCall *call_instruction) |
| 906 | switch (call_instruction->modifier) { | 906 | switch (call_instruction->modifier) { |
| 907 | case CallModifierNone: | 907 | case CallModifierNone: |
| 908 | break; | 908 | break; |
| 909 | case CallModifierNoAsync: | 909 | case CallModifierNoSuspend: |
| 910 | fprintf(irp->f, "noasync "); | 910 | fprintf(irp->f, "nosuspend "); |
| 911 | break; | 911 | break; |
| 912 | case CallModifierAsync: | 912 | case CallModifierAsync: |
| 913 | fprintf(irp->f, "async "); | 913 | fprintf(irp->f, "async "); |
src/parser.cpp+16-16| ... | @@ -913,7 +913,7 @@ static AstNode *ast_parse_container_field(ParseContext *pc) { | ... | @@ -913,7 +913,7 @@ static AstNode *ast_parse_container_field(ParseContext *pc) { |
| 913 | // Statement | 913 | // Statement |
| 914 | // <- KEYWORD_comptime? VarDecl | 914 | // <- KEYWORD_comptime? VarDecl |
| 915 | // / KEYWORD_comptime BlockExprStatement | 915 | // / KEYWORD_comptime BlockExprStatement |
| 916 | // / KEYWORD_noasync BlockExprStatement | 916 | // / KEYWORD_nosuspend BlockExprStatement |
| 917 | // / KEYWORD_suspend (SEMICOLON / BlockExprStatement) | 917 | // / KEYWORD_suspend (SEMICOLON / BlockExprStatement) |
| 918 | // / KEYWORD_defer BlockExprStatement | 918 | // / KEYWORD_defer BlockExprStatement |
| 919 | // / KEYWORD_errdefer Payload? BlockExprStatement | 919 | // / KEYWORD_errdefer Payload? BlockExprStatement |
| ... | @@ -937,11 +937,11 @@ static AstNode *ast_parse_statement(ParseContext *pc) { | ... | @@ -937,11 +937,11 @@ static AstNode *ast_parse_statement(ParseContext *pc) { |
| 937 | return res; | 937 | return res; |
| 938 | } | 938 | } |
| 939 | 939 | ||
| 940 | Token *noasync = eat_token_if(pc, TokenIdKeywordNoAsync); | 940 | Token *nosuspend = eat_token_if(pc, TokenIdKeywordNoSuspend); |
| 941 | if (noasync != nullptr) { | 941 | if (nosuspend != nullptr) { |
| 942 | AstNode *statement = ast_expect(pc, ast_parse_block_expr_statement); | 942 | AstNode *statement = ast_expect(pc, ast_parse_block_expr_statement); |
| 943 | AstNode *res = ast_create_node(pc, NodeTypeNoAsync, noasync); | 943 | AstNode *res = ast_create_node(pc, NodeTypeNoSuspend, nosuspend); |
| 944 | res->data.noasync_expr.expr = statement; | 944 | res->data.nosuspend_expr.expr = statement; |
| 945 | return res; | 945 | return res; |
| 946 | } | 946 | } |
| 947 | 947 | ||
| ... | @@ -1289,7 +1289,7 @@ static AstNode *ast_parse_prefix_expr(ParseContext *pc) { | ... | @@ -1289,7 +1289,7 @@ static AstNode *ast_parse_prefix_expr(ParseContext *pc) { |
| 1289 | // / IfExpr | 1289 | // / IfExpr |
| 1290 | // / KEYWORD_break BreakLabel? Expr? | 1290 | // / KEYWORD_break BreakLabel? Expr? |
| 1291 | // / KEYWORD_comptime Expr | 1291 | // / KEYWORD_comptime Expr |
| 1292 | // / KEYWORD_noasync Expr | 1292 | // / KEYWORD_nosuspend Expr |
| 1293 | // / KEYWORD_continue BreakLabel? | 1293 | // / KEYWORD_continue BreakLabel? |
| 1294 | // / KEYWORD_resume Expr | 1294 | // / KEYWORD_resume Expr |
| 1295 | // / KEYWORD_return Expr? | 1295 | // / KEYWORD_return Expr? |
| ... | @@ -1324,11 +1324,11 @@ static AstNode *ast_parse_primary_expr(ParseContext *pc) { | ... | @@ -1324,11 +1324,11 @@ static AstNode *ast_parse_primary_expr(ParseContext *pc) { |
| 1324 | return res; | 1324 | return res; |
| 1325 | } | 1325 | } |
| 1326 | 1326 | ||
| 1327 | Token *noasync = eat_token_if(pc, TokenIdKeywordNoAsync); | 1327 | Token *nosuspend = eat_token_if(pc, TokenIdKeywordNoSuspend); |
| 1328 | if (noasync != nullptr) { | 1328 | if (nosuspend != nullptr) { |
| 1329 | AstNode *expr = ast_expect(pc, ast_parse_expr); | 1329 | AstNode *expr = ast_expect(pc, ast_parse_expr); |
| 1330 | AstNode *res = ast_create_node(pc, NodeTypeNoAsync, noasync); | 1330 | AstNode *res = ast_create_node(pc, NodeTypeNoSuspend, nosuspend); |
| 1331 | res->data.noasync_expr.expr = expr; | 1331 | res->data.nosuspend_expr.expr = expr; |
| 1332 | return res; | 1332 | return res; |
| 1333 | } | 1333 | } |
| 1334 | 1334 | ||
| ... | @@ -1640,7 +1640,7 @@ static AstNode *ast_parse_suffix_expr(ParseContext *pc) { | ... | @@ -1640,7 +1640,7 @@ static AstNode *ast_parse_suffix_expr(ParseContext *pc) { |
| 1640 | // / IfTypeExpr | 1640 | // / IfTypeExpr |
| 1641 | // / INTEGER | 1641 | // / INTEGER |
| 1642 | // / KEYWORD_comptime TypeExpr | 1642 | // / KEYWORD_comptime TypeExpr |
| 1643 | // / KEYWORD_noasync TypeExpr | 1643 | // / KEYWORD_nosuspend TypeExpr |
| 1644 | // / KEYWORD_error DOT IDENTIFIER | 1644 | // / KEYWORD_error DOT IDENTIFIER |
| 1645 | // / KEYWORD_false | 1645 | // / KEYWORD_false |
| 1646 | // / KEYWORD_null | 1646 | // / KEYWORD_null |
| ... | @@ -1742,11 +1742,11 @@ static AstNode *ast_parse_primary_type_expr(ParseContext *pc) { | ... | @@ -1742,11 +1742,11 @@ static AstNode *ast_parse_primary_type_expr(ParseContext *pc) { |
| 1742 | return res; | 1742 | return res; |
| 1743 | } | 1743 | } |
| 1744 | 1744 | ||
| 1745 | Token *noasync = eat_token_if(pc, TokenIdKeywordNoAsync); | 1745 | Token *nosuspend = eat_token_if(pc, TokenIdKeywordNoSuspend); |
| 1746 | if (noasync != nullptr) { | 1746 | if (nosuspend != nullptr) { |
| 1747 | AstNode *expr = ast_expect(pc, ast_parse_type_expr); | 1747 | AstNode *expr = ast_expect(pc, ast_parse_type_expr); |
| 1748 | AstNode *res = ast_create_node(pc, NodeTypeNoAsync, noasync); | 1748 | AstNode *res = ast_create_node(pc, NodeTypeNoSuspend, nosuspend); |
| 1749 | res->data.noasync_expr.expr = expr; | 1749 | res->data.nosuspend_expr.expr = expr; |
| 1750 | return res; | 1750 | return res; |
| 1751 | } | 1751 | } |
| 1752 | 1752 | ||
| ... | @@ -3189,7 +3189,7 @@ void ast_visit_node_children(AstNode *node, void (*visit)(AstNode **, void *cont | ... | @@ -3189,7 +3189,7 @@ void ast_visit_node_children(AstNode *node, void (*visit)(AstNode **, void *cont |
| 3189 | case NodeTypeCompTime: | 3189 | case NodeTypeCompTime: |
| 3190 | visit_field(&node->data.comptime_expr.expr, visit, context); | 3190 | visit_field(&node->data.comptime_expr.expr, visit, context); |
| 3191 | break; | 3191 | break; |
| 3192 | case NodeTypeNoAsync: | 3192 | case NodeTypeNoSuspend: |
| 3193 | visit_field(&node->data.comptime_expr.expr, visit, context); | 3193 | visit_field(&node->data.comptime_expr.expr, visit, context); |
| 3194 | break; | 3194 | break; |
| 3195 | case NodeTypeBreak: | 3195 | case NodeTypeBreak: |
src/tokenizer.cpp+2-2| ... | @@ -128,8 +128,8 @@ static const struct ZigKeyword zig_keywords[] = { | ... | @@ -128,8 +128,8 @@ static const struct ZigKeyword zig_keywords[] = { |
| 128 | {"if", TokenIdKeywordIf}, | 128 | {"if", TokenIdKeywordIf}, |
| 129 | {"inline", TokenIdKeywordInline}, | 129 | {"inline", TokenIdKeywordInline}, |
| 130 | {"noalias", TokenIdKeywordNoAlias}, | 130 | {"noalias", TokenIdKeywordNoAlias}, |
| 131 | {"noasync", TokenIdKeywordNoAsync}, | ||
| 132 | {"noinline", TokenIdKeywordNoInline}, | 131 | {"noinline", TokenIdKeywordNoInline}, |
| 132 | {"nosuspend", TokenIdKeywordNoSuspend}, | ||
| 133 | {"null", TokenIdKeywordNull}, | 133 | {"null", TokenIdKeywordNull}, |
| 134 | {"or", TokenIdKeywordOr}, | 134 | {"or", TokenIdKeywordOr}, |
| 135 | {"orelse", TokenIdKeywordOrElse}, | 135 | {"orelse", TokenIdKeywordOrElse}, |
| ... | @@ -1589,8 +1589,8 @@ const char * token_name(TokenId id) { | ... | @@ -1589,8 +1589,8 @@ const char * token_name(TokenId id) { |
| 1589 | case TokenIdKeywordIf: return "if"; | 1589 | case TokenIdKeywordIf: return "if"; |
| 1590 | case TokenIdKeywordInline: return "inline"; | 1590 | case TokenIdKeywordInline: return "inline"; |
| 1591 | case TokenIdKeywordNoAlias: return "noalias"; | 1591 | case TokenIdKeywordNoAlias: return "noalias"; |
| 1592 | case TokenIdKeywordNoAsync: return "noasync"; | ||
| 1593 | case TokenIdKeywordNoInline: return "noinline"; | 1592 | case TokenIdKeywordNoInline: return "noinline"; |
| 1593 | case TokenIdKeywordNoSuspend: return "nosuspend"; | ||
| 1594 | case TokenIdKeywordNull: return "null"; | 1594 | case TokenIdKeywordNull: return "null"; |
| 1595 | case TokenIdKeywordOr: return "or"; | 1595 | case TokenIdKeywordOr: return "or"; |
| 1596 | case TokenIdKeywordOrElse: return "orelse"; | 1596 | case TokenIdKeywordOrElse: return "orelse"; |
src/tokenizer.hpp+1-1| ... | @@ -78,7 +78,7 @@ enum TokenId { | ... | @@ -78,7 +78,7 @@ enum TokenId { |
| 78 | TokenIdKeywordNoInline, | 78 | TokenIdKeywordNoInline, |
| 79 | TokenIdKeywordLinkSection, | 79 | TokenIdKeywordLinkSection, |
| 80 | TokenIdKeywordNoAlias, | 80 | TokenIdKeywordNoAlias, |
| 81 | TokenIdKeywordNoAsync, | 81 | TokenIdKeywordNoSuspend, |
| 82 | TokenIdKeywordNull, | 82 | TokenIdKeywordNull, |
| 83 | TokenIdKeywordOr, | 83 | TokenIdKeywordOr, |
| 84 | TokenIdKeywordOrElse, | 84 | TokenIdKeywordOrElse, |
test/compile_errors.zig+5-5| ... | @@ -266,9 +266,9 @@ pub fn addCases(cases: *tests.CompileErrorContext) void { | ... | @@ -266,9 +266,9 @@ pub fn addCases(cases: *tests.CompileErrorContext) void { |
| 266 | "tmp.zig:17:17: error: RHS of shift is too large for LHS type", | 266 | "tmp.zig:17:17: error: RHS of shift is too large for LHS type", |
| 267 | }); | 267 | }); |
| 268 | 268 | ||
| 269 | cases.addTest("combination of noasync and async", | 269 | cases.addTest("combination of nosuspend and async", |
| 270 | \\export fn entry() void { | 270 | \\export fn entry() void { |
| 271 | \\ noasync { | 271 | \\ nosuspend { |
| 272 | \\ const bar = async foo(); | 272 | \\ const bar = async foo(); |
| 273 | \\ suspend; | 273 | \\ suspend; |
| 274 | \\ resume bar; | 274 | \\ resume bar; |
| ... | @@ -276,9 +276,9 @@ pub fn addCases(cases: *tests.CompileErrorContext) void { | ... | @@ -276,9 +276,9 @@ pub fn addCases(cases: *tests.CompileErrorContext) void { |
| 276 | \\} | 276 | \\} |
| 277 | \\fn foo() void {} | 277 | \\fn foo() void {} |
| 278 | , &[_][]const u8{ | 278 | , &[_][]const u8{ |
| 279 | "tmp.zig:3:21: error: async call in noasync scope", | 279 | "tmp.zig:3:21: error: async call in nosuspend scope", |
| 280 | "tmp.zig:4:9: error: suspend in noasync scope", | 280 | "tmp.zig:4:9: error: suspend in nosuspend scope", |
| 281 | "tmp.zig:5:9: error: resume in noasync scope", | 281 | "tmp.zig:5:9: error: resume in nosuspend scope", |
| 282 | }); | 282 | }); |
| 283 | 283 | ||
| 284 | cases.add("atomicrmw with bool op not .Xchg", | 284 | cases.add("atomicrmw with bool op not .Xchg", |
test/runtime_safety.zig+2-2| ... | @@ -234,12 +234,12 @@ pub fn addCases(cases: *tests.CompareOutputContext) void { | ... | @@ -234,12 +234,12 @@ pub fn addCases(cases: *tests.CompareOutputContext) void { |
| 234 | \\} | 234 | \\} |
| 235 | ); | 235 | ); |
| 236 | 236 | ||
| 237 | cases.addRuntimeSafety("noasync function call, callee suspends", | 237 | cases.addRuntimeSafety("nosuspend function call, callee suspends", |
| 238 | \\pub fn panic(message: []const u8, stack_trace: ?*@import("builtin").StackTrace) noreturn { | 238 | \\pub fn panic(message: []const u8, stack_trace: ?*@import("builtin").StackTrace) noreturn { |
| 239 | \\ @import("std").os.exit(126); | 239 | \\ @import("std").os.exit(126); |
| 240 | \\} | 240 | \\} |
| 241 | \\pub fn main() void { | 241 | \\pub fn main() void { |
| 242 | \\ _ = noasync add(101, 100); | 242 | \\ _ = nosuspend add(101, 100); |
| 243 | \\} | 243 | \\} |
| 244 | \\fn add(a: i32, b: i32) i32 { | 244 | \\fn add(a: i32, b: i32) i32 { |
| 245 | \\ if (a > 100) { | 245 | \\ if (a > 100) { |
test/stage1/behavior/async_fn.zig+8-8| ... | @@ -1090,10 +1090,10 @@ test "recursive call of await @asyncCall with struct return type" { | ... | @@ -1090,10 +1090,10 @@ test "recursive call of await @asyncCall with struct return type" { |
| 1090 | expect(res.z == 3); | 1090 | expect(res.z == 3); |
| 1091 | } | 1091 | } |
| 1092 | 1092 | ||
| 1093 | test "noasync function call" { | 1093 | test "nosuspend function call" { |
| 1094 | const S = struct { | 1094 | const S = struct { |
| 1095 | fn doTheTest() void { | 1095 | fn doTheTest() void { |
| 1096 | const result = noasync add(50, 100); | 1096 | const result = nosuspend add(50, 100); |
| 1097 | expect(result == 150); | 1097 | expect(result == 150); |
| 1098 | } | 1098 | } |
| 1099 | fn add(a: i32, b: i32) i32 { | 1099 | fn add(a: i32, b: i32) i32 { |
| ... | @@ -1511,13 +1511,13 @@ test "take address of temporary async frame" { | ... | @@ -1511,13 +1511,13 @@ test "take address of temporary async frame" { |
| 1511 | S.doTheTest(); | 1511 | S.doTheTest(); |
| 1512 | } | 1512 | } |
| 1513 | 1513 | ||
| 1514 | test "noasync await" { | 1514 | test "nosuspend await" { |
| 1515 | const S = struct { | 1515 | const S = struct { |
| 1516 | var finished = false; | 1516 | var finished = false; |
| 1517 | 1517 | ||
| 1518 | fn doTheTest() void { | 1518 | fn doTheTest() void { |
| 1519 | var frame = async foo(false); | 1519 | var frame = async foo(false); |
| 1520 | expect(noasync await frame == 42); | 1520 | expect(nosuspend await frame == 42); |
| 1521 | finished = true; | 1521 | finished = true; |
| 1522 | } | 1522 | } |
| 1523 | 1523 | ||
| ... | @@ -1532,7 +1532,7 @@ test "noasync await" { | ... | @@ -1532,7 +1532,7 @@ test "noasync await" { |
| 1532 | expect(S.finished); | 1532 | expect(S.finished); |
| 1533 | } | 1533 | } |
| 1534 | 1534 | ||
| 1535 | test "noasync on function calls" { | 1535 | test "nosuspend on function calls" { |
| 1536 | const S0 = struct { | 1536 | const S0 = struct { |
| 1537 | b: i32 = 42, | 1537 | b: i32 = 42, |
| 1538 | }; | 1538 | }; |
| ... | @@ -1544,8 +1544,8 @@ test "noasync on function calls" { | ... | @@ -1544,8 +1544,8 @@ test "noasync on function calls" { |
| 1544 | return S0{}; | 1544 | return S0{}; |
| 1545 | } | 1545 | } |
| 1546 | }; | 1546 | }; |
| 1547 | expectEqual(@as(i32, 42), noasync S1.c().b); | 1547 | expectEqual(@as(i32, 42), nosuspend S1.c().b); |
| 1548 | expectEqual(@as(i32, 42), (try noasync S1.d()).b); | 1548 | expectEqual(@as(i32, 42), (try nosuspend S1.d()).b); |
| 1549 | } | 1549 | } |
| 1550 | 1550 | ||
| 1551 | test "avoid forcing frame alignment resolution implicit cast to *c_void" { | 1551 | test "avoid forcing frame alignment resolution implicit cast to *c_void" { |
| ... | @@ -1561,5 +1561,5 @@ test "avoid forcing frame alignment resolution implicit cast to *c_void" { | ... | @@ -1561,5 +1561,5 @@ test "avoid forcing frame alignment resolution implicit cast to *c_void" { |
| 1561 | }; | 1561 | }; |
| 1562 | var frame = async S.foo(); | 1562 | var frame = async S.foo(); |
| 1563 | resume @ptrCast(anyframe->bool, @alignCast(@alignOf(@Frame(S.foo)), S.x)); | 1563 | resume @ptrCast(anyframe->bool, @alignCast(@alignOf(@Frame(S.foo)), S.x)); |
| 1564 | expect(noasync await frame); | 1564 | expect(nosuspend await frame); |
| 1565 | } | 1565 | } |
test/stage1/behavior/cast.zig+1-1| ... | @@ -823,7 +823,7 @@ test "peer type resolve array pointer and unknown pointer" { | ... | @@ -823,7 +823,7 @@ test "peer type resolve array pointer and unknown pointer" { |
| 823 | 823 | ||
| 824 | comptime expect(@TypeOf(&array, const_ptr) == [*]const u8); | 824 | comptime expect(@TypeOf(&array, const_ptr) == [*]const u8); |
| 825 | comptime expect(@TypeOf(const_ptr, &array) == [*]const u8); | 825 | comptime expect(@TypeOf(const_ptr, &array) == [*]const u8); |
| 826 | 826 | ||
| 827 | comptime expect(@TypeOf(&const_array, const_ptr) == [*]const u8); | 827 | comptime expect(@TypeOf(&const_array, const_ptr) == [*]const u8); |
| 828 | comptime expect(@TypeOf(const_ptr, &const_array) == [*]const u8); | 828 | comptime expect(@TypeOf(const_ptr, &const_array) == [*]const u8); |
| 829 | } | 829 | } |
test/standalone/main_return_error/error_u8.zig+1-3| ... | @@ -1,6 +1,4 @@ | ... | @@ -1,6 +1,4 @@ |
| 1 | const Err = error { | 1 | const Err = error{Foo}; |
| 2 | Foo | ||
| 3 | }; | ||
| 4 | 2 | ||
| 5 | pub fn main() !u8 { | 3 | pub fn main() !u8 { |
| 6 | return Err.Foo; | 4 | return Err.Foo; |
test/standalone/main_return_error/error_u8_non_zero.zig+5-2| ... | @@ -1,6 +1,9 @@ | ... | @@ -1,6 +1,9 @@ |
| 1 | const Err = error { Foo }; | 1 | const Err = error{Foo}; |
| 2 | 2 | ||
| 3 | fn foo() u8 { var x = @intCast(u8, 9); return x; } | 3 | fn foo() u8 { |
| 4 | var x = @intCast(u8, 9); | ||
| 5 | return x; | ||
| 6 | } | ||
| 4 | 7 | ||
| 5 | pub fn main() !u8 { | 8 | pub fn main() !u8 { |
| 6 | if (foo() == 7) return Err.Foo; | 9 | if (foo() == 7) return Err.Foo; |