| author | |
| committer | |
| log | 9485df42e938d5692c9066dee9152951a1aa1ad8 |
| tree | a7d21af6c49c522465a0276f15051c4eb0bbd8a4 |
| parent | 8807e934d840906f4b5bd2ad8fdaa6967c1922ea |
| parent | f2c2ee28cbb2aad3943a5726ea5d1dfa427c96af |
Reviewed-on: https://codeberg.org/ziglang/zig/pulls/3623886 files changed, 483 insertions(+), 428 deletions(-)
build.zig+8-8| ... | ... | @@ -207,7 +207,7 @@ pub fn build(b: *std.Build) !void { |
| 207 | 207 | |
| 208 | 208 | const mem_leak_frames: u32 = b.option(u32, "mem-leak-frames", "How many stack frames to print when a memory leak occurs. Tests get 2x this amount.") orelse blk: { |
| 209 | 209 | if (strip == true) break :blk @as(u32, 0); |
| 210 | if (optimize != .Debug) break :blk 0; | |
| 210 | if (optimize != .debug) break :blk 0; | |
| 211 | 211 | break :blk 4; |
| 212 | 212 | }; |
| 213 | 213 | |
| ... | ... | @@ -256,7 +256,7 @@ pub fn build(b: *std.Build) !void { |
| 256 | 256 | exe.root_module.link_libc = true; |
| 257 | 257 | } |
| 258 | 258 | |
| 259 | const is_debug = optimize == .Debug; | |
| 259 | const is_debug = optimize == .debug; | |
| 260 | 260 | const enable_debug_extensions = b.option(bool, "debug-extensions", "Enable commands and options useful for debugging the compiler") orelse is_debug; |
| 261 | 261 | const enable_logging = b.option(bool, "log", "Enable debug logging with --debug-log") orelse is_debug; |
| 262 | 262 | |
| ... | ... | @@ -403,8 +403,8 @@ pub fn build(b: *std.Build) !void { |
| 403 | 403 | if (tracy) |tracy_dir| { |
| 404 | 404 | const tracy_mod = b.createModule(.{ |
| 405 | 405 | .target = target, |
| 406 | // Always build Tracy in ReleaseFast so that it doesn't make Debug compiler builds unusable. | |
| 407 | .optimize = .ReleaseFast, | |
| 406 | // Always build Tracy in ReleaseFast so that it doesn't make -Odebug compiler builds unusable. | |
| 407 | .optimize = .fast, | |
| 408 | 408 | .root_source_file = null, |
| 409 | 409 | .link_libc = true, |
| 410 | 410 | .link_libcpp = true, |
| ... | ... | @@ -434,19 +434,19 @@ pub fn build(b: *std.Build) !void { |
| 434 | 434 | var chosen_opt_modes_buf: [4]std.lang.OptimizeMode = undefined; |
| 435 | 435 | var chosen_mode_index: usize = 0; |
| 436 | 436 | if (!skip_debug) { |
| 437 | chosen_opt_modes_buf[chosen_mode_index] = .Debug; | |
| 437 | chosen_opt_modes_buf[chosen_mode_index] = .debug; | |
| 438 | 438 | chosen_mode_index += 1; |
| 439 | 439 | } |
| 440 | 440 | if (!skip_release_safe) { |
| 441 | chosen_opt_modes_buf[chosen_mode_index] = .ReleaseSafe; | |
| 441 | chosen_opt_modes_buf[chosen_mode_index] = .safe; | |
| 442 | 442 | chosen_mode_index += 1; |
| 443 | 443 | } |
| 444 | 444 | if (!skip_release_fast) { |
| 445 | chosen_opt_modes_buf[chosen_mode_index] = .ReleaseFast; | |
| 445 | chosen_opt_modes_buf[chosen_mode_index] = .fast; | |
| 446 | 446 | chosen_mode_index += 1; |
| 447 | 447 | } |
| 448 | 448 | if (!skip_release_small) { |
| 449 | chosen_opt_modes_buf[chosen_mode_index] = .ReleaseSmall; | |
| 449 | chosen_opt_modes_buf[chosen_mode_index] = .small; | |
| 450 | 450 | chosen_mode_index += 1; |
| 451 | 451 | } |
| 452 | 452 | const optimize_modes = chosen_opt_modes_buf[0..chosen_mode_index]; |
lib/c/malloc.zig+2-2| ... | ... | @@ -59,8 +59,8 @@ const Header = packed struct(u64) { |
| 59 | 59 | } |
| 60 | 60 | |
| 61 | 61 | const safety = switch (builtin.mode) { |
| 62 | .Debug, .ReleaseSafe => true, | |
| 63 | .ReleaseFast, .ReleaseSmall => false, | |
| 62 | .debug, .safe => true, | |
| 63 | .fast, .small => false, | |
| 64 | 64 | }; |
| 65 | 65 | const max_addr_bits = switch (safety) { |
| 66 | 66 | true => 48, // Ensures space for Canary bits. |
lib/compiler/Maker.zig+3-3| ... | ... | @@ -69,10 +69,10 @@ var debug_maker_leaks: bool = false; |
| 69 | 69 | |
| 70 | 70 | const AvoidableWebServer = if (builtin.single_threaded) void else WebServer; |
| 71 | 71 | |
| 72 | const is_debug_mode = builtin.mode == .Debug; | |
| 72 | const is_debug_mode = builtin.mode == .debug; | |
| 73 | 73 | const use_safe_allocator = switch (builtin.mode) { |
| 74 | .Debug, .ReleaseSafe => true, | |
| 75 | .ReleaseFast, .ReleaseSmall => false, | |
| 74 | .debug, .safe => true, | |
| 75 | .fast, .small => false, | |
| 76 | 76 | }; |
| 77 | 77 | |
| 78 | 78 | const InstallPaths = struct { |
lib/compiler/Maker/Step/TranslateC.zig+3-3| ... | ... | @@ -49,9 +49,9 @@ pub fn make( |
| 49 | 49 | |
| 50 | 50 | const opt: ?OptimizeMode = switch (conf_tc.flags.optimize) { |
| 51 | 51 | .debug, .default => null, // Skip since it's the default |
| 52 | .safe => .ReleaseSafe, | |
| 53 | .fast => .ReleaseFast, | |
| 54 | .small => .ReleaseSmall, | |
| 52 | .safe => .safe, | |
| 53 | .fast => .fast, | |
| 54 | .small => .small, | |
| 55 | 55 | }; |
| 56 | 56 | if (opt) |o| argv.appendAssumeCapacity(try arena.print("-O{t}", .{o})); |
| 57 | 57 |
lib/compiler/Maker/WebServer.zig+1-1| ... | ... | @@ -501,7 +501,7 @@ fn serveRequest(ws: *WebServer, req: *http.Server.Request) !void { |
| 501 | 501 | if (mem.eql(u8, target, "/main.js")) return serveLibFile(ws, req, "build-web/main.js", "application/javascript"); |
| 502 | 502 | if (mem.eql(u8, target, "/style.css")) return serveLibFile(ws, req, "build-web/style.css", "text/css"); |
| 503 | 503 | if (mem.eql(u8, target, "/time_report.css")) return serveLibFile(ws, req, "build-web/time_report.css", "text/css"); |
| 504 | if (mem.eql(u8, target, "/main.wasm")) return serveClientWasm(ws, req, if (debug) .Debug else .ReleaseFast); | |
| 504 | if (mem.eql(u8, target, "/main.wasm")) return serveClientWasm(ws, req, if (debug) .debug else .fast); | |
| 505 | 505 | |
| 506 | 506 | if (ws.fuzz) |*fuzz| { |
| 507 | 507 | if (mem.eql(u8, target, "/sources.tar")) return fuzz.serveSourcesTar(req); |
lib/compiler/aro/aro/Diagnostics.zig+1-1| ... | ... | @@ -510,7 +510,7 @@ pub fn formatArgs(w: *std.Io.Writer, fmt: []const u8, args: anytype) std.Io.Writ |
| 510 | 510 | |
| 511 | 511 | pub fn templateIndex(w: *std.Io.Writer, fmt: []const u8, template: []const u8) std.Io.Writer.Error!usize { |
| 512 | 512 | const i = std.mem.indexOf(u8, fmt, template) orelse { |
| 513 | if (@import("builtin").mode == .Debug) { | |
| 513 | if (@import("builtin").mode == .debug) { | |
| 514 | 514 | std.debug.panic("template `{s}` not found in format string `{s}`", .{ template, fmt }); |
| 515 | 515 | } |
| 516 | 516 | try w.print("template `{s}` not found in format string `{s}` (this is a bug in arocc)", .{ template, fmt }); |
lib/compiler/aro/main.zig+1-1| ... | ... | @@ -40,7 +40,7 @@ pub fn main(init: process.Init.Minimal) u8 { |
| 40 | 40 | defer threaded.deinit(); |
| 41 | 41 | const io = threaded.io(); |
| 42 | 42 | |
| 43 | const fast_exit = @import("builtin").mode != .Debug; | |
| 43 | const fast_exit = @import("builtin").mode != .debug; | |
| 44 | 44 | |
| 45 | 45 | const args = init.args.toSlice(arena) catch { |
| 46 | 46 | std.debug.print("out of memory\n", .{}); |
lib/compiler/std-docs.zig+2-2| ... | ... | @@ -142,9 +142,9 @@ fn serveRequest(request: *std.http.Server.Request, context: *Context) !void { |
| 142 | 142 | { |
| 143 | 143 | try serveDocsFile(request, context, "docs/main.js", "application/javascript"); |
| 144 | 144 | } else if (std.mem.eql(u8, request.head.target, "/main.wasm")) { |
| 145 | try serveWasm(request, context, .ReleaseFast); | |
| 145 | try serveWasm(request, context, .fast); | |
| 146 | 146 | } else if (std.mem.eql(u8, request.head.target, "/debug/main.wasm")) { |
| 147 | try serveWasm(request, context, .Debug); | |
| 147 | try serveWasm(request, context, .debug); | |
| 148 | 148 | } else if (std.mem.eql(u8, request.head.target, "/sources.tar") or |
| 149 | 149 | std.mem.eql(u8, request.head.target, "/debug/sources.tar")) |
| 150 | 150 | { |
lib/compiler/translate-c/main.zig+1-1| ... | ... | @@ -9,7 +9,7 @@ const compiler_util = @import("../util.zig"); |
| 9 | 9 | |
| 10 | 10 | const Translator = @import("Translator.zig"); |
| 11 | 11 | |
| 12 | const fast_exit = @import("builtin").mode != .Debug; | |
| 12 | const fast_exit = @import("builtin").mode != .debug; | |
| 13 | 13 | |
| 14 | 14 | pub fn main(init: process.Init) u8 { |
| 15 | 15 | const gpa = init.gpa; |
lib/compiler_rt/memcpy.zig+1-1| ... | ... | @@ -11,7 +11,7 @@ comptime { |
| 11 | 11 | .visibility = compiler_rt.visibility, |
| 12 | 12 | }; |
| 13 | 13 | |
| 14 | if (builtin.mode == .ReleaseSmall or builtin.zig_backend == .stage2_aarch64) | |
| 14 | if (builtin.mode == .small or builtin.zig_backend == .stage2_aarch64) | |
| 15 | 15 | @export(&memcpySmall, export_options) |
| 16 | 16 | else |
| 17 | 17 | @export(&memcpyFast, export_options); |
lib/compiler_rt/memmove.zig+1-1| ... | ... | @@ -14,7 +14,7 @@ comptime { |
| 14 | 14 | .visibility = compiler_rt.visibility, |
| 15 | 15 | }; |
| 16 | 16 | |
| 17 | if (builtin.mode == .ReleaseSmall or builtin.zig_backend == .stage2_aarch64) | |
| 17 | if (builtin.mode == .small or builtin.zig_backend == .stage2_aarch64) | |
| 18 | 18 | @export(&memmoveSmall, export_options) |
| 19 | 19 | else |
| 20 | 20 | @export(&memmoveFast, export_options); |
lib/docs/wasm/markdown/Document.zig+1-1| ... | ... | @@ -108,7 +108,7 @@ pub const Node = struct { |
| 108 | 108 | // In Debug and ReleaseSafe builds, there may be hidden extra fields |
| 109 | 109 | // included for safety checks. Without such safety checks enabled, |
| 110 | 110 | // we always want this union to be 8 bytes. |
| 111 | if (builtin.mode != .Debug and builtin.mode != .ReleaseSafe) { | |
| 111 | if (builtin.mode != .debug and builtin.mode != .safe) { | |
| 112 | 112 | assert(@sizeOf(Data) == 8); |
| 113 | 113 | } |
| 114 | 114 | } |
lib/fuzzer.zig+3-3| ... | ... | @@ -41,8 +41,8 @@ fn logOverride( |
| 41 | 41 | |
| 42 | 42 | var safe_allocator: std.heap.SafeAllocator = .init(std.heap.page_allocator, .{}); |
| 43 | 43 | const gpa = switch (builtin.mode) { |
| 44 | .Debug, .ReleaseSafe => safe_allocator.allocator(), | |
| 45 | .ReleaseFast, .ReleaseSmall => std.heap.smp_allocator, | |
| 44 | .debug, .safe => safe_allocator.allocator(), | |
| 45 | .fast, .small => std.heap.smp_allocator, | |
| 46 | 46 | }; |
| 47 | 47 | |
| 48 | 48 | // Seperate from `exec` to allow initialization before `exec` is. |
| ... | ... | @@ -1209,7 +1209,7 @@ const Fuzzer = struct { |
| 1209 | 1209 | f.req_bytes = @intCast(f.input_builder.bytes_table.items.len); |
| 1210 | 1210 | const quality: Input.Best.Quality = .{ |
| 1211 | 1211 | .n_pcs = n_pcs: { |
| 1212 | @setRuntimeSafety(builtin.mode == .Debug); // Necessary for vectorization | |
| 1212 | @setRuntimeSafety(builtin.mode == .debug); // Necessary for vectorization | |
| 1213 | 1213 | var n: u32 = 0; |
| 1214 | 1214 | for (exec.pc_counters) |c| { |
| 1215 | 1215 | n += @intFromBool(c != 0); |
lib/std/Build.zig+38-22| ... | ... | @@ -1210,13 +1210,16 @@ pub fn option(b: *Build, comptime T: type, name_raw: []const u8, description_raw |
| 1210 | 1210 | return null; |
| 1211 | 1211 | }, |
| 1212 | 1212 | .scalar => |s| { |
| 1213 | if (std.meta.stringToEnum(T, s)) |enum_lit| { | |
| 1214 | return enum_lit; | |
| 1215 | } else { | |
| 1216 | log.err("expected -D{s} to be of type {s}", .{ name, @typeName(T) }); | |
| 1217 | b.markInvalidUserInput(); | |
| 1218 | return null; | |
| 1213 | if (T == std.lang.Optimize) { | |
| 1214 | if (std.lang.Optimize.fromString(s)) |tag| { | |
| 1215 | return tag; | |
| 1216 | } | |
| 1217 | } else if (std.meta.stringToEnum(T, s)) |tag| { | |
| 1218 | return tag; | |
| 1219 | 1219 | } |
| 1220 | log.err("expected -D{s} to be of type {q}", .{ name, @typeName(T) }); | |
| 1221 | b.markInvalidUserInput(); | |
| 1222 | return null; | |
| 1220 | 1223 | }, |
| 1221 | 1224 | }, |
| 1222 | 1225 | .string => switch (option_ptr.value) { |
| ... | ... | @@ -1262,23 +1265,36 @@ pub fn option(b: *Build, comptime T: type, name_raw: []const u8, description_raw |
| 1262 | 1265 | }, |
| 1263 | 1266 | .scalar => |s| { |
| 1264 | 1267 | const Child = @typeInfo(T).pointer.child; |
| 1265 | const value = std.meta.stringToEnum(Child, s) orelse { | |
| 1266 | log.err("expected -D{s} to be of type {s}", .{ name, @typeName(Child) }); | |
| 1267 | b.markInvalidUserInput(); | |
| 1268 | return null; | |
| 1269 | }; | |
| 1270 | return arena.dupe(Child, &[_]Child{value}) catch @panic("OOM"); | |
| 1268 | if (Child == std.lang.Optimize) { | |
| 1269 | if (std.lang.Optimize.fromString(s)) |tag| { | |
| 1270 | return arena.dupe(Child, &.{tag}) catch @panic("OOM"); | |
| 1271 | } | |
| 1272 | } else { | |
| 1273 | if (std.meta.stringToEnum(Child, s)) |tag| { | |
| 1274 | return arena.dupe(Child, &.{tag}) catch @panic("OOM"); | |
| 1275 | } | |
| 1276 | } | |
| 1277 | log.err("expected -D{s} to be of type {q}", .{ name, @typeName(Child) }); | |
| 1278 | b.markInvalidUserInput(); | |
| 1279 | return null; | |
| 1271 | 1280 | }, |
| 1272 | 1281 | .list => |lst| { |
| 1273 | 1282 | const Child = @typeInfo(T).pointer.child; |
| 1274 | 1283 | const new_list = graph.alloc(Child, lst.items.len); |
| 1275 | 1284 | for (new_list, lst.items) |*new_item, str| { |
| 1276 | new_item.* = std.meta.stringToEnum(Child, str) orelse { | |
| 1277 | log.err("expected -D{s} to be of type {s}", .{ name, @typeName(Child) }); | |
| 1278 | b.markInvalidUserInput(); | |
| 1279 | arena.free(new_list); | |
| 1280 | return null; | |
| 1281 | }; | |
| 1285 | if (Child == std.lang.Optimize) { | |
| 1286 | if (std.lang.Optimize.fromString(str)) |tag| { | |
| 1287 | new_item.* = tag; | |
| 1288 | continue; | |
| 1289 | } | |
| 1290 | } | |
| 1291 | if (std.meta.stringToEnum(Child, str)) |tag| { | |
| 1292 | new_item.* = tag; | |
| 1293 | continue; | |
| 1294 | } | |
| 1295 | log.err("expected -D{s} to be of type {q}", .{ name, @typeName(Child) }); | |
| 1296 | b.markInvalidUserInput(); | |
| 1297 | return null; | |
| 1282 | 1298 | } |
| 1283 | 1299 | return new_list; |
| 1284 | 1300 | }, |
| ... | ... | @@ -1359,14 +1375,14 @@ pub fn standardOptimizeOption(b: *Build, options: StandardOptimizeOptionOptions) |
| 1359 | 1375 | } |
| 1360 | 1376 | |
| 1361 | 1377 | return switch (graph.release_mode) { |
| 1362 | .off => .Debug, | |
| 1378 | .off => .debug, | |
| 1363 | 1379 | .any => { |
| 1364 | 1380 | std.debug.print("the project does not declare a preferred optimization mode. choose: --release=fast, --release=safe, or --release=small\n", .{}); |
| 1365 | 1381 | process.exit(1); |
| 1366 | 1382 | }, |
| 1367 | .fast => .ReleaseFast, | |
| 1368 | .safe => .ReleaseSafe, | |
| 1369 | .small => .ReleaseSmall, | |
| 1383 | .fast => .fast, | |
| 1384 | .safe => .safe, | |
| 1385 | .small => .small, | |
| 1370 | 1386 | }; |
| 1371 | 1387 | } |
| 1372 | 1388 |
lib/std/Build/Configuration.zig+4-4| ... | ... | @@ -1655,10 +1655,10 @@ pub const Module = struct { |
| 1655 | 1655 | |
| 1656 | 1656 | pub fn init(o: ?std.builtin.OptimizeMode) Optimize { |
| 1657 | 1657 | return switch (o orelse return .default) { |
| 1658 | .Debug => .debug, | |
| 1659 | .ReleaseSafe => .safe, | |
| 1660 | .ReleaseFast => .fast, | |
| 1661 | .ReleaseSmall => .small, | |
| 1658 | .debug => .debug, | |
| 1659 | .safe => .safe, | |
| 1660 | .fast => .fast, | |
| 1661 | .small => .small, | |
| 1662 | 1662 | }; |
| 1663 | 1663 | } |
| 1664 | 1664 | }; |
lib/std/Build/Step/Compile.zig+2-2| ... | ... | @@ -390,7 +390,7 @@ pub fn create(owner: *std.Build, options: Options) *Compile { |
| 390 | 390 | @tagName(options.kind) |
| 391 | 391 | else |
| 392 | 392 | owner.fmt("{t} {s}", .{ options.kind, name }), |
| 393 | @tagName(options.root_module.optimize orelse .Debug), | |
| 393 | @tagName(options.root_module.optimize orelse .debug), | |
| 394 | 394 | resolved_target.query.zigTriple(arena) catch @panic("OOM"), |
| 395 | 395 | }); |
| 396 | 396 | |
| ... | ... | @@ -645,7 +645,7 @@ pub fn producesPdbFile(compile: *Compile) bool { |
| 645 | 645 | if (target.ofmt == .c) return false; |
| 646 | 646 | if (compile.use_llvm == false) return false; |
| 647 | 647 | if (compile.root_module.strip == true or |
| 648 | (compile.root_module.strip == null and compile.root_module.optimize == .ReleaseSmall)) | |
| 648 | (compile.root_module.strip == null and compile.root_module.optimize == .small)) | |
| 649 | 649 | { |
| 650 | 650 | return false; |
| 651 | 651 | } |
lib/std/Io/Dispatch.zig+1-1| ... | ... | @@ -3897,7 +3897,7 @@ fn fileMemoryMapDestroy(userdata: ?*anyopaque, mm: *File.MemoryMap) void { |
| 3897 | 3897 | if (memory.len == 0) return; |
| 3898 | 3898 | switch (c.errno(c.munmap(memory.ptr, memory.len))) { |
| 3899 | 3899 | .SUCCESS => {}, |
| 3900 | else => |err| if (builtin.mode == .Debug) | |
| 3900 | else => |err| if (builtin.mode == .debug) | |
| 3901 | 3901 | std.log.err("failed to unmap {d} bytes at {*}: {t}", .{ memory.len, memory.ptr, err }), |
| 3902 | 3902 | } |
| 3903 | 3903 | mm.* = undefined; |
lib/std/Io/Threaded.zig+6-6| ... | ... | @@ -4,7 +4,7 @@ const builtin = @import("builtin"); |
| 4 | 4 | const native_os = builtin.os.tag; |
| 5 | 5 | const is_windows = native_os == .windows; |
| 6 | 6 | const is_darwin = native_os.isDarwin(); |
| 7 | const is_debug = builtin.mode == .Debug; | |
| 7 | const is_debug = builtin.mode == .debug; | |
| 8 | 8 | |
| 9 | 9 | const std = @import("../std.zig"); |
| 10 | 10 | const Io = std.Io; |
| ... | ... | @@ -440,12 +440,12 @@ pub const UseFchmodat2 = if (have_fchmodat2 and !have_fchmodat_flags) enum { |
| 440 | 440 | pub const apc_align = @max(default_fn_align, 2); |
| 441 | 441 | |
| 442 | 442 | const default_fn_align = switch (builtin.mode) { |
| 443 | .Debug, .ReleaseSafe, .ReleaseFast => switch (builtin.cpu.arch) { | |
| 443 | .debug, .safe, .fast => switch (builtin.cpu.arch) { | |
| 444 | 444 | else => |arch| @compileError("Unsupported architecture: " ++ @tagName(arch)), |
| 445 | 445 | .arm, .thumb => 4, |
| 446 | 446 | .aarch64, .x86, .x86_64 => 16, |
| 447 | 447 | }, |
| 448 | .ReleaseSmall => 1, | |
| 448 | .small => 1, | |
| 449 | 449 | }; |
| 450 | 450 | |
| 451 | 451 | const Runnable = struct { |
| ... | ... | @@ -18172,7 +18172,7 @@ fn fileMemoryMapCreate( |
| 18172 | 18172 | error.Unseekable, error.Canceled, error.AccessDenied => |e| return e, |
| 18173 | 18173 | error.OperationUnsupported => {}, |
| 18174 | 18174 | else => { |
| 18175 | if (builtin.mode == .Debug) | |
| 18175 | if (builtin.mode == .debug) | |
| 18176 | 18176 | std.log.warn("memory mapping failed with {t}, falling back to file operations", .{err}); |
| 18177 | 18177 | }, |
| 18178 | 18178 | } |
| ... | ... | @@ -18279,7 +18279,7 @@ fn createFileMap( |
| 18279 | 18279 | .INVALID_VIEW_SIZE => |status| return windows.statusBug(status), |
| 18280 | 18280 | else => |status| return windows.unexpectedStatus(status), |
| 18281 | 18281 | } |
| 18282 | if (builtin.mode == .Debug) { | |
| 18282 | if (builtin.mode == .debug) { | |
| 18283 | 18283 | const page_size = std.heap.pageSize(); |
| 18284 | 18284 | const alignment: Alignment = .fromByteUnits(page_size); |
| 18285 | 18285 | assert(contents_len == alignment.forward(len)); |
| ... | ... | @@ -18370,7 +18370,7 @@ fn fileMemoryMapDestroy(userdata: ?*anyopaque, mm: *File.MemoryMap) void { |
| 18370 | 18370 | switch (posix.errno(posix.system.munmap(memory.ptr, memory.len))) { |
| 18371 | 18371 | .SUCCESS => {}, |
| 18372 | 18372 | else => |e| { |
| 18373 | if (builtin.mode == .Debug) | |
| 18373 | if (builtin.mode == .debug) | |
| 18374 | 18374 | std.log.err("failed to unmap {d} bytes at {*}: {t}", .{ memory.len, memory.ptr, e }); |
| 18375 | 18375 | }, |
| 18376 | 18376 | } |
lib/std/Io/Uring.zig+1-1| ... | ... | @@ -4050,7 +4050,7 @@ fn fileMemoryMapDestroy(userdata: ?*anyopaque, mm: *File.MemoryMap) void { |
| 4050 | 4050 | if (memory.len == 0) return; |
| 4051 | 4051 | switch (linux.errno(linux.munmap(memory.ptr, memory.len))) { |
| 4052 | 4052 | .SUCCESS => {}, |
| 4053 | else => |err| if (builtin.mode == .Debug) | |
| 4053 | else => |err| if (builtin.mode == .debug) | |
| 4054 | 4054 | std.log.err("failed to unmap {d} bytes at {*}: {t}", .{ memory.len, memory.ptr, err }), |
| 4055 | 4055 | } |
| 4056 | 4056 | mm.* = undefined; |
lib/std/Random/benchmark.zig+1-1| ... | ... | @@ -122,7 +122,7 @@ fn usage() void { |
| 122 | 122 | } |
| 123 | 123 | |
| 124 | 124 | fn mode(comptime x: comptime_int) comptime_int { |
| 125 | return if (builtin.mode == .Debug) x / 64 else x; | |
| 125 | return if (builtin.mode == .debug) x / 64 else x; | |
| 126 | 126 | } |
| 127 | 127 | |
| 128 | 128 | pub fn main(init: std.process.Init) !void { |
lib/std/c/darwin/dispatch.zig+2-2| ... | ... | @@ -44,8 +44,8 @@ pub const once_t = enum(isize) { |
| 44 | 44 | once_f(predicate, context, function); |
| 45 | 45 | } else asm volatile ("" ::: .{ .memory = true }); |
| 46 | 46 | switch (builtin.mode) { |
| 47 | .Debug, .ReleaseSafe => {}, | |
| 48 | .ReleaseFast, .ReleaseSmall => if (predicate.* != .done) unreachable, | |
| 47 | .debug, .safe => {}, | |
| 48 | .fast, .small => if (predicate.* != .done) unreachable, | |
| 49 | 49 | } |
| 50 | 50 | } |
| 51 | 51 | }; |
lib/std/compress/flate/Compress.zig+1-1| ... | ... | @@ -738,7 +738,7 @@ fn matchAndAddHash(c: *Compress, i: usize, h: Hash, gt: u16, max_chain: u16, goo |
| 738 | 738 | |
| 739 | 739 | fn clenHlen(freqs: [19]u16) u4 { |
| 740 | 740 | // Note that the first four codes (16, 17, 18, and 0) are always present. |
| 741 | if (builtin.mode != .ReleaseSmall and (std.simd.suggestVectorLength(u16) orelse 1) >= 8) { | |
| 741 | if (builtin.mode != .small and (std.simd.suggestVectorLength(u16) orelse 1) >= 8) { | |
| 742 | 742 | const V = @Vector(16, u16); |
| 743 | 743 | const hlen_mul: V = comptime m: { |
| 744 | 744 | var hlen_mul: [16]u16 = undefined; |
lib/std/compress/flate/token.zig+3-3| ... | ... | @@ -57,9 +57,9 @@ const fixed_dist = blk: { |
| 57 | 57 | }; |
| 58 | 58 | |
| 59 | 59 | // All paramters of codes can be derived matchematically, however some are faster to |
| 60 | // do via lookup table. For ReleaseSmall, we do all mathematically to save space. | |
| 61 | pub const LenCode = if (builtin.mode != .ReleaseSmall) LookupLenCode else ShortLenCode; | |
| 62 | pub const DistCode = if (builtin.mode != .ReleaseSmall) LookupDistCode else ShortDistCode; | |
| 60 | // do via lookup table. For -Osmall, we do all mathematically to save space. | |
| 61 | pub const LenCode = if (builtin.mode != .small) LookupLenCode else ShortLenCode; | |
| 62 | pub const DistCode = if (builtin.mode != .small) LookupDistCode else ShortDistCode; | |
| 63 | 63 | const ShortLenCode = ShortCode(u8, u2, u3, true); |
| 64 | 64 | const ShortDistCode = ShortCode(u15, u1, u4, false); |
| 65 | 65 | /// For length and distance codes, they having this format. |
lib/std/crypto/25519/field.zig+2-2| ... | ... | @@ -7,8 +7,8 @@ const NotSquareError = crypto.errors.NotSquareError; |
| 7 | 7 | |
| 8 | 8 | // Inline conditionally, when it can result in large code generation. |
| 9 | 9 | const bloaty_inline: std.builtin.CallingConvention = switch (builtin.mode) { |
| 10 | .ReleaseSafe, .ReleaseFast => .@"inline", | |
| 11 | .Debug, .ReleaseSmall => .auto, | |
| 10 | .safe, .fast => .@"inline", | |
| 11 | .debug, .small => .auto, | |
| 12 | 12 | }; |
| 13 | 13 | |
| 14 | 14 | pub const Fe = struct { |
lib/std/crypto/benchmark.zig+1-1| ... | ... | @@ -493,7 +493,7 @@ fn usage() void { |
| 493 | 493 | } |
| 494 | 494 | |
| 495 | 495 | fn mode(comptime x: comptime_int) comptime_int { |
| 496 | return if (builtin.mode == .Debug) x / 64 else x; | |
| 496 | return if (builtin.mode == .debug) x / 64 else x; | |
| 497 | 497 | } |
| 498 | 498 | |
| 499 | 499 | pub fn main(init: std.process.Init) !void { |
lib/std/crypto/ghash_polyval.zig+5-5| ... | ... | @@ -30,7 +30,7 @@ fn Hash(comptime endian: std.builtin.Endian, comptime shift_key: bool) type { |
| 30 | 30 | pub const mac_length = 16; |
| 31 | 31 | pub const key_length = 16; |
| 32 | 32 | |
| 33 | const pc_count = if (builtin.mode != .ReleaseSmall) 16 else 2; | |
| 33 | const pc_count = if (builtin.mode != .small) 16 else 2; | |
| 34 | 34 | const agg_4_threshold = 22; |
| 35 | 35 | const agg_8_threshold = 84; |
| 36 | 36 | const agg_16_threshold = 328; |
| ... | ... | @@ -61,7 +61,7 @@ fn Hash(comptime endian: std.builtin.Endian, comptime shift_key: bool) type { |
| 61 | 61 | hx[0] = h; |
| 62 | 62 | hx[1] = reduce(clsq128(hx[0])); // h^2 |
| 63 | 63 | |
| 64 | if (builtin.mode != .ReleaseSmall) { | |
| 64 | if (builtin.mode != .small) { | |
| 65 | 65 | hx[2] = reduce(clmul128(hx[1], h)); // h^3 |
| 66 | 66 | hx[3] = reduce(clsq128(hx[1])); // h^4 = h^2^2 |
| 67 | 67 | if (block_count >= agg_8_threshold) { |
| ... | ... | @@ -303,7 +303,7 @@ fn Hash(comptime endian: std.builtin.Endian, comptime shift_key: bool) type { |
| 303 | 303 | |
| 304 | 304 | var i: usize = 0; |
| 305 | 305 | |
| 306 | if (builtin.mode != .ReleaseSmall and msg.len >= agg_16_threshold * block_length) { | |
| 306 | if (builtin.mode != .small and msg.len >= agg_16_threshold * block_length) { | |
| 307 | 307 | // 16-blocks aggregated reduction |
| 308 | 308 | while (i + 256 <= msg.len) : (i += 256) { |
| 309 | 309 | var u = clmul128(acc ^ mem.readInt(u128, msg[i..][0..16], endian), st.hx[15 - 0]); |
| ... | ... | @@ -313,7 +313,7 @@ fn Hash(comptime endian: std.builtin.Endian, comptime shift_key: bool) type { |
| 313 | 313 | } |
| 314 | 314 | acc = reduce(u); |
| 315 | 315 | } |
| 316 | } else if (builtin.mode != .ReleaseSmall and msg.len >= agg_8_threshold * block_length) { | |
| 316 | } else if (builtin.mode != .small and msg.len >= agg_8_threshold * block_length) { | |
| 317 | 317 | // 8-blocks aggregated reduction |
| 318 | 318 | while (i + 128 <= msg.len) : (i += 128) { |
| 319 | 319 | var u = clmul128(acc ^ mem.readInt(u128, msg[i..][0..16], endian), st.hx[7 - 0]); |
| ... | ... | @@ -323,7 +323,7 @@ fn Hash(comptime endian: std.builtin.Endian, comptime shift_key: bool) type { |
| 323 | 323 | } |
| 324 | 324 | acc = reduce(u); |
| 325 | 325 | } |
| 326 | } else if (builtin.mode != .ReleaseSmall and msg.len >= agg_4_threshold * block_length) { | |
| 326 | } else if (builtin.mode != .small and msg.len >= agg_4_threshold * block_length) { | |
| 327 | 327 | // 4-blocks aggregated reduction |
| 328 | 328 | while (i + 64 <= msg.len) : (i += 64) { |
| 329 | 329 | var u = clmul128(acc ^ mem.readInt(u128, msg[i..][0..16], endian), st.hx[3 - 0]); |
lib/std/crypto/kangarootwelve.zig+1-1| ... | ... | @@ -1398,7 +1398,7 @@ test "KT128 sequential and parallel produce same output for many random lengths" |
| 1398 | 1398 | var prng = std.Random.DefaultPrng.init(std.testing.random_seed); |
| 1399 | 1399 | const random = prng.random(); |
| 1400 | 1400 | |
| 1401 | const num_tests = if (builtin.mode == .Debug) 10 else 1000; | |
| 1401 | const num_tests = if (builtin.mode == .debug) 10 else 1000; | |
| 1402 | 1402 | const max_length = 250000; |
| 1403 | 1403 | |
| 1404 | 1404 | for (0..num_tests) |_| { |
lib/std/crypto/keccak_p.zig+2-2| ... | ... | @@ -202,7 +202,7 @@ pub fn State(comptime f: u11, comptime capacity: u11, comptime rounds: u5) type |
| 202 | 202 | |
| 203 | 203 | // In debug mode, track transitions to prevent insecure ones. |
| 204 | 204 | const Op = enum { uninitialized, initialized, updated, absorb, squeeze }; |
| 205 | const TransitionTracker = if (mode == .Debug) struct { | |
| 205 | const TransitionTracker = if (mode == .debug) struct { | |
| 206 | 206 | op: Op = .uninitialized, |
| 207 | 207 | |
| 208 | 208 | fn to(tracker: *@This(), next_op: Op) void { |
| ... | ... | @@ -294,7 +294,7 @@ pub fn State(comptime f: u11, comptime capacity: u11, comptime rounds: u5) type |
| 294 | 294 | |
| 295 | 295 | /// Permute the state |
| 296 | 296 | pub fn permute(self: *Self) void { |
| 297 | if (mode == .Debug) { | |
| 297 | if (mode == .debug) { | |
| 298 | 298 | if (self.transition.op == .absorb and self.offset > 0) { |
| 299 | 299 | @panic("cannot permute with pending input - call fillBlock() or pad() instead"); |
| 300 | 300 | } |
lib/std/crypto/pcurves/p256/p256_64.zig+17-17| ... | ... | @@ -110,7 +110,7 @@ fn subborrowxU64(out1: *u64, out2: *u1, arg1: u1, arg2: u64, arg3: u64) void { |
| 110 | 110 | /// out1: [0x0 ~> 0xffffffffffffffff] |
| 111 | 111 | /// out2: [0x0 ~> 0xffffffffffffffff] |
| 112 | 112 | fn mulxU64(out1: *u64, out2: *u64, arg1: u64, arg2: u64) void { |
| 113 | @setRuntimeSafety(mode == .Debug); | |
| 113 | @setRuntimeSafety(mode == .debug); | |
| 114 | 114 | |
| 115 | 115 | const x = @as(u128, arg1) * @as(u128, arg2); |
| 116 | 116 | out1.* = @as(u64, @truncate(x)); |
| ... | ... | @@ -129,7 +129,7 @@ fn mulxU64(out1: *u64, out2: *u64, arg1: u64, arg2: u64) void { |
| 129 | 129 | /// Output Bounds: |
| 130 | 130 | /// out1: [0x0 ~> 0xffffffffffffffff] |
| 131 | 131 | fn cmovznzU64(out1: *u64, arg1: u1, arg2: u64, arg3: u64) void { |
| 132 | @setRuntimeSafety(mode == .Debug); | |
| 132 | @setRuntimeSafety(mode == .debug); | |
| 133 | 133 | |
| 134 | 134 | const mask = 0 -% @as(u64, arg1); |
| 135 | 135 | out1.* = (mask & arg3) | ((~mask) & arg2); |
| ... | ... | @@ -145,7 +145,7 @@ fn cmovznzU64(out1: *u64, arg1: u1, arg2: u64, arg3: u64) void { |
| 145 | 145 | /// 0 ≤ eval out1 < m |
| 146 | 146 | /// |
| 147 | 147 | pub fn mul(out1: *MontgomeryDomainFieldElement, arg1: MontgomeryDomainFieldElement, arg2: MontgomeryDomainFieldElement) void { |
| 148 | @setRuntimeSafety(mode == .Debug); | |
| 148 | @setRuntimeSafety(mode == .debug); | |
| 149 | 149 | |
| 150 | 150 | const x1 = (arg1[1]); |
| 151 | 151 | const x2 = (arg1[2]); |
| ... | ... | @@ -437,7 +437,7 @@ pub fn mul(out1: *MontgomeryDomainFieldElement, arg1: MontgomeryDomainFieldEleme |
| 437 | 437 | /// 0 ≤ eval out1 < m |
| 438 | 438 | /// |
| 439 | 439 | pub fn square(out1: *MontgomeryDomainFieldElement, arg1: MontgomeryDomainFieldElement) void { |
| 440 | @setRuntimeSafety(mode == .Debug); | |
| 440 | @setRuntimeSafety(mode == .debug); | |
| 441 | 441 | |
| 442 | 442 | const x1 = (arg1[1]); |
| 443 | 443 | const x2 = (arg1[2]); |
| ... | ... | @@ -730,7 +730,7 @@ pub fn square(out1: *MontgomeryDomainFieldElement, arg1: MontgomeryDomainFieldEl |
| 730 | 730 | /// 0 ≤ eval out1 < m |
| 731 | 731 | /// |
| 732 | 732 | pub fn add(out1: *MontgomeryDomainFieldElement, arg1: MontgomeryDomainFieldElement, arg2: MontgomeryDomainFieldElement) void { |
| 733 | @setRuntimeSafety(mode == .Debug); | |
| 733 | @setRuntimeSafety(mode == .debug); | |
| 734 | 734 | |
| 735 | 735 | var x1: u64 = undefined; |
| 736 | 736 | var x2: u1 = undefined; |
| ... | ... | @@ -783,7 +783,7 @@ pub fn add(out1: *MontgomeryDomainFieldElement, arg1: MontgomeryDomainFieldEleme |
| 783 | 783 | /// 0 ≤ eval out1 < m |
| 784 | 784 | /// |
| 785 | 785 | pub fn sub(out1: *MontgomeryDomainFieldElement, arg1: MontgomeryDomainFieldElement, arg2: MontgomeryDomainFieldElement) void { |
| 786 | @setRuntimeSafety(mode == .Debug); | |
| 786 | @setRuntimeSafety(mode == .debug); | |
| 787 | 787 | |
| 788 | 788 | var x1: u64 = undefined; |
| 789 | 789 | var x2: u1 = undefined; |
| ... | ... | @@ -826,7 +826,7 @@ pub fn sub(out1: *MontgomeryDomainFieldElement, arg1: MontgomeryDomainFieldEleme |
| 826 | 826 | /// 0 ≤ eval out1 < m |
| 827 | 827 | /// |
| 828 | 828 | pub fn opp(out1: *MontgomeryDomainFieldElement, arg1: MontgomeryDomainFieldElement) void { |
| 829 | @setRuntimeSafety(mode == .Debug); | |
| 829 | @setRuntimeSafety(mode == .debug); | |
| 830 | 830 | |
| 831 | 831 | var x1: u64 = undefined; |
| 832 | 832 | var x2: u1 = undefined; |
| ... | ... | @@ -869,7 +869,7 @@ pub fn opp(out1: *MontgomeryDomainFieldElement, arg1: MontgomeryDomainFieldEleme |
| 869 | 869 | /// 0 ≤ eval out1 < m |
| 870 | 870 | /// |
| 871 | 871 | pub fn fromMontgomery(out1: *NonMontgomeryDomainFieldElement, arg1: MontgomeryDomainFieldElement) void { |
| 872 | @setRuntimeSafety(mode == .Debug); | |
| 872 | @setRuntimeSafety(mode == .debug); | |
| 873 | 873 | |
| 874 | 874 | const x1 = (arg1[0]); |
| 875 | 875 | var x2: u64 = undefined; |
| ... | ... | @@ -1022,7 +1022,7 @@ pub fn fromMontgomery(out1: *NonMontgomeryDomainFieldElement, arg1: MontgomeryDo |
| 1022 | 1022 | /// 0 ≤ eval out1 < m |
| 1023 | 1023 | /// |
| 1024 | 1024 | pub fn toMontgomery(out1: *MontgomeryDomainFieldElement, arg1: NonMontgomeryDomainFieldElement) void { |
| 1025 | @setRuntimeSafety(mode == .Debug); | |
| 1025 | @setRuntimeSafety(mode == .debug); | |
| 1026 | 1026 | |
| 1027 | 1027 | const x1 = (arg1[1]); |
| 1028 | 1028 | const x2 = (arg1[2]); |
| ... | ... | @@ -1297,7 +1297,7 @@ pub fn toMontgomery(out1: *MontgomeryDomainFieldElement, arg1: NonMontgomeryDoma |
| 1297 | 1297 | /// Output Bounds: |
| 1298 | 1298 | /// out1: [0x0 ~> 0xffffffffffffffff] |
| 1299 | 1299 | pub fn nonzero(out1: *u64, arg1: [4]u64) void { |
| 1300 | @setRuntimeSafety(mode == .Debug); | |
| 1300 | @setRuntimeSafety(mode == .debug); | |
| 1301 | 1301 | |
| 1302 | 1302 | const x1 = ((arg1[0]) | ((arg1[1]) | ((arg1[2]) | (arg1[3])))); |
| 1303 | 1303 | out1.* = x1; |
| ... | ... | @@ -1315,7 +1315,7 @@ pub fn nonzero(out1: *u64, arg1: [4]u64) void { |
| 1315 | 1315 | /// Output Bounds: |
| 1316 | 1316 | /// out1: [[0x0 ~> 0xffffffffffffffff], [0x0 ~> 0xffffffffffffffff], [0x0 ~> 0xffffffffffffffff], [0x0 ~> 0xffffffffffffffff]] |
| 1317 | 1317 | pub fn selectznz(out1: *[4]u64, arg1: u1, arg2: [4]u64, arg3: [4]u64) void { |
| 1318 | @setRuntimeSafety(mode == .Debug); | |
| 1318 | @setRuntimeSafety(mode == .debug); | |
| 1319 | 1319 | |
| 1320 | 1320 | var x1: u64 = undefined; |
| 1321 | 1321 | cmovznzU64(&x1, arg1, (arg2[0]), (arg3[0])); |
| ... | ... | @@ -1343,7 +1343,7 @@ pub fn selectznz(out1: *[4]u64, arg1: u1, arg2: [4]u64, arg3: [4]u64) void { |
| 1343 | 1343 | /// Output Bounds: |
| 1344 | 1344 | /// out1: [[0x0 ~> 0xff], [0x0 ~> 0xff], [0x0 ~> 0xff], [0x0 ~> 0xff], [0x0 ~> 0xff], [0x0 ~> 0xff], [0x0 ~> 0xff], [0x0 ~> 0xff], [0x0 ~> 0xff], [0x0 ~> 0xff], [0x0 ~> 0xff], [0x0 ~> 0xff], [0x0 ~> 0xff], [0x0 ~> 0xff], [0x0 ~> 0xff], [0x0 ~> 0xff], [0x0 ~> 0xff], [0x0 ~> 0xff], [0x0 ~> 0xff], [0x0 ~> 0xff], [0x0 ~> 0xff], [0x0 ~> 0xff], [0x0 ~> 0xff], [0x0 ~> 0xff], [0x0 ~> 0xff], [0x0 ~> 0xff], [0x0 ~> 0xff], [0x0 ~> 0xff], [0x0 ~> 0xff], [0x0 ~> 0xff], [0x0 ~> 0xff], [0x0 ~> 0xff]] |
| 1345 | 1345 | pub fn toBytes(out1: *[32]u8, arg1: [4]u64) void { |
| 1346 | @setRuntimeSafety(mode == .Debug); | |
| 1346 | @setRuntimeSafety(mode == .debug); | |
| 1347 | 1347 | |
| 1348 | 1348 | const x1 = (arg1[3]); |
| 1349 | 1349 | const x2 = (arg1[2]); |
| ... | ... | @@ -1452,7 +1452,7 @@ pub fn toBytes(out1: *[32]u8, arg1: [4]u64) void { |
| 1452 | 1452 | /// Output Bounds: |
| 1453 | 1453 | /// out1: [[0x0 ~> 0xffffffffffffffff], [0x0 ~> 0xffffffffffffffff], [0x0 ~> 0xffffffffffffffff], [0x0 ~> 0xffffffffffffffff]] |
| 1454 | 1454 | pub fn fromBytes(out1: *[4]u64, arg1: [32]u8) void { |
| 1455 | @setRuntimeSafety(mode == .Debug); | |
| 1455 | @setRuntimeSafety(mode == .debug); | |
| 1456 | 1456 | |
| 1457 | 1457 | const x1 = (@as(u64, (arg1[31])) << 56); |
| 1458 | 1458 | const x2 = (@as(u64, (arg1[30])) << 48); |
| ... | ... | @@ -1527,7 +1527,7 @@ pub fn fromBytes(out1: *[4]u64, arg1: [32]u8) void { |
| 1527 | 1527 | /// 0 ≤ eval out1 < m |
| 1528 | 1528 | /// |
| 1529 | 1529 | pub fn setOne(out1: *MontgomeryDomainFieldElement) void { |
| 1530 | @setRuntimeSafety(mode == .Debug); | |
| 1530 | @setRuntimeSafety(mode == .debug); | |
| 1531 | 1531 | |
| 1532 | 1532 | out1[0] = @as(u64, 0x1); |
| 1533 | 1533 | out1[1] = 0xffffffff00000000; |
| ... | ... | @@ -1544,7 +1544,7 @@ pub fn setOne(out1: *MontgomeryDomainFieldElement) void { |
| 1544 | 1544 | /// Output Bounds: |
| 1545 | 1545 | /// out1: [[0x0 ~> 0xffffffffffffffff], [0x0 ~> 0xffffffffffffffff], [0x0 ~> 0xffffffffffffffff], [0x0 ~> 0xffffffffffffffff], [0x0 ~> 0xffffffffffffffff]] |
| 1546 | 1546 | pub fn msat(out1: *[5]u64) void { |
| 1547 | @setRuntimeSafety(mode == .Debug); | |
| 1547 | @setRuntimeSafety(mode == .debug); | |
| 1548 | 1548 | |
| 1549 | 1549 | out1[0] = 0xffffffffffffffff; |
| 1550 | 1550 | out1[1] = 0xffffffff; |
| ... | ... | @@ -1582,7 +1582,7 @@ pub fn msat(out1: *[5]u64) void { |
| 1582 | 1582 | /// out4: [[0x0 ~> 0xffffffffffffffff], [0x0 ~> 0xffffffffffffffff], [0x0 ~> 0xffffffffffffffff], [0x0 ~> 0xffffffffffffffff]] |
| 1583 | 1583 | /// out5: [[0x0 ~> 0xffffffffffffffff], [0x0 ~> 0xffffffffffffffff], [0x0 ~> 0xffffffffffffffff], [0x0 ~> 0xffffffffffffffff]] |
| 1584 | 1584 | pub fn divstep(out1: *u64, out2: *[5]u64, out3: *[5]u64, out4: *[4]u64, out5: *[4]u64, arg1: u64, arg2: [5]u64, arg3: [5]u64, arg4: [4]u64, arg5: [4]u64) void { |
| 1585 | @setRuntimeSafety(mode == .Debug); | |
| 1585 | @setRuntimeSafety(mode == .debug); | |
| 1586 | 1586 | |
| 1587 | 1587 | var x1: u64 = undefined; |
| 1588 | 1588 | var x2: u1 = undefined; |
| ... | ... | @@ -1816,7 +1816,7 @@ pub fn divstep(out1: *u64, out2: *[5]u64, out3: *[5]u64, out4: *[4]u64, out5: *[ |
| 1816 | 1816 | /// Output Bounds: |
| 1817 | 1817 | /// out1: [[0x0 ~> 0xffffffffffffffff], [0x0 ~> 0xffffffffffffffff], [0x0 ~> 0xffffffffffffffff], [0x0 ~> 0xffffffffffffffff]] |
| 1818 | 1818 | pub fn divstepPrecomp(out1: *[4]u64) void { |
| 1819 | @setRuntimeSafety(mode == .Debug); | |
| 1819 | @setRuntimeSafety(mode == .debug); | |
| 1820 | 1820 | |
| 1821 | 1821 | out1[0] = 0x67ffffffb8000000; |
| 1822 | 1822 | out1[1] = 0xc000000038000000; |
lib/std/crypto/pcurves/p256/p256_scalar_64.zig+17-17| ... | ... | @@ -110,7 +110,7 @@ fn subborrowxU64(out1: *u64, out2: *u1, arg1: u1, arg2: u64, arg3: u64) void { |
| 110 | 110 | /// out1: [0x0 ~> 0xffffffffffffffff] |
| 111 | 111 | /// out2: [0x0 ~> 0xffffffffffffffff] |
| 112 | 112 | fn mulxU64(out1: *u64, out2: *u64, arg1: u64, arg2: u64) void { |
| 113 | @setRuntimeSafety(mode == .Debug); | |
| 113 | @setRuntimeSafety(mode == .debug); | |
| 114 | 114 | |
| 115 | 115 | const x = @as(u128, arg1) * @as(u128, arg2); |
| 116 | 116 | out1.* = @as(u64, @truncate(x)); |
| ... | ... | @@ -129,7 +129,7 @@ fn mulxU64(out1: *u64, out2: *u64, arg1: u64, arg2: u64) void { |
| 129 | 129 | /// Output Bounds: |
| 130 | 130 | /// out1: [0x0 ~> 0xffffffffffffffff] |
| 131 | 131 | fn cmovznzU64(out1: *u64, arg1: u1, arg2: u64, arg3: u64) void { |
| 132 | @setRuntimeSafety(mode == .Debug); | |
| 132 | @setRuntimeSafety(mode == .debug); | |
| 133 | 133 | |
| 134 | 134 | const mask = 0 -% @as(u64, arg1); |
| 135 | 135 | out1.* = (mask & arg3) | ((~mask) & arg2); |
| ... | ... | @@ -145,7 +145,7 @@ fn cmovznzU64(out1: *u64, arg1: u1, arg2: u64, arg3: u64) void { |
| 145 | 145 | /// 0 ≤ eval out1 < m |
| 146 | 146 | /// |
| 147 | 147 | pub fn mul(out1: *MontgomeryDomainFieldElement, arg1: MontgomeryDomainFieldElement, arg2: MontgomeryDomainFieldElement) void { |
| 148 | @setRuntimeSafety(mode == .Debug); | |
| 148 | @setRuntimeSafety(mode == .debug); | |
| 149 | 149 | |
| 150 | 150 | const x1 = (arg1[1]); |
| 151 | 151 | const x2 = (arg1[2]); |
| ... | ... | @@ -485,7 +485,7 @@ pub fn mul(out1: *MontgomeryDomainFieldElement, arg1: MontgomeryDomainFieldEleme |
| 485 | 485 | /// 0 ≤ eval out1 < m |
| 486 | 486 | /// |
| 487 | 487 | pub fn square(out1: *MontgomeryDomainFieldElement, arg1: MontgomeryDomainFieldElement) void { |
| 488 | @setRuntimeSafety(mode == .Debug); | |
| 488 | @setRuntimeSafety(mode == .debug); | |
| 489 | 489 | |
| 490 | 490 | const x1 = (arg1[1]); |
| 491 | 491 | const x2 = (arg1[2]); |
| ... | ... | @@ -826,7 +826,7 @@ pub fn square(out1: *MontgomeryDomainFieldElement, arg1: MontgomeryDomainFieldEl |
| 826 | 826 | /// 0 ≤ eval out1 < m |
| 827 | 827 | /// |
| 828 | 828 | pub fn add(out1: *MontgomeryDomainFieldElement, arg1: MontgomeryDomainFieldElement, arg2: MontgomeryDomainFieldElement) void { |
| 829 | @setRuntimeSafety(mode == .Debug); | |
| 829 | @setRuntimeSafety(mode == .debug); | |
| 830 | 830 | |
| 831 | 831 | var x1: u64 = undefined; |
| 832 | 832 | var x2: u1 = undefined; |
| ... | ... | @@ -879,7 +879,7 @@ pub fn add(out1: *MontgomeryDomainFieldElement, arg1: MontgomeryDomainFieldEleme |
| 879 | 879 | /// 0 ≤ eval out1 < m |
| 880 | 880 | /// |
| 881 | 881 | pub fn sub(out1: *MontgomeryDomainFieldElement, arg1: MontgomeryDomainFieldElement, arg2: MontgomeryDomainFieldElement) void { |
| 882 | @setRuntimeSafety(mode == .Debug); | |
| 882 | @setRuntimeSafety(mode == .debug); | |
| 883 | 883 | |
| 884 | 884 | var x1: u64 = undefined; |
| 885 | 885 | var x2: u1 = undefined; |
| ... | ... | @@ -922,7 +922,7 @@ pub fn sub(out1: *MontgomeryDomainFieldElement, arg1: MontgomeryDomainFieldEleme |
| 922 | 922 | /// 0 ≤ eval out1 < m |
| 923 | 923 | /// |
| 924 | 924 | pub fn opp(out1: *MontgomeryDomainFieldElement, arg1: MontgomeryDomainFieldElement) void { |
| 925 | @setRuntimeSafety(mode == .Debug); | |
| 925 | @setRuntimeSafety(mode == .debug); | |
| 926 | 926 | |
| 927 | 927 | var x1: u64 = undefined; |
| 928 | 928 | var x2: u1 = undefined; |
| ... | ... | @@ -965,7 +965,7 @@ pub fn opp(out1: *MontgomeryDomainFieldElement, arg1: MontgomeryDomainFieldEleme |
| 965 | 965 | /// 0 ≤ eval out1 < m |
| 966 | 966 | /// |
| 967 | 967 | pub fn fromMontgomery(out1: *NonMontgomeryDomainFieldElement, arg1: MontgomeryDomainFieldElement) void { |
| 968 | @setRuntimeSafety(mode == .Debug); | |
| 968 | @setRuntimeSafety(mode == .debug); | |
| 969 | 969 | |
| 970 | 970 | const x1 = (arg1[0]); |
| 971 | 971 | var x2: u64 = undefined; |
| ... | ... | @@ -1178,7 +1178,7 @@ pub fn fromMontgomery(out1: *NonMontgomeryDomainFieldElement, arg1: MontgomeryDo |
| 1178 | 1178 | /// 0 ≤ eval out1 < m |
| 1179 | 1179 | /// |
| 1180 | 1180 | pub fn toMontgomery(out1: *MontgomeryDomainFieldElement, arg1: NonMontgomeryDomainFieldElement) void { |
| 1181 | @setRuntimeSafety(mode == .Debug); | |
| 1181 | @setRuntimeSafety(mode == .debug); | |
| 1182 | 1182 | |
| 1183 | 1183 | const x1 = (arg1[1]); |
| 1184 | 1184 | const x2 = (arg1[2]); |
| ... | ... | @@ -1501,7 +1501,7 @@ pub fn toMontgomery(out1: *MontgomeryDomainFieldElement, arg1: NonMontgomeryDoma |
| 1501 | 1501 | /// Output Bounds: |
| 1502 | 1502 | /// out1: [0x0 ~> 0xffffffffffffffff] |
| 1503 | 1503 | pub fn nonzero(out1: *u64, arg1: [4]u64) void { |
| 1504 | @setRuntimeSafety(mode == .Debug); | |
| 1504 | @setRuntimeSafety(mode == .debug); | |
| 1505 | 1505 | |
| 1506 | 1506 | const x1 = ((arg1[0]) | ((arg1[1]) | ((arg1[2]) | (arg1[3])))); |
| 1507 | 1507 | out1.* = x1; |
| ... | ... | @@ -1519,7 +1519,7 @@ pub fn nonzero(out1: *u64, arg1: [4]u64) void { |
| 1519 | 1519 | /// Output Bounds: |
| 1520 | 1520 | /// out1: [[0x0 ~> 0xffffffffffffffff], [0x0 ~> 0xffffffffffffffff], [0x0 ~> 0xffffffffffffffff], [0x0 ~> 0xffffffffffffffff]] |
| 1521 | 1521 | pub fn selectznz(out1: *[4]u64, arg1: u1, arg2: [4]u64, arg3: [4]u64) void { |
| 1522 | @setRuntimeSafety(mode == .Debug); | |
| 1522 | @setRuntimeSafety(mode == .debug); | |
| 1523 | 1523 | |
| 1524 | 1524 | var x1: u64 = undefined; |
| 1525 | 1525 | cmovznzU64(&x1, arg1, (arg2[0]), (arg3[0])); |
| ... | ... | @@ -1547,7 +1547,7 @@ pub fn selectznz(out1: *[4]u64, arg1: u1, arg2: [4]u64, arg3: [4]u64) void { |
| 1547 | 1547 | /// Output Bounds: |
| 1548 | 1548 | /// out1: [[0x0 ~> 0xff], [0x0 ~> 0xff], [0x0 ~> 0xff], [0x0 ~> 0xff], [0x0 ~> 0xff], [0x0 ~> 0xff], [0x0 ~> 0xff], [0x0 ~> 0xff], [0x0 ~> 0xff], [0x0 ~> 0xff], [0x0 ~> 0xff], [0x0 ~> 0xff], [0x0 ~> 0xff], [0x0 ~> 0xff], [0x0 ~> 0xff], [0x0 ~> 0xff], [0x0 ~> 0xff], [0x0 ~> 0xff], [0x0 ~> 0xff], [0x0 ~> 0xff], [0x0 ~> 0xff], [0x0 ~> 0xff], [0x0 ~> 0xff], [0x0 ~> 0xff], [0x0 ~> 0xff], [0x0 ~> 0xff], [0x0 ~> 0xff], [0x0 ~> 0xff], [0x0 ~> 0xff], [0x0 ~> 0xff], [0x0 ~> 0xff], [0x0 ~> 0xff]] |
| 1549 | 1549 | pub fn toBytes(out1: *[32]u8, arg1: [4]u64) void { |
| 1550 | @setRuntimeSafety(mode == .Debug); | |
| 1550 | @setRuntimeSafety(mode == .debug); | |
| 1551 | 1551 | |
| 1552 | 1552 | const x1 = (arg1[3]); |
| 1553 | 1553 | const x2 = (arg1[2]); |
| ... | ... | @@ -1656,7 +1656,7 @@ pub fn toBytes(out1: *[32]u8, arg1: [4]u64) void { |
| 1656 | 1656 | /// Output Bounds: |
| 1657 | 1657 | /// out1: [[0x0 ~> 0xffffffffffffffff], [0x0 ~> 0xffffffffffffffff], [0x0 ~> 0xffffffffffffffff], [0x0 ~> 0xffffffffffffffff]] |
| 1658 | 1658 | pub fn fromBytes(out1: *[4]u64, arg1: [32]u8) void { |
| 1659 | @setRuntimeSafety(mode == .Debug); | |
| 1659 | @setRuntimeSafety(mode == .debug); | |
| 1660 | 1660 | |
| 1661 | 1661 | const x1 = (@as(u64, (arg1[31])) << 56); |
| 1662 | 1662 | const x2 = (@as(u64, (arg1[30])) << 48); |
| ... | ... | @@ -1731,7 +1731,7 @@ pub fn fromBytes(out1: *[4]u64, arg1: [32]u8) void { |
| 1731 | 1731 | /// 0 ≤ eval out1 < m |
| 1732 | 1732 | /// |
| 1733 | 1733 | pub fn setOne(out1: *MontgomeryDomainFieldElement) void { |
| 1734 | @setRuntimeSafety(mode == .Debug); | |
| 1734 | @setRuntimeSafety(mode == .debug); | |
| 1735 | 1735 | |
| 1736 | 1736 | out1[0] = 0xc46353d039cdaaf; |
| 1737 | 1737 | out1[1] = 0x4319055258e8617b; |
| ... | ... | @@ -1748,7 +1748,7 @@ pub fn setOne(out1: *MontgomeryDomainFieldElement) void { |
| 1748 | 1748 | /// Output Bounds: |
| 1749 | 1749 | /// out1: [[0x0 ~> 0xffffffffffffffff], [0x0 ~> 0xffffffffffffffff], [0x0 ~> 0xffffffffffffffff], [0x0 ~> 0xffffffffffffffff], [0x0 ~> 0xffffffffffffffff]] |
| 1750 | 1750 | pub fn msat(out1: *[5]u64) void { |
| 1751 | @setRuntimeSafety(mode == .Debug); | |
| 1751 | @setRuntimeSafety(mode == .debug); | |
| 1752 | 1752 | |
| 1753 | 1753 | out1[0] = 0xf3b9cac2fc632551; |
| 1754 | 1754 | out1[1] = 0xbce6faada7179e84; |
| ... | ... | @@ -1786,7 +1786,7 @@ pub fn msat(out1: *[5]u64) void { |
| 1786 | 1786 | /// out4: [[0x0 ~> 0xffffffffffffffff], [0x0 ~> 0xffffffffffffffff], [0x0 ~> 0xffffffffffffffff], [0x0 ~> 0xffffffffffffffff]] |
| 1787 | 1787 | /// out5: [[0x0 ~> 0xffffffffffffffff], [0x0 ~> 0xffffffffffffffff], [0x0 ~> 0xffffffffffffffff], [0x0 ~> 0xffffffffffffffff]] |
| 1788 | 1788 | pub fn divstep(out1: *u64, out2: *[5]u64, out3: *[5]u64, out4: *[4]u64, out5: *[4]u64, arg1: u64, arg2: [5]u64, arg3: [5]u64, arg4: [4]u64, arg5: [4]u64) void { |
| 1789 | @setRuntimeSafety(mode == .Debug); | |
| 1789 | @setRuntimeSafety(mode == .debug); | |
| 1790 | 1790 | |
| 1791 | 1791 | var x1: u64 = undefined; |
| 1792 | 1792 | var x2: u1 = undefined; |
| ... | ... | @@ -2020,7 +2020,7 @@ pub fn divstep(out1: *u64, out2: *[5]u64, out3: *[5]u64, out4: *[4]u64, out5: *[ |
| 2020 | 2020 | /// Output Bounds: |
| 2021 | 2021 | /// out1: [[0x0 ~> 0xffffffffffffffff], [0x0 ~> 0xffffffffffffffff], [0x0 ~> 0xffffffffffffffff], [0x0 ~> 0xffffffffffffffff]] |
| 2022 | 2022 | pub fn divstepPrecomp(out1: *[4]u64) void { |
| 2023 | @setRuntimeSafety(mode == .Debug); | |
| 2023 | @setRuntimeSafety(mode == .debug); | |
| 2024 | 2024 | |
| 2025 | 2025 | out1[0] = 0xd739262fb7fcfbb5; |
| 2026 | 2026 | out1[1] = 0x8ac6f75d20074414; |
lib/std/crypto/pcurves/p384/p384_64.zig+17-17| ... | ... | @@ -79,7 +79,7 @@ fn subborrowxU64(out1: *u64, out2: *u1, arg1: u1, arg2: u64, arg3: u64) void { |
| 79 | 79 | /// out1: [0x0 ~> 0xffffffffffffffff] |
| 80 | 80 | /// out2: [0x0 ~> 0xffffffffffffffff] |
| 81 | 81 | fn mulxU64(out1: *u64, out2: *u64, arg1: u64, arg2: u64) void { |
| 82 | @setRuntimeSafety(mode == .Debug); | |
| 82 | @setRuntimeSafety(mode == .debug); | |
| 83 | 83 | |
| 84 | 84 | const x = @as(u128, arg1) * @as(u128, arg2); |
| 85 | 85 | out1.* = @as(u64, @truncate(x)); |
| ... | ... | @@ -98,7 +98,7 @@ fn mulxU64(out1: *u64, out2: *u64, arg1: u64, arg2: u64) void { |
| 98 | 98 | /// Output Bounds: |
| 99 | 99 | /// out1: [0x0 ~> 0xffffffffffffffff] |
| 100 | 100 | fn cmovznzU64(out1: *u64, arg1: u1, arg2: u64, arg3: u64) void { |
| 101 | @setRuntimeSafety(mode == .Debug); | |
| 101 | @setRuntimeSafety(mode == .debug); | |
| 102 | 102 | |
| 103 | 103 | const mask = 0 -% @as(u64, arg1); |
| 104 | 104 | out1.* = (mask & arg3) | ((~mask) & arg2); |
| ... | ... | @@ -114,7 +114,7 @@ fn cmovznzU64(out1: *u64, arg1: u1, arg2: u64, arg3: u64) void { |
| 114 | 114 | /// 0 ≤ eval out1 < m |
| 115 | 115 | /// |
| 116 | 116 | pub fn mul(out1: *MontgomeryDomainFieldElement, arg1: MontgomeryDomainFieldElement, arg2: MontgomeryDomainFieldElement) void { |
| 117 | @setRuntimeSafety(mode == .Debug); | |
| 117 | @setRuntimeSafety(mode == .debug); | |
| 118 | 118 | |
| 119 | 119 | const x1 = (arg1[1]); |
| 120 | 120 | const x2 = (arg1[2]); |
| ... | ... | @@ -834,7 +834,7 @@ pub fn mul(out1: *MontgomeryDomainFieldElement, arg1: MontgomeryDomainFieldEleme |
| 834 | 834 | /// 0 ≤ eval out1 < m |
| 835 | 835 | /// |
| 836 | 836 | pub fn square(out1: *MontgomeryDomainFieldElement, arg1: MontgomeryDomainFieldElement) void { |
| 837 | @setRuntimeSafety(mode == .Debug); | |
| 837 | @setRuntimeSafety(mode == .debug); | |
| 838 | 838 | |
| 839 | 839 | const x1 = (arg1[1]); |
| 840 | 840 | const x2 = (arg1[2]); |
| ... | ... | @@ -1555,7 +1555,7 @@ pub fn square(out1: *MontgomeryDomainFieldElement, arg1: MontgomeryDomainFieldEl |
| 1555 | 1555 | /// 0 ≤ eval out1 < m |
| 1556 | 1556 | /// |
| 1557 | 1557 | pub fn add(out1: *MontgomeryDomainFieldElement, arg1: MontgomeryDomainFieldElement, arg2: MontgomeryDomainFieldElement) void { |
| 1558 | @setRuntimeSafety(mode == .Debug); | |
| 1558 | @setRuntimeSafety(mode == .debug); | |
| 1559 | 1559 | |
| 1560 | 1560 | var x1: u64 = undefined; |
| 1561 | 1561 | var x2: u1 = undefined; |
| ... | ... | @@ -1626,7 +1626,7 @@ pub fn add(out1: *MontgomeryDomainFieldElement, arg1: MontgomeryDomainFieldEleme |
| 1626 | 1626 | /// 0 ≤ eval out1 < m |
| 1627 | 1627 | /// |
| 1628 | 1628 | pub fn sub(out1: *MontgomeryDomainFieldElement, arg1: MontgomeryDomainFieldElement, arg2: MontgomeryDomainFieldElement) void { |
| 1629 | @setRuntimeSafety(mode == .Debug); | |
| 1629 | @setRuntimeSafety(mode == .debug); | |
| 1630 | 1630 | |
| 1631 | 1631 | var x1: u64 = undefined; |
| 1632 | 1632 | var x2: u1 = undefined; |
| ... | ... | @@ -1683,7 +1683,7 @@ pub fn sub(out1: *MontgomeryDomainFieldElement, arg1: MontgomeryDomainFieldEleme |
| 1683 | 1683 | /// 0 ≤ eval out1 < m |
| 1684 | 1684 | /// |
| 1685 | 1685 | pub fn opp(out1: *MontgomeryDomainFieldElement, arg1: MontgomeryDomainFieldElement) void { |
| 1686 | @setRuntimeSafety(mode == .Debug); | |
| 1686 | @setRuntimeSafety(mode == .debug); | |
| 1687 | 1687 | |
| 1688 | 1688 | var x1: u64 = undefined; |
| 1689 | 1689 | var x2: u1 = undefined; |
| ... | ... | @@ -1740,7 +1740,7 @@ pub fn opp(out1: *MontgomeryDomainFieldElement, arg1: MontgomeryDomainFieldEleme |
| 1740 | 1740 | /// 0 ≤ eval out1 < m |
| 1741 | 1741 | /// |
| 1742 | 1742 | pub fn fromMontgomery(out1: *NonMontgomeryDomainFieldElement, arg1: MontgomeryDomainFieldElement) void { |
| 1743 | @setRuntimeSafety(mode == .Debug); | |
| 1743 | @setRuntimeSafety(mode == .debug); | |
| 1744 | 1744 | |
| 1745 | 1745 | const x1 = (arg1[0]); |
| 1746 | 1746 | var x2: u64 = undefined; |
| ... | ... | @@ -2225,7 +2225,7 @@ pub fn fromMontgomery(out1: *NonMontgomeryDomainFieldElement, arg1: MontgomeryDo |
| 2225 | 2225 | /// 0 ≤ eval out1 < m |
| 2226 | 2226 | /// |
| 2227 | 2227 | pub fn toMontgomery(out1: *MontgomeryDomainFieldElement, arg1: NonMontgomeryDomainFieldElement) void { |
| 2228 | @setRuntimeSafety(mode == .Debug); | |
| 2228 | @setRuntimeSafety(mode == .debug); | |
| 2229 | 2229 | |
| 2230 | 2230 | const x1 = (arg1[1]); |
| 2231 | 2231 | const x2 = (arg1[2]); |
| ... | ... | @@ -2862,7 +2862,7 @@ pub fn toMontgomery(out1: *MontgomeryDomainFieldElement, arg1: NonMontgomeryDoma |
| 2862 | 2862 | /// Output Bounds: |
| 2863 | 2863 | /// out1: [0x0 ~> 0xffffffffffffffff] |
| 2864 | 2864 | pub fn nonzero(out1: *u64, arg1: [6]u64) void { |
| 2865 | @setRuntimeSafety(mode == .Debug); | |
| 2865 | @setRuntimeSafety(mode == .debug); | |
| 2866 | 2866 | |
| 2867 | 2867 | const x1 = ((arg1[0]) | ((arg1[1]) | ((arg1[2]) | ((arg1[3]) | ((arg1[4]) | (arg1[5])))))); |
| 2868 | 2868 | out1.* = x1; |
| ... | ... | @@ -2880,7 +2880,7 @@ pub fn nonzero(out1: *u64, arg1: [6]u64) void { |
| 2880 | 2880 | /// Output Bounds: |
| 2881 | 2881 | /// out1: [[0x0 ~> 0xffffffffffffffff], [0x0 ~> 0xffffffffffffffff], [0x0 ~> 0xffffffffffffffff], [0x0 ~> 0xffffffffffffffff], [0x0 ~> 0xffffffffffffffff], [0x0 ~> 0xffffffffffffffff]] |
| 2882 | 2882 | pub fn selectznz(out1: *[6]u64, arg1: u1, arg2: [6]u64, arg3: [6]u64) void { |
| 2883 | @setRuntimeSafety(mode == .Debug); | |
| 2883 | @setRuntimeSafety(mode == .debug); | |
| 2884 | 2884 | |
| 2885 | 2885 | var x1: u64 = undefined; |
| 2886 | 2886 | cmovznzU64(&x1, arg1, (arg2[0]), (arg3[0])); |
| ... | ... | @@ -2914,7 +2914,7 @@ pub fn selectznz(out1: *[6]u64, arg1: u1, arg2: [6]u64, arg3: [6]u64) void { |
| 2914 | 2914 | /// Output Bounds: |
| 2915 | 2915 | /// out1: [[0x0 ~> 0xff], [0x0 ~> 0xff], [0x0 ~> 0xff], [0x0 ~> 0xff], [0x0 ~> 0xff], [0x0 ~> 0xff], [0x0 ~> 0xff], [0x0 ~> 0xff], [0x0 ~> 0xff], [0x0 ~> 0xff], [0x0 ~> 0xff], [0x0 ~> 0xff], [0x0 ~> 0xff], [0x0 ~> 0xff], [0x0 ~> 0xff], [0x0 ~> 0xff], [0x0 ~> 0xff], [0x0 ~> 0xff], [0x0 ~> 0xff], [0x0 ~> 0xff], [0x0 ~> 0xff], [0x0 ~> 0xff], [0x0 ~> 0xff], [0x0 ~> 0xff], [0x0 ~> 0xff], [0x0 ~> 0xff], [0x0 ~> 0xff], [0x0 ~> 0xff], [0x0 ~> 0xff], [0x0 ~> 0xff], [0x0 ~> 0xff], [0x0 ~> 0xff], [0x0 ~> 0xff], [0x0 ~> 0xff], [0x0 ~> 0xff], [0x0 ~> 0xff], [0x0 ~> 0xff], [0x0 ~> 0xff], [0x0 ~> 0xff], [0x0 ~> 0xff], [0x0 ~> 0xff], [0x0 ~> 0xff], [0x0 ~> 0xff], [0x0 ~> 0xff], [0x0 ~> 0xff], [0x0 ~> 0xff], [0x0 ~> 0xff], [0x0 ~> 0xff]] |
| 2916 | 2916 | pub fn toBytes(out1: *[48]u8, arg1: [6]u64) void { |
| 2917 | @setRuntimeSafety(mode == .Debug); | |
| 2917 | @setRuntimeSafety(mode == .debug); | |
| 2918 | 2918 | |
| 2919 | 2919 | const x1 = (arg1[5]); |
| 2920 | 2920 | const x2 = (arg1[4]); |
| ... | ... | @@ -3069,7 +3069,7 @@ pub fn toBytes(out1: *[48]u8, arg1: [6]u64) void { |
| 3069 | 3069 | /// Output Bounds: |
| 3070 | 3070 | /// out1: [[0x0 ~> 0xffffffffffffffff], [0x0 ~> 0xffffffffffffffff], [0x0 ~> 0xffffffffffffffff], [0x0 ~> 0xffffffffffffffff], [0x0 ~> 0xffffffffffffffff], [0x0 ~> 0xffffffffffffffff]] |
| 3071 | 3071 | pub fn fromBytes(out1: *[6]u64, arg1: [48]u8) void { |
| 3072 | @setRuntimeSafety(mode == .Debug); | |
| 3072 | @setRuntimeSafety(mode == .debug); | |
| 3073 | 3073 | |
| 3074 | 3074 | const x1 = (@as(u64, (arg1[47])) << 56); |
| 3075 | 3075 | const x2 = (@as(u64, (arg1[46])) << 48); |
| ... | ... | @@ -3176,7 +3176,7 @@ pub fn fromBytes(out1: *[6]u64, arg1: [48]u8) void { |
| 3176 | 3176 | /// 0 ≤ eval out1 < m |
| 3177 | 3177 | /// |
| 3178 | 3178 | pub fn setOne(out1: *MontgomeryDomainFieldElement) void { |
| 3179 | @setRuntimeSafety(mode == .Debug); | |
| 3179 | @setRuntimeSafety(mode == .debug); | |
| 3180 | 3180 | |
| 3181 | 3181 | out1[0] = 0xffffffff00000001; |
| 3182 | 3182 | out1[1] = 0xffffffff; |
| ... | ... | @@ -3195,7 +3195,7 @@ pub fn setOne(out1: *MontgomeryDomainFieldElement) void { |
| 3195 | 3195 | /// Output Bounds: |
| 3196 | 3196 | /// out1: [[0x0 ~> 0xffffffffffffffff], [0x0 ~> 0xffffffffffffffff], [0x0 ~> 0xffffffffffffffff], [0x0 ~> 0xffffffffffffffff], [0x0 ~> 0xffffffffffffffff], [0x0 ~> 0xffffffffffffffff], [0x0 ~> 0xffffffffffffffff]] |
| 3197 | 3197 | pub fn msat(out1: *[7]u64) void { |
| 3198 | @setRuntimeSafety(mode == .Debug); | |
| 3198 | @setRuntimeSafety(mode == .debug); | |
| 3199 | 3199 | |
| 3200 | 3200 | out1[0] = 0xffffffff; |
| 3201 | 3201 | out1[1] = 0xffffffff00000000; |
| ... | ... | @@ -3235,7 +3235,7 @@ pub fn msat(out1: *[7]u64) void { |
| 3235 | 3235 | /// out4: [[0x0 ~> 0xffffffffffffffff], [0x0 ~> 0xffffffffffffffff], [0x0 ~> 0xffffffffffffffff], [0x0 ~> 0xffffffffffffffff], [0x0 ~> 0xffffffffffffffff], [0x0 ~> 0xffffffffffffffff]] |
| 3236 | 3236 | /// out5: [[0x0 ~> 0xffffffffffffffff], [0x0 ~> 0xffffffffffffffff], [0x0 ~> 0xffffffffffffffff], [0x0 ~> 0xffffffffffffffff], [0x0 ~> 0xffffffffffffffff], [0x0 ~> 0xffffffffffffffff]] |
| 3237 | 3237 | pub fn divstep(out1: *u64, out2: *[7]u64, out3: *[7]u64, out4: *[6]u64, out5: *[6]u64, arg1: u64, arg2: [7]u64, arg3: [7]u64, arg4: [6]u64, arg5: [6]u64) void { |
| 3238 | @setRuntimeSafety(mode == .Debug); | |
| 3238 | @setRuntimeSafety(mode == .debug); | |
| 3239 | 3239 | |
| 3240 | 3240 | var x1: u64 = undefined; |
| 3241 | 3241 | var x2: u1 = undefined; |
| ... | ... | @@ -3561,7 +3561,7 @@ pub fn divstep(out1: *u64, out2: *[7]u64, out3: *[7]u64, out4: *[6]u64, out5: *[ |
| 3561 | 3561 | /// Output Bounds: |
| 3562 | 3562 | /// out1: [[0x0 ~> 0xffffffffffffffff], [0x0 ~> 0xffffffffffffffff], [0x0 ~> 0xffffffffffffffff], [0x0 ~> 0xffffffffffffffff], [0x0 ~> 0xffffffffffffffff], [0x0 ~> 0xffffffffffffffff]] |
| 3563 | 3563 | pub fn divstepPrecomp(out1: *[6]u64) void { |
| 3564 | @setRuntimeSafety(mode == .Debug); | |
| 3564 | @setRuntimeSafety(mode == .debug); | |
| 3565 | 3565 | |
| 3566 | 3566 | out1[0] = 0xfff69400fff18fff; |
| 3567 | 3567 | out1[1] = 0x2b7feffffd3ff; |
lib/std/crypto/pcurves/p384/p384_scalar_64.zig+17-17| ... | ... | @@ -79,7 +79,7 @@ fn subborrowxU64(out1: *u64, out2: *u1, arg1: u1, arg2: u64, arg3: u64) void { |
| 79 | 79 | /// out1: [0x0 ~> 0xffffffffffffffff] |
| 80 | 80 | /// out2: [0x0 ~> 0xffffffffffffffff] |
| 81 | 81 | fn mulxU64(out1: *u64, out2: *u64, arg1: u64, arg2: u64) void { |
| 82 | @setRuntimeSafety(mode == .Debug); | |
| 82 | @setRuntimeSafety(mode == .debug); | |
| 83 | 83 | |
| 84 | 84 | const x = @as(u128, arg1) * @as(u128, arg2); |
| 85 | 85 | out1.* = @as(u64, @truncate(x)); |
| ... | ... | @@ -98,7 +98,7 @@ fn mulxU64(out1: *u64, out2: *u64, arg1: u64, arg2: u64) void { |
| 98 | 98 | /// Output Bounds: |
| 99 | 99 | /// out1: [0x0 ~> 0xffffffffffffffff] |
| 100 | 100 | fn cmovznzU64(out1: *u64, arg1: u1, arg2: u64, arg3: u64) void { |
| 101 | @setRuntimeSafety(mode == .Debug); | |
| 101 | @setRuntimeSafety(mode == .debug); | |
| 102 | 102 | |
| 103 | 103 | const mask = 0 -% @as(u64, arg1); |
| 104 | 104 | out1.* = (mask & arg3) | ((~mask) & arg2); |
| ... | ... | @@ -114,7 +114,7 @@ fn cmovznzU64(out1: *u64, arg1: u1, arg2: u64, arg3: u64) void { |
| 114 | 114 | /// 0 ≤ eval out1 < m |
| 115 | 115 | /// |
| 116 | 116 | pub fn mul(out1: *MontgomeryDomainFieldElement, arg1: MontgomeryDomainFieldElement, arg2: MontgomeryDomainFieldElement) void { |
| 117 | @setRuntimeSafety(mode == .Debug); | |
| 117 | @setRuntimeSafety(mode == .debug); | |
| 118 | 118 | |
| 119 | 119 | const x1 = (arg1[1]); |
| 120 | 120 | const x2 = (arg1[2]); |
| ... | ... | @@ -834,7 +834,7 @@ pub fn mul(out1: *MontgomeryDomainFieldElement, arg1: MontgomeryDomainFieldEleme |
| 834 | 834 | /// 0 ≤ eval out1 < m |
| 835 | 835 | /// |
| 836 | 836 | pub fn square(out1: *MontgomeryDomainFieldElement, arg1: MontgomeryDomainFieldElement) void { |
| 837 | @setRuntimeSafety(mode == .Debug); | |
| 837 | @setRuntimeSafety(mode == .debug); | |
| 838 | 838 | |
| 839 | 839 | const x1 = (arg1[1]); |
| 840 | 840 | const x2 = (arg1[2]); |
| ... | ... | @@ -1555,7 +1555,7 @@ pub fn square(out1: *MontgomeryDomainFieldElement, arg1: MontgomeryDomainFieldEl |
| 1555 | 1555 | /// 0 ≤ eval out1 < m |
| 1556 | 1556 | /// |
| 1557 | 1557 | pub fn add(out1: *MontgomeryDomainFieldElement, arg1: MontgomeryDomainFieldElement, arg2: MontgomeryDomainFieldElement) void { |
| 1558 | @setRuntimeSafety(mode == .Debug); | |
| 1558 | @setRuntimeSafety(mode == .debug); | |
| 1559 | 1559 | |
| 1560 | 1560 | var x1: u64 = undefined; |
| 1561 | 1561 | var x2: u1 = undefined; |
| ... | ... | @@ -1626,7 +1626,7 @@ pub fn add(out1: *MontgomeryDomainFieldElement, arg1: MontgomeryDomainFieldEleme |
| 1626 | 1626 | /// 0 ≤ eval out1 < m |
| 1627 | 1627 | /// |
| 1628 | 1628 | pub fn sub(out1: *MontgomeryDomainFieldElement, arg1: MontgomeryDomainFieldElement, arg2: MontgomeryDomainFieldElement) void { |
| 1629 | @setRuntimeSafety(mode == .Debug); | |
| 1629 | @setRuntimeSafety(mode == .debug); | |
| 1630 | 1630 | |
| 1631 | 1631 | var x1: u64 = undefined; |
| 1632 | 1632 | var x2: u1 = undefined; |
| ... | ... | @@ -1683,7 +1683,7 @@ pub fn sub(out1: *MontgomeryDomainFieldElement, arg1: MontgomeryDomainFieldEleme |
| 1683 | 1683 | /// 0 ≤ eval out1 < m |
| 1684 | 1684 | /// |
| 1685 | 1685 | pub fn opp(out1: *MontgomeryDomainFieldElement, arg1: MontgomeryDomainFieldElement) void { |
| 1686 | @setRuntimeSafety(mode == .Debug); | |
| 1686 | @setRuntimeSafety(mode == .debug); | |
| 1687 | 1687 | |
| 1688 | 1688 | var x1: u64 = undefined; |
| 1689 | 1689 | var x2: u1 = undefined; |
| ... | ... | @@ -1740,7 +1740,7 @@ pub fn opp(out1: *MontgomeryDomainFieldElement, arg1: MontgomeryDomainFieldEleme |
| 1740 | 1740 | /// 0 ≤ eval out1 < m |
| 1741 | 1741 | /// |
| 1742 | 1742 | pub fn fromMontgomery(out1: *NonMontgomeryDomainFieldElement, arg1: MontgomeryDomainFieldElement) void { |
| 1743 | @setRuntimeSafety(mode == .Debug); | |
| 1743 | @setRuntimeSafety(mode == .debug); | |
| 1744 | 1744 | |
| 1745 | 1745 | const x1 = (arg1[0]); |
| 1746 | 1746 | var x2: u64 = undefined; |
| ... | ... | @@ -2225,7 +2225,7 @@ pub fn fromMontgomery(out1: *NonMontgomeryDomainFieldElement, arg1: MontgomeryDo |
| 2225 | 2225 | /// 0 ≤ eval out1 < m |
| 2226 | 2226 | /// |
| 2227 | 2227 | pub fn toMontgomery(out1: *MontgomeryDomainFieldElement, arg1: NonMontgomeryDomainFieldElement) void { |
| 2228 | @setRuntimeSafety(mode == .Debug); | |
| 2228 | @setRuntimeSafety(mode == .debug); | |
| 2229 | 2229 | |
| 2230 | 2230 | const x1 = (arg1[1]); |
| 2231 | 2231 | const x2 = (arg1[2]); |
| ... | ... | @@ -2916,7 +2916,7 @@ pub fn toMontgomery(out1: *MontgomeryDomainFieldElement, arg1: NonMontgomeryDoma |
| 2916 | 2916 | /// Output Bounds: |
| 2917 | 2917 | /// out1: [0x0 ~> 0xffffffffffffffff] |
| 2918 | 2918 | pub fn nonzero(out1: *u64, arg1: [6]u64) void { |
| 2919 | @setRuntimeSafety(mode == .Debug); | |
| 2919 | @setRuntimeSafety(mode == .debug); | |
| 2920 | 2920 | |
| 2921 | 2921 | const x1 = ((arg1[0]) | ((arg1[1]) | ((arg1[2]) | ((arg1[3]) | ((arg1[4]) | (arg1[5])))))); |
| 2922 | 2922 | out1.* = x1; |
| ... | ... | @@ -2934,7 +2934,7 @@ pub fn nonzero(out1: *u64, arg1: [6]u64) void { |
| 2934 | 2934 | /// Output Bounds: |
| 2935 | 2935 | /// out1: [[0x0 ~> 0xffffffffffffffff], [0x0 ~> 0xffffffffffffffff], [0x0 ~> 0xffffffffffffffff], [0x0 ~> 0xffffffffffffffff], [0x0 ~> 0xffffffffffffffff], [0x0 ~> 0xffffffffffffffff]] |
| 2936 | 2936 | pub fn selectznz(out1: *[6]u64, arg1: u1, arg2: [6]u64, arg3: [6]u64) void { |
| 2937 | @setRuntimeSafety(mode == .Debug); | |
| 2937 | @setRuntimeSafety(mode == .debug); | |
| 2938 | 2938 | |
| 2939 | 2939 | var x1: u64 = undefined; |
| 2940 | 2940 | cmovznzU64(&x1, arg1, (arg2[0]), (arg3[0])); |
| ... | ... | @@ -2968,7 +2968,7 @@ pub fn selectznz(out1: *[6]u64, arg1: u1, arg2: [6]u64, arg3: [6]u64) void { |
| 2968 | 2968 | /// Output Bounds: |
| 2969 | 2969 | /// out1: [[0x0 ~> 0xff], [0x0 ~> 0xff], [0x0 ~> 0xff], [0x0 ~> 0xff], [0x0 ~> 0xff], [0x0 ~> 0xff], [0x0 ~> 0xff], [0x0 ~> 0xff], [0x0 ~> 0xff], [0x0 ~> 0xff], [0x0 ~> 0xff], [0x0 ~> 0xff], [0x0 ~> 0xff], [0x0 ~> 0xff], [0x0 ~> 0xff], [0x0 ~> 0xff], [0x0 ~> 0xff], [0x0 ~> 0xff], [0x0 ~> 0xff], [0x0 ~> 0xff], [0x0 ~> 0xff], [0x0 ~> 0xff], [0x0 ~> 0xff], [0x0 ~> 0xff], [0x0 ~> 0xff], [0x0 ~> 0xff], [0x0 ~> 0xff], [0x0 ~> 0xff], [0x0 ~> 0xff], [0x0 ~> 0xff], [0x0 ~> 0xff], [0x0 ~> 0xff], [0x0 ~> 0xff], [0x0 ~> 0xff], [0x0 ~> 0xff], [0x0 ~> 0xff], [0x0 ~> 0xff], [0x0 ~> 0xff], [0x0 ~> 0xff], [0x0 ~> 0xff], [0x0 ~> 0xff], [0x0 ~> 0xff], [0x0 ~> 0xff], [0x0 ~> 0xff], [0x0 ~> 0xff], [0x0 ~> 0xff], [0x0 ~> 0xff], [0x0 ~> 0xff]] |
| 2970 | 2970 | pub fn toBytes(out1: *[48]u8, arg1: [6]u64) void { |
| 2971 | @setRuntimeSafety(mode == .Debug); | |
| 2971 | @setRuntimeSafety(mode == .debug); | |
| 2972 | 2972 | |
| 2973 | 2973 | const x1 = (arg1[5]); |
| 2974 | 2974 | const x2 = (arg1[4]); |
| ... | ... | @@ -3123,7 +3123,7 @@ pub fn toBytes(out1: *[48]u8, arg1: [6]u64) void { |
| 3123 | 3123 | /// Output Bounds: |
| 3124 | 3124 | /// out1: [[0x0 ~> 0xffffffffffffffff], [0x0 ~> 0xffffffffffffffff], [0x0 ~> 0xffffffffffffffff], [0x0 ~> 0xffffffffffffffff], [0x0 ~> 0xffffffffffffffff], [0x0 ~> 0xffffffffffffffff]] |
| 3125 | 3125 | pub fn fromBytes(out1: *[6]u64, arg1: [48]u8) void { |
| 3126 | @setRuntimeSafety(mode == .Debug); | |
| 3126 | @setRuntimeSafety(mode == .debug); | |
| 3127 | 3127 | |
| 3128 | 3128 | const x1 = (@as(u64, (arg1[47])) << 56); |
| 3129 | 3129 | const x2 = (@as(u64, (arg1[46])) << 48); |
| ... | ... | @@ -3230,7 +3230,7 @@ pub fn fromBytes(out1: *[6]u64, arg1: [48]u8) void { |
| 3230 | 3230 | /// 0 ≤ eval out1 < m |
| 3231 | 3231 | /// |
| 3232 | 3232 | pub fn setOne(out1: *MontgomeryDomainFieldElement) void { |
| 3233 | @setRuntimeSafety(mode == .Debug); | |
| 3233 | @setRuntimeSafety(mode == .debug); | |
| 3234 | 3234 | |
| 3235 | 3235 | out1[0] = 0x1313e695333ad68d; |
| 3236 | 3236 | out1[1] = 0xa7e5f24db74f5885; |
| ... | ... | @@ -3249,7 +3249,7 @@ pub fn setOne(out1: *MontgomeryDomainFieldElement) void { |
| 3249 | 3249 | /// Output Bounds: |
| 3250 | 3250 | /// out1: [[0x0 ~> 0xffffffffffffffff], [0x0 ~> 0xffffffffffffffff], [0x0 ~> 0xffffffffffffffff], [0x0 ~> 0xffffffffffffffff], [0x0 ~> 0xffffffffffffffff], [0x0 ~> 0xffffffffffffffff], [0x0 ~> 0xffffffffffffffff]] |
| 3251 | 3251 | pub fn msat(out1: *[7]u64) void { |
| 3252 | @setRuntimeSafety(mode == .Debug); | |
| 3252 | @setRuntimeSafety(mode == .debug); | |
| 3253 | 3253 | |
| 3254 | 3254 | out1[0] = 0xecec196accc52973; |
| 3255 | 3255 | out1[1] = 0x581a0db248b0a77a; |
| ... | ... | @@ -3289,7 +3289,7 @@ pub fn msat(out1: *[7]u64) void { |
| 3289 | 3289 | /// out4: [[0x0 ~> 0xffffffffffffffff], [0x0 ~> 0xffffffffffffffff], [0x0 ~> 0xffffffffffffffff], [0x0 ~> 0xffffffffffffffff], [0x0 ~> 0xffffffffffffffff], [0x0 ~> 0xffffffffffffffff]] |
| 3290 | 3290 | /// out5: [[0x0 ~> 0xffffffffffffffff], [0x0 ~> 0xffffffffffffffff], [0x0 ~> 0xffffffffffffffff], [0x0 ~> 0xffffffffffffffff], [0x0 ~> 0xffffffffffffffff], [0x0 ~> 0xffffffffffffffff]] |
| 3291 | 3291 | pub fn divstep(out1: *u64, out2: *[7]u64, out3: *[7]u64, out4: *[6]u64, out5: *[6]u64, arg1: u64, arg2: [7]u64, arg3: [7]u64, arg4: [6]u64, arg5: [6]u64) void { |
| 3292 | @setRuntimeSafety(mode == .Debug); | |
| 3292 | @setRuntimeSafety(mode == .debug); | |
| 3293 | 3293 | |
| 3294 | 3294 | var x1: u64 = undefined; |
| 3295 | 3295 | var x2: u1 = undefined; |
| ... | ... | @@ -3615,7 +3615,7 @@ pub fn divstep(out1: *u64, out2: *[7]u64, out3: *[7]u64, out4: *[6]u64, out5: *[ |
| 3615 | 3615 | /// Output Bounds: |
| 3616 | 3616 | /// out1: [[0x0 ~> 0xffffffffffffffff], [0x0 ~> 0xffffffffffffffff], [0x0 ~> 0xffffffffffffffff], [0x0 ~> 0xffffffffffffffff], [0x0 ~> 0xffffffffffffffff], [0x0 ~> 0xffffffffffffffff]] |
| 3617 | 3617 | pub fn divstepPrecomp(out1: *[6]u64) void { |
| 3618 | @setRuntimeSafety(mode == .Debug); | |
| 3618 | @setRuntimeSafety(mode == .debug); | |
| 3619 | 3619 | |
| 3620 | 3620 | out1[0] = 0x49589ae0e6045b6a; |
| 3621 | 3621 | out1[1] = 0x3c9a5352870040ed; |
lib/std/crypto/pcurves/secp256k1/secp256k1_64.zig+17-17| ... | ... | @@ -79,7 +79,7 @@ fn subborrowxU64(out1: *u64, out2: *u1, arg1: u1, arg2: u64, arg3: u64) void { |
| 79 | 79 | /// out1: [0x0 ~> 0xffffffffffffffff] |
| 80 | 80 | /// out2: [0x0 ~> 0xffffffffffffffff] |
| 81 | 81 | fn mulxU64(out1: *u64, out2: *u64, arg1: u64, arg2: u64) void { |
| 82 | @setRuntimeSafety(mode == .Debug); | |
| 82 | @setRuntimeSafety(mode == .debug); | |
| 83 | 83 | |
| 84 | 84 | const x = @as(u128, arg1) * @as(u128, arg2); |
| 85 | 85 | out1.* = @as(u64, @truncate(x)); |
| ... | ... | @@ -98,7 +98,7 @@ fn mulxU64(out1: *u64, out2: *u64, arg1: u64, arg2: u64) void { |
| 98 | 98 | /// Output Bounds: |
| 99 | 99 | /// out1: [0x0 ~> 0xffffffffffffffff] |
| 100 | 100 | fn cmovznzU64(out1: *u64, arg1: u1, arg2: u64, arg3: u64) void { |
| 101 | @setRuntimeSafety(mode == .Debug); | |
| 101 | @setRuntimeSafety(mode == .debug); | |
| 102 | 102 | |
| 103 | 103 | const mask = 0 -% @as(u64, arg1); |
| 104 | 104 | out1.* = (mask & arg3) | ((~mask) & arg2); |
| ... | ... | @@ -114,7 +114,7 @@ fn cmovznzU64(out1: *u64, arg1: u1, arg2: u64, arg3: u64) void { |
| 114 | 114 | /// 0 ≤ eval out1 < m |
| 115 | 115 | /// |
| 116 | 116 | pub fn mul(out1: *MontgomeryDomainFieldElement, arg1: MontgomeryDomainFieldElement, arg2: MontgomeryDomainFieldElement) void { |
| 117 | @setRuntimeSafety(mode == .Debug); | |
| 117 | @setRuntimeSafety(mode == .debug); | |
| 118 | 118 | |
| 119 | 119 | const x1 = (arg1[1]); |
| 120 | 120 | const x2 = (arg1[2]); |
| ... | ... | @@ -454,7 +454,7 @@ pub fn mul(out1: *MontgomeryDomainFieldElement, arg1: MontgomeryDomainFieldEleme |
| 454 | 454 | /// 0 ≤ eval out1 < m |
| 455 | 455 | /// |
| 456 | 456 | pub fn square(out1: *MontgomeryDomainFieldElement, arg1: MontgomeryDomainFieldElement) void { |
| 457 | @setRuntimeSafety(mode == .Debug); | |
| 457 | @setRuntimeSafety(mode == .debug); | |
| 458 | 458 | |
| 459 | 459 | const x1 = (arg1[1]); |
| 460 | 460 | const x2 = (arg1[2]); |
| ... | ... | @@ -795,7 +795,7 @@ pub fn square(out1: *MontgomeryDomainFieldElement, arg1: MontgomeryDomainFieldEl |
| 795 | 795 | /// 0 ≤ eval out1 < m |
| 796 | 796 | /// |
| 797 | 797 | pub fn add(out1: *MontgomeryDomainFieldElement, arg1: MontgomeryDomainFieldElement, arg2: MontgomeryDomainFieldElement) void { |
| 798 | @setRuntimeSafety(mode == .Debug); | |
| 798 | @setRuntimeSafety(mode == .debug); | |
| 799 | 799 | |
| 800 | 800 | var x1: u64 = undefined; |
| 801 | 801 | var x2: u1 = undefined; |
| ... | ... | @@ -848,7 +848,7 @@ pub fn add(out1: *MontgomeryDomainFieldElement, arg1: MontgomeryDomainFieldEleme |
| 848 | 848 | /// 0 ≤ eval out1 < m |
| 849 | 849 | /// |
| 850 | 850 | pub fn sub(out1: *MontgomeryDomainFieldElement, arg1: MontgomeryDomainFieldElement, arg2: MontgomeryDomainFieldElement) void { |
| 851 | @setRuntimeSafety(mode == .Debug); | |
| 851 | @setRuntimeSafety(mode == .debug); | |
| 852 | 852 | |
| 853 | 853 | var x1: u64 = undefined; |
| 854 | 854 | var x2: u1 = undefined; |
| ... | ... | @@ -891,7 +891,7 @@ pub fn sub(out1: *MontgomeryDomainFieldElement, arg1: MontgomeryDomainFieldEleme |
| 891 | 891 | /// 0 ≤ eval out1 < m |
| 892 | 892 | /// |
| 893 | 893 | pub fn opp(out1: *MontgomeryDomainFieldElement, arg1: MontgomeryDomainFieldElement) void { |
| 894 | @setRuntimeSafety(mode == .Debug); | |
| 894 | @setRuntimeSafety(mode == .debug); | |
| 895 | 895 | |
| 896 | 896 | var x1: u64 = undefined; |
| 897 | 897 | var x2: u1 = undefined; |
| ... | ... | @@ -934,7 +934,7 @@ pub fn opp(out1: *MontgomeryDomainFieldElement, arg1: MontgomeryDomainFieldEleme |
| 934 | 934 | /// 0 ≤ eval out1 < m |
| 935 | 935 | /// |
| 936 | 936 | pub fn fromMontgomery(out1: *NonMontgomeryDomainFieldElement, arg1: MontgomeryDomainFieldElement) void { |
| 937 | @setRuntimeSafety(mode == .Debug); | |
| 937 | @setRuntimeSafety(mode == .debug); | |
| 938 | 938 | |
| 939 | 939 | const x1 = (arg1[0]); |
| 940 | 940 | var x2: u64 = undefined; |
| ... | ... | @@ -1167,7 +1167,7 @@ pub fn fromMontgomery(out1: *NonMontgomeryDomainFieldElement, arg1: MontgomeryDo |
| 1167 | 1167 | /// 0 ≤ eval out1 < m |
| 1168 | 1168 | /// |
| 1169 | 1169 | pub fn toMontgomery(out1: *MontgomeryDomainFieldElement, arg1: NonMontgomeryDomainFieldElement) void { |
| 1170 | @setRuntimeSafety(mode == .Debug); | |
| 1170 | @setRuntimeSafety(mode == .debug); | |
| 1171 | 1171 | |
| 1172 | 1172 | const x1 = (arg1[1]); |
| 1173 | 1173 | const x2 = (arg1[2]); |
| ... | ... | @@ -1430,7 +1430,7 @@ pub fn toMontgomery(out1: *MontgomeryDomainFieldElement, arg1: NonMontgomeryDoma |
| 1430 | 1430 | /// Output Bounds: |
| 1431 | 1431 | /// out1: [0x0 ~> 0xffffffffffffffff] |
| 1432 | 1432 | pub fn nonzero(out1: *u64, arg1: [4]u64) void { |
| 1433 | @setRuntimeSafety(mode == .Debug); | |
| 1433 | @setRuntimeSafety(mode == .debug); | |
| 1434 | 1434 | |
| 1435 | 1435 | const x1 = ((arg1[0]) | ((arg1[1]) | ((arg1[2]) | (arg1[3])))); |
| 1436 | 1436 | out1.* = x1; |
| ... | ... | @@ -1448,7 +1448,7 @@ pub fn nonzero(out1: *u64, arg1: [4]u64) void { |
| 1448 | 1448 | /// Output Bounds: |
| 1449 | 1449 | /// out1: [[0x0 ~> 0xffffffffffffffff], [0x0 ~> 0xffffffffffffffff], [0x0 ~> 0xffffffffffffffff], [0x0 ~> 0xffffffffffffffff]] |
| 1450 | 1450 | pub fn selectznz(out1: *[4]u64, arg1: u1, arg2: [4]u64, arg3: [4]u64) void { |
| 1451 | @setRuntimeSafety(mode == .Debug); | |
| 1451 | @setRuntimeSafety(mode == .debug); | |
| 1452 | 1452 | |
| 1453 | 1453 | var x1: u64 = undefined; |
| 1454 | 1454 | cmovznzU64(&x1, arg1, (arg2[0]), (arg3[0])); |
| ... | ... | @@ -1476,7 +1476,7 @@ pub fn selectznz(out1: *[4]u64, arg1: u1, arg2: [4]u64, arg3: [4]u64) void { |
| 1476 | 1476 | /// Output Bounds: |
| 1477 | 1477 | /// out1: [[0x0 ~> 0xff], [0x0 ~> 0xff], [0x0 ~> 0xff], [0x0 ~> 0xff], [0x0 ~> 0xff], [0x0 ~> 0xff], [0x0 ~> 0xff], [0x0 ~> 0xff], [0x0 ~> 0xff], [0x0 ~> 0xff], [0x0 ~> 0xff], [0x0 ~> 0xff], [0x0 ~> 0xff], [0x0 ~> 0xff], [0x0 ~> 0xff], [0x0 ~> 0xff], [0x0 ~> 0xff], [0x0 ~> 0xff], [0x0 ~> 0xff], [0x0 ~> 0xff], [0x0 ~> 0xff], [0x0 ~> 0xff], [0x0 ~> 0xff], [0x0 ~> 0xff], [0x0 ~> 0xff], [0x0 ~> 0xff], [0x0 ~> 0xff], [0x0 ~> 0xff], [0x0 ~> 0xff], [0x0 ~> 0xff], [0x0 ~> 0xff], [0x0 ~> 0xff]] |
| 1478 | 1478 | pub fn toBytes(out1: *[32]u8, arg1: [4]u64) void { |
| 1479 | @setRuntimeSafety(mode == .Debug); | |
| 1479 | @setRuntimeSafety(mode == .debug); | |
| 1480 | 1480 | |
| 1481 | 1481 | const x1 = (arg1[3]); |
| 1482 | 1482 | const x2 = (arg1[2]); |
| ... | ... | @@ -1585,7 +1585,7 @@ pub fn toBytes(out1: *[32]u8, arg1: [4]u64) void { |
| 1585 | 1585 | /// Output Bounds: |
| 1586 | 1586 | /// out1: [[0x0 ~> 0xffffffffffffffff], [0x0 ~> 0xffffffffffffffff], [0x0 ~> 0xffffffffffffffff], [0x0 ~> 0xffffffffffffffff]] |
| 1587 | 1587 | pub fn fromBytes(out1: *[4]u64, arg1: [32]u8) void { |
| 1588 | @setRuntimeSafety(mode == .Debug); | |
| 1588 | @setRuntimeSafety(mode == .debug); | |
| 1589 | 1589 | |
| 1590 | 1590 | const x1 = (@as(u64, (arg1[31])) << 56); |
| 1591 | 1591 | const x2 = (@as(u64, (arg1[30])) << 48); |
| ... | ... | @@ -1660,7 +1660,7 @@ pub fn fromBytes(out1: *[4]u64, arg1: [32]u8) void { |
| 1660 | 1660 | /// 0 ≤ eval out1 < m |
| 1661 | 1661 | /// |
| 1662 | 1662 | pub fn setOne(out1: *MontgomeryDomainFieldElement) void { |
| 1663 | @setRuntimeSafety(mode == .Debug); | |
| 1663 | @setRuntimeSafety(mode == .debug); | |
| 1664 | 1664 | |
| 1665 | 1665 | out1[0] = 0x1000003d1; |
| 1666 | 1666 | out1[1] = 0x0; |
| ... | ... | @@ -1677,7 +1677,7 @@ pub fn setOne(out1: *MontgomeryDomainFieldElement) void { |
| 1677 | 1677 | /// Output Bounds: |
| 1678 | 1678 | /// out1: [[0x0 ~> 0xffffffffffffffff], [0x0 ~> 0xffffffffffffffff], [0x0 ~> 0xffffffffffffffff], [0x0 ~> 0xffffffffffffffff], [0x0 ~> 0xffffffffffffffff]] |
| 1679 | 1679 | pub fn msat(out1: *[5]u64) void { |
| 1680 | @setRuntimeSafety(mode == .Debug); | |
| 1680 | @setRuntimeSafety(mode == .debug); | |
| 1681 | 1681 | |
| 1682 | 1682 | out1[0] = 0xfffffffefffffc2f; |
| 1683 | 1683 | out1[1] = 0xffffffffffffffff; |
| ... | ... | @@ -1715,7 +1715,7 @@ pub fn msat(out1: *[5]u64) void { |
| 1715 | 1715 | /// out4: [[0x0 ~> 0xffffffffffffffff], [0x0 ~> 0xffffffffffffffff], [0x0 ~> 0xffffffffffffffff], [0x0 ~> 0xffffffffffffffff]] |
| 1716 | 1716 | /// out5: [[0x0 ~> 0xffffffffffffffff], [0x0 ~> 0xffffffffffffffff], [0x0 ~> 0xffffffffffffffff], [0x0 ~> 0xffffffffffffffff]] |
| 1717 | 1717 | pub fn divstep(out1: *u64, out2: *[5]u64, out3: *[5]u64, out4: *[4]u64, out5: *[4]u64, arg1: u64, arg2: [5]u64, arg3: [5]u64, arg4: [4]u64, arg5: [4]u64) void { |
| 1718 | @setRuntimeSafety(mode == .Debug); | |
| 1718 | @setRuntimeSafety(mode == .debug); | |
| 1719 | 1719 | |
| 1720 | 1720 | var x1: u64 = undefined; |
| 1721 | 1721 | var x2: u1 = undefined; |
| ... | ... | @@ -1949,7 +1949,7 @@ pub fn divstep(out1: *u64, out2: *[5]u64, out3: *[5]u64, out4: *[4]u64, out5: *[ |
| 1949 | 1949 | /// Output Bounds: |
| 1950 | 1950 | /// out1: [[0x0 ~> 0xffffffffffffffff], [0x0 ~> 0xffffffffffffffff], [0x0 ~> 0xffffffffffffffff], [0x0 ~> 0xffffffffffffffff]] |
| 1951 | 1951 | pub fn divstepPrecomp(out1: *[4]u64) void { |
| 1952 | @setRuntimeSafety(mode == .Debug); | |
| 1952 | @setRuntimeSafety(mode == .debug); | |
| 1953 | 1953 | |
| 1954 | 1954 | out1[0] = 0xf201a41831525e0a; |
| 1955 | 1955 | out1[1] = 0x9953f9ddcd648d85; |
lib/std/crypto/pcurves/secp256k1/secp256k1_scalar_64.zig+17-17| ... | ... | @@ -79,7 +79,7 @@ fn subborrowxU64(out1: *u64, out2: *u1, arg1: u1, arg2: u64, arg3: u64) void { |
| 79 | 79 | /// out1: [0x0 ~> 0xffffffffffffffff] |
| 80 | 80 | /// out2: [0x0 ~> 0xffffffffffffffff] |
| 81 | 81 | fn mulxU64(out1: *u64, out2: *u64, arg1: u64, arg2: u64) void { |
| 82 | @setRuntimeSafety(mode == .Debug); | |
| 82 | @setRuntimeSafety(mode == .debug); | |
| 83 | 83 | |
| 84 | 84 | const x = @as(u128, arg1) * @as(u128, arg2); |
| 85 | 85 | out1.* = @as(u64, @truncate(x)); |
| ... | ... | @@ -98,7 +98,7 @@ fn mulxU64(out1: *u64, out2: *u64, arg1: u64, arg2: u64) void { |
| 98 | 98 | /// Output Bounds: |
| 99 | 99 | /// out1: [0x0 ~> 0xffffffffffffffff] |
| 100 | 100 | fn cmovznzU64(out1: *u64, arg1: u1, arg2: u64, arg3: u64) void { |
| 101 | @setRuntimeSafety(mode == .Debug); | |
| 101 | @setRuntimeSafety(mode == .debug); | |
| 102 | 102 | |
| 103 | 103 | const mask = 0 -% @as(u64, arg1); |
| 104 | 104 | out1.* = (mask & arg3) | ((~mask) & arg2); |
| ... | ... | @@ -114,7 +114,7 @@ fn cmovznzU64(out1: *u64, arg1: u1, arg2: u64, arg3: u64) void { |
| 114 | 114 | /// 0 ≤ eval out1 < m |
| 115 | 115 | /// |
| 116 | 116 | pub fn mul(out1: *MontgomeryDomainFieldElement, arg1: MontgomeryDomainFieldElement, arg2: MontgomeryDomainFieldElement) void { |
| 117 | @setRuntimeSafety(mode == .Debug); | |
| 117 | @setRuntimeSafety(mode == .debug); | |
| 118 | 118 | |
| 119 | 119 | const x1 = (arg1[1]); |
| 120 | 120 | const x2 = (arg1[2]); |
| ... | ... | @@ -454,7 +454,7 @@ pub fn mul(out1: *MontgomeryDomainFieldElement, arg1: MontgomeryDomainFieldEleme |
| 454 | 454 | /// 0 ≤ eval out1 < m |
| 455 | 455 | /// |
| 456 | 456 | pub fn square(out1: *MontgomeryDomainFieldElement, arg1: MontgomeryDomainFieldElement) void { |
| 457 | @setRuntimeSafety(mode == .Debug); | |
| 457 | @setRuntimeSafety(mode == .debug); | |
| 458 | 458 | |
| 459 | 459 | const x1 = (arg1[1]); |
| 460 | 460 | const x2 = (arg1[2]); |
| ... | ... | @@ -795,7 +795,7 @@ pub fn square(out1: *MontgomeryDomainFieldElement, arg1: MontgomeryDomainFieldEl |
| 795 | 795 | /// 0 ≤ eval out1 < m |
| 796 | 796 | /// |
| 797 | 797 | pub fn add(out1: *MontgomeryDomainFieldElement, arg1: MontgomeryDomainFieldElement, arg2: MontgomeryDomainFieldElement) void { |
| 798 | @setRuntimeSafety(mode == .Debug); | |
| 798 | @setRuntimeSafety(mode == .debug); | |
| 799 | 799 | |
| 800 | 800 | var x1: u64 = undefined; |
| 801 | 801 | var x2: u1 = undefined; |
| ... | ... | @@ -848,7 +848,7 @@ pub fn add(out1: *MontgomeryDomainFieldElement, arg1: MontgomeryDomainFieldEleme |
| 848 | 848 | /// 0 ≤ eval out1 < m |
| 849 | 849 | /// |
| 850 | 850 | pub fn sub(out1: *MontgomeryDomainFieldElement, arg1: MontgomeryDomainFieldElement, arg2: MontgomeryDomainFieldElement) void { |
| 851 | @setRuntimeSafety(mode == .Debug); | |
| 851 | @setRuntimeSafety(mode == .debug); | |
| 852 | 852 | |
| 853 | 853 | var x1: u64 = undefined; |
| 854 | 854 | var x2: u1 = undefined; |
| ... | ... | @@ -891,7 +891,7 @@ pub fn sub(out1: *MontgomeryDomainFieldElement, arg1: MontgomeryDomainFieldEleme |
| 891 | 891 | /// 0 ≤ eval out1 < m |
| 892 | 892 | /// |
| 893 | 893 | pub fn opp(out1: *MontgomeryDomainFieldElement, arg1: MontgomeryDomainFieldElement) void { |
| 894 | @setRuntimeSafety(mode == .Debug); | |
| 894 | @setRuntimeSafety(mode == .debug); | |
| 895 | 895 | |
| 896 | 896 | var x1: u64 = undefined; |
| 897 | 897 | var x2: u1 = undefined; |
| ... | ... | @@ -934,7 +934,7 @@ pub fn opp(out1: *MontgomeryDomainFieldElement, arg1: MontgomeryDomainFieldEleme |
| 934 | 934 | /// 0 ≤ eval out1 < m |
| 935 | 935 | /// |
| 936 | 936 | pub fn fromMontgomery(out1: *NonMontgomeryDomainFieldElement, arg1: MontgomeryDomainFieldElement) void { |
| 937 | @setRuntimeSafety(mode == .Debug); | |
| 937 | @setRuntimeSafety(mode == .debug); | |
| 938 | 938 | |
| 939 | 939 | const x1 = (arg1[0]); |
| 940 | 940 | var x2: u64 = undefined; |
| ... | ... | @@ -1167,7 +1167,7 @@ pub fn fromMontgomery(out1: *NonMontgomeryDomainFieldElement, arg1: MontgomeryDo |
| 1167 | 1167 | /// 0 ≤ eval out1 < m |
| 1168 | 1168 | /// |
| 1169 | 1169 | pub fn toMontgomery(out1: *MontgomeryDomainFieldElement, arg1: NonMontgomeryDomainFieldElement) void { |
| 1170 | @setRuntimeSafety(mode == .Debug); | |
| 1170 | @setRuntimeSafety(mode == .debug); | |
| 1171 | 1171 | |
| 1172 | 1172 | const x1 = (arg1[1]); |
| 1173 | 1173 | const x2 = (arg1[2]); |
| ... | ... | @@ -1490,7 +1490,7 @@ pub fn toMontgomery(out1: *MontgomeryDomainFieldElement, arg1: NonMontgomeryDoma |
| 1490 | 1490 | /// Output Bounds: |
| 1491 | 1491 | /// out1: [0x0 ~> 0xffffffffffffffff] |
| 1492 | 1492 | pub fn nonzero(out1: *u64, arg1: [4]u64) void { |
| 1493 | @setRuntimeSafety(mode == .Debug); | |
| 1493 | @setRuntimeSafety(mode == .debug); | |
| 1494 | 1494 | |
| 1495 | 1495 | const x1 = ((arg1[0]) | ((arg1[1]) | ((arg1[2]) | (arg1[3])))); |
| 1496 | 1496 | out1.* = x1; |
| ... | ... | @@ -1508,7 +1508,7 @@ pub fn nonzero(out1: *u64, arg1: [4]u64) void { |
| 1508 | 1508 | /// Output Bounds: |
| 1509 | 1509 | /// out1: [[0x0 ~> 0xffffffffffffffff], [0x0 ~> 0xffffffffffffffff], [0x0 ~> 0xffffffffffffffff], [0x0 ~> 0xffffffffffffffff]] |
| 1510 | 1510 | pub fn selectznz(out1: *[4]u64, arg1: u1, arg2: [4]u64, arg3: [4]u64) void { |
| 1511 | @setRuntimeSafety(mode == .Debug); | |
| 1511 | @setRuntimeSafety(mode == .debug); | |
| 1512 | 1512 | |
| 1513 | 1513 | var x1: u64 = undefined; |
| 1514 | 1514 | cmovznzU64(&x1, arg1, (arg2[0]), (arg3[0])); |
| ... | ... | @@ -1536,7 +1536,7 @@ pub fn selectznz(out1: *[4]u64, arg1: u1, arg2: [4]u64, arg3: [4]u64) void { |
| 1536 | 1536 | /// Output Bounds: |
| 1537 | 1537 | /// out1: [[0x0 ~> 0xff], [0x0 ~> 0xff], [0x0 ~> 0xff], [0x0 ~> 0xff], [0x0 ~> 0xff], [0x0 ~> 0xff], [0x0 ~> 0xff], [0x0 ~> 0xff], [0x0 ~> 0xff], [0x0 ~> 0xff], [0x0 ~> 0xff], [0x0 ~> 0xff], [0x0 ~> 0xff], [0x0 ~> 0xff], [0x0 ~> 0xff], [0x0 ~> 0xff], [0x0 ~> 0xff], [0x0 ~> 0xff], [0x0 ~> 0xff], [0x0 ~> 0xff], [0x0 ~> 0xff], [0x0 ~> 0xff], [0x0 ~> 0xff], [0x0 ~> 0xff], [0x0 ~> 0xff], [0x0 ~> 0xff], [0x0 ~> 0xff], [0x0 ~> 0xff], [0x0 ~> 0xff], [0x0 ~> 0xff], [0x0 ~> 0xff], [0x0 ~> 0xff]] |
| 1538 | 1538 | pub fn toBytes(out1: *[32]u8, arg1: [4]u64) void { |
| 1539 | @setRuntimeSafety(mode == .Debug); | |
| 1539 | @setRuntimeSafety(mode == .debug); | |
| 1540 | 1540 | |
| 1541 | 1541 | const x1 = (arg1[3]); |
| 1542 | 1542 | const x2 = (arg1[2]); |
| ... | ... | @@ -1645,7 +1645,7 @@ pub fn toBytes(out1: *[32]u8, arg1: [4]u64) void { |
| 1645 | 1645 | /// Output Bounds: |
| 1646 | 1646 | /// out1: [[0x0 ~> 0xffffffffffffffff], [0x0 ~> 0xffffffffffffffff], [0x0 ~> 0xffffffffffffffff], [0x0 ~> 0xffffffffffffffff]] |
| 1647 | 1647 | pub fn fromBytes(out1: *[4]u64, arg1: [32]u8) void { |
| 1648 | @setRuntimeSafety(mode == .Debug); | |
| 1648 | @setRuntimeSafety(mode == .debug); | |
| 1649 | 1649 | |
| 1650 | 1650 | const x1 = (@as(u64, (arg1[31])) << 56); |
| 1651 | 1651 | const x2 = (@as(u64, (arg1[30])) << 48); |
| ... | ... | @@ -1720,7 +1720,7 @@ pub fn fromBytes(out1: *[4]u64, arg1: [32]u8) void { |
| 1720 | 1720 | /// 0 ≤ eval out1 < m |
| 1721 | 1721 | /// |
| 1722 | 1722 | pub fn setOne(out1: *MontgomeryDomainFieldElement) void { |
| 1723 | @setRuntimeSafety(mode == .Debug); | |
| 1723 | @setRuntimeSafety(mode == .debug); | |
| 1724 | 1724 | |
| 1725 | 1725 | out1[0] = 0x402da1732fc9bebf; |
| 1726 | 1726 | out1[1] = 0x4551231950b75fc4; |
| ... | ... | @@ -1737,7 +1737,7 @@ pub fn setOne(out1: *MontgomeryDomainFieldElement) void { |
| 1737 | 1737 | /// Output Bounds: |
| 1738 | 1738 | /// out1: [[0x0 ~> 0xffffffffffffffff], [0x0 ~> 0xffffffffffffffff], [0x0 ~> 0xffffffffffffffff], [0x0 ~> 0xffffffffffffffff], [0x0 ~> 0xffffffffffffffff]] |
| 1739 | 1739 | pub fn msat(out1: *[5]u64) void { |
| 1740 | @setRuntimeSafety(mode == .Debug); | |
| 1740 | @setRuntimeSafety(mode == .debug); | |
| 1741 | 1741 | |
| 1742 | 1742 | out1[0] = 0xbfd25e8cd0364141; |
| 1743 | 1743 | out1[1] = 0xbaaedce6af48a03b; |
| ... | ... | @@ -1775,7 +1775,7 @@ pub fn msat(out1: *[5]u64) void { |
| 1775 | 1775 | /// out4: [[0x0 ~> 0xffffffffffffffff], [0x0 ~> 0xffffffffffffffff], [0x0 ~> 0xffffffffffffffff], [0x0 ~> 0xffffffffffffffff]] |
| 1776 | 1776 | /// out5: [[0x0 ~> 0xffffffffffffffff], [0x0 ~> 0xffffffffffffffff], [0x0 ~> 0xffffffffffffffff], [0x0 ~> 0xffffffffffffffff]] |
| 1777 | 1777 | pub fn divstep(out1: *u64, out2: *[5]u64, out3: *[5]u64, out4: *[4]u64, out5: *[4]u64, arg1: u64, arg2: [5]u64, arg3: [5]u64, arg4: [4]u64, arg5: [4]u64) void { |
| 1778 | @setRuntimeSafety(mode == .Debug); | |
| 1778 | @setRuntimeSafety(mode == .debug); | |
| 1779 | 1779 | |
| 1780 | 1780 | var x1: u64 = undefined; |
| 1781 | 1781 | var x2: u1 = undefined; |
| ... | ... | @@ -2009,7 +2009,7 @@ pub fn divstep(out1: *u64, out2: *[5]u64, out3: *[5]u64, out4: *[4]u64, out5: *[ |
| 2009 | 2009 | /// Output Bounds: |
| 2010 | 2010 | /// out1: [[0x0 ~> 0xffffffffffffffff], [0x0 ~> 0xffffffffffffffff], [0x0 ~> 0xffffffffffffffff], [0x0 ~> 0xffffffffffffffff]] |
| 2011 | 2011 | pub fn divstepPrecomp(out1: *[4]u64) void { |
| 2012 | @setRuntimeSafety(mode == .Debug); | |
| 2012 | @setRuntimeSafety(mode == .debug); | |
| 2013 | 2013 | |
| 2014 | 2014 | out1[0] = 0xd7431a4d2b9cb4e9; |
| 2015 | 2015 | out1[1] = 0xab67d35a32d9c503; |
lib/std/debug.zig+11-12| ... | ... | @@ -237,13 +237,12 @@ pub const Symbol = struct { |
| 237 | 237 | }; |
| 238 | 238 | }; |
| 239 | 239 | |
| 240 | /// Deprecated because it returns the optimization mode of the standard | |
| 241 | /// library, when the caller probably wants to use the optimization mode of | |
| 242 | /// their own module. | |
| 243 | pub const runtime_safety = switch (builtin.mode) { | |
| 244 | .Debug, .ReleaseSafe => true, | |
| 245 | .ReleaseFast, .ReleaseSmall => false, | |
| 246 | }; | |
| 240 | /// Deprecated in favor of `std.lang.Optimize.runtimeSafety`, to be removed after 0.18.0 | |
| 241 | /// | |
| 242 | /// Returns whether the standard library has safety checks enabled. Callsites | |
| 243 | /// likely would rather know whether their own module's optimization mode | |
| 244 | /// (found via `@import("builtin").optimize`) has safety checks enabled. | |
| 245 | pub const runtime_safety = builtin.mode.runtimeSafety(); | |
| 247 | 246 | |
| 248 | 247 | /// Whether we can unwind the stack on this target, allowing capturing and/or printing the current |
| 249 | 248 | /// stack trace. It is still legal to call `captureCurrentStackTrace`, `writeCurrentStackTrace`, and |
| ... | ... | @@ -257,7 +256,7 @@ pub const sys_can_stack_trace = switch (builtin.cpu.arch) { |
| 257 | 256 | // because Emscripten's implementation is very slow. |
| 258 | 257 | .wasm32, |
| 259 | 258 | .wasm64, |
| 260 | => native_os == .emscripten and builtin.mode == .Debug, | |
| 259 | => native_os == .emscripten and builtin.mode == .debug, | |
| 261 | 260 | |
| 262 | 261 | // `@returnAddress()` is unsupported in LLVM 21. |
| 263 | 262 | .bpfel, |
| ... | ... | @@ -419,16 +418,16 @@ pub const CpuContextPtr = if (cpu_context.Native == noreturn) noreturn else *con |
| 419 | 418 | |
| 420 | 419 | /// Invokes detectable illegal behavior when `ok` is `false`. |
| 421 | 420 | /// |
| 422 | /// In Debug and ReleaseSafe modes, calls to this function are always | |
| 421 | /// In debug and safe modes, calls to this function are always | |
| 423 | 422 | /// generated, and the `unreachable` statement triggers a panic. |
| 424 | 423 | /// |
| 425 | /// In ReleaseFast and ReleaseSmall modes, calls to this function are optimized | |
| 424 | /// In fast and small modes, calls to this function are optimized | |
| 426 | 425 | /// away, and in fact the optimizer is able to use the assertion in its |
| 427 | 426 | /// heuristics. |
| 428 | 427 | /// |
| 429 | 428 | /// Inside a test block, it is best to use the `testing` module rather than |
| 430 | 429 | /// this function, because this function may not detect a test failure in |
| 431 | /// ReleaseFast and ReleaseSmall mode. Outside of a test block, this assert | |
| 430 | /// fast and small mode. Outside of a test block, this assert | |
| 432 | 431 | /// function is the correct function to use. |
| 433 | 432 | pub fn assert(ok: bool) void { |
| 434 | 433 | @disableInstrumentation(); |
| ... | ... | @@ -1760,7 +1759,7 @@ test "manage resources correctly" { |
| 1760 | 1759 | /// In release mode, it is size 0 and all methods are no-ops. |
| 1761 | 1760 | /// This is a pre-made type with default settings. |
| 1762 | 1761 | /// For more advanced usage, see `ConfigurableTrace`. |
| 1763 | pub const Trace = ConfigurableTrace(2, 4, builtin.mode == .Debug); | |
| 1762 | pub const Trace = ConfigurableTrace(2, 4, builtin.mode == .debug); | |
| 1764 | 1763 | |
| 1765 | 1764 | pub fn ConfigurableTrace(comptime size: usize, comptime stack_frame_count: usize, comptime is_enabled: bool) type { |
| 1766 | 1765 | return struct { |
lib/std/fmt.zig+2-2| ... | ... | @@ -261,7 +261,7 @@ test printInt { |
| 261 | 261 | |
| 262 | 262 | /// Converts values in the range [0, 100) to a base 10 string. |
| 263 | 263 | pub fn digits2(value: u8) [2]u8 { |
| 264 | if (builtin.mode == .ReleaseSmall) { | |
| 264 | if (builtin.mode == .small) { | |
| 265 | 265 | return .{ @intCast('0' + value / 10), @intCast('0' + value % 10) }; |
| 266 | 266 | } else { |
| 267 | 267 | return "00010203040506070809101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899"[value * 2 ..][0..2].*; |
| ... | ... | @@ -924,7 +924,7 @@ test "enum" { |
| 924 | 924 | |
| 925 | 925 | // test very large enum to verify ct branch quota is large enough |
| 926 | 926 | // TODO: https://github.com/ziglang/zig/issues/15609 |
| 927 | if (!((builtin.cpu.arch == .wasm32) and builtin.mode == .Debug)) { | |
| 927 | if (!((builtin.cpu.arch == .wasm32) and builtin.mode == .debug)) { | |
| 928 | 928 | try expectFmt("enum: .INVALID_FUNCTION\n", "enum: {}\n", .{std.os.windows.Win32Error.INVALID_FUNCTION}); |
| 929 | 929 | } |
| 930 | 930 |
lib/std/fmt/float.zig+1-1| ... | ... | @@ -65,7 +65,7 @@ pub fn render(buf: []u8, value: anytype, options: Options) Error![]const u8 { |
| 65 | 65 | |
| 66 | 66 | const DT = if (@bitSizeOf(T) <= 64) u64 else u128; |
| 67 | 67 | const tables = switch (DT) { |
| 68 | u64 => if (@import("builtin").mode == .ReleaseSmall) &Backend64_TablesSmall else &Backend64_TablesFull, | |
| 68 | u64 => if (@import("builtin").mode == .small) &Backend64_TablesSmall else &Backend64_TablesFull, | |
| 69 | 69 | u128 => &Backend128_Tables, |
| 70 | 70 | else => unreachable, |
| 71 | 71 | }; |
lib/std/hash/benchmark.zig+1-1| ... | ... | @@ -355,7 +355,7 @@ fn usage() void { |
| 355 | 355 | } |
| 356 | 356 | |
| 357 | 357 | fn mode(comptime x: comptime_int) comptime_int { |
| 358 | return if (builtin.mode == .Debug) x / 64 else x; | |
| 358 | return if (builtin.mode == .debug) x / 64 else x; | |
| 359 | 359 | } |
| 360 | 360 | |
| 361 | 361 | pub fn main(init: std.process.Init) !void { |
lib/std/heap/SafeAllocator.zig+1-1| ... | ... | @@ -39,7 +39,7 @@ const SafeAllocator = @This(); |
| 39 | 39 | const scoped_log = std.log.scoped(.SafeAllocator); |
| 40 | 40 | |
| 41 | 41 | pub const Options = struct { |
| 42 | const is_debug = @import("builtin").mode == .Debug; | |
| 42 | const is_debug = @import("builtin").mode == .debug; | |
| 43 | 43 | const page_size_log2 = @max(math.log2_int(usize, std.heap.page_size_max), 8); |
| 44 | 44 | |
| 45 | 45 | stack_trace_frames: usize = if (is_debug and std.debug.sys_can_stack_trace) 7 else 0, |
lib/std/http/test.zig+9-9| ... | ... | @@ -34,7 +34,7 @@ test "content length reader state update" { |
| 34 | 34 | } |
| 35 | 35 | |
| 36 | 36 | test "trailers" { |
| 37 | if (builtin.cpu.arch.isPowerPC64() and builtin.mode != .Debug) return error.SkipZigTest; // https://github.com/llvm/llvm-project/issues/194257 | |
| 37 | if (builtin.cpu.arch.isPowerPC64() and builtin.mode != .debug) return error.SkipZigTest; // https://github.com/llvm/llvm-project/issues/194257 | |
| 38 | 38 | if (builtin.os.tag == .openbsd) return error.SkipZigTest; // https://codeberg.org/ziglang/zig/issues/30806 |
| 39 | 39 | |
| 40 | 40 | const io = std.testing.io; |
| ... | ... | @@ -121,7 +121,7 @@ test "trailers" { |
| 121 | 121 | } |
| 122 | 122 | |
| 123 | 123 | test "HTTP server handles a chunked transfer coding request" { |
| 124 | if (builtin.cpu.arch.isPowerPC64() and builtin.mode != .Debug) return error.SkipZigTest; // https://github.com/llvm/llvm-project/issues/194257 | |
| 124 | if (builtin.cpu.arch.isPowerPC64() and builtin.mode != .debug) return error.SkipZigTest; // https://github.com/llvm/llvm-project/issues/194257 | |
| 125 | 125 | if (builtin.os.tag == .openbsd) return error.SkipZigTest; // https://codeberg.org/ziglang/zig/issues/30806 |
| 126 | 126 | |
| 127 | 127 | const io = std.testing.io; |
| ... | ... | @@ -190,7 +190,7 @@ test "HTTP server handles a chunked transfer coding request" { |
| 190 | 190 | } |
| 191 | 191 | |
| 192 | 192 | test "echo content server" { |
| 193 | if (builtin.cpu.arch.isPowerPC64() and builtin.mode != .Debug) return error.SkipZigTest; // https://github.com/llvm/llvm-project/issues/194257 | |
| 193 | if (builtin.cpu.arch.isPowerPC64() and builtin.mode != .debug) return error.SkipZigTest; // https://github.com/llvm/llvm-project/issues/194257 | |
| 194 | 194 | if (builtin.os.tag == .openbsd) return error.SkipZigTest; // https://codeberg.org/ziglang/zig/issues/30806 |
| 195 | 195 | |
| 196 | 196 | const io = std.testing.io; |
| ... | ... | @@ -281,7 +281,7 @@ test "echo content server" { |
| 281 | 281 | } |
| 282 | 282 | |
| 283 | 283 | test "Server.Request.respondStreaming non-chunked, unknown content-length" { |
| 284 | if (builtin.cpu.arch.isPowerPC64() and builtin.mode != .Debug) return error.SkipZigTest; // https://github.com/llvm/llvm-project/issues/194257 | |
| 284 | if (builtin.cpu.arch.isPowerPC64() and builtin.mode != .debug) return error.SkipZigTest; // https://github.com/llvm/llvm-project/issues/194257 | |
| 285 | 285 | if (builtin.os.tag == .openbsd) return error.SkipZigTest; // https://codeberg.org/ziglang/zig/issues/30806 |
| 286 | 286 | |
| 287 | 287 | const io = std.testing.io; |
| ... | ... | @@ -360,7 +360,7 @@ test "Server.Request.respondStreaming non-chunked, unknown content-length" { |
| 360 | 360 | } |
| 361 | 361 | |
| 362 | 362 | test "receiving arbitrary http headers from the client" { |
| 363 | if (builtin.cpu.arch.isPowerPC64() and builtin.mode != .Debug) return error.SkipZigTest; // https://github.com/llvm/llvm-project/issues/194257 | |
| 363 | if (builtin.cpu.arch.isPowerPC64() and builtin.mode != .debug) return error.SkipZigTest; // https://github.com/llvm/llvm-project/issues/194257 | |
| 364 | 364 | if (builtin.os.tag == .openbsd) return error.SkipZigTest; // https://codeberg.org/ziglang/zig/issues/30806 |
| 365 | 365 | |
| 366 | 366 | const io = std.testing.io; |
| ... | ... | @@ -426,7 +426,7 @@ test "receiving arbitrary http headers from the client" { |
| 426 | 426 | } |
| 427 | 427 | |
| 428 | 428 | test "general client/server API coverage" { |
| 429 | if (builtin.cpu.arch.isPowerPC64() and builtin.mode != .Debug) return error.SkipZigTest; // https://github.com/llvm/llvm-project/issues/194257 | |
| 429 | if (builtin.cpu.arch.isPowerPC64() and builtin.mode != .debug) return error.SkipZigTest; // https://github.com/llvm/llvm-project/issues/194257 | |
| 430 | 430 | if (builtin.os.tag == .openbsd) return error.SkipZigTest; // https://codeberg.org/ziglang/zig/issues/30806 |
| 431 | 431 | |
| 432 | 432 | const io = std.testing.io; |
| ... | ... | @@ -922,7 +922,7 @@ test "general client/server API coverage" { |
| 922 | 922 | } |
| 923 | 923 | |
| 924 | 924 | test "Server streams both reading and writing" { |
| 925 | if (builtin.cpu.arch.isPowerPC64() and builtin.mode != .Debug) return error.SkipZigTest; // https://github.com/llvm/llvm-project/issues/194257 | |
| 925 | if (builtin.cpu.arch.isPowerPC64() and builtin.mode != .debug) return error.SkipZigTest; // https://github.com/llvm/llvm-project/issues/194257 | |
| 926 | 926 | if (builtin.os.tag == .openbsd) return error.SkipZigTest; // https://codeberg.org/ziglang/zig/issues/30806 |
| 927 | 927 | |
| 928 | 928 | const io = std.testing.io; |
| ... | ... | @@ -1192,7 +1192,7 @@ fn createTestServer(io: Io, S: type) !*TestServer { |
| 1192 | 1192 | } |
| 1193 | 1193 | |
| 1194 | 1194 | test "redirect to different connection" { |
| 1195 | if (builtin.cpu.arch.isPowerPC64() and builtin.mode != .Debug) return error.SkipZigTest; // https://github.com/llvm/llvm-project/issues/194257 | |
| 1195 | if (builtin.cpu.arch.isPowerPC64() and builtin.mode != .debug) return error.SkipZigTest; // https://github.com/llvm/llvm-project/issues/194257 | |
| 1196 | 1196 | if (builtin.os.tag == .openbsd) return error.SkipZigTest; // https://codeberg.org/ziglang/zig/issues/30806 |
| 1197 | 1197 | |
| 1198 | 1198 | const io = std.testing.io; |
| ... | ... | @@ -1280,7 +1280,7 @@ test "redirect to different connection" { |
| 1280 | 1280 | } |
| 1281 | 1281 | |
| 1282 | 1282 | test "boot failed connections from the pool" { |
| 1283 | if (builtin.cpu.arch.isPowerPC64() and builtin.mode != .Debug) return error.SkipZigTest; // https://github.com/llvm/llvm-project/issues/194257 | |
| 1283 | if (builtin.cpu.arch.isPowerPC64() and builtin.mode != .debug) return error.SkipZigTest; // https://github.com/llvm/llvm-project/issues/194257 | |
| 1284 | 1284 | if (builtin.os.tag == .openbsd) return error.SkipZigTest; // https://codeberg.org/ziglang/zig/issues/30806 |
| 1285 | 1285 | |
| 1286 | 1286 | const io = std.testing.io; |
lib/std/json/Stringify.zig+3-3| ... | ... | @@ -54,8 +54,8 @@ else |
| 54 | 54 | void = if (build_mode_has_safety) .none else {}, |
| 55 | 55 | |
| 56 | 56 | const build_mode_has_safety = switch (@import("builtin").mode) { |
| 57 | .Debug, .ReleaseSafe => true, | |
| 58 | .ReleaseFast, .ReleaseSmall => false, | |
| 57 | .debug, .safe => true, | |
| 58 | .fast, .small => false, | |
| 59 | 59 | }; |
| 60 | 60 | |
| 61 | 61 | /// The `safety_checks_hint` parameter determines how much memory is used to enable assertions that the above grammar is being followed, |
| ... | ... | @@ -66,7 +66,7 @@ const build_mode_has_safety = switch (@import("builtin").mode) { |
| 66 | 66 | /// If `.checked_to_fixed_depth` is used, there is additionally an assertion that the nesting depth never exceeds the given limit. |
| 67 | 67 | /// `.checked_to_fixed_depth` embeds the storage required in the `Stringify` struct. |
| 68 | 68 | /// `.assumed_correct` requires no space and performs none of these assertions. |
| 69 | /// In `ReleaseFast` and `ReleaseSmall` mode, the given `safety_checks_hint` is ignored and is always treated as `.assumed_correct`. | |
| 69 | /// In fast and small optimization modes, the given `safety_checks_hint` is ignored and is always treated as `.assumed_correct`. | |
| 70 | 70 | const safety_checks_hint: union(enum) { |
| 71 | 71 | /// Rounded up to the nearest multiple of 8. |
| 72 | 72 | checked_to_fixed_depth: usize, |
lib/std/lang.zig+44-5| ... | ... | @@ -107,13 +107,52 @@ pub const CodeModel = enum(u4) { |
| 107 | 107 | tiny, |
| 108 | 108 | }; |
| 109 | 109 | |
| 110 | /// Deprecated, to be removed after 0.18.0 | |
| 111 | pub const OptimizeMode = Optimize; | |
| 112 | ||
| 110 | 113 | /// This data structure is used by the Zig language code generation and |
| 111 | 114 | /// therefore must be kept in sync with the compiler implementation. |
| 112 | pub const OptimizeMode = enum { | |
| 113 | Debug, | |
| 114 | ReleaseSafe, | |
| 115 | ReleaseFast, | |
| 116 | ReleaseSmall, | |
| 115 | pub const Optimize = enum { | |
| 116 | /// Safety checks enabled. Optimize for bug detection, accurate debug info, | |
| 117 | /// and compilation speed (in that order). | |
| 118 | debug, | |
| 119 | /// Safety checks enabled. Optimize for runtime performance. | |
| 120 | safe, | |
| 121 | /// Safety checks disabled. Optimize for runtime performance. | |
| 122 | fast, | |
| 123 | /// Safety checks disabled. Optimize for machine code size, then runtime performance. | |
| 124 | small, | |
| 125 | ||
| 126 | /// Deprecated, to be removed after 0.18.0 | |
| 127 | pub const Debug: @This() = .debug; | |
| 128 | /// Deprecated, to be removed after 0.18.0 | |
| 129 | pub const ReleaseSafe: @This() = .safe; | |
| 130 | /// Deprecated, to be removed after 0.18.0 | |
| 131 | pub const ReleaseFast: @This() = .fast; | |
| 132 | /// Deprecated, to be removed after 0.18.0 | |
| 133 | pub const ReleaseSmall: @This() = .small; | |
| 134 | /// Deprecated, to be removed after 0.18.0 | |
| 135 | pub fn fromString(s: []const u8) ?@This() { | |
| 136 | return std.StaticStringMap(@This()).initComptime(&.{ | |
| 137 | .{ "Debug", .debug }, | |
| 138 | .{ "ReleaseSafe", .safe }, | |
| 139 | .{ "ReleaseFast", .fast }, | |
| 140 | .{ "ReleaseSmall", .small }, | |
| 141 | .{ "debug", .debug }, | |
| 142 | .{ "safe", .safe }, | |
| 143 | .{ "fast", .fast }, | |
| 144 | .{ "small", .small }, | |
| 145 | }).get(s); | |
| 146 | } | |
| 147 | ||
| 148 | /// Returns whether illegal behavior safety checks are enabled based on the | |
| 149 | /// provided optimization mode. | |
| 150 | pub fn runtimeSafety(o: @This()) bool { | |
| 151 | return switch (o) { | |
| 152 | .debug, .safe => true, | |
| 153 | .fast, .small => false, | |
| 154 | }; | |
| 155 | } | |
| 117 | 156 | }; |
| 118 | 157 | |
| 119 | 158 | /// The calling convention of a function defines how arguments and return values are passed, as well |
lib/std/log.zig+1-1| ... | ... | @@ -53,7 +53,7 @@ pub const Level = enum { |
| 53 | 53 | /// The default log level is based on build mode. |
| 54 | 54 | pub const default_level: Level = switch (builtin.mode) { |
| 55 | 55 | .Debug => .debug, |
| 56 | .ReleaseSafe, .ReleaseFast, .ReleaseSmall => .info, | |
| 56 | .safe, .fast, .small => .info, | |
| 57 | 57 | }; |
| 58 | 58 | |
| 59 | 59 | pub const ScopeLevel = struct { |
lib/std/math/hypot.zig+4-4| ... | ... | @@ -93,13 +93,13 @@ const hypot_test_cases = .{ |
| 93 | 93 | }; |
| 94 | 94 | |
| 95 | 95 | test hypot { |
| 96 | if (builtin.cpu.arch.isPowerPC() and builtin.mode != .Debug) return error.SkipZigTest; // https://github.com/llvm/llvm-project/issues/171869 | |
| 96 | if (builtin.cpu.arch.isPowerPC() and builtin.mode != .debug) return error.SkipZigTest; // https://github.com/llvm/llvm-project/issues/171869 | |
| 97 | 97 | try expect(hypot(0.3, 0.4) == 0.5); |
| 98 | 98 | } |
| 99 | 99 | |
| 100 | 100 | test "hypot.correct" { |
| 101 | 101 | if (builtin.target.cpu.arch == .x86_64 and builtin.target.os.tag == .macos) return error.SkipZigTest; |
| 102 | if (builtin.cpu.arch.isPowerPC() and builtin.mode != .Debug) return error.SkipZigTest; // https://github.com/llvm/llvm-project/issues/171869 | |
| 102 | if (builtin.cpu.arch.isPowerPC() and builtin.mode != .debug) return error.SkipZigTest; // https://github.com/llvm/llvm-project/issues/171869 | |
| 103 | 103 | |
| 104 | 104 | inline for (.{ f16, f32, f64, f128 }) |T| { |
| 105 | 105 | inline for (hypot_test_cases) |v| { |
| ... | ... | @@ -111,7 +111,7 @@ test "hypot.correct" { |
| 111 | 111 | |
| 112 | 112 | test "hypot.precise" { |
| 113 | 113 | if (builtin.target.cpu.arch == .x86_64 and builtin.target.os.tag == .macos) return error.SkipZigTest; |
| 114 | if (builtin.cpu.arch.isPowerPC() and builtin.mode != .Debug) return error.SkipZigTest; // https://github.com/llvm/llvm-project/issues/171869 | |
| 114 | if (builtin.cpu.arch.isPowerPC() and builtin.mode != .debug) return error.SkipZigTest; // https://github.com/llvm/llvm-project/issues/171869 | |
| 115 | 115 | |
| 116 | 116 | inline for (.{ f16, f32, f64 }) |T| { // f128 seems to be 5 ulp |
| 117 | 117 | inline for (hypot_test_cases) |v| { |
| ... | ... | @@ -122,7 +122,7 @@ test "hypot.precise" { |
| 122 | 122 | } |
| 123 | 123 | |
| 124 | 124 | test "hypot.special" { |
| 125 | if (builtin.cpu.arch.isPowerPC() and builtin.mode != .Debug) return error.SkipZigTest; // https://github.com/llvm/llvm-project/issues/171869 | |
| 125 | if (builtin.cpu.arch.isPowerPC() and builtin.mode != .debug) return error.SkipZigTest; // https://github.com/llvm/llvm-project/issues/171869 | |
| 126 | 126 | @setEvalBranchQuota(2000); |
| 127 | 127 | inline for (.{ f16, f32, f64, f128 }) |T| { |
| 128 | 128 | try expect(math.isNan(hypot(nan(T), 0.0))); |
lib/std/process.zig+2-2| ... | ... | @@ -644,7 +644,7 @@ pub fn totalSystemMemory() TotalSystemMemoryError!u64 { |
| 644 | 644 | /// leaks can be accurate. In release builds, this calls `exit` with code zero, |
| 645 | 645 | /// and does not return. |
| 646 | 646 | pub fn cleanExit(io: Io) void { |
| 647 | if (builtin.mode == .Debug) return; | |
| 647 | if (builtin.mode == .debug) return; | |
| 648 | 648 | _ = io.lockStderr(&.{}, .no_color) catch {}; |
| 649 | 649 | exit(0); |
| 650 | 650 | } |
| ... | ... | @@ -809,7 +809,7 @@ pub fn abort() noreturn { |
| 809 | 809 | // even when linking libc on Windows we use our own abort implementation. |
| 810 | 810 | // See https://github.com/ziglang/zig/issues/2071 for more details. |
| 811 | 811 | if (native_os == .windows) { |
| 812 | if (builtin.mode == .Debug and windows.peb().BeingDebugged.toBool()) { | |
| 812 | if (builtin.mode == .debug and windows.peb().BeingDebugged.toBool()) { | |
| 813 | 813 | @breakpoint(); |
| 814 | 814 | } |
| 815 | 815 | windows.ntdll.RtlExitUserProcess(3); |
lib/std/sort/block.zig+1-1| ... | ... | @@ -103,7 +103,7 @@ pub fn block( |
| 103 | 103 | context: anytype, |
| 104 | 104 | comptime lessThanFn: fn (@TypeOf(context), lhs: T, rhs: T) bool, |
| 105 | 105 | ) void { |
| 106 | const lessThan = if (builtin.mode == .Debug) struct { | |
| 106 | const lessThan = if (builtin.mode == .debug) struct { | |
| 107 | 107 | fn lessThan(ctx: @TypeOf(context), lhs: T, rhs: T) bool { |
| 108 | 108 | const lt = lessThanFn(ctx, lhs, rhs); |
| 109 | 109 | const gt = lessThanFn(ctx, rhs, lhs); |
lib/std/start.zig+2-2| ... | ... | @@ -742,8 +742,8 @@ fn mainWithoutEnv(c_argc: c_int, c_argv: [*][*:0]c_char) callconv(.c) c_int { |
| 742 | 742 | const bad_main_ret = "expected return type of main to be 'void', '!void', 'noreturn', 'u8', or '!u8'"; |
| 743 | 743 | |
| 744 | 744 | const use_safe_allocator = !is_wasm and switch (builtin.mode) { |
| 745 | .Debug, .ReleaseSafe => true, | |
| 746 | .ReleaseFast, .ReleaseSmall => !builtin.link_libc and builtin.single_threaded, // Also not ideal. | |
| 745 | .debug, .safe => true, | |
| 746 | .fast, .small => !builtin.link_libc and builtin.single_threaded, // Also not ideal. | |
| 747 | 747 | }; |
| 748 | 748 | var safe_allocator: std.heap.SafeAllocator = .init(std.heap.page_allocator, .{}); |
| 749 | 749 |
lib/std/std.zig+2-2| ... | ... | @@ -162,7 +162,7 @@ pub const Options = struct { |
| 162 | 162 | /// This enables `std.http.Client` to log ssl secrets to the file specified by the SSLKEYLOGFILE |
| 163 | 163 | /// env var. Creating such a log file allows other programs with access to that file to decrypt |
| 164 | 164 | /// all `std.http.Client` traffic made by this program. |
| 165 | http_enable_ssl_key_log_file: bool = @import("builtin").mode == .Debug, | |
| 165 | http_enable_ssl_key_log_file: bool = @import("builtin").mode == .debug, | |
| 166 | 166 | |
| 167 | 167 | side_channels_mitigations: crypto.SideChannelsMitigations = crypto.default_side_channels_mitigations, |
| 168 | 168 | |
| ... | ... | @@ -192,7 +192,7 @@ pub const Options = struct { |
| 192 | 192 | /// If this happens the fix is to add the error code to the corresponding |
| 193 | 193 | /// switch expression, possibly introduce a new error in the error set, and |
| 194 | 194 | /// send a patch to Zig. |
| 195 | unexpected_error_tracing: bool = @import("builtin").mode == .Debug and switch (@import("builtin").zig_backend) { | |
| 195 | unexpected_error_tracing: bool = @import("builtin").mode == .debug and switch (@import("builtin").zig_backend) { | |
| 196 | 196 | .stage2_llvm, .stage2_x86_64 => true, |
| 197 | 197 | else => false, |
| 198 | 198 | }, |
lib/std/zig/Zir.zig+1-1| ... | ... | @@ -2522,7 +2522,7 @@ pub const Inst = struct { |
| 2522 | 2522 | // bigger than expected. Note that in Debug builds, Zig is allowed |
| 2523 | 2523 | // to insert a secret field for safety checks. |
| 2524 | 2524 | comptime { |
| 2525 | if (builtin.mode != .Debug and builtin.mode != .ReleaseSafe) { | |
| 2525 | if (builtin.mode != .debug and builtin.mode != .safe) { | |
| 2526 | 2526 | assert(@sizeOf(Data) == 8); |
| 2527 | 2527 | } |
| 2528 | 2528 | } |
src/Builtin.zig+4-2| ... | ... | @@ -7,7 +7,7 @@ is_test: bool, |
| 7 | 7 | single_threaded: bool, |
| 8 | 8 | link_libc: bool, |
| 9 | 9 | link_libcpp: bool, |
| 10 | optimize_mode: std.lang.OptimizeMode, | |
| 10 | optimize_mode: std.lang.Optimize, | |
| 11 | 11 | error_tracing: bool, |
| 12 | 12 | valgrind: bool, |
| 13 | 13 | sanitize_thread: bool, |
| ... | ... | @@ -239,7 +239,9 @@ pub fn append(opts: @This(), buffer: *std.array_list.Managed(u8)) Allocator.Erro |
| 239 | 239 | |
| 240 | 240 | try buffer.print( |
| 241 | 241 | \\pub const object_format: std.Target.ObjectFormat = .{f}; |
| 242 | \\pub const mode: std.lang.OptimizeMode = .{f}; | |
| 242 | \\/// Deprecated, to be removed after 0.18.0 | |
| 243 | \\pub const mode = optimize; | |
| 244 | \\pub const optimize: std.lang.Optimize = .{f}; | |
| 243 | 245 | \\pub const link_libc = {}; |
| 244 | 246 | \\pub const link_libcpp = {}; |
| 245 | 247 | \\pub const have_error_return_tracing = {}; |
src/Compilation.zig+20-20| ... | ... | @@ -172,7 +172,7 @@ verbose_link: bool, |
| 172 | 172 | link_depfile: ?[]const u8, |
| 173 | 173 | disable_c_depfile: bool, |
| 174 | 174 | stack_report: bool, |
| 175 | debug_compiler_runtime_libs: ?std.lang.OptimizeMode, | |
| 175 | debug_compiler_runtime_libs: ?std.lang.Optimize, | |
| 176 | 176 | debug_compile_errors: bool, |
| 177 | 177 | /// Do not check this field directly. Instead, use the `debugIncremental` wrapper function. |
| 178 | 178 | debug_incremental: bool, |
| ... | ... | @@ -1506,7 +1506,7 @@ pub const CreateOptions = struct { |
| 1506 | 1506 | verbose_llvm_bc: ?[]const u8 = null, |
| 1507 | 1507 | link_depfile: ?[]const u8 = null, |
| 1508 | 1508 | verbose_llvm_cpu_features: bool = false, |
| 1509 | debug_compiler_runtime_libs: ?std.lang.OptimizeMode = null, | |
| 1509 | debug_compiler_runtime_libs: ?std.lang.Optimize = null, | |
| 1510 | 1510 | debug_compile_errors: bool = false, |
| 1511 | 1511 | debug_incremental: bool = false, |
| 1512 | 1512 | /// Normally when you create a `Compilation`, Zig will automatically build |
| ... | ... | @@ -2160,7 +2160,7 @@ pub fn create(gpa: Allocator, arena: Allocator, io: Io, diag: *CreateDiagnostic, |
| 2160 | 2160 | .framework_dirs = options.framework_dirs, |
| 2161 | 2161 | .rpath_list = options.rpath_list, |
| 2162 | 2162 | .symbol_wrap_set = options.symbol_wrap_set, |
| 2163 | .repro = options.linker_repro orelse (options.root_mod.optimize_mode != .Debug), | |
| 2163 | .repro = options.linker_repro orelse (options.root_mod.optimize_mode != .debug), | |
| 2164 | 2164 | .allow_shlib_undefined = options.linker_allow_shlib_undefined, |
| 2165 | 2165 | .bind_global_refs_locally = options.linker_bind_global_refs_locally orelse false, |
| 2166 | 2166 | .compress_debug_sections = options.linker_compress_debug_sections orelse .none, |
| ... | ... | @@ -3189,8 +3189,8 @@ fn flush(comp: *Compilation, arena: Allocator) (Io.Cancelable || Allocator.Error |
| 3189 | 3189 | break :p try p.toStringZ(arena); |
| 3190 | 3190 | }, |
| 3191 | 3191 | |
| 3192 | .is_debug = comp.root_mod.optimize_mode == .Debug, | |
| 3193 | .is_small = comp.root_mod.optimize_mode == .ReleaseSmall, | |
| 3192 | .is_debug = comp.root_mod.optimize_mode == .debug, | |
| 3193 | .is_small = comp.root_mod.optimize_mode == .small, | |
| 3194 | 3194 | .time_report = if (comp.time_report) |*p| p else null, |
| 3195 | 3195 | .sanitize_thread = comp.config.any_sanitize_thread, |
| 3196 | 3196 | .fuzz = comp.config.any_fuzz, |
| ... | ... | @@ -4744,7 +4744,7 @@ fn workerDocsWasmFallible(comp: *Compilation, prog_node: std.Progress.Node) SubU |
| 4744 | 4744 | defer arena_allocator.deinit(); |
| 4745 | 4745 | const arena = arena_allocator.allocator(); |
| 4746 | 4746 | |
| 4747 | const optimize_mode = std.lang.OptimizeMode.ReleaseSmall; | |
| 4747 | const optimize_mode: std.lang.Optimize = .small; | |
| 4748 | 4748 | const output_mode = std.lang.OutputMode.Exe; |
| 4749 | 4749 | const resolved_target: Module.ResolvedTarget = .{ |
| 4750 | 4750 | .result = std.zig.system.resolveTargetQuery(io, .{ |
| ... | ... | @@ -5910,8 +5910,8 @@ fn updateWin32Resource(comp: *Compilation, win32_resource: *Win32Resource, win32 |
| 5910 | 5910 | // them being defined matches the behavior of how MSVC calls rc.exe which is the more |
| 5911 | 5911 | // relevant behavior in this case. |
| 5912 | 5912 | switch (rc_src.owner.optimize_mode) { |
| 5913 | .Debug, .ReleaseSafe => {}, | |
| 5914 | .ReleaseFast, .ReleaseSmall => try argv.append("-DNDEBUG"), | |
| 5913 | .debug, .safe => {}, | |
| 5914 | .fast, .small => try argv.append("-DNDEBUG"), | |
| 5915 | 5915 | } |
| 5916 | 5916 | try argv.appendSlice(rc_src.extra_flags); |
| 5917 | 5917 | try argv.appendSlice(&.{ "--", rc_src.src_path, out_res_path }); |
| ... | ... | @@ -6178,11 +6178,11 @@ fn addCommonCCArgs( |
| 6178 | 6178 | // LLVM IR files don't support these flags. |
| 6179 | 6179 | if (ext != .ll and ext != .bc) { |
| 6180 | 6180 | switch (mod.optimize_mode) { |
| 6181 | .Debug => {}, | |
| 6182 | .ReleaseSafe => { | |
| 6181 | .debug => {}, | |
| 6182 | .safe => { | |
| 6183 | 6183 | try argv.append("-D_FORTIFY_SOURCE=2"); |
| 6184 | 6184 | }, |
| 6185 | .ReleaseFast, .ReleaseSmall => { | |
| 6185 | .fast, .small => { | |
| 6186 | 6186 | try argv.append("-DNDEBUG"); |
| 6187 | 6187 | }, |
| 6188 | 6188 | } |
| ... | ... | @@ -6333,7 +6333,7 @@ fn addCommonCCArgs( |
| 6333 | 6333 | } |
| 6334 | 6334 | } |
| 6335 | 6335 | |
| 6336 | if (mod.optimize_mode != .Debug) { | |
| 6336 | if (mod.optimize_mode != .debug) { | |
| 6337 | 6337 | try argv.append("-Werror=date-time"); |
| 6338 | 6338 | } |
| 6339 | 6339 | }, |
| ... | ... | @@ -6412,18 +6412,18 @@ fn addCommonCCArgs( |
| 6412 | 6412 | } |
| 6413 | 6413 | |
| 6414 | 6414 | switch (mod.optimize_mode) { |
| 6415 | .Debug => { | |
| 6415 | .debug => { | |
| 6416 | 6416 | // Clang has -Og for compatibility with GCC, but currently it is just equivalent |
| 6417 | 6417 | // to -O1. Besides potentially impairing debugging, -O1/-Og significantly |
| 6418 | 6418 | // increases compile times. |
| 6419 | 6419 | try argv.append("-O0"); |
| 6420 | 6420 | }, |
| 6421 | .ReleaseSafe => { | |
| 6421 | .safe => { | |
| 6422 | 6422 | // See the comment in the BuildModeFastRelease case for why we pass -O2 rather |
| 6423 | 6423 | // than -O3 here. |
| 6424 | 6424 | try argv.append("-O2"); |
| 6425 | 6425 | }, |
| 6426 | .ReleaseFast => { | |
| 6426 | .fast => { | |
| 6427 | 6427 | // Here we pass -O2 rather than -O3 because, although we do the equivalent of |
| 6428 | 6428 | // -O3 in Zig code, the justification for the difference here is that Zig |
| 6429 | 6429 | // has better detection and prevention of undefined behavior, so -O3 is safer for |
| ... | ... | @@ -6431,7 +6431,7 @@ fn addCommonCCArgs( |
| 6431 | 6431 | // running in -O2 and thus the -O3 path has been tested less. |
| 6432 | 6432 | try argv.append("-O2"); |
| 6433 | 6433 | }, |
| 6434 | .ReleaseSmall => { | |
| 6434 | .small => { | |
| 6435 | 6435 | try argv.append("-Os"); |
| 6436 | 6436 | }, |
| 6437 | 6437 | } |
| ... | ... | @@ -7557,15 +7557,15 @@ pub fn addLinkLib(comp: *Compilation, lib_name: []const u8) !void { |
| 7557 | 7557 | |
| 7558 | 7558 | /// This decides the optimization mode for all zig-provided libraries, including |
| 7559 | 7559 | /// compiler-rt, libcxx, libc, libunwind, etc. |
| 7560 | pub fn compilerRtOptMode(comp: Compilation) std.lang.OptimizeMode { | |
| 7560 | pub fn compilerRtOptMode(comp: Compilation) std.lang.Optimize { | |
| 7561 | 7561 | if (comp.debug_compiler_runtime_libs) |mode| { |
| 7562 | 7562 | return mode; |
| 7563 | 7563 | } |
| 7564 | 7564 | const target = &comp.root_mod.resolved_target.result; |
| 7565 | 7565 | switch (comp.root_mod.optimize_mode) { |
| 7566 | .Debug, .ReleaseSafe => return target_util.defaultCompilerRtOptimizeMode(target), | |
| 7567 | .ReleaseFast => return .ReleaseFast, | |
| 7568 | .ReleaseSmall => return .ReleaseSmall, | |
| 7566 | .debug, .safe => return target_util.defaultCompilerRtOptimizeMode(target), | |
| 7567 | .fast => return .fast, | |
| 7568 | .small => return .small, | |
| 7569 | 7569 | } |
| 7570 | 7570 | } |
| 7571 | 7571 |
src/Compilation/Config.zig+7-7| ... | ... | @@ -59,7 +59,7 @@ export_memory: bool, |
| 59 | 59 | shared_memory: bool, |
| 60 | 60 | is_test: bool, |
| 61 | 61 | debug_format: DebugFormat, |
| 62 | root_optimize_mode: std.lang.OptimizeMode, | |
| 62 | root_optimize_mode: std.lang.Optimize, | |
| 63 | 63 | root_strip: bool, |
| 64 | 64 | root_error_tracing: bool, |
| 65 | 65 | dll_export_fns: bool, |
| ... | ... | @@ -80,7 +80,7 @@ pub const Options = struct { |
| 80 | 80 | is_test: bool, |
| 81 | 81 | have_zcu: bool, |
| 82 | 82 | emit_bin: bool, |
| 83 | root_optimize_mode: ?std.lang.OptimizeMode = null, | |
| 83 | root_optimize_mode: ?std.lang.Optimize = null, | |
| 84 | 84 | root_strip: ?bool = null, |
| 85 | 85 | root_error_tracing: ?bool = null, |
| 86 | 86 | link_mode: ?std.lang.LinkMode = null, |
| ... | ... | @@ -196,7 +196,7 @@ pub fn resolve(options: Options) ResolveError!Config { |
| 196 | 196 | break :b options.use_lib_llvm orelse true; |
| 197 | 197 | }; |
| 198 | 198 | |
| 199 | const root_optimize_mode = options.root_optimize_mode orelse .Debug; | |
| 199 | const root_optimize_mode = options.root_optimize_mode orelse .debug; | |
| 200 | 200 | |
| 201 | 201 | // Make a decision on whether to use Clang or Aro for translate-c and compiling C files. |
| 202 | 202 | const c_frontend: CFrontend = b: { |
| ... | ... | @@ -357,7 +357,7 @@ pub fn resolve(options: Options) ResolveError!Config { |
| 357 | 357 | if (!use_lib_llvm and options.emit_bin) break :b false; |
| 358 | 358 | |
| 359 | 359 | // Prefer LLVM for release builds. |
| 360 | if (root_optimize_mode != .Debug) break :b true; | |
| 360 | if (root_optimize_mode != .debug) break :b true; | |
| 361 | 361 | |
| 362 | 362 | // load_dynamic_library standalone test not passing on this combination |
| 363 | 363 | // https://github.com/ziglang/zig/issues/24080 |
| ... | ... | @@ -486,7 +486,7 @@ pub fn resolve(options: Options) ResolveError!Config { |
| 486 | 486 | |
| 487 | 487 | const root_strip = b: { |
| 488 | 488 | if (options.root_strip) |x| break :b x; |
| 489 | if (root_optimize_mode == .ReleaseSmall) break :b true; | |
| 489 | if (root_optimize_mode == .small) break :b true; | |
| 490 | 490 | if (!target_util.hasDebugInfo(target)) break :b true; |
| 491 | 491 | break :b false; |
| 492 | 492 | }; |
| ... | ... | @@ -512,8 +512,8 @@ pub fn resolve(options: Options) ResolveError!Config { |
| 512 | 512 | if (root_strip) break :b false; |
| 513 | 513 | if (!backend_supports_error_tracing) break :b false; |
| 514 | 514 | break :b switch (root_optimize_mode) { |
| 515 | .Debug => true, | |
| 516 | .ReleaseSafe, .ReleaseFast, .ReleaseSmall => false, | |
| 515 | .debug => true, | |
| 516 | .safe, .fast, .small => false, | |
| 517 | 517 | }; |
| 518 | 518 | }; |
| 519 | 519 |
src/Module.zig+9-9| ... | ... | @@ -26,7 +26,7 @@ fully_qualified_name: []const u8, |
| 26 | 26 | deps: Deps = .{}, |
| 27 | 27 | |
| 28 | 28 | resolved_target: ResolvedTarget, |
| 29 | optimize_mode: std.lang.OptimizeMode, | |
| 29 | optimize_mode: std.lang.Optimize, | |
| 30 | 30 | code_model: std.lang.CodeModel, |
| 31 | 31 | single_threaded: bool, |
| 32 | 32 | error_tracing: bool, |
| ... | ... | @@ -67,7 +67,7 @@ pub const CreateOptions = struct { |
| 67 | 67 | pub const Inherited = struct { |
| 68 | 68 | /// If this is null then `parent` must be non-null. |
| 69 | 69 | resolved_target: ?ResolvedTarget = null, |
| 70 | optimize_mode: ?std.lang.OptimizeMode = null, | |
| 70 | optimize_mode: ?std.lang.Optimize = null, | |
| 71 | 71 | code_model: ?std.lang.CodeModel = null, |
| 72 | 72 | single_threaded: ?bool = null, |
| 73 | 73 | error_tracing: ?bool = null, |
| ... | ... | @@ -144,7 +144,7 @@ pub fn create(arena: Allocator, options: CreateOptions) !*Module { |
| 144 | 144 | if (options.inherited.valgrind) |x| break :b x; |
| 145 | 145 | if (options.parent) |p| break :b p.valgrind; |
| 146 | 146 | if (strip) break :b false; |
| 147 | break :b optimize_mode == .Debug; | |
| 147 | break :b optimize_mode == .debug; | |
| 148 | 148 | }; |
| 149 | 149 | |
| 150 | 150 | const single_threaded = b: { |
| ... | ... | @@ -212,7 +212,7 @@ pub fn create(arena: Allocator, options: CreateOptions) !*Module { |
| 212 | 212 | const omit_frame_pointer = b: { |
| 213 | 213 | if (options.inherited.omit_frame_pointer) |x| break :b x; |
| 214 | 214 | if (options.parent) |p| break :b p.omit_frame_pointer; |
| 215 | if (optimize_mode == .ReleaseSmall) { | |
| 215 | if (optimize_mode == .small) { | |
| 216 | 216 | // On x86, in most cases, keeping the frame pointer usually results in smaller binary size. |
| 217 | 217 | // This has to do with how instructions for memory access via the stack base pointer register (when keeping the frame pointer) |
| 218 | 218 | // are smaller than instructions for memory access via the stack pointer register (when omitting the frame pointer). |
| ... | ... | @@ -251,21 +251,21 @@ pub fn create(arena: Allocator, options: CreateOptions) !*Module { |
| 251 | 251 | }; |
| 252 | 252 | |
| 253 | 253 | const is_safe_mode = switch (optimize_mode) { |
| 254 | .Debug, .ReleaseSafe => true, | |
| 255 | .ReleaseFast, .ReleaseSmall => false, | |
| 254 | .debug, .safe => true, | |
| 255 | .fast, .small => false, | |
| 256 | 256 | }; |
| 257 | 257 | |
| 258 | 258 | const sanitize_c: std.zig.SanitizeC = b: { |
| 259 | 259 | if (options.inherited.sanitize_c) |x| break :b x; |
| 260 | 260 | if (options.parent) |p| break :b p.sanitize_c; |
| 261 | 261 | break :b switch (optimize_mode) { |
| 262 | .Debug => .full, | |
| 262 | .debug => .full, | |
| 263 | 263 | // It's recommended to use the minimal runtime in production |
| 264 | 264 | // environments due to the security implications of the full runtime. |
| 265 | 265 | // The minimal runtime doesn't provide much benefit over simply |
| 266 | 266 | // trapping, however, so we do that instead. |
| 267 | .ReleaseSafe => .trap, | |
| 268 | .ReleaseFast, .ReleaseSmall => .off, | |
| 267 | .safe => .trap, | |
| 268 | .fast, .small => .off, | |
| 269 | 269 | }; |
| 270 | 270 | }; |
| 271 | 271 |
src/Sema.zig+9-9| ... | ... | @@ -532,20 +532,20 @@ pub const Block = struct { |
| 532 | 532 | |
| 533 | 533 | fn wantSafeTypes(block: *const Block) bool { |
| 534 | 534 | return block.want_safety orelse switch (block.ownerModule().optimize_mode) { |
| 535 | .Debug => true, | |
| 536 | .ReleaseSafe => true, | |
| 537 | .ReleaseFast => false, | |
| 538 | .ReleaseSmall => false, | |
| 535 | .debug => true, | |
| 536 | .safe => true, | |
| 537 | .fast => false, | |
| 538 | .small => false, | |
| 539 | 539 | }; |
| 540 | 540 | } |
| 541 | 541 | |
| 542 | 542 | fn wantSafety(block: *const Block) bool { |
| 543 | 543 | if (block.isComptime()) return false; // runtime safety checks are pointless in comptime blocks |
| 544 | 544 | return block.want_safety orelse switch (block.ownerModule().optimize_mode) { |
| 545 | .Debug => true, | |
| 546 | .ReleaseSafe => true, | |
| 547 | .ReleaseFast => false, | |
| 548 | .ReleaseSmall => false, | |
| 545 | .debug => true, | |
| 546 | .safe => true, | |
| 547 | .fast => false, | |
| 548 | .small => false, | |
| 549 | 549 | }; |
| 550 | 550 | } |
| 551 | 551 | |
| ... | ... | @@ -2247,7 +2247,7 @@ fn resolveValue(sema: *Sema, inst: Air.Inst.Ref) ?Value { |
| 2247 | 2247 | .inferred_alloc_comptime => unreachable, // assertion failure |
| 2248 | 2248 | else => {}, |
| 2249 | 2249 | } |
| 2250 | // LLVM fails to eliminate this `classify` call in ReleaseFast, which hurts performance, so | |
| 2250 | // LLVM fails to eliminate this `classify` call in -Ofast, which hurts performance, so | |
| 2251 | 2251 | // we must explicitly check for `std.debug.runtime_safety`. |
| 2252 | 2252 | if (std.debug.runtime_safety) switch (sema.typeOf(inst).classify(zcu)) { |
| 2253 | 2253 | .no_possible_value => unreachable, // values of this type do not exist |
src/codegen/aarch64/Mir.zig+2-2| ... | ... | @@ -70,8 +70,8 @@ pub fn emit( |
| 70 | 70 | |
| 71 | 71 | const func_align = switch (nav.resolved.?.@"align") { |
| 72 | 72 | .none => switch (mod.optimize_mode) { |
| 73 | .Debug, .ReleaseSafe, .ReleaseFast => target_util.defaultFunctionAlignment(target), | |
| 74 | .ReleaseSmall => target_util.minFunctionAlignment(target), | |
| 73 | .debug, .safe, .fast => target_util.defaultFunctionAlignment(target), | |
| 74 | .small => target_util.minFunctionAlignment(target), | |
| 75 | 75 | }, |
| 76 | 76 | else => |a| a.maxStrict(target_util.minFunctionAlignment(target)), |
| 77 | 77 | }; |
src/codegen/c.zig+4-4| ... | ... | @@ -453,8 +453,8 @@ pub const Function = struct { |
| 453 | 453 | |
| 454 | 454 | fn wantSafety(f: *Function) bool { |
| 455 | 455 | return switch (f.dg.mod.optimize_mode) { |
| 456 | .Debug, .ReleaseSafe => true, | |
| 457 | .ReleaseFast, .ReleaseSmall => false, | |
| 456 | .debug, .safe => true, | |
| 457 | .fast, .small => false, | |
| 458 | 458 | }; |
| 459 | 459 | } |
| 460 | 460 | |
| ... | ... | @@ -1306,8 +1306,8 @@ pub const DeclGen = struct { |
| 1306 | 1306 | }; |
| 1307 | 1307 | |
| 1308 | 1308 | const safety_on = switch (dg.mod.optimize_mode) { |
| 1309 | .Debug, .ReleaseSafe => true, | |
| 1310 | .ReleaseFast, .ReleaseSmall => false, | |
| 1309 | .debug, .safe => true, | |
| 1310 | .fast, .small => false, | |
| 1311 | 1311 | }; |
| 1312 | 1312 | |
| 1313 | 1313 | switch (ty.toIntern()) { |
src/codegen/llvm.zig+4-4| ... | ... | @@ -653,7 +653,7 @@ pub const Object = struct { |
| 653 | 653 | }), |
| 654 | 654 | debug_enums_fwd_ref, |
| 655 | 655 | debug_globals_fwd_ref, |
| 656 | .{ .optimized = comp.root_mod.optimize_mode != .Debug }, | |
| 656 | .{ .optimized = comp.root_mod.optimize_mode != .debug }, | |
| 657 | 657 | ); |
| 658 | 658 | |
| 659 | 659 | try builder.addNamedMetadata(try builder.string("llvm.dbg.cu"), &.{debug_compile_unit}); |
| ... | ... | @@ -1028,7 +1028,7 @@ pub const Object = struct { |
| 1028 | 1028 | |
| 1029 | 1029 | const optimize_mode = comp.root_mod.optimize_mode; |
| 1030 | 1030 | |
| 1031 | const opt_level: bindings.CodeGenOptLevel = if (optimize_mode == .Debug) | |
| 1031 | const opt_level: bindings.CodeGenOptLevel = if (optimize_mode == .debug) | |
| 1032 | 1032 | .None |
| 1033 | 1033 | else |
| 1034 | 1034 | .Aggressive; |
| ... | ... | @@ -1299,7 +1299,7 @@ pub const Object = struct { |
| 1299 | 1299 | .NoReturn = fn_info.return_type == .noreturn_type, |
| 1300 | 1300 | }, |
| 1301 | 1301 | .sp_flags = .{ |
| 1302 | .Optimized = owner_mod.optimize_mode != .Debug, | |
| 1302 | .Optimized = owner_mod.optimize_mode != .debug, | |
| 1303 | 1303 | .Definition = true, |
| 1304 | 1304 | .LocalToUnit = is_internal_linkage, |
| 1305 | 1305 | }, |
| ... | ... | @@ -2798,7 +2798,7 @@ pub const Object = struct { |
| 2798 | 2798 | &o.builder, |
| 2799 | 2799 | ); |
| 2800 | 2800 | } |
| 2801 | if (owner_mod.optimize_mode == .ReleaseSmall) { | |
| 2801 | if (owner_mod.optimize_mode == .small) { | |
| 2802 | 2802 | try attributes.addFnAttr(.minsize, &o.builder); |
| 2803 | 2803 | try attributes.addFnAttr(.optsize, &o.builder); |
| 2804 | 2804 | } |
src/codegen/llvm/FuncGen.zig+4-4| ... | ... | @@ -696,7 +696,7 @@ fn genBodyDebugScope( |
| 696 | 696 | .{ |
| 697 | 697 | .di_flags = .{ .StaticMember = true }, |
| 698 | 698 | .sp_flags = .{ |
| 699 | .Optimized = mod.optimize_mode != .Debug, | |
| 699 | .Optimized = mod.optimize_mode != .debug, | |
| 700 | 700 | .Definition = true, |
| 701 | 701 | .LocalToUnit = true, // inline functions cannot be exported |
| 702 | 702 | }, |
| ... | ... | @@ -2516,7 +2516,7 @@ fn airDbgVarVal(self: *FuncGen, inst: Air.Inst.Index, is_arg: bool) Allocator.Er |
| 2516 | 2516 | }, |
| 2517 | 2517 | "", |
| 2518 | 2518 | ); |
| 2519 | } else if (owner_mod.optimize_mode == .Debug and !self.is_naked) { | |
| 2519 | } else if (owner_mod.optimize_mode == .debug and !self.is_naked) { | |
| 2520 | 2520 | // We avoid taking this path for naked functions because there's no guarantee that such |
| 2521 | 2521 | // functions even have a valid stack pointer, making the `alloca` + `store` unsafe. |
| 2522 | 2522 | |
| ... | ... | @@ -4689,7 +4689,7 @@ fn airArg(self: *FuncGen, inst: Air.Inst.Index) Allocator.Error!Builder.Value { |
| 4689 | 4689 | }, |
| 4690 | 4690 | "", |
| 4691 | 4691 | ); |
| 4692 | } else if (mod.optimize_mode == .Debug) { | |
| 4692 | } else if (mod.optimize_mode == .debug) { | |
| 4693 | 4693 | const alloca = try self.buildZigAlloca(inst_ty, .none); |
| 4694 | 4694 | try self.store(alloca, .none, arg_val, inst_ty, .normal); |
| 4695 | 4695 | _ = try self.wip.callIntrinsic( |
| ... | ... | @@ -4820,7 +4820,7 @@ fn airStore(fg: *FuncGen, inst: Air.Inst.Index, safety: bool) Allocator.Error!Bu |
| 4820 | 4820 | // unexpected call in the user's code. This is problematic if the code in question is |
| 4821 | 4821 | // not ready to correctly make calls yet, such as in our early PIE startup code, or in |
| 4822 | 4822 | // the early stages of a dynamic linker, etc. |
| 4823 | if (!safety and owner_mod.optimize_mode == .Debug) { | |
| 4823 | if (!safety and owner_mod.optimize_mode == .debug) { | |
| 4824 | 4824 | return .none; |
| 4825 | 4825 | } |
| 4826 | 4826 |
src/codegen/riscv64/CodeGen.zig+3-3| ... | ... | @@ -8339,9 +8339,9 @@ fn resolveCallingConventionValues( |
| 8339 | 8339 | fn wantSafety(func: *Func) bool { |
| 8340 | 8340 | return switch (func.mod.optimize_mode) { |
| 8341 | 8341 | .Debug => true, |
| 8342 | .ReleaseSafe => true, | |
| 8343 | .ReleaseFast => false, | |
| 8344 | .ReleaseSmall => false, | |
| 8342 | .safe => true, | |
| 8343 | .fast => false, | |
| 8344 | .small => false, | |
| 8345 | 8345 | }; |
| 8346 | 8346 | } |
| 8347 | 8347 |
src/codegen/sparc64/CodeGen.zig+3-3| ... | ... | @@ -4764,9 +4764,9 @@ fn truncRegister( |
| 4764 | 4764 | fn wantSafety(self: *Self) bool { |
| 4765 | 4765 | return switch (self.bin_file.comp.root_mod.optimize_mode) { |
| 4766 | 4766 | .Debug => true, |
| 4767 | .ReleaseSafe => true, | |
| 4768 | .ReleaseFast => false, | |
| 4769 | .ReleaseSmall => false, | |
| 4767 | .safe => true, | |
| 4768 | .fast => false, | |
| 4769 | .small => false, | |
| 4770 | 4770 | }; |
| 4771 | 4771 | } |
| 4772 | 4772 |
src/codegen/wasm/Mir.zig+2-2| ... | ... | @@ -661,8 +661,8 @@ pub const Inst = struct { |
| 661 | 661 | |
| 662 | 662 | comptime { |
| 663 | 663 | switch (builtin.mode) { |
| 664 | .Debug, .ReleaseSafe => {}, | |
| 665 | .ReleaseFast, .ReleaseSmall => assert(@sizeOf(Data) == 4), | |
| 664 | .debug, .safe => {}, | |
| 665 | .fast, .small => assert(@sizeOf(Data) == 4), | |
| 666 | 666 | } |
| 667 | 667 | } |
| 668 | 668 | }; |
src/codegen/x86_64/CodeGen.zig+4-4| ... | ... | @@ -182502,8 +182502,8 @@ fn hasFeature(cg: *CodeGen, feature: std.Target.x86.Feature) bool { |
| 182502 | 182502 | .slow_unaligned_mem_16, |
| 182503 | 182503 | .slow_unaligned_mem_32, |
| 182504 | 182504 | => switch (cg.mod.optimize_mode) { |
| 182505 | .Debug, .ReleaseSafe, .ReleaseFast => null, | |
| 182506 | .ReleaseSmall => false, | |
| 182505 | .debug, .safe, .fast => null, | |
| 182506 | .small => false, | |
| 182507 | 182507 | }, |
| 182508 | 182508 | .fast_11bytenop, |
| 182509 | 182509 | .fast_15bytenop, |
| ... | ... | @@ -182523,8 +182523,8 @@ fn hasFeature(cg: *CodeGen, feature: std.Target.x86.Feature) bool { |
| 182523 | 182523 | .fast_vector_fsqrt, |
| 182524 | 182524 | .fast_vector_shift_masks, |
| 182525 | 182525 | => switch (cg.mod.optimize_mode) { |
| 182526 | .Debug, .ReleaseSafe, .ReleaseFast => null, | |
| 182527 | .ReleaseSmall => true, | |
| 182526 | .debug, .safe, .fast => null, | |
| 182527 | .small => true, | |
| 182528 | 182528 | }, |
| 182529 | 182529 | .mmx => false, |
| 182530 | 182530 | .sahf => switch (cg.target.cpu.arch) { |
src/libs/libcxx.zig+3-3| ... | ... | @@ -539,15 +539,15 @@ pub fn addCxxArgs( |
| 539 | 539 | // is simple and works everywhere. |
| 540 | 540 | try cflags.append("-D_LIBCPP_PSTL_BACKEND_SERIAL"); |
| 541 | 541 | switch (optimize_mode) { |
| 542 | .Debug => { | |
| 542 | .debug => { | |
| 543 | 543 | try cflags.append("-D_LIBCPP_HARDENING_MODE=_LIBCPP_HARDENING_MODE_DEBUG"); |
| 544 | 544 | try cflags.append("-D_LIBCPP_ASSERTION_SEMANTIC_DEFAULT=_LIBCPP_ASSERTION_SEMANTIC_ENFORCE"); |
| 545 | 545 | }, |
| 546 | .ReleaseFast, .ReleaseSmall => { | |
| 546 | .fast, .small => { | |
| 547 | 547 | try cflags.append("-D_LIBCPP_HARDENING_MODE=_LIBCPP_HARDENING_MODE_NONE"); |
| 548 | 548 | try cflags.append("-D_LIBCPP_ASSERTION_SEMANTIC_DEFAULT=_LIBCPP_ASSERTION_SEMANTIC_IGNORE"); |
| 549 | 549 | }, |
| 550 | .ReleaseSafe => { | |
| 550 | .safe => { | |
| 551 | 551 | try cflags.append("-D_LIBCPP_HARDENING_MODE=_LIBCPP_HARDENING_MODE_FAST"); |
| 552 | 552 | try cflags.append("-D_LIBCPP_ASSERTION_SEMANTIC_DEFAULT=_LIBCPP_ASSERTION_SEMANTIC_ENFORCE"); |
| 553 | 553 | }, |
src/libs/libunwind.zig+1-1| ... | ... | @@ -118,7 +118,7 @@ pub fn buildStaticLib(comp: *Compilation, prog_node: std.Progress.Node) BuildErr |
| 118 | 118 | // defines will be correct. |
| 119 | 119 | try cflags.append("-D_LIBUNWIND_IS_NATIVE_ONLY"); |
| 120 | 120 | |
| 121 | if (comp.root_mod.optimize_mode == .Debug) { | |
| 121 | if (comp.root_mod.optimize_mode == .debug) { | |
| 122 | 122 | try cflags.append("-D_DEBUG"); |
| 123 | 123 | } |
| 124 | 124 | if (!comp.config.any_non_single_threaded) { |
src/libs/mingw.zig+2-2| ... | ... | @@ -135,8 +135,8 @@ pub fn buildCrtFile(comp: *Compilation, crt_file: CrtFile, prog_node: std.Progre |
| 135 | 135 | }); |
| 136 | 136 | |
| 137 | 137 | switch (comp.compilerRtOptMode()) { |
| 138 | .Debug, .ReleaseSafe => try winpthreads_args.append("-DWINPTHREAD_DBG"), | |
| 139 | .ReleaseFast, .ReleaseSmall => {}, | |
| 138 | .debug, .safe => try winpthreads_args.append("-DWINPTHREAD_DBG"), | |
| 139 | .fast, .small => {}, | |
| 140 | 140 | } |
| 141 | 141 | |
| 142 | 142 | for (mingw32_winpthreads_src) |dep| { |
src/link/C.zig+1-1| ... | ... | @@ -429,7 +429,7 @@ pub fn createEmpty( |
| 429 | 429 | .tag = .c, |
| 430 | 430 | .comp = comp, |
| 431 | 431 | .emit = emit, |
| 432 | .gc_sections = options.gc_sections orelse (optimize_mode != .Debug and output_mode != .Obj), | |
| 432 | .gc_sections = options.gc_sections orelse (optimize_mode != .debug and output_mode != .Obj), | |
| 433 | 433 | .print_gc_sections = options.print_gc_sections, |
| 434 | 434 | .stack_size = options.stack_size orelse 16777216, |
| 435 | 435 | .allow_shlib_undefined = options.allow_shlib_undefined orelse false, |
src/link/Coff.zig+8-8| ... | ... | @@ -5598,11 +5598,11 @@ fn updateFuncInner( |
| 5598 | 5598 | const ni = try coff.mf.addLastChildNode(gpa, sec_si.node(coff), .{ |
| 5599 | 5599 | .alignment = switch (nav.resolved.?.@"align") { |
| 5600 | 5600 | .none => switch (mod.optimize_mode) { |
| 5601 | .Debug, | |
| 5602 | .ReleaseSafe, | |
| 5603 | .ReleaseFast, | |
| 5601 | .debug, | |
| 5602 | .safe, | |
| 5603 | .fast, | |
| 5604 | 5604 | => target_util.defaultFunctionAlignment(target), |
| 5605 | .ReleaseSmall => target_util.minFunctionAlignment(target), | |
| 5605 | .small => target_util.minFunctionAlignment(target), | |
| 5606 | 5606 | }, |
| 5607 | 5607 | else => |a| a.maxStrict(target_util.minFunctionAlignment(target)), |
| 5608 | 5608 | }.toStdMem(), |
| ... | ... | @@ -6649,11 +6649,11 @@ fn flushGlobal(coff: *Coff, gmi: Node.GlobalMapIndex) !bool { |
| 6649 | 6649 | |
| 6650 | 6650 | const target = &comp.root_mod.resolved_target.result; |
| 6651 | 6651 | const alignment = switch (comp.root_mod.optimize_mode) { |
| 6652 | .Debug, | |
| 6653 | .ReleaseSafe, | |
| 6654 | .ReleaseFast, | |
| 6652 | .debug, | |
| 6653 | .safe, | |
| 6654 | .fast, | |
| 6655 | 6655 | => target_util.defaultFunctionAlignment(target), |
| 6656 | .ReleaseSmall => target_util.minFunctionAlignment(target), | |
| 6656 | .small => target_util.minFunctionAlignment(target), | |
| 6657 | 6657 | }.toStdMem(); |
| 6658 | 6658 | const parent_si = (try coff.pseudoSectionMapIndex( |
| 6659 | 6659 | .@".thunks", |
src/link/Elf.zig+1-1| ... | ... | @@ -260,7 +260,7 @@ pub fn createEmpty( |
| 260 | 260 | .tag = .elf, |
| 261 | 261 | .comp = comp, |
| 262 | 262 | .emit = emit, |
| 263 | .gc_sections = options.gc_sections orelse (optimize_mode != .Debug and output_mode != .Obj), | |
| 263 | .gc_sections = options.gc_sections orelse (optimize_mode != .debug and output_mode != .Obj), | |
| 264 | 264 | .print_gc_sections = options.print_gc_sections, |
| 265 | 265 | .stack_size = options.stack_size orelse 16777216, |
| 266 | 266 | .allow_shlib_undefined = options.allow_shlib_undefined orelse !is_native_os, |
src/link/Elf/ZigObject.zig+4-4| ... | ... | @@ -1299,7 +1299,7 @@ fn getNavShdrIndex( |
| 1299 | 1299 | } |
| 1300 | 1300 | if (nav_val.isUndef(zcu)) |
| 1301 | 1301 | return switch (zcu.navFileScope(nav_index).mod.?.optimize_mode) { |
| 1302 | .Debug, .ReleaseSafe => { | |
| 1302 | .debug, .safe => { | |
| 1303 | 1303 | if (self.data_index) |symbol_index| |
| 1304 | 1304 | return self.symbol(symbol_index).outputShndx(elf_file).?; |
| 1305 | 1305 | const osec = try elf_file.addSection(.{ |
| ... | ... | @@ -1311,7 +1311,7 @@ fn getNavShdrIndex( |
| 1311 | 1311 | self.data_index = try self.addSectionSymbol(gpa, try self.addString(gpa, ".data"), osec); |
| 1312 | 1312 | return osec; |
| 1313 | 1313 | }, |
| 1314 | .ReleaseFast, .ReleaseSmall => { | |
| 1314 | .fast, .small => { | |
| 1315 | 1315 | if (self.bss_index) |symbol_index| |
| 1316 | 1316 | return self.symbol(symbol_index).outputShndx(elf_file).?; |
| 1317 | 1317 | const osec = try elf_file.addSection(.{ |
| ... | ... | @@ -1374,8 +1374,8 @@ fn updateNavCode( |
| 1374 | 1374 | const target = &mod.resolved_target.result; |
| 1375 | 1375 | const required_alignment = switch (nav.resolved.?.@"align") { |
| 1376 | 1376 | .none => switch (mod.optimize_mode) { |
| 1377 | .Debug, .ReleaseSafe, .ReleaseFast => target_util.defaultFunctionAlignment(target), | |
| 1378 | .ReleaseSmall => target_util.minFunctionAlignment(target), | |
| 1377 | .debug, .safe, .fast => target_util.defaultFunctionAlignment(target), | |
| 1378 | .small => target_util.minFunctionAlignment(target), | |
| 1379 | 1379 | }.maxStrict(Type.fromInterned(nav.resolved.?.type).abiAlignment(zcu)), |
| 1380 | 1380 | else => |a| a.maxStrict(target_util.minFunctionAlignment(target)), |
| 1381 | 1381 | }; |
src/link/Elf2.zig+4-4| ... | ... | @@ -4782,11 +4782,11 @@ fn navMapIndex(elf: *Elf, zcu: *Zcu, nav_index: InternPool.Nav.Index) Error!Node |
| 4782 | 4782 | break :a switch (nav.resolved.?.@"align") { |
| 4783 | 4783 | else => |a| a.maxStrict(min), |
| 4784 | 4784 | .none => switch (mod.optimize_mode) { |
| 4785 | .Debug, | |
| 4786 | .ReleaseSafe, | |
| 4787 | .ReleaseFast, | |
| 4785 | .debug, | |
| 4786 | .safe, | |
| 4787 | .fast, | |
| 4788 | 4788 | => target_util.defaultFunctionAlignment(target), |
| 4789 | .ReleaseSmall => min, | |
| 4789 | .small => min, | |
| 4790 | 4790 | }.maxStrict(Type.fromInterned(nav.resolved.?.type).abiAlignment(zcu)), |
| 4791 | 4791 | }; |
| 4792 | 4792 | }, |
src/link/Lld.zig+14-14| ... | ... | @@ -206,8 +206,8 @@ pub fn createEmpty( |
| 206 | 206 | const optimize_mode = comp.root_mod.optimize_mode; |
| 207 | 207 | |
| 208 | 208 | const gc_sections: bool = options.gc_sections orelse switch (target.ofmt) { |
| 209 | .coff => optimize_mode != .Debug, | |
| 210 | .elf => optimize_mode != .Debug and output_mode != .Obj, | |
| 209 | .coff => optimize_mode != .debug, | |
| 210 | .elf => optimize_mode != .debug and output_mode != .Obj, | |
| 211 | 211 | .wasm => output_mode != .Obj, |
| 212 | 212 | else => unreachable, |
| 213 | 213 | }; |
| ... | ... | @@ -454,9 +454,9 @@ fn coffLink(lld: *Lld, arena: Allocator) !void { |
| 454 | 454 | |
| 455 | 455 | if (comp.config.lto != .none) { |
| 456 | 456 | switch (optimize_mode) { |
| 457 | .Debug => {}, | |
| 458 | .ReleaseSmall => try argv.append("-OPT:lldlto=2"), | |
| 459 | .ReleaseFast, .ReleaseSafe => try argv.append("-OPT:lldlto=3"), | |
| 457 | .debug => {}, | |
| 458 | .small => try argv.append("-OPT:lldlto=2"), | |
| 459 | .fast, .safe => try argv.append("-OPT:lldlto=3"), | |
| 460 | 460 | } |
| 461 | 461 | } |
| 462 | 462 | if (comp.config.output_mode == .Exe) { |
| ... | ... | @@ -863,15 +863,15 @@ fn elfLink(lld: *Lld, arena: Allocator) !void { |
| 863 | 863 | |
| 864 | 864 | if (comp.config.lto != .none) { |
| 865 | 865 | switch (comp.root_mod.optimize_mode) { |
| 866 | .Debug => {}, | |
| 867 | .ReleaseSmall => try argv.append("--lto-O2"), | |
| 868 | .ReleaseFast, .ReleaseSafe => try argv.append("--lto-O3"), | |
| 866 | .debug => {}, | |
| 867 | .small => try argv.append("--lto-O2"), | |
| 868 | .fast, .safe => try argv.append("--lto-O3"), | |
| 869 | 869 | } |
| 870 | 870 | } |
| 871 | 871 | switch (comp.root_mod.optimize_mode) { |
| 872 | .Debug => {}, | |
| 873 | .ReleaseSmall => try argv.append("-O2"), | |
| 874 | .ReleaseFast, .ReleaseSafe => try argv.append("-O3"), | |
| 872 | .debug => {}, | |
| 873 | .small => try argv.append("-O2"), | |
| 874 | .fast, .safe => try argv.append("-O3"), | |
| 875 | 875 | } |
| 876 | 876 | |
| 877 | 877 | if (elf.entry_name) |name| { |
| ... | ... | @@ -1414,9 +1414,9 @@ fn wasmLink(lld: *Lld, arena: Allocator) !void { |
| 1414 | 1414 | |
| 1415 | 1415 | if (comp.config.lto != .none) { |
| 1416 | 1416 | switch (comp.root_mod.optimize_mode) { |
| 1417 | .Debug => {}, | |
| 1418 | .ReleaseSmall => try argv.append("-O2"), | |
| 1419 | .ReleaseFast, .ReleaseSafe => try argv.append("-O3"), | |
| 1417 | .debug => {}, | |
| 1418 | .small => try argv.append("-O2"), | |
| 1419 | .fast, .safe => try argv.append("-O3"), | |
| 1420 | 1420 | } |
| 1421 | 1421 | } |
| 1422 | 1422 |
src/link/MachO.zig+1-1| ... | ... | @@ -181,7 +181,7 @@ pub fn createEmpty( |
| 181 | 181 | .tag = .macho, |
| 182 | 182 | .comp = comp, |
| 183 | 183 | .emit = emit, |
| 184 | .gc_sections = options.gc_sections orelse (optimize_mode != .Debug), | |
| 184 | .gc_sections = options.gc_sections orelse (optimize_mode != .debug), | |
| 185 | 185 | .print_gc_sections = options.print_gc_sections, |
| 186 | 186 | .stack_size = options.stack_size orelse 16777216, |
| 187 | 187 | .allow_shlib_undefined = allow_shlib_undefined, |
src/link/MachO/ZigObject.zig+4-4| ... | ... | @@ -946,8 +946,8 @@ fn updateNavCode( |
| 946 | 946 | const target = &mod.resolved_target.result; |
| 947 | 947 | const required_alignment = switch (nav.resolved.?.@"align") { |
| 948 | 948 | .none => switch (mod.optimize_mode) { |
| 949 | .Debug, .ReleaseSafe, .ReleaseFast => target_util.defaultFunctionAlignment(target), | |
| 950 | .ReleaseSmall => target_util.minFunctionAlignment(target), | |
| 949 | .debug, .safe, .fast => target_util.defaultFunctionAlignment(target), | |
| 950 | .small => target_util.minFunctionAlignment(target), | |
| 951 | 951 | }, |
| 952 | 952 | else => |a| a.maxStrict(target_util.minFunctionAlignment(target)), |
| 953 | 953 | }; |
| ... | ... | @@ -1172,8 +1172,8 @@ fn getNavOutputSection( |
| 1172 | 1172 | if (nav.resolved.?.@"const") return macho_file.zig_const_sect_index.?; |
| 1173 | 1173 | if (nav_val.isUndef(zcu)) |
| 1174 | 1174 | return switch (zcu.navFileScope(nav_index).mod.?.optimize_mode) { |
| 1175 | .Debug, .ReleaseSafe => macho_file.zig_data_sect_index.?, | |
| 1176 | .ReleaseFast, .ReleaseSmall => macho_file.zig_bss_sect_index.?, | |
| 1175 | .debug, .safe => macho_file.zig_data_sect_index.?, | |
| 1176 | .fast, .small => macho_file.zig_bss_sect_index.?, | |
| 1177 | 1177 | }; |
| 1178 | 1178 | for (code) |byte| { |
| 1179 | 1179 | if (byte != 0) break; |
src/main.zig+25-26| ... | ... | @@ -44,9 +44,9 @@ pub const std_options: std.Options = .{ |
| 44 | 44 | .logFn = log, |
| 45 | 45 | |
| 46 | 46 | .log_level = switch (builtin.mode) { |
| 47 | .Debug => .debug, | |
| 48 | .ReleaseSafe, .ReleaseFast => .info, | |
| 49 | .ReleaseSmall => .err, | |
| 47 | .debug => .debug, | |
| 48 | .safe, .fast => .info, | |
| 49 | .small => .err, | |
| 50 | 50 | }, |
| 51 | 51 | }; |
| 52 | 52 | pub const std_options_cwd = if (native_os == .wasi) wasi_cwd else null; |
| ... | ... | @@ -158,8 +158,8 @@ pub fn log( |
| 158 | 158 | |
| 159 | 159 | const use_safe_allocator = build_options.debug_gpa or |
| 160 | 160 | (native_os != .wasi and !builtin.link_libc and switch (builtin.mode) { |
| 161 | .Debug, .ReleaseSafe => true, | |
| 162 | .ReleaseFast, .ReleaseSmall => false, | |
| 161 | .debug, .safe => true, | |
| 162 | .fast, .small => false, | |
| 163 | 163 | }); |
| 164 | 164 | |
| 165 | 165 | var safe_allocator: std.heap.SafeAllocator = .init(std.heap.page_allocator, .{ |
| ... | ... | @@ -360,7 +360,7 @@ fn mainArgs( |
| 360 | 360 | .prepend_zig_exe_path = true, |
| 361 | 361 | .prepend_seed = true, |
| 362 | 362 | .debug_env_var = .ZIG_DEBUG_MAKER, |
| 363 | .release_mode = .ReleaseSafe, | |
| 363 | .release_mode = .safe, | |
| 364 | 364 | }); |
| 365 | 365 | }, |
| 366 | 366 | .clang, .@"-cc1", .@"-cc1as" => { |
| ... | ... | @@ -568,10 +568,10 @@ const usage_build_generic = |
| 568 | 568 | \\Per-Module Compile Options: |
| 569 | 569 | \\ -target [name] <arch><sub>-<os>-<abi> see the targets command |
| 570 | 570 | \\ -O [mode] Choose what to optimize for |
| 571 | \\ Debug (default) Optimizations off, safety on | |
| 572 | \\ ReleaseFast Optimize for performance, safety off | |
| 573 | \\ ReleaseSafe Optimize for performance, safety on | |
| 574 | \\ ReleaseSmall Optimize for small binary, safety off | |
| 571 | \\ debug (default) Prioritize bug detection, accurate debug info, compilation speed | |
| 572 | \\ fast Prioritize runtime performance. Safety checks off. | |
| 573 | \\ safe Enable both safety checks and machine code optimizations | |
| 574 | \\ small Prioritize small binary size. Safety checks off. | |
| 575 | 575 | \\ -ofmt=[fmt] Override target object format |
| 576 | 576 | \\ elf Executable and Linking Format |
| 577 | 577 | \\ c C source code |
| ... | ... | @@ -994,7 +994,7 @@ fn buildOutputType( |
| 994 | 994 | var minor_subsystem_version: ?u16 = null; |
| 995 | 995 | var mingw_unicode_entry_point: bool = false; |
| 996 | 996 | var enable_link_snapshots: bool = false; |
| 997 | var debug_compiler_runtime_libs: ?std.lang.OptimizeMode = null; | |
| 997 | var debug_compiler_runtime_libs: ?std.lang.Optimize = null; | |
| 998 | 998 | var install_name: ?[]const u8 = null; |
| 999 | 999 | var hash_style: link.File.Lld.Elf.HashStyle = .both; |
| 1000 | 1000 | var entitlements: ?[]const u8 = null; |
| ... | ... | @@ -1433,7 +1433,7 @@ fn buildOutputType( |
| 1433 | 1433 | enable_link_snapshots = true; |
| 1434 | 1434 | } |
| 1435 | 1435 | } else if (mem.eql(u8, arg, "--debug-rt")) { |
| 1436 | debug_compiler_runtime_libs = .Debug; | |
| 1436 | debug_compiler_runtime_libs = .debug; | |
| 1437 | 1437 | } else if (mem.cutPrefix(u8, arg, "--debug-rt=")) |rest| { |
| 1438 | 1438 | debug_compiler_runtime_libs = parseOptimizeMode(rest); |
| 1439 | 1439 | } else if (mem.eql(u8, arg, "--debug-incremental")) { |
| ... | ... | @@ -2271,18 +2271,18 @@ fn buildOutputType( |
| 2271 | 2271 | if (mem.eql(u8, level, "s") or |
| 2272 | 2272 | mem.eql(u8, level, "z")) |
| 2273 | 2273 | { |
| 2274 | mod_opts.optimize_mode = .ReleaseSmall; | |
| 2274 | mod_opts.optimize_mode = .small; | |
| 2275 | 2275 | } else if (mem.eql(u8, level, "1") or |
| 2276 | 2276 | mem.eql(u8, level, "2") or |
| 2277 | 2277 | mem.eql(u8, level, "3") or |
| 2278 | 2278 | mem.eql(u8, level, "4") or |
| 2279 | 2279 | mem.eql(u8, level, "fast")) |
| 2280 | 2280 | { |
| 2281 | mod_opts.optimize_mode = .ReleaseFast; | |
| 2281 | mod_opts.optimize_mode = .fast; | |
| 2282 | 2282 | } else if (mem.eql(u8, level, "g") or |
| 2283 | 2283 | mem.eql(u8, level, "0")) |
| 2284 | 2284 | { |
| 2285 | mod_opts.optimize_mode = .Debug; | |
| 2285 | mod_opts.optimize_mode = .debug; | |
| 2286 | 2286 | } else { |
| 2287 | 2287 | try cc_argv.appendSlice(arena, it.other_args); |
| 2288 | 2288 | } |
| ... | ... | @@ -2356,9 +2356,9 @@ fn buildOutputType( |
| 2356 | 2356 | // `sanitize_c` will resolve to! So we either have to pick `off` or `full`. |
| 2357 | 2357 | // |
| 2358 | 2358 | // `full` has the potential to be problematic if `optimize_mode` turns out to |
| 2359 | // be `ReleaseFast`/`ReleaseSmall` because the user will get a slower and larger | |
| 2359 | // be `fast`/`small` because the user will get a slower and larger | |
| 2360 | 2360 | // binary than expected. On the other hand, if `optimize_mode` turns out to be |
| 2361 | // `Debug`/`ReleaseSafe`, `off` would mean UBSan would unexpectedly be disabled. | |
| 2361 | // `debug`/`safe`, `off` would mean UBSan would unexpectedly be disabled. | |
| 2362 | 2362 | // |
| 2363 | 2363 | // `off` seems very slightly less bad, so let's go with that. |
| 2364 | 2364 | mod_opts.sanitize_c = .off; |
| ... | ... | @@ -2972,8 +2972,8 @@ fn buildOutputType( |
| 2972 | 2972 | } |
| 2973 | 2973 | |
| 2974 | 2974 | if (mod_opts.sanitize_c) |wsc| { |
| 2975 | if (wsc != .off and mod_opts.optimize_mode == .ReleaseFast) { | |
| 2976 | mod_opts.optimize_mode = .ReleaseSafe; | |
| 2975 | if (wsc != .off and mod_opts.optimize_mode == .fast) { | |
| 2976 | mod_opts.optimize_mode = .safe; | |
| 2977 | 2977 | } |
| 2978 | 2978 | } |
| 2979 | 2979 | |
| ... | ... | @@ -4875,7 +4875,7 @@ const JitCmdOptions = struct { |
| 4875 | 4875 | /// Send error bundles via std.zig.Server over stdout |
| 4876 | 4876 | server: bool = false, |
| 4877 | 4877 | debug_env_var: EnvVar = .ZIG_DEBUG_CMD, |
| 4878 | release_mode: std.lang.OptimizeMode = .ReleaseFast, | |
| 4878 | release_mode: std.lang.Optimize = .fast, | |
| 4879 | 4879 | }; |
| 4880 | 4880 | |
| 4881 | 4881 | fn jitCmd( |
| ... | ... | @@ -4926,11 +4926,11 @@ fn jitCmdInner( |
| 4926 | 4926 | const self_exe_path = process.executablePathAlloc(io, arena) catch |err| |
| 4927 | 4927 | fatal("unable to find self exe path: {t}", .{err}); |
| 4928 | 4928 | |
| 4929 | const optimize_mode: std.lang.OptimizeMode = if (options.debug_env_var.isSet(environ_map)) | |
| 4930 | .Debug | |
| 4929 | const optimize_mode: std.lang.Optimize = if (options.debug_env_var.isSet(environ_map)) | |
| 4930 | .debug | |
| 4931 | 4931 | else |
| 4932 | 4932 | options.release_mode; |
| 4933 | const strip = optimize_mode != .Debug; | |
| 4933 | const strip = optimize_mode != .debug; | |
| 4934 | 4934 | var override_lib_dir: ?[]const u8 = EnvVar.ZIG_LIB_DIR.get(environ_map); |
| 4935 | 4935 | const override_global_cache_dir: ?[]const u8 = EnvVar.ZIG_GLOBAL_CACHE_DIR.get(environ_map); |
| 4936 | 4936 | |
| ... | ... | @@ -6008,9 +6008,8 @@ fn parseRcIncludes(arg: []const u8) std.zig.RcIncludes { |
| 6008 | 6008 | fatal("unsupported rc includes type: {q}", .{arg}); |
| 6009 | 6009 | } |
| 6010 | 6010 | |
| 6011 | fn parseOptimizeMode(s: []const u8) std.lang.OptimizeMode { | |
| 6012 | return stringToEnum(std.lang.OptimizeMode, s) orelse | |
| 6013 | fatal("unrecognized optimization mode: {q}", .{s}); | |
| 6011 | fn parseOptimizeMode(s: []const u8) std.lang.Optimize { | |
| 6012 | return std.lang.Optimize.fromString(s) orelse fatal("unrecognized optimization mode: {q}", .{s}); | |
| 6014 | 6013 | } |
| 6015 | 6014 | |
| 6016 | 6015 | fn parseWasiExecModel(s: []const u8) std.lang.WasiExecModel { |
src/target.zig+5-5| ... | ... | @@ -357,12 +357,12 @@ pub fn libcProvidesStackProtector(target: *const std.Target) bool { |
| 357 | 357 | |
| 358 | 358 | /// Returns true if `@returnAddress()` is supported by the target and has a |
| 359 | 359 | /// reasonably performant implementation for the requested optimization mode. |
| 360 | pub fn supportsReturnAddress(target: *const std.Target, optimize: std.lang.OptimizeMode) bool { | |
| 360 | pub fn supportsReturnAddress(target: *const std.Target, optimize: std.lang.Optimize) bool { | |
| 361 | 361 | return switch (target.cpu.arch) { |
| 362 | 362 | // Emscripten currently implements `emscripten_return_address()` by calling |
| 363 | 363 | // out into JavaScript and parsing a stack trace, which introduces significant |
| 364 | 364 | // overhead that we would prefer to avoid in release builds. |
| 365 | .wasm32, .wasm64 => target.os.tag == .emscripten and optimize == .Debug, | |
| 365 | .wasm32, .wasm64 => target.os.tag == .emscripten and optimize == .debug, | |
| 366 | 366 | .bpfel, .bpfeb => false, |
| 367 | 367 | .spirv32, .spirv64 => false, |
| 368 | 368 | else => true, |
| ... | ... | @@ -417,11 +417,11 @@ pub fn hasDebugInfo(target: *const std.Target) bool { |
| 417 | 417 | }; |
| 418 | 418 | } |
| 419 | 419 | |
| 420 | pub fn defaultCompilerRtOptimizeMode(target: *const std.Target) std.lang.OptimizeMode { | |
| 420 | pub fn defaultCompilerRtOptimizeMode(target: *const std.Target) std.lang.Optimize { | |
| 421 | 421 | if (target.cpu.arch.isWasm() and target.os.tag == .freestanding) { |
| 422 | return .ReleaseSmall; | |
| 422 | return .small; | |
| 423 | 423 | } else { |
| 424 | return .ReleaseFast; | |
| 424 | return .fast; | |
| 425 | 425 | } |
| 426 | 426 | } |
| 427 | 427 |
test/behavior/cast.zig+1-1| ... | ... | @@ -498,7 +498,7 @@ test "array coercion to undefined at runtime" { |
| 498 | 498 | |
| 499 | 499 | @setRuntimeSafety(true); |
| 500 | 500 | |
| 501 | if (builtin.mode != .Debug and builtin.mode != .ReleaseSafe) { | |
| 501 | if (builtin.mode != .debug and builtin.mode != .safe) { | |
| 502 | 502 | return error.SkipZigTest; |
| 503 | 503 | } |
| 504 | 504 |
test/behavior/floatop.zig+1-1| ... | ... | @@ -1678,7 +1678,7 @@ test "runtime isNan(inf * 0)" { |
| 1678 | 1678 | |
| 1679 | 1679 | test "optimized float mode" { |
| 1680 | 1680 | if (builtin.zig_backend != .stage2_llvm) return error.SkipZigTest; |
| 1681 | if (builtin.mode == .Debug) return error.SkipZigTest; | |
| 1681 | if (builtin.mode == .debug) return error.SkipZigTest; | |
| 1682 | 1682 | |
| 1683 | 1683 | const big = 0x1p40; |
| 1684 | 1684 | const small = 0.001; |
test/behavior/int128.zig+1-1| ... | ... | @@ -31,7 +31,7 @@ test "undefined 128 bit int" { |
| 31 | 31 | @setRuntimeSafety(true); |
| 32 | 32 | |
| 33 | 33 | // TODO implement @setRuntimeSafety |
| 34 | if (builtin.mode != .Debug and builtin.mode != .ReleaseSafe) { | |
| 34 | if (builtin.mode != .debug and builtin.mode != .safe) { | |
| 35 | 35 | return error.SkipZigTest; |
| 36 | 36 | } |
| 37 | 37 |
test/c_abi/main.zig+3-3| ... | ... | @@ -16754,7 +16754,7 @@ test "CFF: Zig returns to C" { |
| 16754 | 16754 | } |
| 16755 | 16755 | test "CFF: C passes to Zig" { |
| 16756 | 16756 | if (builtin.target.cpu.arch == .x86) return error.SkipZigTest; |
| 16757 | if (builtin.cpu.arch.isRISCV() and builtin.mode != .Debug) return error.SkipZigTest; | |
| 16757 | if (builtin.cpu.arch.isRISCV() and builtin.mode != .debug) return error.SkipZigTest; | |
| 16758 | 16758 | if (builtin.cpu.arch.isMIPS64()) return error.SkipZigTest; |
| 16759 | 16759 | if (builtin.cpu.arch.isPowerPC()) return error.SkipZigTest; |
| 16760 | 16760 | if (builtin.cpu.arch.isLoongArch()) return error.SkipZigTest; |
| ... | ... | @@ -16764,7 +16764,7 @@ test "CFF: C passes to Zig" { |
| 16764 | 16764 | try expectOk(c_send_CFF()); |
| 16765 | 16765 | } |
| 16766 | 16766 | test "CFF: C returns to Zig" { |
| 16767 | if (builtin.cpu.arch.isRISCV() and builtin.mode != .Debug) return error.SkipZigTest; | |
| 16767 | if (builtin.cpu.arch.isRISCV() and builtin.mode != .debug) return error.SkipZigTest; | |
| 16768 | 16768 | if (builtin.cpu.arch.isMIPS64()) return error.SkipZigTest; |
| 16769 | 16769 | if (builtin.cpu.arch.isPowerPC()) return error.SkipZigTest; |
| 16770 | 16770 | if (builtin.cpu.arch.isLoongArch()) return error.SkipZigTest; |
| ... | ... | @@ -16920,7 +16920,7 @@ extern fn c_f16_struct(f16_struct) f16_struct; |
| 16920 | 16920 | test "f16 struct" { |
| 16921 | 16921 | if (builtin.target.cpu.arch.isMIPS64()) return error.SkipZigTest; |
| 16922 | 16922 | if (builtin.target.cpu.arch.isPowerPC32()) return error.SkipZigTest; |
| 16923 | if (builtin.cpu.arch.isArm() and builtin.mode != .Debug) return error.SkipZigTest; | |
| 16923 | if (builtin.cpu.arch.isArm() and builtin.mode != .debug) return error.SkipZigTest; | |
| 16924 | 16924 | if (builtin.cpu.arch == .s390x) return error.SkipZigTest; |
| 16925 | 16925 | if (builtin.cpu.arch == .x86 and builtin.os.tag == .windows) return error.SkipZigTest; |
| 16926 | 16926 |
test/cases/compile_errors/invalid_member_of_builtin_enum.zig+1-1| ... | ... | @@ -6,5 +6,5 @@ export fn entry() void { |
| 6 | 6 | |
| 7 | 7 | // error |
| 8 | 8 | // |
| 9 | // :3:35: error: enum 'lang.OptimizeMode' has no member named 'x86' | |
| 9 | // :3:35: error: enum 'lang.Optimize' has no member named 'x86' | |
| 10 | 10 | // : note: enum declared here |
test/src/ErrorTrace.zig+2-2| ... | ... | @@ -60,9 +60,9 @@ fn addCaseConfig( |
| 60 | 60 | const b = self.b; |
| 61 | 61 | |
| 62 | 62 | const error_tracing: bool = tracing: { |
| 63 | if (optimize == .Debug) break :tracing true; | |
| 63 | if (optimize == .debug) break :tracing true; | |
| 64 | 64 | if (backend != .llvm) break :tracing true; |
| 65 | if (optimize == .ReleaseSmall) break :tracing false; | |
| 65 | if (optimize == .small) break :tracing false; | |
| 66 | 66 | for (case.disable_trace_optimized) |disable| { |
| 67 | 67 | const d_arch, const d_os = disable; |
| 68 | 68 | if (target.result.cpu.arch == d_arch and target.result.os.tag == d_os) { |
test/standalone/dependency_options/build.zig+9-9| ... | ... | @@ -11,11 +11,11 @@ pub fn build(b: *std.Build) !void { |
| 11 | 11 | const none_specified_mod = none_specified.module("dummy"); |
| 12 | 12 | if (!none_specified_mod.resolved_target.?.query.eql(b.graph.host.query)) return error.TestFailed; |
| 13 | 13 | const expected_optimize: std.builtin.OptimizeMode = switch (b.graph.release_mode) { |
| 14 | .off => .Debug, | |
| 14 | .off => .debug, | |
| 15 | 15 | .any => unreachable, |
| 16 | .fast => .ReleaseFast, | |
| 17 | .safe => .ReleaseSafe, | |
| 18 | .small => .ReleaseSmall, | |
| 16 | .fast => .fast, | |
| 17 | .safe => .safe, | |
| 18 | .small => .small, | |
| 19 | 19 | }; |
| 20 | 20 | if (none_specified_mod.optimize.? != expected_optimize) return error.TestFailed; |
| 21 | 21 | |
| ... | ... | @@ -44,7 +44,7 @@ pub fn build(b: *std.Build) !void { |
| 44 | 44 | |
| 45 | 45 | const all_specified = b.dependency("other", .{ |
| 46 | 46 | .target = b.resolveTargetQuery(.{ .cpu_arch = .x86_64, .os_tag = .windows, .abi = .gnu }), |
| 47 | .optimize = @as(std.builtin.OptimizeMode, .ReleaseSafe), | |
| 47 | .optimize = @as(std.builtin.OptimizeMode, .safe), | |
| 48 | 48 | .bool = @as(bool, true), |
| 49 | 49 | .int = @as(i64, 123), |
| 50 | 50 | .float = @as(f64, 0.5), |
| ... | ... | @@ -66,11 +66,11 @@ pub fn build(b: *std.Build) !void { |
| 66 | 66 | if (all_specified_mod.resolved_target.?.result.cpu.arch != .x86_64) return error.TestFailed; |
| 67 | 67 | if (all_specified_mod.resolved_target.?.result.os.tag != .windows) return error.TestFailed; |
| 68 | 68 | if (all_specified_mod.resolved_target.?.result.abi != .gnu) return error.TestFailed; |
| 69 | if (all_specified_mod.optimize.? != .ReleaseSafe) return error.TestFailed; | |
| 69 | if (all_specified_mod.optimize.? != .safe) return error.TestFailed; | |
| 70 | 70 | |
| 71 | 71 | const all_specified_optional = b.dependency("other", .{ |
| 72 | 72 | .target = @as(?std.Build.ResolvedTarget, b.resolveTargetQuery(.{ .cpu_arch = .x86_64, .os_tag = .windows, .abi = .gnu })), |
| 73 | .optimize = @as(?std.builtin.OptimizeMode, .ReleaseSafe), | |
| 73 | .optimize = @as(?std.builtin.OptimizeMode, .safe), | |
| 74 | 74 | .bool = @as(?bool, true), |
| 75 | 75 | .int = @as(?i64, 123), |
| 76 | 76 | .float = @as(?f64, 0.5), |
| ... | ... | @@ -92,7 +92,7 @@ pub fn build(b: *std.Build) !void { |
| 92 | 92 | |
| 93 | 93 | const all_specified_literal = b.dependency("other", .{ |
| 94 | 94 | .target = b.resolveTargetQuery(.{ .cpu_arch = .x86_64, .os_tag = .windows, .abi = .gnu }), |
| 95 | .optimize = .ReleaseSafe, | |
| 95 | .optimize = .safe, | |
| 96 | 96 | .bool = true, |
| 97 | 97 | .int = 123, |
| 98 | 98 | .float = 0.5, |
| ... | ... | @@ -130,7 +130,7 @@ pub fn build(b: *std.Build) !void { |
| 130 | 130 | // to the same cached dependency instance. |
| 131 | 131 | const all_specified_alt = b.dependency("other", .{ |
| 132 | 132 | .target = @as(std.Target.Query, .{ .cpu_arch = .x86_64, .os_tag = .windows, .abi = .gnu }), |
| 133 | .optimize = "ReleaseSafe", | |
| 133 | .optimize = "safe", | |
| 134 | 134 | .bool = .true, |
| 135 | 135 | .int = "123", |
| 136 | 136 | .float = @as(f16, 0.5), |
test/standalone/simple/build.zig+5-5| ... | ... | @@ -13,26 +13,26 @@ pub fn build(b: *std.Build) void { |
| 13 | 13 | var optimize_modes_buf: [4]std.builtin.OptimizeMode = undefined; |
| 14 | 14 | var optimize_modes_len: usize = 0; |
| 15 | 15 | if (!skip_debug) { |
| 16 | optimize_modes_buf[optimize_modes_len] = .Debug; | |
| 16 | optimize_modes_buf[optimize_modes_len] = .debug; | |
| 17 | 17 | optimize_modes_len += 1; |
| 18 | 18 | } |
| 19 | 19 | if (!skip_release_safe) { |
| 20 | optimize_modes_buf[optimize_modes_len] = .ReleaseSafe; | |
| 20 | optimize_modes_buf[optimize_modes_len] = .safe; | |
| 21 | 21 | optimize_modes_len += 1; |
| 22 | 22 | } |
| 23 | 23 | if (!skip_release_fast) { |
| 24 | optimize_modes_buf[optimize_modes_len] = .ReleaseFast; | |
| 24 | optimize_modes_buf[optimize_modes_len] = .fast; | |
| 25 | 25 | optimize_modes_len += 1; |
| 26 | 26 | } |
| 27 | 27 | if (!skip_release_small) { |
| 28 | optimize_modes_buf[optimize_modes_len] = .ReleaseSmall; | |
| 28 | optimize_modes_buf[optimize_modes_len] = .small; | |
| 29 | 29 | optimize_modes_len += 1; |
| 30 | 30 | } |
| 31 | 31 | const optimize_modes = optimize_modes_buf[0..optimize_modes_len]; |
| 32 | 32 | |
| 33 | 33 | for (cases) |case| { |
| 34 | 34 | for (optimize_modes) |optimize| { |
| 35 | if (!case.all_modes and optimize != .Debug) continue; | |
| 35 | if (!case.all_modes and optimize != .debug) continue; | |
| 36 | 36 | if (case.os_filter) |os_tag| { |
| 37 | 37 | if (os_tag != builtin.os.tag) continue; |
| 38 | 38 | } |
test/tests.zig+22-22| ... | ... | @@ -23,7 +23,7 @@ pub const LinkContext = @import("src/Link.zig"); |
| 23 | 23 | const ModuleTestTarget = struct { |
| 24 | 24 | linkage: ?std.builtin.LinkMode = null, |
| 25 | 25 | target: std.Target.Query = .{}, |
| 26 | optimize_mode: std.builtin.OptimizeMode = .Debug, | |
| 26 | optimize_mode: std.builtin.OptimizeMode = .debug, | |
| 27 | 27 | link_libc: ?bool = null, |
| 28 | 28 | single_threaded: ?bool = null, |
| 29 | 29 | use_llvm: ?bool = null, |
| ... | ... | @@ -57,38 +57,38 @@ const module_test_targets = blk: { |
| 57 | 57 | }, |
| 58 | 58 | |
| 59 | 59 | .{ |
| 60 | .optimize_mode = .ReleaseFast, | |
| 60 | .optimize_mode = .fast, | |
| 61 | 61 | }, |
| 62 | 62 | .{ |
| 63 | 63 | .link_libc = true, |
| 64 | .optimize_mode = .ReleaseFast, | |
| 64 | .optimize_mode = .fast, | |
| 65 | 65 | }, |
| 66 | 66 | .{ |
| 67 | .optimize_mode = .ReleaseFast, | |
| 67 | .optimize_mode = .fast, | |
| 68 | 68 | .single_threaded = true, |
| 69 | 69 | }, |
| 70 | 70 | |
| 71 | 71 | .{ |
| 72 | .optimize_mode = .ReleaseSafe, | |
| 72 | .optimize_mode = .safe, | |
| 73 | 73 | }, |
| 74 | 74 | .{ |
| 75 | 75 | .link_libc = true, |
| 76 | .optimize_mode = .ReleaseSafe, | |
| 76 | .optimize_mode = .safe, | |
| 77 | 77 | }, |
| 78 | 78 | .{ |
| 79 | .optimize_mode = .ReleaseSafe, | |
| 79 | .optimize_mode = .safe, | |
| 80 | 80 | .single_threaded = true, |
| 81 | 81 | }, |
| 82 | 82 | |
| 83 | 83 | .{ |
| 84 | .optimize_mode = .ReleaseSmall, | |
| 84 | .optimize_mode = .small, | |
| 85 | 85 | }, |
| 86 | 86 | .{ |
| 87 | 87 | .link_libc = true, |
| 88 | .optimize_mode = .ReleaseSmall, | |
| 88 | .optimize_mode = .small, | |
| 89 | 89 | }, |
| 90 | 90 | .{ |
| 91 | .optimize_mode = .ReleaseSmall, | |
| 91 | .optimize_mode = .small, | |
| 92 | 92 | .single_threaded = true, |
| 93 | 93 | }, |
| 94 | 94 | |
| ... | ... | @@ -200,7 +200,7 @@ const module_test_targets = blk: { |
| 200 | 200 | // }, |
| 201 | 201 | // .use_llvm = false, |
| 202 | 202 | // .use_lld = false, |
| 203 | // .optimize_mode = .ReleaseFast, | |
| 203 | // .optimize_mode = .fast, | |
| 204 | 204 | // .strip = true, |
| 205 | 205 | // .skip_modules = &.{"std"}, // TODO get these passing |
| 206 | 206 | //}, |
| ... | ... | @@ -213,7 +213,7 @@ const module_test_targets = blk: { |
| 213 | 213 | // }, |
| 214 | 214 | // .use_llvm = false, |
| 215 | 215 | // .use_lld = false, |
| 216 | // .optimize_mode = .ReleaseFast, | |
| 216 | // .optimize_mode = .fast, | |
| 217 | 217 | // .strip = true, |
| 218 | 218 | // .skip_modules = &.{"std"}, // TODO get these passing |
| 219 | 219 | //}, |
| ... | ... | @@ -1257,7 +1257,7 @@ const module_test_targets = blk: { |
| 1257 | 1257 | // }, |
| 1258 | 1258 | // .use_llvm = false, |
| 1259 | 1259 | // .use_lld = false, |
| 1260 | // .optimize_mode = .ReleaseFast, | |
| 1260 | // .optimize_mode = .fast, | |
| 1261 | 1261 | // .strip = true, |
| 1262 | 1262 | //}, |
| 1263 | 1263 | |
| ... | ... | @@ -2063,7 +2063,7 @@ const c_abi_targets = blk: { |
| 2063 | 2063 | |
| 2064 | 2064 | const LinkTarget = struct { |
| 2065 | 2065 | target: std.Target.Query = .{}, |
| 2066 | optimize_mode: std.builtin.OptimizeMode = .Debug, | |
| 2066 | optimize_mode: std.builtin.OptimizeMode = .debug, | |
| 2067 | 2067 | link_libc: bool = false, |
| 2068 | 2068 | use_llvm: bool = false, |
| 2069 | 2069 | use_lld: bool = false, |
| ... | ... | @@ -2368,7 +2368,7 @@ pub fn addStackTraceTests( |
| 2368 | 2368 | .root_module = b.createModule(.{ |
| 2369 | 2369 | .root_source_file = b.path("test/src/convert-stack-trace.zig"), |
| 2370 | 2370 | .target = b.graph.host, |
| 2371 | .optimize = .Debug, | |
| 2371 | .optimize = .debug, | |
| 2372 | 2372 | }), |
| 2373 | 2373 | }); |
| 2374 | 2374 | |
| ... | ... | @@ -2422,7 +2422,7 @@ pub fn addErrorTraceTests( |
| 2422 | 2422 | .root_module = b.createModule(.{ |
| 2423 | 2423 | .root_source_file = b.path("test/src/convert-stack-trace.zig"), |
| 2424 | 2424 | .target = b.graph.host, |
| 2425 | .optimize = .Debug, | |
| 2425 | .optimize = .debug, | |
| 2426 | 2426 | }), |
| 2427 | 2427 | }); |
| 2428 | 2428 | |
| ... | ... | @@ -2486,10 +2486,10 @@ pub fn addStandaloneTests( |
| 2486 | 2486 | .enable_ios_sdk = enable_ios_sdk, |
| 2487 | 2487 | .enable_macos_sdk = enable_macos_sdk, |
| 2488 | 2488 | .enable_symlinks_windows = enable_symlinks_windows, |
| 2489 | .simple_skip_debug = mem.indexOfScalar(OptimizeMode, optimize_modes, .Debug) == null, | |
| 2490 | .simple_skip_release_safe = mem.indexOfScalar(OptimizeMode, optimize_modes, .ReleaseSafe) == null, | |
| 2491 | .simple_skip_release_fast = mem.indexOfScalar(OptimizeMode, optimize_modes, .ReleaseFast) == null, | |
| 2492 | .simple_skip_release_small = mem.indexOfScalar(OptimizeMode, optimize_modes, .ReleaseSmall) == null, | |
| 2489 | .simple_skip_debug = mem.indexOfScalar(OptimizeMode, optimize_modes, .debug) == null, | |
| 2490 | .simple_skip_release_safe = mem.indexOfScalar(OptimizeMode, optimize_modes, .safe) == null, | |
| 2491 | .simple_skip_release_fast = mem.indexOfScalar(OptimizeMode, optimize_modes, .fast) == null, | |
| 2492 | .simple_skip_release_small = mem.indexOfScalar(OptimizeMode, optimize_modes, .small) == null, | |
| 2493 | 2493 | }); |
| 2494 | 2494 | const test_cases_dep_step = test_cases_dep.builder.default_step; |
| 2495 | 2495 | test_cases_dep_step.name = b.dupe(test_cases_dep_name); |
| ... | ... | @@ -3057,7 +3057,7 @@ pub fn wouldUseLlvm(use_llvm: ?bool, query: std.Target.Query, optimize_mode: Opt |
| 3057 | 3057 | if (use_llvm) |x| return x; |
| 3058 | 3058 | if (query.ofmt == .c) return false; |
| 3059 | 3059 | switch (optimize_mode) { |
| 3060 | .Debug => {}, | |
| 3060 | .debug => {}, | |
| 3061 | 3061 | else => return true, |
| 3062 | 3062 | } |
| 3063 | 3063 | const cpu_arch = query.cpu_arch orelse builtin.cpu.arch; |
| ... | ... | @@ -3314,7 +3314,7 @@ pub fn addIncrementalTests(b: *std.Build, test_step: *Step, test_filters: []cons |
| 3314 | 3314 | .root_module = b.createModule(.{ |
| 3315 | 3315 | .root_source_file = b.path("tools/incr-check.zig"), |
| 3316 | 3316 | .target = b.graph.host, |
| 3317 | .optimize = .Debug, | |
| 3317 | .optimize = .debug, | |
| 3318 | 3318 | }), |
| 3319 | 3319 | }); |
| 3320 | 3320 |
tools/doctest.zig+3-3| ... | ... | @@ -915,11 +915,11 @@ fn parseManifest(arena: Allocator, source_bytes: []const u8) !Code { |
| 915 | 915 | while (it.next()) |prefixed_line| { |
| 916 | 916 | const line = skipPrefix(prefixed_line); |
| 917 | 917 | if (mem.startsWith(u8, line, "optimize=")) { |
| 918 | mode = std.meta.stringToEnum(std.builtin.OptimizeMode, line["optimize=".len..]) orelse | |
| 919 | fatal("bad optimization mode line: '{s}'", .{line}); | |
| 918 | mode = std.builtin.Optimize.fromString(line["optimize=".len..]) orelse | |
| 919 | fatal("bad optimization mode line: {q}", .{line}); | |
| 920 | 920 | } else if (mem.startsWith(u8, line, "link_mode=")) { |
| 921 | 921 | link_mode = std.meta.stringToEnum(std.builtin.LinkMode, line["link_mode=".len..]) orelse |
| 922 | fatal("bad link mode line: '{s}'", .{line}); | |
| 922 | fatal("bad link mode line: {q}", .{line}); | |
| 923 | 923 | } else if (mem.startsWith(u8, line, "link_object=")) { |
| 924 | 924 | try link_objects.append(arena, line["link_object=".len..]); |
| 925 | 925 | } else if (mem.startsWith(u8, line, "additional_option=")) { |
tools/migrate_langref.zig+2-2| ... | ... | @@ -319,7 +319,7 @@ fn walk(arena: Allocator, io: Io, tokenizer: *Tokenizer, out_dir: Dir, w: anytyp |
| 319 | 319 | return parseError(tokenizer, code_kind_tok, "unrecognized code kind: {s}", .{code_kind_str}); |
| 320 | 320 | } |
| 321 | 321 | |
| 322 | var mode: std.builtin.OptimizeMode = .Debug; | |
| 322 | var mode: std.builtin.OptimizeMode = .debug; | |
| 323 | 323 | var link_objects = std.array_list.Managed([]const u8).init(arena); |
| 324 | 324 | var target_str: ?[]const u8 = null; |
| 325 | 325 | var link_libc = false; |
| ... | ... | @@ -403,7 +403,7 @@ fn walk(arena: Allocator, io: Io, tokenizer: *Tokenizer, out_dir: Dir, w: anytyp |
| 403 | 403 | }, |
| 404 | 404 | } |
| 405 | 405 | |
| 406 | if (mode != .Debug) | |
| 406 | if (mode != .debug) | |
| 407 | 407 | try code.print("// optimize={s}\n", .{@tagName(mode)}); |
| 408 | 408 | |
| 409 | 409 | for (link_objects.items) |link_object| { |