authorgravatar for andrew@ziglang.orgAndrew Kelley <andrew@ziglang.org> 2026-07-21 08:52:58+02:00
committergravatar for andrew@ziglang.orgAndrew Kelley <andrew@ziglang.org> 2026-07-21 08:52:58+02:00
log9485df42e938d5692c9066dee9152951a1aa1ad8
treea7d21af6c49c522465a0276f15051c4eb0bbd8a4
parent8807e934d840906f4b5bd2ad8fdaa6967c1922ea
parentf2c2ee28cbb2aad3943a5726ea5d1dfa427c96af

Merge pull request 'std.lang: rename OptimizeMode to Optimize' (#36238) from rename-opt-mode into master

Reviewed-on: https://codeberg.org/ziglang/zig/pulls/36238

86 files changed, 483 insertions(+), 428 deletions(-)

build.zig+8-8
......@@ -207,7 +207,7 @@ pub fn build(b: *std.Build) !void {
207207
208208 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: {
209209 if (strip == true) break :blk @as(u32, 0);
210 if (optimize != .Debug) break :blk 0;
210 if (optimize != .debug) break :blk 0;
211211 break :blk 4;
212212 };
213213
......@@ -256,7 +256,7 @@ pub fn build(b: *std.Build) !void {
256256 exe.root_module.link_libc = true;
257257 }
258258
259 const is_debug = optimize == .Debug;
259 const is_debug = optimize == .debug;
260260 const enable_debug_extensions = b.option(bool, "debug-extensions", "Enable commands and options useful for debugging the compiler") orelse is_debug;
261261 const enable_logging = b.option(bool, "log", "Enable debug logging with --debug-log") orelse is_debug;
262262
......@@ -403,8 +403,8 @@ pub fn build(b: *std.Build) !void {
403403 if (tracy) |tracy_dir| {
404404 const tracy_mod = b.createModule(.{
405405 .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,
408408 .root_source_file = null,
409409 .link_libc = true,
410410 .link_libcpp = true,
......@@ -434,19 +434,19 @@ pub fn build(b: *std.Build) !void {
434434 var chosen_opt_modes_buf: [4]std.lang.OptimizeMode = undefined;
435435 var chosen_mode_index: usize = 0;
436436 if (!skip_debug) {
437 chosen_opt_modes_buf[chosen_mode_index] = .Debug;
437 chosen_opt_modes_buf[chosen_mode_index] = .debug;
438438 chosen_mode_index += 1;
439439 }
440440 if (!skip_release_safe) {
441 chosen_opt_modes_buf[chosen_mode_index] = .ReleaseSafe;
441 chosen_opt_modes_buf[chosen_mode_index] = .safe;
442442 chosen_mode_index += 1;
443443 }
444444 if (!skip_release_fast) {
445 chosen_opt_modes_buf[chosen_mode_index] = .ReleaseFast;
445 chosen_opt_modes_buf[chosen_mode_index] = .fast;
446446 chosen_mode_index += 1;
447447 }
448448 if (!skip_release_small) {
449 chosen_opt_modes_buf[chosen_mode_index] = .ReleaseSmall;
449 chosen_opt_modes_buf[chosen_mode_index] = .small;
450450 chosen_mode_index += 1;
451451 }
452452 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) {
5959 }
6060
6161 const safety = switch (builtin.mode) {
62 .Debug, .ReleaseSafe => true,
63 .ReleaseFast, .ReleaseSmall => false,
62 .debug, .safe => true,
63 .fast, .small => false,
6464 };
6565 const max_addr_bits = switch (safety) {
6666 true => 48, // Ensures space for Canary bits.
lib/compiler/Maker.zig+3-3
......@@ -69,10 +69,10 @@ var debug_maker_leaks: bool = false;
6969
7070const AvoidableWebServer = if (builtin.single_threaded) void else WebServer;
7171
72const is_debug_mode = builtin.mode == .Debug;
72const is_debug_mode = builtin.mode == .debug;
7373const use_safe_allocator = switch (builtin.mode) {
74 .Debug, .ReleaseSafe => true,
75 .ReleaseFast, .ReleaseSmall => false,
74 .debug, .safe => true,
75 .fast, .small => false,
7676};
7777
7878const InstallPaths = struct {
lib/compiler/Maker/Step/TranslateC.zig+3-3
......@@ -49,9 +49,9 @@ pub fn make(
4949
5050 const opt: ?OptimizeMode = switch (conf_tc.flags.optimize) {
5151 .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,
5555 };
5656 if (opt) |o| argv.appendAssumeCapacity(try arena.print("-O{t}", .{o}));
5757
lib/compiler/Maker/WebServer.zig+1-1
......@@ -501,7 +501,7 @@ fn serveRequest(ws: *WebServer, req: *http.Server.Request) !void {
501501 if (mem.eql(u8, target, "/main.js")) return serveLibFile(ws, req, "build-web/main.js", "application/javascript");
502502 if (mem.eql(u8, target, "/style.css")) return serveLibFile(ws, req, "build-web/style.css", "text/css");
503503 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);
505505
506506 if (ws.fuzz) |*fuzz| {
507507 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
510510
511511pub fn templateIndex(w: *std.Io.Writer, fmt: []const u8, template: []const u8) std.Io.Writer.Error!usize {
512512 const i = std.mem.indexOf(u8, fmt, template) orelse {
513 if (@import("builtin").mode == .Debug) {
513 if (@import("builtin").mode == .debug) {
514514 std.debug.panic("template `{s}` not found in format string `{s}`", .{ template, fmt });
515515 }
516516 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 {
4040 defer threaded.deinit();
4141 const io = threaded.io();
4242
43 const fast_exit = @import("builtin").mode != .Debug;
43 const fast_exit = @import("builtin").mode != .debug;
4444
4545 const args = init.args.toSlice(arena) catch {
4646 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 {
142142 {
143143 try serveDocsFile(request, context, "docs/main.js", "application/javascript");
144144 } else if (std.mem.eql(u8, request.head.target, "/main.wasm")) {
145 try serveWasm(request, context, .ReleaseFast);
145 try serveWasm(request, context, .fast);
146146 } else if (std.mem.eql(u8, request.head.target, "/debug/main.wasm")) {
147 try serveWasm(request, context, .Debug);
147 try serveWasm(request, context, .debug);
148148 } else if (std.mem.eql(u8, request.head.target, "/sources.tar") or
149149 std.mem.eql(u8, request.head.target, "/debug/sources.tar"))
150150 {
lib/compiler/translate-c/main.zig+1-1
......@@ -9,7 +9,7 @@ const compiler_util = @import("../util.zig");
99
1010const Translator = @import("Translator.zig");
1111
12const fast_exit = @import("builtin").mode != .Debug;
12const fast_exit = @import("builtin").mode != .debug;
1313
1414pub fn main(init: process.Init) u8 {
1515 const gpa = init.gpa;
lib/compiler_rt/memcpy.zig+1-1
......@@ -11,7 +11,7 @@ comptime {
1111 .visibility = compiler_rt.visibility,
1212 };
1313
14 if (builtin.mode == .ReleaseSmall or builtin.zig_backend == .stage2_aarch64)
14 if (builtin.mode == .small or builtin.zig_backend == .stage2_aarch64)
1515 @export(&memcpySmall, export_options)
1616 else
1717 @export(&memcpyFast, export_options);
lib/compiler_rt/memmove.zig+1-1
......@@ -14,7 +14,7 @@ comptime {
1414 .visibility = compiler_rt.visibility,
1515 };
1616
17 if (builtin.mode == .ReleaseSmall or builtin.zig_backend == .stage2_aarch64)
17 if (builtin.mode == .small or builtin.zig_backend == .stage2_aarch64)
1818 @export(&memmoveSmall, export_options)
1919 else
2020 @export(&memmoveFast, export_options);
lib/docs/wasm/markdown/Document.zig+1-1
......@@ -108,7 +108,7 @@ pub const Node = struct {
108108 // In Debug and ReleaseSafe builds, there may be hidden extra fields
109109 // included for safety checks. Without such safety checks enabled,
110110 // 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) {
112112 assert(@sizeOf(Data) == 8);
113113 }
114114 }
lib/fuzzer.zig+3-3
......@@ -41,8 +41,8 @@ fn logOverride(
4141
4242var safe_allocator: std.heap.SafeAllocator = .init(std.heap.page_allocator, .{});
4343const 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,
4646};
4747
4848// Seperate from `exec` to allow initialization before `exec` is.
......@@ -1209,7 +1209,7 @@ const Fuzzer = struct {
12091209 f.req_bytes = @intCast(f.input_builder.bytes_table.items.len);
12101210 const quality: Input.Best.Quality = .{
12111211 .n_pcs = n_pcs: {
1212 @setRuntimeSafety(builtin.mode == .Debug); // Necessary for vectorization
1212 @setRuntimeSafety(builtin.mode == .debug); // Necessary for vectorization
12131213 var n: u32 = 0;
12141214 for (exec.pc_counters) |c| {
12151215 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
12101210 return null;
12111211 },
12121212 .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;
12191219 }
1220 log.err("expected -D{s} to be of type {q}", .{ name, @typeName(T) });
1221 b.markInvalidUserInput();
1222 return null;
12201223 },
12211224 },
12221225 .string => switch (option_ptr.value) {
......@@ -1262,23 +1265,36 @@ pub fn option(b: *Build, comptime T: type, name_raw: []const u8, description_raw
12621265 },
12631266 .scalar => |s| {
12641267 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;
12711280 },
12721281 .list => |lst| {
12731282 const Child = @typeInfo(T).pointer.child;
12741283 const new_list = graph.alloc(Child, lst.items.len);
12751284 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;
12821298 }
12831299 return new_list;
12841300 },
......@@ -1359,14 +1375,14 @@ pub fn standardOptimizeOption(b: *Build, options: StandardOptimizeOptionOptions)
13591375 }
13601376
13611377 return switch (graph.release_mode) {
1362 .off => .Debug,
1378 .off => .debug,
13631379 .any => {
13641380 std.debug.print("the project does not declare a preferred optimization mode. choose: --release=fast, --release=safe, or --release=small\n", .{});
13651381 process.exit(1);
13661382 },
1367 .fast => .ReleaseFast,
1368 .safe => .ReleaseSafe,
1369 .small => .ReleaseSmall,
1383 .fast => .fast,
1384 .safe => .safe,
1385 .small => .small,
13701386 };
13711387}
13721388
lib/std/Build/Configuration.zig+4-4
......@@ -1655,10 +1655,10 @@ pub const Module = struct {
16551655
16561656 pub fn init(o: ?std.builtin.OptimizeMode) Optimize {
16571657 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,
16621662 };
16631663 }
16641664 };
lib/std/Build/Step/Compile.zig+2-2
......@@ -390,7 +390,7 @@ pub fn create(owner: *std.Build, options: Options) *Compile {
390390 @tagName(options.kind)
391391 else
392392 owner.fmt("{t} {s}", .{ options.kind, name }),
393 @tagName(options.root_module.optimize orelse .Debug),
393 @tagName(options.root_module.optimize orelse .debug),
394394 resolved_target.query.zigTriple(arena) catch @panic("OOM"),
395395 });
396396
......@@ -645,7 +645,7 @@ pub fn producesPdbFile(compile: *Compile) bool {
645645 if (target.ofmt == .c) return false;
646646 if (compile.use_llvm == false) return false;
647647 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))
649649 {
650650 return false;
651651 }
lib/std/Io/Dispatch.zig+1-1
......@@ -3897,7 +3897,7 @@ fn fileMemoryMapDestroy(userdata: ?*anyopaque, mm: *File.MemoryMap) void {
38973897 if (memory.len == 0) return;
38983898 switch (c.errno(c.munmap(memory.ptr, memory.len))) {
38993899 .SUCCESS => {},
3900 else => |err| if (builtin.mode == .Debug)
3900 else => |err| if (builtin.mode == .debug)
39013901 std.log.err("failed to unmap {d} bytes at {*}: {t}", .{ memory.len, memory.ptr, err }),
39023902 }
39033903 mm.* = undefined;
lib/std/Io/Threaded.zig+6-6
......@@ -4,7 +4,7 @@ const builtin = @import("builtin");
44const native_os = builtin.os.tag;
55const is_windows = native_os == .windows;
66const is_darwin = native_os.isDarwin();
7const is_debug = builtin.mode == .Debug;
7const is_debug = builtin.mode == .debug;
88
99const std = @import("../std.zig");
1010const Io = std.Io;
......@@ -440,12 +440,12 @@ pub const UseFchmodat2 = if (have_fchmodat2 and !have_fchmodat_flags) enum {
440440pub const apc_align = @max(default_fn_align, 2);
441441
442442const default_fn_align = switch (builtin.mode) {
443 .Debug, .ReleaseSafe, .ReleaseFast => switch (builtin.cpu.arch) {
443 .debug, .safe, .fast => switch (builtin.cpu.arch) {
444444 else => |arch| @compileError("Unsupported architecture: " ++ @tagName(arch)),
445445 .arm, .thumb => 4,
446446 .aarch64, .x86, .x86_64 => 16,
447447 },
448 .ReleaseSmall => 1,
448 .small => 1,
449449};
450450
451451const Runnable = struct {
......@@ -18172,7 +18172,7 @@ fn fileMemoryMapCreate(
1817218172 error.Unseekable, error.Canceled, error.AccessDenied => |e| return e,
1817318173 error.OperationUnsupported => {},
1817418174 else => {
18175 if (builtin.mode == .Debug)
18175 if (builtin.mode == .debug)
1817618176 std.log.warn("memory mapping failed with {t}, falling back to file operations", .{err});
1817718177 },
1817818178 }
......@@ -18279,7 +18279,7 @@ fn createFileMap(
1827918279 .INVALID_VIEW_SIZE => |status| return windows.statusBug(status),
1828018280 else => |status| return windows.unexpectedStatus(status),
1828118281 }
18282 if (builtin.mode == .Debug) {
18282 if (builtin.mode == .debug) {
1828318283 const page_size = std.heap.pageSize();
1828418284 const alignment: Alignment = .fromByteUnits(page_size);
1828518285 assert(contents_len == alignment.forward(len));
......@@ -18370,7 +18370,7 @@ fn fileMemoryMapDestroy(userdata: ?*anyopaque, mm: *File.MemoryMap) void {
1837018370 switch (posix.errno(posix.system.munmap(memory.ptr, memory.len))) {
1837118371 .SUCCESS => {},
1837218372 else => |e| {
18373 if (builtin.mode == .Debug)
18373 if (builtin.mode == .debug)
1837418374 std.log.err("failed to unmap {d} bytes at {*}: {t}", .{ memory.len, memory.ptr, e });
1837518375 },
1837618376 }
lib/std/Io/Uring.zig+1-1
......@@ -4050,7 +4050,7 @@ fn fileMemoryMapDestroy(userdata: ?*anyopaque, mm: *File.MemoryMap) void {
40504050 if (memory.len == 0) return;
40514051 switch (linux.errno(linux.munmap(memory.ptr, memory.len))) {
40524052 .SUCCESS => {},
4053 else => |err| if (builtin.mode == .Debug)
4053 else => |err| if (builtin.mode == .debug)
40544054 std.log.err("failed to unmap {d} bytes at {*}: {t}", .{ memory.len, memory.ptr, err }),
40554055 }
40564056 mm.* = undefined;
lib/std/Random/benchmark.zig+1-1
......@@ -122,7 +122,7 @@ fn usage() void {
122122}
123123
124124fn 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;
126126}
127127
128128pub 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) {
4444 once_f(predicate, context, function);
4545 } else asm volatile ("" ::: .{ .memory = true });
4646 switch (builtin.mode) {
47 .Debug, .ReleaseSafe => {},
48 .ReleaseFast, .ReleaseSmall => if (predicate.* != .done) unreachable,
47 .debug, .safe => {},
48 .fast, .small => if (predicate.* != .done) unreachable,
4949 }
5050 }
5151};
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
738738
739739fn clenHlen(freqs: [19]u16) u4 {
740740 // 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) {
742742 const V = @Vector(16, u16);
743743 const hlen_mul: V = comptime m: {
744744 var hlen_mul: [16]u16 = undefined;
lib/std/compress/flate/token.zig+3-3
......@@ -57,9 +57,9 @@ const fixed_dist = blk: {
5757};
5858
5959// 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.
61pub const LenCode = if (builtin.mode != .ReleaseSmall) LookupLenCode else ShortLenCode;
62pub const DistCode = if (builtin.mode != .ReleaseSmall) LookupDistCode else ShortDistCode;
60// do via lookup table. For -Osmall, we do all mathematically to save space.
61pub const LenCode = if (builtin.mode != .small) LookupLenCode else ShortLenCode;
62pub const DistCode = if (builtin.mode != .small) LookupDistCode else ShortDistCode;
6363const ShortLenCode = ShortCode(u8, u2, u3, true);
6464const ShortDistCode = ShortCode(u15, u1, u4, false);
6565/// 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;
77
88// Inline conditionally, when it can result in large code generation.
99const bloaty_inline: std.builtin.CallingConvention = switch (builtin.mode) {
10 .ReleaseSafe, .ReleaseFast => .@"inline",
11 .Debug, .ReleaseSmall => .auto,
10 .safe, .fast => .@"inline",
11 .debug, .small => .auto,
1212};
1313
1414pub const Fe = struct {
lib/std/crypto/benchmark.zig+1-1
......@@ -493,7 +493,7 @@ fn usage() void {
493493}
494494
495495fn 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;
497497}
498498
499499pub 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 {
3030 pub const mac_length = 16;
3131 pub const key_length = 16;
3232
33 const pc_count = if (builtin.mode != .ReleaseSmall) 16 else 2;
33 const pc_count = if (builtin.mode != .small) 16 else 2;
3434 const agg_4_threshold = 22;
3535 const agg_8_threshold = 84;
3636 const agg_16_threshold = 328;
......@@ -61,7 +61,7 @@ fn Hash(comptime endian: std.builtin.Endian, comptime shift_key: bool) type {
6161 hx[0] = h;
6262 hx[1] = reduce(clsq128(hx[0])); // h^2
6363
64 if (builtin.mode != .ReleaseSmall) {
64 if (builtin.mode != .small) {
6565 hx[2] = reduce(clmul128(hx[1], h)); // h^3
6666 hx[3] = reduce(clsq128(hx[1])); // h^4 = h^2^2
6767 if (block_count >= agg_8_threshold) {
......@@ -303,7 +303,7 @@ fn Hash(comptime endian: std.builtin.Endian, comptime shift_key: bool) type {
303303
304304 var i: usize = 0;
305305
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) {
307307 // 16-blocks aggregated reduction
308308 while (i + 256 <= msg.len) : (i += 256) {
309309 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 {
313313 }
314314 acc = reduce(u);
315315 }
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) {
317317 // 8-blocks aggregated reduction
318318 while (i + 128 <= msg.len) : (i += 128) {
319319 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 {
323323 }
324324 acc = reduce(u);
325325 }
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) {
327327 // 4-blocks aggregated reduction
328328 while (i + 64 <= msg.len) : (i += 64) {
329329 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"
13981398 var prng = std.Random.DefaultPrng.init(std.testing.random_seed);
13991399 const random = prng.random();
14001400
1401 const num_tests = if (builtin.mode == .Debug) 10 else 1000;
1401 const num_tests = if (builtin.mode == .debug) 10 else 1000;
14021402 const max_length = 250000;
14031403
14041404 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
202202
203203 // In debug mode, track transitions to prevent insecure ones.
204204 const Op = enum { uninitialized, initialized, updated, absorb, squeeze };
205 const TransitionTracker = if (mode == .Debug) struct {
205 const TransitionTracker = if (mode == .debug) struct {
206206 op: Op = .uninitialized,
207207
208208 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
294294
295295 /// Permute the state
296296 pub fn permute(self: *Self) void {
297 if (mode == .Debug) {
297 if (mode == .debug) {
298298 if (self.transition.op == .absorb and self.offset > 0) {
299299 @panic("cannot permute with pending input - call fillBlock() or pad() instead");
300300 }
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 {
110110/// out1: [0x0 ~> 0xffffffffffffffff]
111111/// out2: [0x0 ~> 0xffffffffffffffff]
112112fn mulxU64(out1: *u64, out2: *u64, arg1: u64, arg2: u64) void {
113 @setRuntimeSafety(mode == .Debug);
113 @setRuntimeSafety(mode == .debug);
114114
115115 const x = @as(u128, arg1) * @as(u128, arg2);
116116 out1.* = @as(u64, @truncate(x));
......@@ -129,7 +129,7 @@ fn mulxU64(out1: *u64, out2: *u64, arg1: u64, arg2: u64) void {
129129/// Output Bounds:
130130/// out1: [0x0 ~> 0xffffffffffffffff]
131131fn cmovznzU64(out1: *u64, arg1: u1, arg2: u64, arg3: u64) void {
132 @setRuntimeSafety(mode == .Debug);
132 @setRuntimeSafety(mode == .debug);
133133
134134 const mask = 0 -% @as(u64, arg1);
135135 out1.* = (mask & arg3) | ((~mask) & arg2);
......@@ -145,7 +145,7 @@ fn cmovznzU64(out1: *u64, arg1: u1, arg2: u64, arg3: u64) void {
145145/// 0 ≤ eval out1 < m
146146///
147147pub fn mul(out1: *MontgomeryDomainFieldElement, arg1: MontgomeryDomainFieldElement, arg2: MontgomeryDomainFieldElement) void {
148 @setRuntimeSafety(mode == .Debug);
148 @setRuntimeSafety(mode == .debug);
149149
150150 const x1 = (arg1[1]);
151151 const x2 = (arg1[2]);
......@@ -437,7 +437,7 @@ pub fn mul(out1: *MontgomeryDomainFieldElement, arg1: MontgomeryDomainFieldEleme
437437/// 0 ≤ eval out1 < m
438438///
439439pub fn square(out1: *MontgomeryDomainFieldElement, arg1: MontgomeryDomainFieldElement) void {
440 @setRuntimeSafety(mode == .Debug);
440 @setRuntimeSafety(mode == .debug);
441441
442442 const x1 = (arg1[1]);
443443 const x2 = (arg1[2]);
......@@ -730,7 +730,7 @@ pub fn square(out1: *MontgomeryDomainFieldElement, arg1: MontgomeryDomainFieldEl
730730/// 0 ≤ eval out1 < m
731731///
732732pub fn add(out1: *MontgomeryDomainFieldElement, arg1: MontgomeryDomainFieldElement, arg2: MontgomeryDomainFieldElement) void {
733 @setRuntimeSafety(mode == .Debug);
733 @setRuntimeSafety(mode == .debug);
734734
735735 var x1: u64 = undefined;
736736 var x2: u1 = undefined;
......@@ -783,7 +783,7 @@ pub fn add(out1: *MontgomeryDomainFieldElement, arg1: MontgomeryDomainFieldEleme
783783/// 0 ≤ eval out1 < m
784784///
785785pub fn sub(out1: *MontgomeryDomainFieldElement, arg1: MontgomeryDomainFieldElement, arg2: MontgomeryDomainFieldElement) void {
786 @setRuntimeSafety(mode == .Debug);
786 @setRuntimeSafety(mode == .debug);
787787
788788 var x1: u64 = undefined;
789789 var x2: u1 = undefined;
......@@ -826,7 +826,7 @@ pub fn sub(out1: *MontgomeryDomainFieldElement, arg1: MontgomeryDomainFieldEleme
826826/// 0 ≤ eval out1 < m
827827///
828828pub fn opp(out1: *MontgomeryDomainFieldElement, arg1: MontgomeryDomainFieldElement) void {
829 @setRuntimeSafety(mode == .Debug);
829 @setRuntimeSafety(mode == .debug);
830830
831831 var x1: u64 = undefined;
832832 var x2: u1 = undefined;
......@@ -869,7 +869,7 @@ pub fn opp(out1: *MontgomeryDomainFieldElement, arg1: MontgomeryDomainFieldEleme
869869/// 0 ≤ eval out1 < m
870870///
871871pub fn fromMontgomery(out1: *NonMontgomeryDomainFieldElement, arg1: MontgomeryDomainFieldElement) void {
872 @setRuntimeSafety(mode == .Debug);
872 @setRuntimeSafety(mode == .debug);
873873
874874 const x1 = (arg1[0]);
875875 var x2: u64 = undefined;
......@@ -1022,7 +1022,7 @@ pub fn fromMontgomery(out1: *NonMontgomeryDomainFieldElement, arg1: MontgomeryDo
10221022/// 0 ≤ eval out1 < m
10231023///
10241024pub fn toMontgomery(out1: *MontgomeryDomainFieldElement, arg1: NonMontgomeryDomainFieldElement) void {
1025 @setRuntimeSafety(mode == .Debug);
1025 @setRuntimeSafety(mode == .debug);
10261026
10271027 const x1 = (arg1[1]);
10281028 const x2 = (arg1[2]);
......@@ -1297,7 +1297,7 @@ pub fn toMontgomery(out1: *MontgomeryDomainFieldElement, arg1: NonMontgomeryDoma
12971297/// Output Bounds:
12981298/// out1: [0x0 ~> 0xffffffffffffffff]
12991299pub fn nonzero(out1: *u64, arg1: [4]u64) void {
1300 @setRuntimeSafety(mode == .Debug);
1300 @setRuntimeSafety(mode == .debug);
13011301
13021302 const x1 = ((arg1[0]) | ((arg1[1]) | ((arg1[2]) | (arg1[3]))));
13031303 out1.* = x1;
......@@ -1315,7 +1315,7 @@ pub fn nonzero(out1: *u64, arg1: [4]u64) void {
13151315/// Output Bounds:
13161316/// out1: [[0x0 ~> 0xffffffffffffffff], [0x0 ~> 0xffffffffffffffff], [0x0 ~> 0xffffffffffffffff], [0x0 ~> 0xffffffffffffffff]]
13171317pub fn selectznz(out1: *[4]u64, arg1: u1, arg2: [4]u64, arg3: [4]u64) void {
1318 @setRuntimeSafety(mode == .Debug);
1318 @setRuntimeSafety(mode == .debug);
13191319
13201320 var x1: u64 = undefined;
13211321 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 {
13431343/// Output Bounds:
13441344/// 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]]
13451345pub fn toBytes(out1: *[32]u8, arg1: [4]u64) void {
1346 @setRuntimeSafety(mode == .Debug);
1346 @setRuntimeSafety(mode == .debug);
13471347
13481348 const x1 = (arg1[3]);
13491349 const x2 = (arg1[2]);
......@@ -1452,7 +1452,7 @@ pub fn toBytes(out1: *[32]u8, arg1: [4]u64) void {
14521452/// Output Bounds:
14531453/// out1: [[0x0 ~> 0xffffffffffffffff], [0x0 ~> 0xffffffffffffffff], [0x0 ~> 0xffffffffffffffff], [0x0 ~> 0xffffffffffffffff]]
14541454pub fn fromBytes(out1: *[4]u64, arg1: [32]u8) void {
1455 @setRuntimeSafety(mode == .Debug);
1455 @setRuntimeSafety(mode == .debug);
14561456
14571457 const x1 = (@as(u64, (arg1[31])) << 56);
14581458 const x2 = (@as(u64, (arg1[30])) << 48);
......@@ -1527,7 +1527,7 @@ pub fn fromBytes(out1: *[4]u64, arg1: [32]u8) void {
15271527/// 0 ≤ eval out1 < m
15281528///
15291529pub fn setOne(out1: *MontgomeryDomainFieldElement) void {
1530 @setRuntimeSafety(mode == .Debug);
1530 @setRuntimeSafety(mode == .debug);
15311531
15321532 out1[0] = @as(u64, 0x1);
15331533 out1[1] = 0xffffffff00000000;
......@@ -1544,7 +1544,7 @@ pub fn setOne(out1: *MontgomeryDomainFieldElement) void {
15441544/// Output Bounds:
15451545/// out1: [[0x0 ~> 0xffffffffffffffff], [0x0 ~> 0xffffffffffffffff], [0x0 ~> 0xffffffffffffffff], [0x0 ~> 0xffffffffffffffff], [0x0 ~> 0xffffffffffffffff]]
15461546pub fn msat(out1: *[5]u64) void {
1547 @setRuntimeSafety(mode == .Debug);
1547 @setRuntimeSafety(mode == .debug);
15481548
15491549 out1[0] = 0xffffffffffffffff;
15501550 out1[1] = 0xffffffff;
......@@ -1582,7 +1582,7 @@ pub fn msat(out1: *[5]u64) void {
15821582/// out4: [[0x0 ~> 0xffffffffffffffff], [0x0 ~> 0xffffffffffffffff], [0x0 ~> 0xffffffffffffffff], [0x0 ~> 0xffffffffffffffff]]
15831583/// out5: [[0x0 ~> 0xffffffffffffffff], [0x0 ~> 0xffffffffffffffff], [0x0 ~> 0xffffffffffffffff], [0x0 ~> 0xffffffffffffffff]]
15841584pub 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);
15861586
15871587 var x1: u64 = undefined;
15881588 var x2: u1 = undefined;
......@@ -1816,7 +1816,7 @@ pub fn divstep(out1: *u64, out2: *[5]u64, out3: *[5]u64, out4: *[4]u64, out5: *[
18161816/// Output Bounds:
18171817/// out1: [[0x0 ~> 0xffffffffffffffff], [0x0 ~> 0xffffffffffffffff], [0x0 ~> 0xffffffffffffffff], [0x0 ~> 0xffffffffffffffff]]
18181818pub fn divstepPrecomp(out1: *[4]u64) void {
1819 @setRuntimeSafety(mode == .Debug);
1819 @setRuntimeSafety(mode == .debug);
18201820
18211821 out1[0] = 0x67ffffffb8000000;
18221822 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 {
110110/// out1: [0x0 ~> 0xffffffffffffffff]
111111/// out2: [0x0 ~> 0xffffffffffffffff]
112112fn mulxU64(out1: *u64, out2: *u64, arg1: u64, arg2: u64) void {
113 @setRuntimeSafety(mode == .Debug);
113 @setRuntimeSafety(mode == .debug);
114114
115115 const x = @as(u128, arg1) * @as(u128, arg2);
116116 out1.* = @as(u64, @truncate(x));
......@@ -129,7 +129,7 @@ fn mulxU64(out1: *u64, out2: *u64, arg1: u64, arg2: u64) void {
129129/// Output Bounds:
130130/// out1: [0x0 ~> 0xffffffffffffffff]
131131fn cmovznzU64(out1: *u64, arg1: u1, arg2: u64, arg3: u64) void {
132 @setRuntimeSafety(mode == .Debug);
132 @setRuntimeSafety(mode == .debug);
133133
134134 const mask = 0 -% @as(u64, arg1);
135135 out1.* = (mask & arg3) | ((~mask) & arg2);
......@@ -145,7 +145,7 @@ fn cmovznzU64(out1: *u64, arg1: u1, arg2: u64, arg3: u64) void {
145145/// 0 ≤ eval out1 < m
146146///
147147pub fn mul(out1: *MontgomeryDomainFieldElement, arg1: MontgomeryDomainFieldElement, arg2: MontgomeryDomainFieldElement) void {
148 @setRuntimeSafety(mode == .Debug);
148 @setRuntimeSafety(mode == .debug);
149149
150150 const x1 = (arg1[1]);
151151 const x2 = (arg1[2]);
......@@ -485,7 +485,7 @@ pub fn mul(out1: *MontgomeryDomainFieldElement, arg1: MontgomeryDomainFieldEleme
485485/// 0 ≤ eval out1 < m
486486///
487487pub fn square(out1: *MontgomeryDomainFieldElement, arg1: MontgomeryDomainFieldElement) void {
488 @setRuntimeSafety(mode == .Debug);
488 @setRuntimeSafety(mode == .debug);
489489
490490 const x1 = (arg1[1]);
491491 const x2 = (arg1[2]);
......@@ -826,7 +826,7 @@ pub fn square(out1: *MontgomeryDomainFieldElement, arg1: MontgomeryDomainFieldEl
826826/// 0 ≤ eval out1 < m
827827///
828828pub fn add(out1: *MontgomeryDomainFieldElement, arg1: MontgomeryDomainFieldElement, arg2: MontgomeryDomainFieldElement) void {
829 @setRuntimeSafety(mode == .Debug);
829 @setRuntimeSafety(mode == .debug);
830830
831831 var x1: u64 = undefined;
832832 var x2: u1 = undefined;
......@@ -879,7 +879,7 @@ pub fn add(out1: *MontgomeryDomainFieldElement, arg1: MontgomeryDomainFieldEleme
879879/// 0 ≤ eval out1 < m
880880///
881881pub fn sub(out1: *MontgomeryDomainFieldElement, arg1: MontgomeryDomainFieldElement, arg2: MontgomeryDomainFieldElement) void {
882 @setRuntimeSafety(mode == .Debug);
882 @setRuntimeSafety(mode == .debug);
883883
884884 var x1: u64 = undefined;
885885 var x2: u1 = undefined;
......@@ -922,7 +922,7 @@ pub fn sub(out1: *MontgomeryDomainFieldElement, arg1: MontgomeryDomainFieldEleme
922922/// 0 ≤ eval out1 < m
923923///
924924pub fn opp(out1: *MontgomeryDomainFieldElement, arg1: MontgomeryDomainFieldElement) void {
925 @setRuntimeSafety(mode == .Debug);
925 @setRuntimeSafety(mode == .debug);
926926
927927 var x1: u64 = undefined;
928928 var x2: u1 = undefined;
......@@ -965,7 +965,7 @@ pub fn opp(out1: *MontgomeryDomainFieldElement, arg1: MontgomeryDomainFieldEleme
965965/// 0 ≤ eval out1 < m
966966///
967967pub fn fromMontgomery(out1: *NonMontgomeryDomainFieldElement, arg1: MontgomeryDomainFieldElement) void {
968 @setRuntimeSafety(mode == .Debug);
968 @setRuntimeSafety(mode == .debug);
969969
970970 const x1 = (arg1[0]);
971971 var x2: u64 = undefined;
......@@ -1178,7 +1178,7 @@ pub fn fromMontgomery(out1: *NonMontgomeryDomainFieldElement, arg1: MontgomeryDo
11781178/// 0 ≤ eval out1 < m
11791179///
11801180pub fn toMontgomery(out1: *MontgomeryDomainFieldElement, arg1: NonMontgomeryDomainFieldElement) void {
1181 @setRuntimeSafety(mode == .Debug);
1181 @setRuntimeSafety(mode == .debug);
11821182
11831183 const x1 = (arg1[1]);
11841184 const x2 = (arg1[2]);
......@@ -1501,7 +1501,7 @@ pub fn toMontgomery(out1: *MontgomeryDomainFieldElement, arg1: NonMontgomeryDoma
15011501/// Output Bounds:
15021502/// out1: [0x0 ~> 0xffffffffffffffff]
15031503pub fn nonzero(out1: *u64, arg1: [4]u64) void {
1504 @setRuntimeSafety(mode == .Debug);
1504 @setRuntimeSafety(mode == .debug);
15051505
15061506 const x1 = ((arg1[0]) | ((arg1[1]) | ((arg1[2]) | (arg1[3]))));
15071507 out1.* = x1;
......@@ -1519,7 +1519,7 @@ pub fn nonzero(out1: *u64, arg1: [4]u64) void {
15191519/// Output Bounds:
15201520/// out1: [[0x0 ~> 0xffffffffffffffff], [0x0 ~> 0xffffffffffffffff], [0x0 ~> 0xffffffffffffffff], [0x0 ~> 0xffffffffffffffff]]
15211521pub fn selectznz(out1: *[4]u64, arg1: u1, arg2: [4]u64, arg3: [4]u64) void {
1522 @setRuntimeSafety(mode == .Debug);
1522 @setRuntimeSafety(mode == .debug);
15231523
15241524 var x1: u64 = undefined;
15251525 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 {
15471547/// Output Bounds:
15481548/// 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]]
15491549pub fn toBytes(out1: *[32]u8, arg1: [4]u64) void {
1550 @setRuntimeSafety(mode == .Debug);
1550 @setRuntimeSafety(mode == .debug);
15511551
15521552 const x1 = (arg1[3]);
15531553 const x2 = (arg1[2]);
......@@ -1656,7 +1656,7 @@ pub fn toBytes(out1: *[32]u8, arg1: [4]u64) void {
16561656/// Output Bounds:
16571657/// out1: [[0x0 ~> 0xffffffffffffffff], [0x0 ~> 0xffffffffffffffff], [0x0 ~> 0xffffffffffffffff], [0x0 ~> 0xffffffffffffffff]]
16581658pub fn fromBytes(out1: *[4]u64, arg1: [32]u8) void {
1659 @setRuntimeSafety(mode == .Debug);
1659 @setRuntimeSafety(mode == .debug);
16601660
16611661 const x1 = (@as(u64, (arg1[31])) << 56);
16621662 const x2 = (@as(u64, (arg1[30])) << 48);
......@@ -1731,7 +1731,7 @@ pub fn fromBytes(out1: *[4]u64, arg1: [32]u8) void {
17311731/// 0 ≤ eval out1 < m
17321732///
17331733pub fn setOne(out1: *MontgomeryDomainFieldElement) void {
1734 @setRuntimeSafety(mode == .Debug);
1734 @setRuntimeSafety(mode == .debug);
17351735
17361736 out1[0] = 0xc46353d039cdaaf;
17371737 out1[1] = 0x4319055258e8617b;
......@@ -1748,7 +1748,7 @@ pub fn setOne(out1: *MontgomeryDomainFieldElement) void {
17481748/// Output Bounds:
17491749/// out1: [[0x0 ~> 0xffffffffffffffff], [0x0 ~> 0xffffffffffffffff], [0x0 ~> 0xffffffffffffffff], [0x0 ~> 0xffffffffffffffff], [0x0 ~> 0xffffffffffffffff]]
17501750pub fn msat(out1: *[5]u64) void {
1751 @setRuntimeSafety(mode == .Debug);
1751 @setRuntimeSafety(mode == .debug);
17521752
17531753 out1[0] = 0xf3b9cac2fc632551;
17541754 out1[1] = 0xbce6faada7179e84;
......@@ -1786,7 +1786,7 @@ pub fn msat(out1: *[5]u64) void {
17861786/// out4: [[0x0 ~> 0xffffffffffffffff], [0x0 ~> 0xffffffffffffffff], [0x0 ~> 0xffffffffffffffff], [0x0 ~> 0xffffffffffffffff]]
17871787/// out5: [[0x0 ~> 0xffffffffffffffff], [0x0 ~> 0xffffffffffffffff], [0x0 ~> 0xffffffffffffffff], [0x0 ~> 0xffffffffffffffff]]
17881788pub 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);
17901790
17911791 var x1: u64 = undefined;
17921792 var x2: u1 = undefined;
......@@ -2020,7 +2020,7 @@ pub fn divstep(out1: *u64, out2: *[5]u64, out3: *[5]u64, out4: *[4]u64, out5: *[
20202020/// Output Bounds:
20212021/// out1: [[0x0 ~> 0xffffffffffffffff], [0x0 ~> 0xffffffffffffffff], [0x0 ~> 0xffffffffffffffff], [0x0 ~> 0xffffffffffffffff]]
20222022pub fn divstepPrecomp(out1: *[4]u64) void {
2023 @setRuntimeSafety(mode == .Debug);
2023 @setRuntimeSafety(mode == .debug);
20242024
20252025 out1[0] = 0xd739262fb7fcfbb5;
20262026 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 {
7979/// out1: [0x0 ~> 0xffffffffffffffff]
8080/// out2: [0x0 ~> 0xffffffffffffffff]
8181fn mulxU64(out1: *u64, out2: *u64, arg1: u64, arg2: u64) void {
82 @setRuntimeSafety(mode == .Debug);
82 @setRuntimeSafety(mode == .debug);
8383
8484 const x = @as(u128, arg1) * @as(u128, arg2);
8585 out1.* = @as(u64, @truncate(x));
......@@ -98,7 +98,7 @@ fn mulxU64(out1: *u64, out2: *u64, arg1: u64, arg2: u64) void {
9898/// Output Bounds:
9999/// out1: [0x0 ~> 0xffffffffffffffff]
100100fn cmovznzU64(out1: *u64, arg1: u1, arg2: u64, arg3: u64) void {
101 @setRuntimeSafety(mode == .Debug);
101 @setRuntimeSafety(mode == .debug);
102102
103103 const mask = 0 -% @as(u64, arg1);
104104 out1.* = (mask & arg3) | ((~mask) & arg2);
......@@ -114,7 +114,7 @@ fn cmovznzU64(out1: *u64, arg1: u1, arg2: u64, arg3: u64) void {
114114/// 0 ≤ eval out1 < m
115115///
116116pub fn mul(out1: *MontgomeryDomainFieldElement, arg1: MontgomeryDomainFieldElement, arg2: MontgomeryDomainFieldElement) void {
117 @setRuntimeSafety(mode == .Debug);
117 @setRuntimeSafety(mode == .debug);
118118
119119 const x1 = (arg1[1]);
120120 const x2 = (arg1[2]);
......@@ -834,7 +834,7 @@ pub fn mul(out1: *MontgomeryDomainFieldElement, arg1: MontgomeryDomainFieldEleme
834834/// 0 ≤ eval out1 < m
835835///
836836pub fn square(out1: *MontgomeryDomainFieldElement, arg1: MontgomeryDomainFieldElement) void {
837 @setRuntimeSafety(mode == .Debug);
837 @setRuntimeSafety(mode == .debug);
838838
839839 const x1 = (arg1[1]);
840840 const x2 = (arg1[2]);
......@@ -1555,7 +1555,7 @@ pub fn square(out1: *MontgomeryDomainFieldElement, arg1: MontgomeryDomainFieldEl
15551555/// 0 ≤ eval out1 < m
15561556///
15571557pub fn add(out1: *MontgomeryDomainFieldElement, arg1: MontgomeryDomainFieldElement, arg2: MontgomeryDomainFieldElement) void {
1558 @setRuntimeSafety(mode == .Debug);
1558 @setRuntimeSafety(mode == .debug);
15591559
15601560 var x1: u64 = undefined;
15611561 var x2: u1 = undefined;
......@@ -1626,7 +1626,7 @@ pub fn add(out1: *MontgomeryDomainFieldElement, arg1: MontgomeryDomainFieldEleme
16261626/// 0 ≤ eval out1 < m
16271627///
16281628pub fn sub(out1: *MontgomeryDomainFieldElement, arg1: MontgomeryDomainFieldElement, arg2: MontgomeryDomainFieldElement) void {
1629 @setRuntimeSafety(mode == .Debug);
1629 @setRuntimeSafety(mode == .debug);
16301630
16311631 var x1: u64 = undefined;
16321632 var x2: u1 = undefined;
......@@ -1683,7 +1683,7 @@ pub fn sub(out1: *MontgomeryDomainFieldElement, arg1: MontgomeryDomainFieldEleme
16831683/// 0 ≤ eval out1 < m
16841684///
16851685pub fn opp(out1: *MontgomeryDomainFieldElement, arg1: MontgomeryDomainFieldElement) void {
1686 @setRuntimeSafety(mode == .Debug);
1686 @setRuntimeSafety(mode == .debug);
16871687
16881688 var x1: u64 = undefined;
16891689 var x2: u1 = undefined;
......@@ -1740,7 +1740,7 @@ pub fn opp(out1: *MontgomeryDomainFieldElement, arg1: MontgomeryDomainFieldEleme
17401740/// 0 ≤ eval out1 < m
17411741///
17421742pub fn fromMontgomery(out1: *NonMontgomeryDomainFieldElement, arg1: MontgomeryDomainFieldElement) void {
1743 @setRuntimeSafety(mode == .Debug);
1743 @setRuntimeSafety(mode == .debug);
17441744
17451745 const x1 = (arg1[0]);
17461746 var x2: u64 = undefined;
......@@ -2225,7 +2225,7 @@ pub fn fromMontgomery(out1: *NonMontgomeryDomainFieldElement, arg1: MontgomeryDo
22252225/// 0 ≤ eval out1 < m
22262226///
22272227pub fn toMontgomery(out1: *MontgomeryDomainFieldElement, arg1: NonMontgomeryDomainFieldElement) void {
2228 @setRuntimeSafety(mode == .Debug);
2228 @setRuntimeSafety(mode == .debug);
22292229
22302230 const x1 = (arg1[1]);
22312231 const x2 = (arg1[2]);
......@@ -2862,7 +2862,7 @@ pub fn toMontgomery(out1: *MontgomeryDomainFieldElement, arg1: NonMontgomeryDoma
28622862/// Output Bounds:
28632863/// out1: [0x0 ~> 0xffffffffffffffff]
28642864pub fn nonzero(out1: *u64, arg1: [6]u64) void {
2865 @setRuntimeSafety(mode == .Debug);
2865 @setRuntimeSafety(mode == .debug);
28662866
28672867 const x1 = ((arg1[0]) | ((arg1[1]) | ((arg1[2]) | ((arg1[3]) | ((arg1[4]) | (arg1[5]))))));
28682868 out1.* = x1;
......@@ -2880,7 +2880,7 @@ pub fn nonzero(out1: *u64, arg1: [6]u64) void {
28802880/// Output Bounds:
28812881/// out1: [[0x0 ~> 0xffffffffffffffff], [0x0 ~> 0xffffffffffffffff], [0x0 ~> 0xffffffffffffffff], [0x0 ~> 0xffffffffffffffff], [0x0 ~> 0xffffffffffffffff], [0x0 ~> 0xffffffffffffffff]]
28822882pub fn selectznz(out1: *[6]u64, arg1: u1, arg2: [6]u64, arg3: [6]u64) void {
2883 @setRuntimeSafety(mode == .Debug);
2883 @setRuntimeSafety(mode == .debug);
28842884
28852885 var x1: u64 = undefined;
28862886 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 {
29142914/// Output Bounds:
29152915/// 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]]
29162916pub fn toBytes(out1: *[48]u8, arg1: [6]u64) void {
2917 @setRuntimeSafety(mode == .Debug);
2917 @setRuntimeSafety(mode == .debug);
29182918
29192919 const x1 = (arg1[5]);
29202920 const x2 = (arg1[4]);
......@@ -3069,7 +3069,7 @@ pub fn toBytes(out1: *[48]u8, arg1: [6]u64) void {
30693069/// Output Bounds:
30703070/// out1: [[0x0 ~> 0xffffffffffffffff], [0x0 ~> 0xffffffffffffffff], [0x0 ~> 0xffffffffffffffff], [0x0 ~> 0xffffffffffffffff], [0x0 ~> 0xffffffffffffffff], [0x0 ~> 0xffffffffffffffff]]
30713071pub fn fromBytes(out1: *[6]u64, arg1: [48]u8) void {
3072 @setRuntimeSafety(mode == .Debug);
3072 @setRuntimeSafety(mode == .debug);
30733073
30743074 const x1 = (@as(u64, (arg1[47])) << 56);
30753075 const x2 = (@as(u64, (arg1[46])) << 48);
......@@ -3176,7 +3176,7 @@ pub fn fromBytes(out1: *[6]u64, arg1: [48]u8) void {
31763176/// 0 ≤ eval out1 < m
31773177///
31783178pub fn setOne(out1: *MontgomeryDomainFieldElement) void {
3179 @setRuntimeSafety(mode == .Debug);
3179 @setRuntimeSafety(mode == .debug);
31803180
31813181 out1[0] = 0xffffffff00000001;
31823182 out1[1] = 0xffffffff;
......@@ -3195,7 +3195,7 @@ pub fn setOne(out1: *MontgomeryDomainFieldElement) void {
31953195/// Output Bounds:
31963196/// out1: [[0x0 ~> 0xffffffffffffffff], [0x0 ~> 0xffffffffffffffff], [0x0 ~> 0xffffffffffffffff], [0x0 ~> 0xffffffffffffffff], [0x0 ~> 0xffffffffffffffff], [0x0 ~> 0xffffffffffffffff], [0x0 ~> 0xffffffffffffffff]]
31973197pub fn msat(out1: *[7]u64) void {
3198 @setRuntimeSafety(mode == .Debug);
3198 @setRuntimeSafety(mode == .debug);
31993199
32003200 out1[0] = 0xffffffff;
32013201 out1[1] = 0xffffffff00000000;
......@@ -3235,7 +3235,7 @@ pub fn msat(out1: *[7]u64) void {
32353235/// out4: [[0x0 ~> 0xffffffffffffffff], [0x0 ~> 0xffffffffffffffff], [0x0 ~> 0xffffffffffffffff], [0x0 ~> 0xffffffffffffffff], [0x0 ~> 0xffffffffffffffff], [0x0 ~> 0xffffffffffffffff]]
32363236/// out5: [[0x0 ~> 0xffffffffffffffff], [0x0 ~> 0xffffffffffffffff], [0x0 ~> 0xffffffffffffffff], [0x0 ~> 0xffffffffffffffff], [0x0 ~> 0xffffffffffffffff], [0x0 ~> 0xffffffffffffffff]]
32373237pub 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);
32393239
32403240 var x1: u64 = undefined;
32413241 var x2: u1 = undefined;
......@@ -3561,7 +3561,7 @@ pub fn divstep(out1: *u64, out2: *[7]u64, out3: *[7]u64, out4: *[6]u64, out5: *[
35613561/// Output Bounds:
35623562/// out1: [[0x0 ~> 0xffffffffffffffff], [0x0 ~> 0xffffffffffffffff], [0x0 ~> 0xffffffffffffffff], [0x0 ~> 0xffffffffffffffff], [0x0 ~> 0xffffffffffffffff], [0x0 ~> 0xffffffffffffffff]]
35633563pub fn divstepPrecomp(out1: *[6]u64) void {
3564 @setRuntimeSafety(mode == .Debug);
3564 @setRuntimeSafety(mode == .debug);
35653565
35663566 out1[0] = 0xfff69400fff18fff;
35673567 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 {
7979/// out1: [0x0 ~> 0xffffffffffffffff]
8080/// out2: [0x0 ~> 0xffffffffffffffff]
8181fn mulxU64(out1: *u64, out2: *u64, arg1: u64, arg2: u64) void {
82 @setRuntimeSafety(mode == .Debug);
82 @setRuntimeSafety(mode == .debug);
8383
8484 const x = @as(u128, arg1) * @as(u128, arg2);
8585 out1.* = @as(u64, @truncate(x));
......@@ -98,7 +98,7 @@ fn mulxU64(out1: *u64, out2: *u64, arg1: u64, arg2: u64) void {
9898/// Output Bounds:
9999/// out1: [0x0 ~> 0xffffffffffffffff]
100100fn cmovznzU64(out1: *u64, arg1: u1, arg2: u64, arg3: u64) void {
101 @setRuntimeSafety(mode == .Debug);
101 @setRuntimeSafety(mode == .debug);
102102
103103 const mask = 0 -% @as(u64, arg1);
104104 out1.* = (mask & arg3) | ((~mask) & arg2);
......@@ -114,7 +114,7 @@ fn cmovznzU64(out1: *u64, arg1: u1, arg2: u64, arg3: u64) void {
114114/// 0 ≤ eval out1 < m
115115///
116116pub fn mul(out1: *MontgomeryDomainFieldElement, arg1: MontgomeryDomainFieldElement, arg2: MontgomeryDomainFieldElement) void {
117 @setRuntimeSafety(mode == .Debug);
117 @setRuntimeSafety(mode == .debug);
118118
119119 const x1 = (arg1[1]);
120120 const x2 = (arg1[2]);
......@@ -834,7 +834,7 @@ pub fn mul(out1: *MontgomeryDomainFieldElement, arg1: MontgomeryDomainFieldEleme
834834/// 0 ≤ eval out1 < m
835835///
836836pub fn square(out1: *MontgomeryDomainFieldElement, arg1: MontgomeryDomainFieldElement) void {
837 @setRuntimeSafety(mode == .Debug);
837 @setRuntimeSafety(mode == .debug);
838838
839839 const x1 = (arg1[1]);
840840 const x2 = (arg1[2]);
......@@ -1555,7 +1555,7 @@ pub fn square(out1: *MontgomeryDomainFieldElement, arg1: MontgomeryDomainFieldEl
15551555/// 0 ≤ eval out1 < m
15561556///
15571557pub fn add(out1: *MontgomeryDomainFieldElement, arg1: MontgomeryDomainFieldElement, arg2: MontgomeryDomainFieldElement) void {
1558 @setRuntimeSafety(mode == .Debug);
1558 @setRuntimeSafety(mode == .debug);
15591559
15601560 var x1: u64 = undefined;
15611561 var x2: u1 = undefined;
......@@ -1626,7 +1626,7 @@ pub fn add(out1: *MontgomeryDomainFieldElement, arg1: MontgomeryDomainFieldEleme
16261626/// 0 ≤ eval out1 < m
16271627///
16281628pub fn sub(out1: *MontgomeryDomainFieldElement, arg1: MontgomeryDomainFieldElement, arg2: MontgomeryDomainFieldElement) void {
1629 @setRuntimeSafety(mode == .Debug);
1629 @setRuntimeSafety(mode == .debug);
16301630
16311631 var x1: u64 = undefined;
16321632 var x2: u1 = undefined;
......@@ -1683,7 +1683,7 @@ pub fn sub(out1: *MontgomeryDomainFieldElement, arg1: MontgomeryDomainFieldEleme
16831683/// 0 ≤ eval out1 < m
16841684///
16851685pub fn opp(out1: *MontgomeryDomainFieldElement, arg1: MontgomeryDomainFieldElement) void {
1686 @setRuntimeSafety(mode == .Debug);
1686 @setRuntimeSafety(mode == .debug);
16871687
16881688 var x1: u64 = undefined;
16891689 var x2: u1 = undefined;
......@@ -1740,7 +1740,7 @@ pub fn opp(out1: *MontgomeryDomainFieldElement, arg1: MontgomeryDomainFieldEleme
17401740/// 0 ≤ eval out1 < m
17411741///
17421742pub fn fromMontgomery(out1: *NonMontgomeryDomainFieldElement, arg1: MontgomeryDomainFieldElement) void {
1743 @setRuntimeSafety(mode == .Debug);
1743 @setRuntimeSafety(mode == .debug);
17441744
17451745 const x1 = (arg1[0]);
17461746 var x2: u64 = undefined;
......@@ -2225,7 +2225,7 @@ pub fn fromMontgomery(out1: *NonMontgomeryDomainFieldElement, arg1: MontgomeryDo
22252225/// 0 ≤ eval out1 < m
22262226///
22272227pub fn toMontgomery(out1: *MontgomeryDomainFieldElement, arg1: NonMontgomeryDomainFieldElement) void {
2228 @setRuntimeSafety(mode == .Debug);
2228 @setRuntimeSafety(mode == .debug);
22292229
22302230 const x1 = (arg1[1]);
22312231 const x2 = (arg1[2]);
......@@ -2916,7 +2916,7 @@ pub fn toMontgomery(out1: *MontgomeryDomainFieldElement, arg1: NonMontgomeryDoma
29162916/// Output Bounds:
29172917/// out1: [0x0 ~> 0xffffffffffffffff]
29182918pub fn nonzero(out1: *u64, arg1: [6]u64) void {
2919 @setRuntimeSafety(mode == .Debug);
2919 @setRuntimeSafety(mode == .debug);
29202920
29212921 const x1 = ((arg1[0]) | ((arg1[1]) | ((arg1[2]) | ((arg1[3]) | ((arg1[4]) | (arg1[5]))))));
29222922 out1.* = x1;
......@@ -2934,7 +2934,7 @@ pub fn nonzero(out1: *u64, arg1: [6]u64) void {
29342934/// Output Bounds:
29352935/// out1: [[0x0 ~> 0xffffffffffffffff], [0x0 ~> 0xffffffffffffffff], [0x0 ~> 0xffffffffffffffff], [0x0 ~> 0xffffffffffffffff], [0x0 ~> 0xffffffffffffffff], [0x0 ~> 0xffffffffffffffff]]
29362936pub fn selectznz(out1: *[6]u64, arg1: u1, arg2: [6]u64, arg3: [6]u64) void {
2937 @setRuntimeSafety(mode == .Debug);
2937 @setRuntimeSafety(mode == .debug);
29382938
29392939 var x1: u64 = undefined;
29402940 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 {
29682968/// Output Bounds:
29692969/// 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]]
29702970pub fn toBytes(out1: *[48]u8, arg1: [6]u64) void {
2971 @setRuntimeSafety(mode == .Debug);
2971 @setRuntimeSafety(mode == .debug);
29722972
29732973 const x1 = (arg1[5]);
29742974 const x2 = (arg1[4]);
......@@ -3123,7 +3123,7 @@ pub fn toBytes(out1: *[48]u8, arg1: [6]u64) void {
31233123/// Output Bounds:
31243124/// out1: [[0x0 ~> 0xffffffffffffffff], [0x0 ~> 0xffffffffffffffff], [0x0 ~> 0xffffffffffffffff], [0x0 ~> 0xffffffffffffffff], [0x0 ~> 0xffffffffffffffff], [0x0 ~> 0xffffffffffffffff]]
31253125pub fn fromBytes(out1: *[6]u64, arg1: [48]u8) void {
3126 @setRuntimeSafety(mode == .Debug);
3126 @setRuntimeSafety(mode == .debug);
31273127
31283128 const x1 = (@as(u64, (arg1[47])) << 56);
31293129 const x2 = (@as(u64, (arg1[46])) << 48);
......@@ -3230,7 +3230,7 @@ pub fn fromBytes(out1: *[6]u64, arg1: [48]u8) void {
32303230/// 0 ≤ eval out1 < m
32313231///
32323232pub fn setOne(out1: *MontgomeryDomainFieldElement) void {
3233 @setRuntimeSafety(mode == .Debug);
3233 @setRuntimeSafety(mode == .debug);
32343234
32353235 out1[0] = 0x1313e695333ad68d;
32363236 out1[1] = 0xa7e5f24db74f5885;
......@@ -3249,7 +3249,7 @@ pub fn setOne(out1: *MontgomeryDomainFieldElement) void {
32493249/// Output Bounds:
32503250/// out1: [[0x0 ~> 0xffffffffffffffff], [0x0 ~> 0xffffffffffffffff], [0x0 ~> 0xffffffffffffffff], [0x0 ~> 0xffffffffffffffff], [0x0 ~> 0xffffffffffffffff], [0x0 ~> 0xffffffffffffffff], [0x0 ~> 0xffffffffffffffff]]
32513251pub fn msat(out1: *[7]u64) void {
3252 @setRuntimeSafety(mode == .Debug);
3252 @setRuntimeSafety(mode == .debug);
32533253
32543254 out1[0] = 0xecec196accc52973;
32553255 out1[1] = 0x581a0db248b0a77a;
......@@ -3289,7 +3289,7 @@ pub fn msat(out1: *[7]u64) void {
32893289/// out4: [[0x0 ~> 0xffffffffffffffff], [0x0 ~> 0xffffffffffffffff], [0x0 ~> 0xffffffffffffffff], [0x0 ~> 0xffffffffffffffff], [0x0 ~> 0xffffffffffffffff], [0x0 ~> 0xffffffffffffffff]]
32903290/// out5: [[0x0 ~> 0xffffffffffffffff], [0x0 ~> 0xffffffffffffffff], [0x0 ~> 0xffffffffffffffff], [0x0 ~> 0xffffffffffffffff], [0x0 ~> 0xffffffffffffffff], [0x0 ~> 0xffffffffffffffff]]
32913291pub 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);
32933293
32943294 var x1: u64 = undefined;
32953295 var x2: u1 = undefined;
......@@ -3615,7 +3615,7 @@ pub fn divstep(out1: *u64, out2: *[7]u64, out3: *[7]u64, out4: *[6]u64, out5: *[
36153615/// Output Bounds:
36163616/// out1: [[0x0 ~> 0xffffffffffffffff], [0x0 ~> 0xffffffffffffffff], [0x0 ~> 0xffffffffffffffff], [0x0 ~> 0xffffffffffffffff], [0x0 ~> 0xffffffffffffffff], [0x0 ~> 0xffffffffffffffff]]
36173617pub fn divstepPrecomp(out1: *[6]u64) void {
3618 @setRuntimeSafety(mode == .Debug);
3618 @setRuntimeSafety(mode == .debug);
36193619
36203620 out1[0] = 0x49589ae0e6045b6a;
36213621 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 {
7979/// out1: [0x0 ~> 0xffffffffffffffff]
8080/// out2: [0x0 ~> 0xffffffffffffffff]
8181fn mulxU64(out1: *u64, out2: *u64, arg1: u64, arg2: u64) void {
82 @setRuntimeSafety(mode == .Debug);
82 @setRuntimeSafety(mode == .debug);
8383
8484 const x = @as(u128, arg1) * @as(u128, arg2);
8585 out1.* = @as(u64, @truncate(x));
......@@ -98,7 +98,7 @@ fn mulxU64(out1: *u64, out2: *u64, arg1: u64, arg2: u64) void {
9898/// Output Bounds:
9999/// out1: [0x0 ~> 0xffffffffffffffff]
100100fn cmovznzU64(out1: *u64, arg1: u1, arg2: u64, arg3: u64) void {
101 @setRuntimeSafety(mode == .Debug);
101 @setRuntimeSafety(mode == .debug);
102102
103103 const mask = 0 -% @as(u64, arg1);
104104 out1.* = (mask & arg3) | ((~mask) & arg2);
......@@ -114,7 +114,7 @@ fn cmovznzU64(out1: *u64, arg1: u1, arg2: u64, arg3: u64) void {
114114/// 0 ≤ eval out1 < m
115115///
116116pub fn mul(out1: *MontgomeryDomainFieldElement, arg1: MontgomeryDomainFieldElement, arg2: MontgomeryDomainFieldElement) void {
117 @setRuntimeSafety(mode == .Debug);
117 @setRuntimeSafety(mode == .debug);
118118
119119 const x1 = (arg1[1]);
120120 const x2 = (arg1[2]);
......@@ -454,7 +454,7 @@ pub fn mul(out1: *MontgomeryDomainFieldElement, arg1: MontgomeryDomainFieldEleme
454454/// 0 ≤ eval out1 < m
455455///
456456pub fn square(out1: *MontgomeryDomainFieldElement, arg1: MontgomeryDomainFieldElement) void {
457 @setRuntimeSafety(mode == .Debug);
457 @setRuntimeSafety(mode == .debug);
458458
459459 const x1 = (arg1[1]);
460460 const x2 = (arg1[2]);
......@@ -795,7 +795,7 @@ pub fn square(out1: *MontgomeryDomainFieldElement, arg1: MontgomeryDomainFieldEl
795795/// 0 ≤ eval out1 < m
796796///
797797pub fn add(out1: *MontgomeryDomainFieldElement, arg1: MontgomeryDomainFieldElement, arg2: MontgomeryDomainFieldElement) void {
798 @setRuntimeSafety(mode == .Debug);
798 @setRuntimeSafety(mode == .debug);
799799
800800 var x1: u64 = undefined;
801801 var x2: u1 = undefined;
......@@ -848,7 +848,7 @@ pub fn add(out1: *MontgomeryDomainFieldElement, arg1: MontgomeryDomainFieldEleme
848848/// 0 ≤ eval out1 < m
849849///
850850pub fn sub(out1: *MontgomeryDomainFieldElement, arg1: MontgomeryDomainFieldElement, arg2: MontgomeryDomainFieldElement) void {
851 @setRuntimeSafety(mode == .Debug);
851 @setRuntimeSafety(mode == .debug);
852852
853853 var x1: u64 = undefined;
854854 var x2: u1 = undefined;
......@@ -891,7 +891,7 @@ pub fn sub(out1: *MontgomeryDomainFieldElement, arg1: MontgomeryDomainFieldEleme
891891/// 0 ≤ eval out1 < m
892892///
893893pub fn opp(out1: *MontgomeryDomainFieldElement, arg1: MontgomeryDomainFieldElement) void {
894 @setRuntimeSafety(mode == .Debug);
894 @setRuntimeSafety(mode == .debug);
895895
896896 var x1: u64 = undefined;
897897 var x2: u1 = undefined;
......@@ -934,7 +934,7 @@ pub fn opp(out1: *MontgomeryDomainFieldElement, arg1: MontgomeryDomainFieldEleme
934934/// 0 ≤ eval out1 < m
935935///
936936pub fn fromMontgomery(out1: *NonMontgomeryDomainFieldElement, arg1: MontgomeryDomainFieldElement) void {
937 @setRuntimeSafety(mode == .Debug);
937 @setRuntimeSafety(mode == .debug);
938938
939939 const x1 = (arg1[0]);
940940 var x2: u64 = undefined;
......@@ -1167,7 +1167,7 @@ pub fn fromMontgomery(out1: *NonMontgomeryDomainFieldElement, arg1: MontgomeryDo
11671167/// 0 ≤ eval out1 < m
11681168///
11691169pub fn toMontgomery(out1: *MontgomeryDomainFieldElement, arg1: NonMontgomeryDomainFieldElement) void {
1170 @setRuntimeSafety(mode == .Debug);
1170 @setRuntimeSafety(mode == .debug);
11711171
11721172 const x1 = (arg1[1]);
11731173 const x2 = (arg1[2]);
......@@ -1430,7 +1430,7 @@ pub fn toMontgomery(out1: *MontgomeryDomainFieldElement, arg1: NonMontgomeryDoma
14301430/// Output Bounds:
14311431/// out1: [0x0 ~> 0xffffffffffffffff]
14321432pub fn nonzero(out1: *u64, arg1: [4]u64) void {
1433 @setRuntimeSafety(mode == .Debug);
1433 @setRuntimeSafety(mode == .debug);
14341434
14351435 const x1 = ((arg1[0]) | ((arg1[1]) | ((arg1[2]) | (arg1[3]))));
14361436 out1.* = x1;
......@@ -1448,7 +1448,7 @@ pub fn nonzero(out1: *u64, arg1: [4]u64) void {
14481448/// Output Bounds:
14491449/// out1: [[0x0 ~> 0xffffffffffffffff], [0x0 ~> 0xffffffffffffffff], [0x0 ~> 0xffffffffffffffff], [0x0 ~> 0xffffffffffffffff]]
14501450pub fn selectznz(out1: *[4]u64, arg1: u1, arg2: [4]u64, arg3: [4]u64) void {
1451 @setRuntimeSafety(mode == .Debug);
1451 @setRuntimeSafety(mode == .debug);
14521452
14531453 var x1: u64 = undefined;
14541454 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 {
14761476/// Output Bounds:
14771477/// 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]]
14781478pub fn toBytes(out1: *[32]u8, arg1: [4]u64) void {
1479 @setRuntimeSafety(mode == .Debug);
1479 @setRuntimeSafety(mode == .debug);
14801480
14811481 const x1 = (arg1[3]);
14821482 const x2 = (arg1[2]);
......@@ -1585,7 +1585,7 @@ pub fn toBytes(out1: *[32]u8, arg1: [4]u64) void {
15851585/// Output Bounds:
15861586/// out1: [[0x0 ~> 0xffffffffffffffff], [0x0 ~> 0xffffffffffffffff], [0x0 ~> 0xffffffffffffffff], [0x0 ~> 0xffffffffffffffff]]
15871587pub fn fromBytes(out1: *[4]u64, arg1: [32]u8) void {
1588 @setRuntimeSafety(mode == .Debug);
1588 @setRuntimeSafety(mode == .debug);
15891589
15901590 const x1 = (@as(u64, (arg1[31])) << 56);
15911591 const x2 = (@as(u64, (arg1[30])) << 48);
......@@ -1660,7 +1660,7 @@ pub fn fromBytes(out1: *[4]u64, arg1: [32]u8) void {
16601660/// 0 ≤ eval out1 < m
16611661///
16621662pub fn setOne(out1: *MontgomeryDomainFieldElement) void {
1663 @setRuntimeSafety(mode == .Debug);
1663 @setRuntimeSafety(mode == .debug);
16641664
16651665 out1[0] = 0x1000003d1;
16661666 out1[1] = 0x0;
......@@ -1677,7 +1677,7 @@ pub fn setOne(out1: *MontgomeryDomainFieldElement) void {
16771677/// Output Bounds:
16781678/// out1: [[0x0 ~> 0xffffffffffffffff], [0x0 ~> 0xffffffffffffffff], [0x0 ~> 0xffffffffffffffff], [0x0 ~> 0xffffffffffffffff], [0x0 ~> 0xffffffffffffffff]]
16791679pub fn msat(out1: *[5]u64) void {
1680 @setRuntimeSafety(mode == .Debug);
1680 @setRuntimeSafety(mode == .debug);
16811681
16821682 out1[0] = 0xfffffffefffffc2f;
16831683 out1[1] = 0xffffffffffffffff;
......@@ -1715,7 +1715,7 @@ pub fn msat(out1: *[5]u64) void {
17151715/// out4: [[0x0 ~> 0xffffffffffffffff], [0x0 ~> 0xffffffffffffffff], [0x0 ~> 0xffffffffffffffff], [0x0 ~> 0xffffffffffffffff]]
17161716/// out5: [[0x0 ~> 0xffffffffffffffff], [0x0 ~> 0xffffffffffffffff], [0x0 ~> 0xffffffffffffffff], [0x0 ~> 0xffffffffffffffff]]
17171717pub 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);
17191719
17201720 var x1: u64 = undefined;
17211721 var x2: u1 = undefined;
......@@ -1949,7 +1949,7 @@ pub fn divstep(out1: *u64, out2: *[5]u64, out3: *[5]u64, out4: *[4]u64, out5: *[
19491949/// Output Bounds:
19501950/// out1: [[0x0 ~> 0xffffffffffffffff], [0x0 ~> 0xffffffffffffffff], [0x0 ~> 0xffffffffffffffff], [0x0 ~> 0xffffffffffffffff]]
19511951pub fn divstepPrecomp(out1: *[4]u64) void {
1952 @setRuntimeSafety(mode == .Debug);
1952 @setRuntimeSafety(mode == .debug);
19531953
19541954 out1[0] = 0xf201a41831525e0a;
19551955 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 {
7979/// out1: [0x0 ~> 0xffffffffffffffff]
8080/// out2: [0x0 ~> 0xffffffffffffffff]
8181fn mulxU64(out1: *u64, out2: *u64, arg1: u64, arg2: u64) void {
82 @setRuntimeSafety(mode == .Debug);
82 @setRuntimeSafety(mode == .debug);
8383
8484 const x = @as(u128, arg1) * @as(u128, arg2);
8585 out1.* = @as(u64, @truncate(x));
......@@ -98,7 +98,7 @@ fn mulxU64(out1: *u64, out2: *u64, arg1: u64, arg2: u64) void {
9898/// Output Bounds:
9999/// out1: [0x0 ~> 0xffffffffffffffff]
100100fn cmovznzU64(out1: *u64, arg1: u1, arg2: u64, arg3: u64) void {
101 @setRuntimeSafety(mode == .Debug);
101 @setRuntimeSafety(mode == .debug);
102102
103103 const mask = 0 -% @as(u64, arg1);
104104 out1.* = (mask & arg3) | ((~mask) & arg2);
......@@ -114,7 +114,7 @@ fn cmovznzU64(out1: *u64, arg1: u1, arg2: u64, arg3: u64) void {
114114/// 0 ≤ eval out1 < m
115115///
116116pub fn mul(out1: *MontgomeryDomainFieldElement, arg1: MontgomeryDomainFieldElement, arg2: MontgomeryDomainFieldElement) void {
117 @setRuntimeSafety(mode == .Debug);
117 @setRuntimeSafety(mode == .debug);
118118
119119 const x1 = (arg1[1]);
120120 const x2 = (arg1[2]);
......@@ -454,7 +454,7 @@ pub fn mul(out1: *MontgomeryDomainFieldElement, arg1: MontgomeryDomainFieldEleme
454454/// 0 ≤ eval out1 < m
455455///
456456pub fn square(out1: *MontgomeryDomainFieldElement, arg1: MontgomeryDomainFieldElement) void {
457 @setRuntimeSafety(mode == .Debug);
457 @setRuntimeSafety(mode == .debug);
458458
459459 const x1 = (arg1[1]);
460460 const x2 = (arg1[2]);
......@@ -795,7 +795,7 @@ pub fn square(out1: *MontgomeryDomainFieldElement, arg1: MontgomeryDomainFieldEl
795795/// 0 ≤ eval out1 < m
796796///
797797pub fn add(out1: *MontgomeryDomainFieldElement, arg1: MontgomeryDomainFieldElement, arg2: MontgomeryDomainFieldElement) void {
798 @setRuntimeSafety(mode == .Debug);
798 @setRuntimeSafety(mode == .debug);
799799
800800 var x1: u64 = undefined;
801801 var x2: u1 = undefined;
......@@ -848,7 +848,7 @@ pub fn add(out1: *MontgomeryDomainFieldElement, arg1: MontgomeryDomainFieldEleme
848848/// 0 ≤ eval out1 < m
849849///
850850pub fn sub(out1: *MontgomeryDomainFieldElement, arg1: MontgomeryDomainFieldElement, arg2: MontgomeryDomainFieldElement) void {
851 @setRuntimeSafety(mode == .Debug);
851 @setRuntimeSafety(mode == .debug);
852852
853853 var x1: u64 = undefined;
854854 var x2: u1 = undefined;
......@@ -891,7 +891,7 @@ pub fn sub(out1: *MontgomeryDomainFieldElement, arg1: MontgomeryDomainFieldEleme
891891/// 0 ≤ eval out1 < m
892892///
893893pub fn opp(out1: *MontgomeryDomainFieldElement, arg1: MontgomeryDomainFieldElement) void {
894 @setRuntimeSafety(mode == .Debug);
894 @setRuntimeSafety(mode == .debug);
895895
896896 var x1: u64 = undefined;
897897 var x2: u1 = undefined;
......@@ -934,7 +934,7 @@ pub fn opp(out1: *MontgomeryDomainFieldElement, arg1: MontgomeryDomainFieldEleme
934934/// 0 ≤ eval out1 < m
935935///
936936pub fn fromMontgomery(out1: *NonMontgomeryDomainFieldElement, arg1: MontgomeryDomainFieldElement) void {
937 @setRuntimeSafety(mode == .Debug);
937 @setRuntimeSafety(mode == .debug);
938938
939939 const x1 = (arg1[0]);
940940 var x2: u64 = undefined;
......@@ -1167,7 +1167,7 @@ pub fn fromMontgomery(out1: *NonMontgomeryDomainFieldElement, arg1: MontgomeryDo
11671167/// 0 ≤ eval out1 < m
11681168///
11691169pub fn toMontgomery(out1: *MontgomeryDomainFieldElement, arg1: NonMontgomeryDomainFieldElement) void {
1170 @setRuntimeSafety(mode == .Debug);
1170 @setRuntimeSafety(mode == .debug);
11711171
11721172 const x1 = (arg1[1]);
11731173 const x2 = (arg1[2]);
......@@ -1490,7 +1490,7 @@ pub fn toMontgomery(out1: *MontgomeryDomainFieldElement, arg1: NonMontgomeryDoma
14901490/// Output Bounds:
14911491/// out1: [0x0 ~> 0xffffffffffffffff]
14921492pub fn nonzero(out1: *u64, arg1: [4]u64) void {
1493 @setRuntimeSafety(mode == .Debug);
1493 @setRuntimeSafety(mode == .debug);
14941494
14951495 const x1 = ((arg1[0]) | ((arg1[1]) | ((arg1[2]) | (arg1[3]))));
14961496 out1.* = x1;
......@@ -1508,7 +1508,7 @@ pub fn nonzero(out1: *u64, arg1: [4]u64) void {
15081508/// Output Bounds:
15091509/// out1: [[0x0 ~> 0xffffffffffffffff], [0x0 ~> 0xffffffffffffffff], [0x0 ~> 0xffffffffffffffff], [0x0 ~> 0xffffffffffffffff]]
15101510pub fn selectznz(out1: *[4]u64, arg1: u1, arg2: [4]u64, arg3: [4]u64) void {
1511 @setRuntimeSafety(mode == .Debug);
1511 @setRuntimeSafety(mode == .debug);
15121512
15131513 var x1: u64 = undefined;
15141514 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 {
15361536/// Output Bounds:
15371537/// 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]]
15381538pub fn toBytes(out1: *[32]u8, arg1: [4]u64) void {
1539 @setRuntimeSafety(mode == .Debug);
1539 @setRuntimeSafety(mode == .debug);
15401540
15411541 const x1 = (arg1[3]);
15421542 const x2 = (arg1[2]);
......@@ -1645,7 +1645,7 @@ pub fn toBytes(out1: *[32]u8, arg1: [4]u64) void {
16451645/// Output Bounds:
16461646/// out1: [[0x0 ~> 0xffffffffffffffff], [0x0 ~> 0xffffffffffffffff], [0x0 ~> 0xffffffffffffffff], [0x0 ~> 0xffffffffffffffff]]
16471647pub fn fromBytes(out1: *[4]u64, arg1: [32]u8) void {
1648 @setRuntimeSafety(mode == .Debug);
1648 @setRuntimeSafety(mode == .debug);
16491649
16501650 const x1 = (@as(u64, (arg1[31])) << 56);
16511651 const x2 = (@as(u64, (arg1[30])) << 48);
......@@ -1720,7 +1720,7 @@ pub fn fromBytes(out1: *[4]u64, arg1: [32]u8) void {
17201720/// 0 ≤ eval out1 < m
17211721///
17221722pub fn setOne(out1: *MontgomeryDomainFieldElement) void {
1723 @setRuntimeSafety(mode == .Debug);
1723 @setRuntimeSafety(mode == .debug);
17241724
17251725 out1[0] = 0x402da1732fc9bebf;
17261726 out1[1] = 0x4551231950b75fc4;
......@@ -1737,7 +1737,7 @@ pub fn setOne(out1: *MontgomeryDomainFieldElement) void {
17371737/// Output Bounds:
17381738/// out1: [[0x0 ~> 0xffffffffffffffff], [0x0 ~> 0xffffffffffffffff], [0x0 ~> 0xffffffffffffffff], [0x0 ~> 0xffffffffffffffff], [0x0 ~> 0xffffffffffffffff]]
17391739pub fn msat(out1: *[5]u64) void {
1740 @setRuntimeSafety(mode == .Debug);
1740 @setRuntimeSafety(mode == .debug);
17411741
17421742 out1[0] = 0xbfd25e8cd0364141;
17431743 out1[1] = 0xbaaedce6af48a03b;
......@@ -1775,7 +1775,7 @@ pub fn msat(out1: *[5]u64) void {
17751775/// out4: [[0x0 ~> 0xffffffffffffffff], [0x0 ~> 0xffffffffffffffff], [0x0 ~> 0xffffffffffffffff], [0x0 ~> 0xffffffffffffffff]]
17761776/// out5: [[0x0 ~> 0xffffffffffffffff], [0x0 ~> 0xffffffffffffffff], [0x0 ~> 0xffffffffffffffff], [0x0 ~> 0xffffffffffffffff]]
17771777pub 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);
17791779
17801780 var x1: u64 = undefined;
17811781 var x2: u1 = undefined;
......@@ -2009,7 +2009,7 @@ pub fn divstep(out1: *u64, out2: *[5]u64, out3: *[5]u64, out4: *[4]u64, out5: *[
20092009/// Output Bounds:
20102010/// out1: [[0x0 ~> 0xffffffffffffffff], [0x0 ~> 0xffffffffffffffff], [0x0 ~> 0xffffffffffffffff], [0x0 ~> 0xffffffffffffffff]]
20112011pub fn divstepPrecomp(out1: *[4]u64) void {
2012 @setRuntimeSafety(mode == .Debug);
2012 @setRuntimeSafety(mode == .debug);
20132013
20142014 out1[0] = 0xd7431a4d2b9cb4e9;
20152015 out1[1] = 0xab67d35a32d9c503;
lib/std/debug.zig+11-12
......@@ -237,13 +237,12 @@ pub const Symbol = struct {
237237 };
238238};
239239
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.
243pub 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.
245pub const runtime_safety = builtin.mode.runtimeSafety();
247246
248247/// Whether we can unwind the stack on this target, allowing capturing and/or printing the current
249248/// 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) {
257256 // because Emscripten's implementation is very slow.
258257 .wasm32,
259258 .wasm64,
260 => native_os == .emscripten and builtin.mode == .Debug,
259 => native_os == .emscripten and builtin.mode == .debug,
261260
262261 // `@returnAddress()` is unsupported in LLVM 21.
263262 .bpfel,
......@@ -419,16 +418,16 @@ pub const CpuContextPtr = if (cpu_context.Native == noreturn) noreturn else *con
419418
420419/// Invokes detectable illegal behavior when `ok` is `false`.
421420///
422/// In Debug and ReleaseSafe modes, calls to this function are always
421/// In debug and safe modes, calls to this function are always
423422/// generated, and the `unreachable` statement triggers a panic.
424423///
425/// In ReleaseFast and ReleaseSmall modes, calls to this function are optimized
424/// In fast and small modes, calls to this function are optimized
426425/// away, and in fact the optimizer is able to use the assertion in its
427426/// heuristics.
428427///
429428/// Inside a test block, it is best to use the `testing` module rather than
430429/// 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
432431/// function is the correct function to use.
433432pub fn assert(ok: bool) void {
434433 @disableInstrumentation();
......@@ -1760,7 +1759,7 @@ test "manage resources correctly" {
17601759/// In release mode, it is size 0 and all methods are no-ops.
17611760/// This is a pre-made type with default settings.
17621761/// For more advanced usage, see `ConfigurableTrace`.
1763pub const Trace = ConfigurableTrace(2, 4, builtin.mode == .Debug);
1762pub const Trace = ConfigurableTrace(2, 4, builtin.mode == .debug);
17641763
17651764pub fn ConfigurableTrace(comptime size: usize, comptime stack_frame_count: usize, comptime is_enabled: bool) type {
17661765 return struct {
lib/std/fmt.zig+2-2
......@@ -261,7 +261,7 @@ test printInt {
261261
262262/// Converts values in the range [0, 100) to a base 10 string.
263263pub fn digits2(value: u8) [2]u8 {
264 if (builtin.mode == .ReleaseSmall) {
264 if (builtin.mode == .small) {
265265 return .{ @intCast('0' + value / 10), @intCast('0' + value % 10) };
266266 } else {
267267 return "00010203040506070809101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899"[value * 2 ..][0..2].*;
......@@ -924,7 +924,7 @@ test "enum" {
924924
925925 // test very large enum to verify ct branch quota is large enough
926926 // 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)) {
928928 try expectFmt("enum: .INVALID_FUNCTION\n", "enum: {}\n", .{std.os.windows.Win32Error.INVALID_FUNCTION});
929929 }
930930
lib/std/fmt/float.zig+1-1
......@@ -65,7 +65,7 @@ pub fn render(buf: []u8, value: anytype, options: Options) Error![]const u8 {
6565
6666 const DT = if (@bitSizeOf(T) <= 64) u64 else u128;
6767 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,
6969 u128 => &Backend128_Tables,
7070 else => unreachable,
7171 };
lib/std/hash/benchmark.zig+1-1
......@@ -355,7 +355,7 @@ fn usage() void {
355355}
356356
357357fn 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;
359359}
360360
361361pub fn main(init: std.process.Init) !void {
lib/std/heap/SafeAllocator.zig+1-1
......@@ -39,7 +39,7 @@ const SafeAllocator = @This();
3939const scoped_log = std.log.scoped(.SafeAllocator);
4040
4141pub const Options = struct {
42 const is_debug = @import("builtin").mode == .Debug;
42 const is_debug = @import("builtin").mode == .debug;
4343 const page_size_log2 = @max(math.log2_int(usize, std.heap.page_size_max), 8);
4444
4545 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" {
3434}
3535
3636test "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
3838 if (builtin.os.tag == .openbsd) return error.SkipZigTest; // https://codeberg.org/ziglang/zig/issues/30806
3939
4040 const io = std.testing.io;
......@@ -121,7 +121,7 @@ test "trailers" {
121121}
122122
123123test "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
125125 if (builtin.os.tag == .openbsd) return error.SkipZigTest; // https://codeberg.org/ziglang/zig/issues/30806
126126
127127 const io = std.testing.io;
......@@ -190,7 +190,7 @@ test "HTTP server handles a chunked transfer coding request" {
190190}
191191
192192test "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
194194 if (builtin.os.tag == .openbsd) return error.SkipZigTest; // https://codeberg.org/ziglang/zig/issues/30806
195195
196196 const io = std.testing.io;
......@@ -281,7 +281,7 @@ test "echo content server" {
281281}
282282
283283test "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
285285 if (builtin.os.tag == .openbsd) return error.SkipZigTest; // https://codeberg.org/ziglang/zig/issues/30806
286286
287287 const io = std.testing.io;
......@@ -360,7 +360,7 @@ test "Server.Request.respondStreaming non-chunked, unknown content-length" {
360360}
361361
362362test "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
364364 if (builtin.os.tag == .openbsd) return error.SkipZigTest; // https://codeberg.org/ziglang/zig/issues/30806
365365
366366 const io = std.testing.io;
......@@ -426,7 +426,7 @@ test "receiving arbitrary http headers from the client" {
426426}
427427
428428test "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
430430 if (builtin.os.tag == .openbsd) return error.SkipZigTest; // https://codeberg.org/ziglang/zig/issues/30806
431431
432432 const io = std.testing.io;
......@@ -922,7 +922,7 @@ test "general client/server API coverage" {
922922}
923923
924924test "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
926926 if (builtin.os.tag == .openbsd) return error.SkipZigTest; // https://codeberg.org/ziglang/zig/issues/30806
927927
928928 const io = std.testing.io;
......@@ -1192,7 +1192,7 @@ fn createTestServer(io: Io, S: type) !*TestServer {
11921192}
11931193
11941194test "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
11961196 if (builtin.os.tag == .openbsd) return error.SkipZigTest; // https://codeberg.org/ziglang/zig/issues/30806
11971197
11981198 const io = std.testing.io;
......@@ -1280,7 +1280,7 @@ test "redirect to different connection" {
12801280}
12811281
12821282test "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
12841284 if (builtin.os.tag == .openbsd) return error.SkipZigTest; // https://codeberg.org/ziglang/zig/issues/30806
12851285
12861286 const io = std.testing.io;
lib/std/json/Stringify.zig+3-3
......@@ -54,8 +54,8 @@ else
5454 void = if (build_mode_has_safety) .none else {},
5555
5656const build_mode_has_safety = switch (@import("builtin").mode) {
57 .Debug, .ReleaseSafe => true,
58 .ReleaseFast, .ReleaseSmall => false,
57 .debug, .safe => true,
58 .fast, .small => false,
5959};
6060
6161/// 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) {
6666/// If `.checked_to_fixed_depth` is used, there is additionally an assertion that the nesting depth never exceeds the given limit.
6767/// `.checked_to_fixed_depth` embeds the storage required in the `Stringify` struct.
6868/// `.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`.
7070const safety_checks_hint: union(enum) {
7171 /// Rounded up to the nearest multiple of 8.
7272 checked_to_fixed_depth: usize,
lib/std/lang.zig+44-5
......@@ -107,13 +107,52 @@ pub const CodeModel = enum(u4) {
107107 tiny,
108108};
109109
110/// Deprecated, to be removed after 0.18.0
111pub const OptimizeMode = Optimize;
112
110113/// This data structure is used by the Zig language code generation and
111114/// therefore must be kept in sync with the compiler implementation.
112pub const OptimizeMode = enum {
113 Debug,
114 ReleaseSafe,
115 ReleaseFast,
116 ReleaseSmall,
115pub 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 }
117156};
118157
119158/// 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 {
5353/// The default log level is based on build mode.
5454pub const default_level: Level = switch (builtin.mode) {
5555 .Debug => .debug,
56 .ReleaseSafe, .ReleaseFast, .ReleaseSmall => .info,
56 .safe, .fast, .small => .info,
5757};
5858
5959pub const ScopeLevel = struct {
lib/std/math/hypot.zig+4-4
......@@ -93,13 +93,13 @@ const hypot_test_cases = .{
9393};
9494
9595test 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
9797 try expect(hypot(0.3, 0.4) == 0.5);
9898}
9999
100100test "hypot.correct" {
101101 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
103103
104104 inline for (.{ f16, f32, f64, f128 }) |T| {
105105 inline for (hypot_test_cases) |v| {
......@@ -111,7 +111,7 @@ test "hypot.correct" {
111111
112112test "hypot.precise" {
113113 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
115115
116116 inline for (.{ f16, f32, f64 }) |T| { // f128 seems to be 5 ulp
117117 inline for (hypot_test_cases) |v| {
......@@ -122,7 +122,7 @@ test "hypot.precise" {
122122}
123123
124124test "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
126126 @setEvalBranchQuota(2000);
127127 inline for (.{ f16, f32, f64, f128 }) |T| {
128128 try expect(math.isNan(hypot(nan(T), 0.0)));
lib/std/process.zig+2-2
......@@ -644,7 +644,7 @@ pub fn totalSystemMemory() TotalSystemMemoryError!u64 {
644644/// leaks can be accurate. In release builds, this calls `exit` with code zero,
645645/// and does not return.
646646pub fn cleanExit(io: Io) void {
647 if (builtin.mode == .Debug) return;
647 if (builtin.mode == .debug) return;
648648 _ = io.lockStderr(&.{}, .no_color) catch {};
649649 exit(0);
650650}
......@@ -809,7 +809,7 @@ pub fn abort() noreturn {
809809 // even when linking libc on Windows we use our own abort implementation.
810810 // See https://github.com/ziglang/zig/issues/2071 for more details.
811811 if (native_os == .windows) {
812 if (builtin.mode == .Debug and windows.peb().BeingDebugged.toBool()) {
812 if (builtin.mode == .debug and windows.peb().BeingDebugged.toBool()) {
813813 @breakpoint();
814814 }
815815 windows.ntdll.RtlExitUserProcess(3);
lib/std/sort/block.zig+1-1
......@@ -103,7 +103,7 @@ pub fn block(
103103 context: anytype,
104104 comptime lessThanFn: fn (@TypeOf(context), lhs: T, rhs: T) bool,
105105) void {
106 const lessThan = if (builtin.mode == .Debug) struct {
106 const lessThan = if (builtin.mode == .debug) struct {
107107 fn lessThan(ctx: @TypeOf(context), lhs: T, rhs: T) bool {
108108 const lt = lessThanFn(ctx, lhs, rhs);
109109 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 {
742742const bad_main_ret = "expected return type of main to be 'void', '!void', 'noreturn', 'u8', or '!u8'";
743743
744744const 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.
747747};
748748var safe_allocator: std.heap.SafeAllocator = .init(std.heap.page_allocator, .{});
749749
lib/std/std.zig+2-2
......@@ -162,7 +162,7 @@ pub const Options = struct {
162162 /// This enables `std.http.Client` to log ssl secrets to the file specified by the SSLKEYLOGFILE
163163 /// env var. Creating such a log file allows other programs with access to that file to decrypt
164164 /// 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,
166166
167167 side_channels_mitigations: crypto.SideChannelsMitigations = crypto.default_side_channels_mitigations,
168168
......@@ -192,7 +192,7 @@ pub const Options = struct {
192192 /// If this happens the fix is to add the error code to the corresponding
193193 /// switch expression, possibly introduce a new error in the error set, and
194194 /// 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) {
196196 .stage2_llvm, .stage2_x86_64 => true,
197197 else => false,
198198 },
lib/std/zig/Zir.zig+1-1
......@@ -2522,7 +2522,7 @@ pub const Inst = struct {
25222522 // bigger than expected. Note that in Debug builds, Zig is allowed
25232523 // to insert a secret field for safety checks.
25242524 comptime {
2525 if (builtin.mode != .Debug and builtin.mode != .ReleaseSafe) {
2525 if (builtin.mode != .debug and builtin.mode != .safe) {
25262526 assert(@sizeOf(Data) == 8);
25272527 }
25282528 }
src/Builtin.zig+4-2
......@@ -7,7 +7,7 @@ is_test: bool,
77single_threaded: bool,
88link_libc: bool,
99link_libcpp: bool,
10optimize_mode: std.lang.OptimizeMode,
10optimize_mode: std.lang.Optimize,
1111error_tracing: bool,
1212valgrind: bool,
1313sanitize_thread: bool,
......@@ -239,7 +239,9 @@ pub fn append(opts: @This(), buffer: *std.array_list.Managed(u8)) Allocator.Erro
239239
240240 try buffer.print(
241241 \\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};
243245 \\pub const link_libc = {};
244246 \\pub const link_libcpp = {};
245247 \\pub const have_error_return_tracing = {};
src/Compilation.zig+20-20
......@@ -172,7 +172,7 @@ verbose_link: bool,
172172link_depfile: ?[]const u8,
173173disable_c_depfile: bool,
174174stack_report: bool,
175debug_compiler_runtime_libs: ?std.lang.OptimizeMode,
175debug_compiler_runtime_libs: ?std.lang.Optimize,
176176debug_compile_errors: bool,
177177/// Do not check this field directly. Instead, use the `debugIncremental` wrapper function.
178178debug_incremental: bool,
......@@ -1506,7 +1506,7 @@ pub const CreateOptions = struct {
15061506 verbose_llvm_bc: ?[]const u8 = null,
15071507 link_depfile: ?[]const u8 = null,
15081508 verbose_llvm_cpu_features: bool = false,
1509 debug_compiler_runtime_libs: ?std.lang.OptimizeMode = null,
1509 debug_compiler_runtime_libs: ?std.lang.Optimize = null,
15101510 debug_compile_errors: bool = false,
15111511 debug_incremental: bool = false,
15121512 /// 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,
21602160 .framework_dirs = options.framework_dirs,
21612161 .rpath_list = options.rpath_list,
21622162 .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),
21642164 .allow_shlib_undefined = options.linker_allow_shlib_undefined,
21652165 .bind_global_refs_locally = options.linker_bind_global_refs_locally orelse false,
21662166 .compress_debug_sections = options.linker_compress_debug_sections orelse .none,
......@@ -3189,8 +3189,8 @@ fn flush(comp: *Compilation, arena: Allocator) (Io.Cancelable || Allocator.Error
31893189 break :p try p.toStringZ(arena);
31903190 },
31913191
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,
31943194 .time_report = if (comp.time_report) |*p| p else null,
31953195 .sanitize_thread = comp.config.any_sanitize_thread,
31963196 .fuzz = comp.config.any_fuzz,
......@@ -4744,7 +4744,7 @@ fn workerDocsWasmFallible(comp: *Compilation, prog_node: std.Progress.Node) SubU
47444744 defer arena_allocator.deinit();
47454745 const arena = arena_allocator.allocator();
47464746
4747 const optimize_mode = std.lang.OptimizeMode.ReleaseSmall;
4747 const optimize_mode: std.lang.Optimize = .small;
47484748 const output_mode = std.lang.OutputMode.Exe;
47494749 const resolved_target: Module.ResolvedTarget = .{
47504750 .result = std.zig.system.resolveTargetQuery(io, .{
......@@ -5910,8 +5910,8 @@ fn updateWin32Resource(comp: *Compilation, win32_resource: *Win32Resource, win32
59105910 // them being defined matches the behavior of how MSVC calls rc.exe which is the more
59115911 // relevant behavior in this case.
59125912 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"),
59155915 }
59165916 try argv.appendSlice(rc_src.extra_flags);
59175917 try argv.appendSlice(&.{ "--", rc_src.src_path, out_res_path });
......@@ -6178,11 +6178,11 @@ fn addCommonCCArgs(
61786178 // LLVM IR files don't support these flags.
61796179 if (ext != .ll and ext != .bc) {
61806180 switch (mod.optimize_mode) {
6181 .Debug => {},
6182 .ReleaseSafe => {
6181 .debug => {},
6182 .safe => {
61836183 try argv.append("-D_FORTIFY_SOURCE=2");
61846184 },
6185 .ReleaseFast, .ReleaseSmall => {
6185 .fast, .small => {
61866186 try argv.append("-DNDEBUG");
61876187 },
61886188 }
......@@ -6333,7 +6333,7 @@ fn addCommonCCArgs(
63336333 }
63346334 }
63356335
6336 if (mod.optimize_mode != .Debug) {
6336 if (mod.optimize_mode != .debug) {
63376337 try argv.append("-Werror=date-time");
63386338 }
63396339 },
......@@ -6412,18 +6412,18 @@ fn addCommonCCArgs(
64126412 }
64136413
64146414 switch (mod.optimize_mode) {
6415 .Debug => {
6415 .debug => {
64166416 // Clang has -Og for compatibility with GCC, but currently it is just equivalent
64176417 // to -O1. Besides potentially impairing debugging, -O1/-Og significantly
64186418 // increases compile times.
64196419 try argv.append("-O0");
64206420 },
6421 .ReleaseSafe => {
6421 .safe => {
64226422 // See the comment in the BuildModeFastRelease case for why we pass -O2 rather
64236423 // than -O3 here.
64246424 try argv.append("-O2");
64256425 },
6426 .ReleaseFast => {
6426 .fast => {
64276427 // Here we pass -O2 rather than -O3 because, although we do the equivalent of
64286428 // -O3 in Zig code, the justification for the difference here is that Zig
64296429 // has better detection and prevention of undefined behavior, so -O3 is safer for
......@@ -6431,7 +6431,7 @@ fn addCommonCCArgs(
64316431 // running in -O2 and thus the -O3 path has been tested less.
64326432 try argv.append("-O2");
64336433 },
6434 .ReleaseSmall => {
6434 .small => {
64356435 try argv.append("-Os");
64366436 },
64376437 }
......@@ -7557,15 +7557,15 @@ pub fn addLinkLib(comp: *Compilation, lib_name: []const u8) !void {
75577557
75587558/// This decides the optimization mode for all zig-provided libraries, including
75597559/// compiler-rt, libcxx, libc, libunwind, etc.
7560pub fn compilerRtOptMode(comp: Compilation) std.lang.OptimizeMode {
7560pub fn compilerRtOptMode(comp: Compilation) std.lang.Optimize {
75617561 if (comp.debug_compiler_runtime_libs) |mode| {
75627562 return mode;
75637563 }
75647564 const target = &comp.root_mod.resolved_target.result;
75657565 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,
75697569 }
75707570}
75717571
src/Compilation/Config.zig+7-7
......@@ -59,7 +59,7 @@ export_memory: bool,
5959shared_memory: bool,
6060is_test: bool,
6161debug_format: DebugFormat,
62root_optimize_mode: std.lang.OptimizeMode,
62root_optimize_mode: std.lang.Optimize,
6363root_strip: bool,
6464root_error_tracing: bool,
6565dll_export_fns: bool,
......@@ -80,7 +80,7 @@ pub const Options = struct {
8080 is_test: bool,
8181 have_zcu: bool,
8282 emit_bin: bool,
83 root_optimize_mode: ?std.lang.OptimizeMode = null,
83 root_optimize_mode: ?std.lang.Optimize = null,
8484 root_strip: ?bool = null,
8585 root_error_tracing: ?bool = null,
8686 link_mode: ?std.lang.LinkMode = null,
......@@ -196,7 +196,7 @@ pub fn resolve(options: Options) ResolveError!Config {
196196 break :b options.use_lib_llvm orelse true;
197197 };
198198
199 const root_optimize_mode = options.root_optimize_mode orelse .Debug;
199 const root_optimize_mode = options.root_optimize_mode orelse .debug;
200200
201201 // Make a decision on whether to use Clang or Aro for translate-c and compiling C files.
202202 const c_frontend: CFrontend = b: {
......@@ -357,7 +357,7 @@ pub fn resolve(options: Options) ResolveError!Config {
357357 if (!use_lib_llvm and options.emit_bin) break :b false;
358358
359359 // Prefer LLVM for release builds.
360 if (root_optimize_mode != .Debug) break :b true;
360 if (root_optimize_mode != .debug) break :b true;
361361
362362 // load_dynamic_library standalone test not passing on this combination
363363 // https://github.com/ziglang/zig/issues/24080
......@@ -486,7 +486,7 @@ pub fn resolve(options: Options) ResolveError!Config {
486486
487487 const root_strip = b: {
488488 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;
490490 if (!target_util.hasDebugInfo(target)) break :b true;
491491 break :b false;
492492 };
......@@ -512,8 +512,8 @@ pub fn resolve(options: Options) ResolveError!Config {
512512 if (root_strip) break :b false;
513513 if (!backend_supports_error_tracing) break :b false;
514514 break :b switch (root_optimize_mode) {
515 .Debug => true,
516 .ReleaseSafe, .ReleaseFast, .ReleaseSmall => false,
515 .debug => true,
516 .safe, .fast, .small => false,
517517 };
518518 };
519519
src/Module.zig+9-9
......@@ -26,7 +26,7 @@ fully_qualified_name: []const u8,
2626deps: Deps = .{},
2727
2828resolved_target: ResolvedTarget,
29optimize_mode: std.lang.OptimizeMode,
29optimize_mode: std.lang.Optimize,
3030code_model: std.lang.CodeModel,
3131single_threaded: bool,
3232error_tracing: bool,
......@@ -67,7 +67,7 @@ pub const CreateOptions = struct {
6767 pub const Inherited = struct {
6868 /// If this is null then `parent` must be non-null.
6969 resolved_target: ?ResolvedTarget = null,
70 optimize_mode: ?std.lang.OptimizeMode = null,
70 optimize_mode: ?std.lang.Optimize = null,
7171 code_model: ?std.lang.CodeModel = null,
7272 single_threaded: ?bool = null,
7373 error_tracing: ?bool = null,
......@@ -144,7 +144,7 @@ pub fn create(arena: Allocator, options: CreateOptions) !*Module {
144144 if (options.inherited.valgrind) |x| break :b x;
145145 if (options.parent) |p| break :b p.valgrind;
146146 if (strip) break :b false;
147 break :b optimize_mode == .Debug;
147 break :b optimize_mode == .debug;
148148 };
149149
150150 const single_threaded = b: {
......@@ -212,7 +212,7 @@ pub fn create(arena: Allocator, options: CreateOptions) !*Module {
212212 const omit_frame_pointer = b: {
213213 if (options.inherited.omit_frame_pointer) |x| break :b x;
214214 if (options.parent) |p| break :b p.omit_frame_pointer;
215 if (optimize_mode == .ReleaseSmall) {
215 if (optimize_mode == .small) {
216216 // On x86, in most cases, keeping the frame pointer usually results in smaller binary size.
217217 // This has to do with how instructions for memory access via the stack base pointer register (when keeping the frame pointer)
218218 // 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 {
251251 };
252252
253253 const is_safe_mode = switch (optimize_mode) {
254 .Debug, .ReleaseSafe => true,
255 .ReleaseFast, .ReleaseSmall => false,
254 .debug, .safe => true,
255 .fast, .small => false,
256256 };
257257
258258 const sanitize_c: std.zig.SanitizeC = b: {
259259 if (options.inherited.sanitize_c) |x| break :b x;
260260 if (options.parent) |p| break :b p.sanitize_c;
261261 break :b switch (optimize_mode) {
262 .Debug => .full,
262 .debug => .full,
263263 // It's recommended to use the minimal runtime in production
264264 // environments due to the security implications of the full runtime.
265265 // The minimal runtime doesn't provide much benefit over simply
266266 // trapping, however, so we do that instead.
267 .ReleaseSafe => .trap,
268 .ReleaseFast, .ReleaseSmall => .off,
267 .safe => .trap,
268 .fast, .small => .off,
269269 };
270270 };
271271
src/Sema.zig+9-9
......@@ -532,20 +532,20 @@ pub const Block = struct {
532532
533533 fn wantSafeTypes(block: *const Block) bool {
534534 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,
539539 };
540540 }
541541
542542 fn wantSafety(block: *const Block) bool {
543543 if (block.isComptime()) return false; // runtime safety checks are pointless in comptime blocks
544544 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,
549549 };
550550 }
551551
......@@ -2247,7 +2247,7 @@ fn resolveValue(sema: *Sema, inst: Air.Inst.Ref) ?Value {
22472247 .inferred_alloc_comptime => unreachable, // assertion failure
22482248 else => {},
22492249 }
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
22512251 // we must explicitly check for `std.debug.runtime_safety`.
22522252 if (std.debug.runtime_safety) switch (sema.typeOf(inst).classify(zcu)) {
22532253 .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(
7070
7171 const func_align = switch (nav.resolved.?.@"align") {
7272 .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),
7575 },
7676 else => |a| a.maxStrict(target_util.minFunctionAlignment(target)),
7777 };
src/codegen/c.zig+4-4
......@@ -453,8 +453,8 @@ pub const Function = struct {
453453
454454 fn wantSafety(f: *Function) bool {
455455 return switch (f.dg.mod.optimize_mode) {
456 .Debug, .ReleaseSafe => true,
457 .ReleaseFast, .ReleaseSmall => false,
456 .debug, .safe => true,
457 .fast, .small => false,
458458 };
459459 }
460460
......@@ -1306,8 +1306,8 @@ pub const DeclGen = struct {
13061306 };
13071307
13081308 const safety_on = switch (dg.mod.optimize_mode) {
1309 .Debug, .ReleaseSafe => true,
1310 .ReleaseFast, .ReleaseSmall => false,
1309 .debug, .safe => true,
1310 .fast, .small => false,
13111311 };
13121312
13131313 switch (ty.toIntern()) {
src/codegen/llvm.zig+4-4
......@@ -653,7 +653,7 @@ pub const Object = struct {
653653 }),
654654 debug_enums_fwd_ref,
655655 debug_globals_fwd_ref,
656 .{ .optimized = comp.root_mod.optimize_mode != .Debug },
656 .{ .optimized = comp.root_mod.optimize_mode != .debug },
657657 );
658658
659659 try builder.addNamedMetadata(try builder.string("llvm.dbg.cu"), &.{debug_compile_unit});
......@@ -1028,7 +1028,7 @@ pub const Object = struct {
10281028
10291029 const optimize_mode = comp.root_mod.optimize_mode;
10301030
1031 const opt_level: bindings.CodeGenOptLevel = if (optimize_mode == .Debug)
1031 const opt_level: bindings.CodeGenOptLevel = if (optimize_mode == .debug)
10321032 .None
10331033 else
10341034 .Aggressive;
......@@ -1299,7 +1299,7 @@ pub const Object = struct {
12991299 .NoReturn = fn_info.return_type == .noreturn_type,
13001300 },
13011301 .sp_flags = .{
1302 .Optimized = owner_mod.optimize_mode != .Debug,
1302 .Optimized = owner_mod.optimize_mode != .debug,
13031303 .Definition = true,
13041304 .LocalToUnit = is_internal_linkage,
13051305 },
......@@ -2798,7 +2798,7 @@ pub const Object = struct {
27982798 &o.builder,
27992799 );
28002800 }
2801 if (owner_mod.optimize_mode == .ReleaseSmall) {
2801 if (owner_mod.optimize_mode == .small) {
28022802 try attributes.addFnAttr(.minsize, &o.builder);
28032803 try attributes.addFnAttr(.optsize, &o.builder);
28042804 }
src/codegen/llvm/FuncGen.zig+4-4
......@@ -696,7 +696,7 @@ fn genBodyDebugScope(
696696 .{
697697 .di_flags = .{ .StaticMember = true },
698698 .sp_flags = .{
699 .Optimized = mod.optimize_mode != .Debug,
699 .Optimized = mod.optimize_mode != .debug,
700700 .Definition = true,
701701 .LocalToUnit = true, // inline functions cannot be exported
702702 },
......@@ -2516,7 +2516,7 @@ fn airDbgVarVal(self: *FuncGen, inst: Air.Inst.Index, is_arg: bool) Allocator.Er
25162516 },
25172517 "",
25182518 );
2519 } else if (owner_mod.optimize_mode == .Debug and !self.is_naked) {
2519 } else if (owner_mod.optimize_mode == .debug and !self.is_naked) {
25202520 // We avoid taking this path for naked functions because there's no guarantee that such
25212521 // functions even have a valid stack pointer, making the `alloca` + `store` unsafe.
25222522
......@@ -4689,7 +4689,7 @@ fn airArg(self: *FuncGen, inst: Air.Inst.Index) Allocator.Error!Builder.Value {
46894689 },
46904690 "",
46914691 );
4692 } else if (mod.optimize_mode == .Debug) {
4692 } else if (mod.optimize_mode == .debug) {
46934693 const alloca = try self.buildZigAlloca(inst_ty, .none);
46944694 try self.store(alloca, .none, arg_val, inst_ty, .normal);
46954695 _ = try self.wip.callIntrinsic(
......@@ -4820,7 +4820,7 @@ fn airStore(fg: *FuncGen, inst: Air.Inst.Index, safety: bool) Allocator.Error!Bu
48204820 // unexpected call in the user's code. This is problematic if the code in question is
48214821 // not ready to correctly make calls yet, such as in our early PIE startup code, or in
48224822 // 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) {
48244824 return .none;
48254825 }
48264826
src/codegen/riscv64/CodeGen.zig+3-3
......@@ -8339,9 +8339,9 @@ fn resolveCallingConventionValues(
83398339fn wantSafety(func: *Func) bool {
83408340 return switch (func.mod.optimize_mode) {
83418341 .Debug => true,
8342 .ReleaseSafe => true,
8343 .ReleaseFast => false,
8344 .ReleaseSmall => false,
8342 .safe => true,
8343 .fast => false,
8344 .small => false,
83458345 };
83468346}
83478347
src/codegen/sparc64/CodeGen.zig+3-3
......@@ -4764,9 +4764,9 @@ fn truncRegister(
47644764fn wantSafety(self: *Self) bool {
47654765 return switch (self.bin_file.comp.root_mod.optimize_mode) {
47664766 .Debug => true,
4767 .ReleaseSafe => true,
4768 .ReleaseFast => false,
4769 .ReleaseSmall => false,
4767 .safe => true,
4768 .fast => false,
4769 .small => false,
47704770 };
47714771}
47724772
src/codegen/wasm/Mir.zig+2-2
......@@ -661,8 +661,8 @@ pub const Inst = struct {
661661
662662 comptime {
663663 switch (builtin.mode) {
664 .Debug, .ReleaseSafe => {},
665 .ReleaseFast, .ReleaseSmall => assert(@sizeOf(Data) == 4),
664 .debug, .safe => {},
665 .fast, .small => assert(@sizeOf(Data) == 4),
666666 }
667667 }
668668 };
src/codegen/x86_64/CodeGen.zig+4-4
......@@ -182502,8 +182502,8 @@ fn hasFeature(cg: *CodeGen, feature: std.Target.x86.Feature) bool {
182502182502 .slow_unaligned_mem_16,
182503182503 .slow_unaligned_mem_32,
182504182504 => switch (cg.mod.optimize_mode) {
182505 .Debug, .ReleaseSafe, .ReleaseFast => null,
182506 .ReleaseSmall => false,
182505 .debug, .safe, .fast => null,
182506 .small => false,
182507182507 },
182508182508 .fast_11bytenop,
182509182509 .fast_15bytenop,
......@@ -182523,8 +182523,8 @@ fn hasFeature(cg: *CodeGen, feature: std.Target.x86.Feature) bool {
182523182523 .fast_vector_fsqrt,
182524182524 .fast_vector_shift_masks,
182525182525 => switch (cg.mod.optimize_mode) {
182526 .Debug, .ReleaseSafe, .ReleaseFast => null,
182527 .ReleaseSmall => true,
182526 .debug, .safe, .fast => null,
182527 .small => true,
182528182528 },
182529182529 .mmx => false,
182530182530 .sahf => switch (cg.target.cpu.arch) {
src/libs/libcxx.zig+3-3
......@@ -539,15 +539,15 @@ pub fn addCxxArgs(
539539 // is simple and works everywhere.
540540 try cflags.append("-D_LIBCPP_PSTL_BACKEND_SERIAL");
541541 switch (optimize_mode) {
542 .Debug => {
542 .debug => {
543543 try cflags.append("-D_LIBCPP_HARDENING_MODE=_LIBCPP_HARDENING_MODE_DEBUG");
544544 try cflags.append("-D_LIBCPP_ASSERTION_SEMANTIC_DEFAULT=_LIBCPP_ASSERTION_SEMANTIC_ENFORCE");
545545 },
546 .ReleaseFast, .ReleaseSmall => {
546 .fast, .small => {
547547 try cflags.append("-D_LIBCPP_HARDENING_MODE=_LIBCPP_HARDENING_MODE_NONE");
548548 try cflags.append("-D_LIBCPP_ASSERTION_SEMANTIC_DEFAULT=_LIBCPP_ASSERTION_SEMANTIC_IGNORE");
549549 },
550 .ReleaseSafe => {
550 .safe => {
551551 try cflags.append("-D_LIBCPP_HARDENING_MODE=_LIBCPP_HARDENING_MODE_FAST");
552552 try cflags.append("-D_LIBCPP_ASSERTION_SEMANTIC_DEFAULT=_LIBCPP_ASSERTION_SEMANTIC_ENFORCE");
553553 },
src/libs/libunwind.zig+1-1
......@@ -118,7 +118,7 @@ pub fn buildStaticLib(comp: *Compilation, prog_node: std.Progress.Node) BuildErr
118118 // defines will be correct.
119119 try cflags.append("-D_LIBUNWIND_IS_NATIVE_ONLY");
120120
121 if (comp.root_mod.optimize_mode == .Debug) {
121 if (comp.root_mod.optimize_mode == .debug) {
122122 try cflags.append("-D_DEBUG");
123123 }
124124 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
135135 });
136136
137137 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 => {},
140140 }
141141
142142 for (mingw32_winpthreads_src) |dep| {
src/link/C.zig+1-1
......@@ -429,7 +429,7 @@ pub fn createEmpty(
429429 .tag = .c,
430430 .comp = comp,
431431 .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),
433433 .print_gc_sections = options.print_gc_sections,
434434 .stack_size = options.stack_size orelse 16777216,
435435 .allow_shlib_undefined = options.allow_shlib_undefined orelse false,
src/link/Coff.zig+8-8
......@@ -5598,11 +5598,11 @@ fn updateFuncInner(
55985598 const ni = try coff.mf.addLastChildNode(gpa, sec_si.node(coff), .{
55995599 .alignment = switch (nav.resolved.?.@"align") {
56005600 .none => switch (mod.optimize_mode) {
5601 .Debug,
5602 .ReleaseSafe,
5603 .ReleaseFast,
5601 .debug,
5602 .safe,
5603 .fast,
56045604 => target_util.defaultFunctionAlignment(target),
5605 .ReleaseSmall => target_util.minFunctionAlignment(target),
5605 .small => target_util.minFunctionAlignment(target),
56065606 },
56075607 else => |a| a.maxStrict(target_util.minFunctionAlignment(target)),
56085608 }.toStdMem(),
......@@ -6649,11 +6649,11 @@ fn flushGlobal(coff: *Coff, gmi: Node.GlobalMapIndex) !bool {
66496649
66506650 const target = &comp.root_mod.resolved_target.result;
66516651 const alignment = switch (comp.root_mod.optimize_mode) {
6652 .Debug,
6653 .ReleaseSafe,
6654 .ReleaseFast,
6652 .debug,
6653 .safe,
6654 .fast,
66556655 => target_util.defaultFunctionAlignment(target),
6656 .ReleaseSmall => target_util.minFunctionAlignment(target),
6656 .small => target_util.minFunctionAlignment(target),
66576657 }.toStdMem();
66586658 const parent_si = (try coff.pseudoSectionMapIndex(
66596659 .@".thunks",
src/link/Elf.zig+1-1
......@@ -260,7 +260,7 @@ pub fn createEmpty(
260260 .tag = .elf,
261261 .comp = comp,
262262 .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),
264264 .print_gc_sections = options.print_gc_sections,
265265 .stack_size = options.stack_size orelse 16777216,
266266 .allow_shlib_undefined = options.allow_shlib_undefined orelse !is_native_os,
src/link/Elf/ZigObject.zig+4-4
......@@ -1299,7 +1299,7 @@ fn getNavShdrIndex(
12991299 }
13001300 if (nav_val.isUndef(zcu))
13011301 return switch (zcu.navFileScope(nav_index).mod.?.optimize_mode) {
1302 .Debug, .ReleaseSafe => {
1302 .debug, .safe => {
13031303 if (self.data_index) |symbol_index|
13041304 return self.symbol(symbol_index).outputShndx(elf_file).?;
13051305 const osec = try elf_file.addSection(.{
......@@ -1311,7 +1311,7 @@ fn getNavShdrIndex(
13111311 self.data_index = try self.addSectionSymbol(gpa, try self.addString(gpa, ".data"), osec);
13121312 return osec;
13131313 },
1314 .ReleaseFast, .ReleaseSmall => {
1314 .fast, .small => {
13151315 if (self.bss_index) |symbol_index|
13161316 return self.symbol(symbol_index).outputShndx(elf_file).?;
13171317 const osec = try elf_file.addSection(.{
......@@ -1374,8 +1374,8 @@ fn updateNavCode(
13741374 const target = &mod.resolved_target.result;
13751375 const required_alignment = switch (nav.resolved.?.@"align") {
13761376 .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),
13791379 }.maxStrict(Type.fromInterned(nav.resolved.?.type).abiAlignment(zcu)),
13801380 else => |a| a.maxStrict(target_util.minFunctionAlignment(target)),
13811381 };
src/link/Elf2.zig+4-4
......@@ -4782,11 +4782,11 @@ fn navMapIndex(elf: *Elf, zcu: *Zcu, nav_index: InternPool.Nav.Index) Error!Node
47824782 break :a switch (nav.resolved.?.@"align") {
47834783 else => |a| a.maxStrict(min),
47844784 .none => switch (mod.optimize_mode) {
4785 .Debug,
4786 .ReleaseSafe,
4787 .ReleaseFast,
4785 .debug,
4786 .safe,
4787 .fast,
47884788 => target_util.defaultFunctionAlignment(target),
4789 .ReleaseSmall => min,
4789 .small => min,
47904790 }.maxStrict(Type.fromInterned(nav.resolved.?.type).abiAlignment(zcu)),
47914791 };
47924792 },
src/link/Lld.zig+14-14
......@@ -206,8 +206,8 @@ pub fn createEmpty(
206206 const optimize_mode = comp.root_mod.optimize_mode;
207207
208208 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,
211211 .wasm => output_mode != .Obj,
212212 else => unreachable,
213213 };
......@@ -454,9 +454,9 @@ fn coffLink(lld: *Lld, arena: Allocator) !void {
454454
455455 if (comp.config.lto != .none) {
456456 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"),
460460 }
461461 }
462462 if (comp.config.output_mode == .Exe) {
......@@ -863,15 +863,15 @@ fn elfLink(lld: *Lld, arena: Allocator) !void {
863863
864864 if (comp.config.lto != .none) {
865865 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"),
869869 }
870870 }
871871 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"),
875875 }
876876
877877 if (elf.entry_name) |name| {
......@@ -1414,9 +1414,9 @@ fn wasmLink(lld: *Lld, arena: Allocator) !void {
14141414
14151415 if (comp.config.lto != .none) {
14161416 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"),
14201420 }
14211421 }
14221422
src/link/MachO.zig+1-1
......@@ -181,7 +181,7 @@ pub fn createEmpty(
181181 .tag = .macho,
182182 .comp = comp,
183183 .emit = emit,
184 .gc_sections = options.gc_sections orelse (optimize_mode != .Debug),
184 .gc_sections = options.gc_sections orelse (optimize_mode != .debug),
185185 .print_gc_sections = options.print_gc_sections,
186186 .stack_size = options.stack_size orelse 16777216,
187187 .allow_shlib_undefined = allow_shlib_undefined,
src/link/MachO/ZigObject.zig+4-4
......@@ -946,8 +946,8 @@ fn updateNavCode(
946946 const target = &mod.resolved_target.result;
947947 const required_alignment = switch (nav.resolved.?.@"align") {
948948 .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),
951951 },
952952 else => |a| a.maxStrict(target_util.minFunctionAlignment(target)),
953953 };
......@@ -1172,8 +1172,8 @@ fn getNavOutputSection(
11721172 if (nav.resolved.?.@"const") return macho_file.zig_const_sect_index.?;
11731173 if (nav_val.isUndef(zcu))
11741174 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.?,
11771177 };
11781178 for (code) |byte| {
11791179 if (byte != 0) break;
src/main.zig+25-26
......@@ -44,9 +44,9 @@ pub const std_options: std.Options = .{
4444 .logFn = log,
4545
4646 .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,
5050 },
5151};
5252pub const std_options_cwd = if (native_os == .wasi) wasi_cwd else null;
......@@ -158,8 +158,8 @@ pub fn log(
158158
159159const use_safe_allocator = build_options.debug_gpa or
160160 (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,
163163 });
164164
165165var safe_allocator: std.heap.SafeAllocator = .init(std.heap.page_allocator, .{
......@@ -360,7 +360,7 @@ fn mainArgs(
360360 .prepend_zig_exe_path = true,
361361 .prepend_seed = true,
362362 .debug_env_var = .ZIG_DEBUG_MAKER,
363 .release_mode = .ReleaseSafe,
363 .release_mode = .safe,
364364 });
365365 },
366366 .clang, .@"-cc1", .@"-cc1as" => {
......@@ -568,10 +568,10 @@ const usage_build_generic =
568568 \\Per-Module Compile Options:
569569 \\ -target [name] <arch><sub>-<os>-<abi> see the targets command
570570 \\ -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.
575575 \\ -ofmt=[fmt] Override target object format
576576 \\ elf Executable and Linking Format
577577 \\ c C source code
......@@ -994,7 +994,7 @@ fn buildOutputType(
994994 var minor_subsystem_version: ?u16 = null;
995995 var mingw_unicode_entry_point: bool = false;
996996 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;
998998 var install_name: ?[]const u8 = null;
999999 var hash_style: link.File.Lld.Elf.HashStyle = .both;
10001000 var entitlements: ?[]const u8 = null;
......@@ -1433,7 +1433,7 @@ fn buildOutputType(
14331433 enable_link_snapshots = true;
14341434 }
14351435 } else if (mem.eql(u8, arg, "--debug-rt")) {
1436 debug_compiler_runtime_libs = .Debug;
1436 debug_compiler_runtime_libs = .debug;
14371437 } else if (mem.cutPrefix(u8, arg, "--debug-rt=")) |rest| {
14381438 debug_compiler_runtime_libs = parseOptimizeMode(rest);
14391439 } else if (mem.eql(u8, arg, "--debug-incremental")) {
......@@ -2271,18 +2271,18 @@ fn buildOutputType(
22712271 if (mem.eql(u8, level, "s") or
22722272 mem.eql(u8, level, "z"))
22732273 {
2274 mod_opts.optimize_mode = .ReleaseSmall;
2274 mod_opts.optimize_mode = .small;
22752275 } else if (mem.eql(u8, level, "1") or
22762276 mem.eql(u8, level, "2") or
22772277 mem.eql(u8, level, "3") or
22782278 mem.eql(u8, level, "4") or
22792279 mem.eql(u8, level, "fast"))
22802280 {
2281 mod_opts.optimize_mode = .ReleaseFast;
2281 mod_opts.optimize_mode = .fast;
22822282 } else if (mem.eql(u8, level, "g") or
22832283 mem.eql(u8, level, "0"))
22842284 {
2285 mod_opts.optimize_mode = .Debug;
2285 mod_opts.optimize_mode = .debug;
22862286 } else {
22872287 try cc_argv.appendSlice(arena, it.other_args);
22882288 }
......@@ -2356,9 +2356,9 @@ fn buildOutputType(
23562356 // `sanitize_c` will resolve to! So we either have to pick `off` or `full`.
23572357 //
23582358 // `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
23602360 // 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.
23622362 //
23632363 // `off` seems very slightly less bad, so let's go with that.
23642364 mod_opts.sanitize_c = .off;
......@@ -2972,8 +2972,8 @@ fn buildOutputType(
29722972 }
29732973
29742974 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;
29772977 }
29782978 }
29792979
......@@ -4875,7 +4875,7 @@ const JitCmdOptions = struct {
48754875 /// Send error bundles via std.zig.Server over stdout
48764876 server: bool = false,
48774877 debug_env_var: EnvVar = .ZIG_DEBUG_CMD,
4878 release_mode: std.lang.OptimizeMode = .ReleaseFast,
4878 release_mode: std.lang.Optimize = .fast,
48794879};
48804880
48814881fn jitCmd(
......@@ -4926,11 +4926,11 @@ fn jitCmdInner(
49264926 const self_exe_path = process.executablePathAlloc(io, arena) catch |err|
49274927 fatal("unable to find self exe path: {t}", .{err});
49284928
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
49314931 else
49324932 options.release_mode;
4933 const strip = optimize_mode != .Debug;
4933 const strip = optimize_mode != .debug;
49344934 var override_lib_dir: ?[]const u8 = EnvVar.ZIG_LIB_DIR.get(environ_map);
49354935 const override_global_cache_dir: ?[]const u8 = EnvVar.ZIG_GLOBAL_CACHE_DIR.get(environ_map);
49364936
......@@ -6008,9 +6008,8 @@ fn parseRcIncludes(arg: []const u8) std.zig.RcIncludes {
60086008 fatal("unsupported rc includes type: {q}", .{arg});
60096009}
60106010
6011fn parseOptimizeMode(s: []const u8) std.lang.OptimizeMode {
6012 return stringToEnum(std.lang.OptimizeMode, s) orelse
6013 fatal("unrecognized optimization mode: {q}", .{s});
6011fn parseOptimizeMode(s: []const u8) std.lang.Optimize {
6012 return std.lang.Optimize.fromString(s) orelse fatal("unrecognized optimization mode: {q}", .{s});
60146013}
60156014
60166015fn parseWasiExecModel(s: []const u8) std.lang.WasiExecModel {
src/target.zig+5-5
......@@ -357,12 +357,12 @@ pub fn libcProvidesStackProtector(target: *const std.Target) bool {
357357
358358/// Returns true if `@returnAddress()` is supported by the target and has a
359359/// reasonably performant implementation for the requested optimization mode.
360pub fn supportsReturnAddress(target: *const std.Target, optimize: std.lang.OptimizeMode) bool {
360pub fn supportsReturnAddress(target: *const std.Target, optimize: std.lang.Optimize) bool {
361361 return switch (target.cpu.arch) {
362362 // Emscripten currently implements `emscripten_return_address()` by calling
363363 // out into JavaScript and parsing a stack trace, which introduces significant
364364 // 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,
366366 .bpfel, .bpfeb => false,
367367 .spirv32, .spirv64 => false,
368368 else => true,
......@@ -417,11 +417,11 @@ pub fn hasDebugInfo(target: *const std.Target) bool {
417417 };
418418}
419419
420pub fn defaultCompilerRtOptimizeMode(target: *const std.Target) std.lang.OptimizeMode {
420pub fn defaultCompilerRtOptimizeMode(target: *const std.Target) std.lang.Optimize {
421421 if (target.cpu.arch.isWasm() and target.os.tag == .freestanding) {
422 return .ReleaseSmall;
422 return .small;
423423 } else {
424 return .ReleaseFast;
424 return .fast;
425425 }
426426}
427427
test/behavior/cast.zig+1-1
......@@ -498,7 +498,7 @@ test "array coercion to undefined at runtime" {
498498
499499 @setRuntimeSafety(true);
500500
501 if (builtin.mode != .Debug and builtin.mode != .ReleaseSafe) {
501 if (builtin.mode != .debug and builtin.mode != .safe) {
502502 return error.SkipZigTest;
503503 }
504504
test/behavior/floatop.zig+1-1
......@@ -1678,7 +1678,7 @@ test "runtime isNan(inf * 0)" {
16781678
16791679test "optimized float mode" {
16801680 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;
16821682
16831683 const big = 0x1p40;
16841684 const small = 0.001;
test/behavior/int128.zig+1-1
......@@ -31,7 +31,7 @@ test "undefined 128 bit int" {
3131 @setRuntimeSafety(true);
3232
3333 // TODO implement @setRuntimeSafety
34 if (builtin.mode != .Debug and builtin.mode != .ReleaseSafe) {
34 if (builtin.mode != .debug and builtin.mode != .safe) {
3535 return error.SkipZigTest;
3636 }
3737
test/c_abi/main.zig+3-3
......@@ -16754,7 +16754,7 @@ test "CFF: Zig returns to C" {
1675416754}
1675516755test "CFF: C passes to Zig" {
1675616756 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;
1675816758 if (builtin.cpu.arch.isMIPS64()) return error.SkipZigTest;
1675916759 if (builtin.cpu.arch.isPowerPC()) return error.SkipZigTest;
1676016760 if (builtin.cpu.arch.isLoongArch()) return error.SkipZigTest;
......@@ -16764,7 +16764,7 @@ test "CFF: C passes to Zig" {
1676416764 try expectOk(c_send_CFF());
1676516765}
1676616766test "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;
1676816768 if (builtin.cpu.arch.isMIPS64()) return error.SkipZigTest;
1676916769 if (builtin.cpu.arch.isPowerPC()) return error.SkipZigTest;
1677016770 if (builtin.cpu.arch.isLoongArch()) return error.SkipZigTest;
......@@ -16920,7 +16920,7 @@ extern fn c_f16_struct(f16_struct) f16_struct;
1692016920test "f16 struct" {
1692116921 if (builtin.target.cpu.arch.isMIPS64()) return error.SkipZigTest;
1692216922 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;
1692416924 if (builtin.cpu.arch == .s390x) return error.SkipZigTest;
1692516925 if (builtin.cpu.arch == .x86 and builtin.os.tag == .windows) return error.SkipZigTest;
1692616926
test/cases/compile_errors/invalid_member_of_builtin_enum.zig+1-1
......@@ -6,5 +6,5 @@ export fn entry() void {
66
77// error
88//
9// :3:35: error: enum 'lang.OptimizeMode' has no member named 'x86'
9// :3:35: error: enum 'lang.Optimize' has no member named 'x86'
1010// : note: enum declared here
test/src/ErrorTrace.zig+2-2
......@@ -60,9 +60,9 @@ fn addCaseConfig(
6060 const b = self.b;
6161
6262 const error_tracing: bool = tracing: {
63 if (optimize == .Debug) break :tracing true;
63 if (optimize == .debug) break :tracing true;
6464 if (backend != .llvm) break :tracing true;
65 if (optimize == .ReleaseSmall) break :tracing false;
65 if (optimize == .small) break :tracing false;
6666 for (case.disable_trace_optimized) |disable| {
6767 const d_arch, const d_os = disable;
6868 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 {
1111 const none_specified_mod = none_specified.module("dummy");
1212 if (!none_specified_mod.resolved_target.?.query.eql(b.graph.host.query)) return error.TestFailed;
1313 const expected_optimize: std.builtin.OptimizeMode = switch (b.graph.release_mode) {
14 .off => .Debug,
14 .off => .debug,
1515 .any => unreachable,
16 .fast => .ReleaseFast,
17 .safe => .ReleaseSafe,
18 .small => .ReleaseSmall,
16 .fast => .fast,
17 .safe => .safe,
18 .small => .small,
1919 };
2020 if (none_specified_mod.optimize.? != expected_optimize) return error.TestFailed;
2121
......@@ -44,7 +44,7 @@ pub fn build(b: *std.Build) !void {
4444
4545 const all_specified = b.dependency("other", .{
4646 .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),
4848 .bool = @as(bool, true),
4949 .int = @as(i64, 123),
5050 .float = @as(f64, 0.5),
......@@ -66,11 +66,11 @@ pub fn build(b: *std.Build) !void {
6666 if (all_specified_mod.resolved_target.?.result.cpu.arch != .x86_64) return error.TestFailed;
6767 if (all_specified_mod.resolved_target.?.result.os.tag != .windows) return error.TestFailed;
6868 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;
7070
7171 const all_specified_optional = b.dependency("other", .{
7272 .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),
7474 .bool = @as(?bool, true),
7575 .int = @as(?i64, 123),
7676 .float = @as(?f64, 0.5),
......@@ -92,7 +92,7 @@ pub fn build(b: *std.Build) !void {
9292
9393 const all_specified_literal = b.dependency("other", .{
9494 .target = b.resolveTargetQuery(.{ .cpu_arch = .x86_64, .os_tag = .windows, .abi = .gnu }),
95 .optimize = .ReleaseSafe,
95 .optimize = .safe,
9696 .bool = true,
9797 .int = 123,
9898 .float = 0.5,
......@@ -130,7 +130,7 @@ pub fn build(b: *std.Build) !void {
130130 // to the same cached dependency instance.
131131 const all_specified_alt = b.dependency("other", .{
132132 .target = @as(std.Target.Query, .{ .cpu_arch = .x86_64, .os_tag = .windows, .abi = .gnu }),
133 .optimize = "ReleaseSafe",
133 .optimize = "safe",
134134 .bool = .true,
135135 .int = "123",
136136 .float = @as(f16, 0.5),
test/standalone/simple/build.zig+5-5
......@@ -13,26 +13,26 @@ pub fn build(b: *std.Build) void {
1313 var optimize_modes_buf: [4]std.builtin.OptimizeMode = undefined;
1414 var optimize_modes_len: usize = 0;
1515 if (!skip_debug) {
16 optimize_modes_buf[optimize_modes_len] = .Debug;
16 optimize_modes_buf[optimize_modes_len] = .debug;
1717 optimize_modes_len += 1;
1818 }
1919 if (!skip_release_safe) {
20 optimize_modes_buf[optimize_modes_len] = .ReleaseSafe;
20 optimize_modes_buf[optimize_modes_len] = .safe;
2121 optimize_modes_len += 1;
2222 }
2323 if (!skip_release_fast) {
24 optimize_modes_buf[optimize_modes_len] = .ReleaseFast;
24 optimize_modes_buf[optimize_modes_len] = .fast;
2525 optimize_modes_len += 1;
2626 }
2727 if (!skip_release_small) {
28 optimize_modes_buf[optimize_modes_len] = .ReleaseSmall;
28 optimize_modes_buf[optimize_modes_len] = .small;
2929 optimize_modes_len += 1;
3030 }
3131 const optimize_modes = optimize_modes_buf[0..optimize_modes_len];
3232
3333 for (cases) |case| {
3434 for (optimize_modes) |optimize| {
35 if (!case.all_modes and optimize != .Debug) continue;
35 if (!case.all_modes and optimize != .debug) continue;
3636 if (case.os_filter) |os_tag| {
3737 if (os_tag != builtin.os.tag) continue;
3838 }
test/tests.zig+22-22
......@@ -23,7 +23,7 @@ pub const LinkContext = @import("src/Link.zig");
2323const ModuleTestTarget = struct {
2424 linkage: ?std.builtin.LinkMode = null,
2525 target: std.Target.Query = .{},
26 optimize_mode: std.builtin.OptimizeMode = .Debug,
26 optimize_mode: std.builtin.OptimizeMode = .debug,
2727 link_libc: ?bool = null,
2828 single_threaded: ?bool = null,
2929 use_llvm: ?bool = null,
......@@ -57,38 +57,38 @@ const module_test_targets = blk: {
5757 },
5858
5959 .{
60 .optimize_mode = .ReleaseFast,
60 .optimize_mode = .fast,
6161 },
6262 .{
6363 .link_libc = true,
64 .optimize_mode = .ReleaseFast,
64 .optimize_mode = .fast,
6565 },
6666 .{
67 .optimize_mode = .ReleaseFast,
67 .optimize_mode = .fast,
6868 .single_threaded = true,
6969 },
7070
7171 .{
72 .optimize_mode = .ReleaseSafe,
72 .optimize_mode = .safe,
7373 },
7474 .{
7575 .link_libc = true,
76 .optimize_mode = .ReleaseSafe,
76 .optimize_mode = .safe,
7777 },
7878 .{
79 .optimize_mode = .ReleaseSafe,
79 .optimize_mode = .safe,
8080 .single_threaded = true,
8181 },
8282
8383 .{
84 .optimize_mode = .ReleaseSmall,
84 .optimize_mode = .small,
8585 },
8686 .{
8787 .link_libc = true,
88 .optimize_mode = .ReleaseSmall,
88 .optimize_mode = .small,
8989 },
9090 .{
91 .optimize_mode = .ReleaseSmall,
91 .optimize_mode = .small,
9292 .single_threaded = true,
9393 },
9494
......@@ -200,7 +200,7 @@ const module_test_targets = blk: {
200200 // },
201201 // .use_llvm = false,
202202 // .use_lld = false,
203 // .optimize_mode = .ReleaseFast,
203 // .optimize_mode = .fast,
204204 // .strip = true,
205205 // .skip_modules = &.{"std"}, // TODO get these passing
206206 //},
......@@ -213,7 +213,7 @@ const module_test_targets = blk: {
213213 // },
214214 // .use_llvm = false,
215215 // .use_lld = false,
216 // .optimize_mode = .ReleaseFast,
216 // .optimize_mode = .fast,
217217 // .strip = true,
218218 // .skip_modules = &.{"std"}, // TODO get these passing
219219 //},
......@@ -1257,7 +1257,7 @@ const module_test_targets = blk: {
12571257 // },
12581258 // .use_llvm = false,
12591259 // .use_lld = false,
1260 // .optimize_mode = .ReleaseFast,
1260 // .optimize_mode = .fast,
12611261 // .strip = true,
12621262 //},
12631263
......@@ -2063,7 +2063,7 @@ const c_abi_targets = blk: {
20632063
20642064const LinkTarget = struct {
20652065 target: std.Target.Query = .{},
2066 optimize_mode: std.builtin.OptimizeMode = .Debug,
2066 optimize_mode: std.builtin.OptimizeMode = .debug,
20672067 link_libc: bool = false,
20682068 use_llvm: bool = false,
20692069 use_lld: bool = false,
......@@ -2368,7 +2368,7 @@ pub fn addStackTraceTests(
23682368 .root_module = b.createModule(.{
23692369 .root_source_file = b.path("test/src/convert-stack-trace.zig"),
23702370 .target = b.graph.host,
2371 .optimize = .Debug,
2371 .optimize = .debug,
23722372 }),
23732373 });
23742374
......@@ -2422,7 +2422,7 @@ pub fn addErrorTraceTests(
24222422 .root_module = b.createModule(.{
24232423 .root_source_file = b.path("test/src/convert-stack-trace.zig"),
24242424 .target = b.graph.host,
2425 .optimize = .Debug,
2425 .optimize = .debug,
24262426 }),
24272427 });
24282428
......@@ -2486,10 +2486,10 @@ pub fn addStandaloneTests(
24862486 .enable_ios_sdk = enable_ios_sdk,
24872487 .enable_macos_sdk = enable_macos_sdk,
24882488 .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,
24932493 });
24942494 const test_cases_dep_step = test_cases_dep.builder.default_step;
24952495 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
30573057 if (use_llvm) |x| return x;
30583058 if (query.ofmt == .c) return false;
30593059 switch (optimize_mode) {
3060 .Debug => {},
3060 .debug => {},
30613061 else => return true,
30623062 }
30633063 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
33143314 .root_module = b.createModule(.{
33153315 .root_source_file = b.path("tools/incr-check.zig"),
33163316 .target = b.graph.host,
3317 .optimize = .Debug,
3317 .optimize = .debug,
33183318 }),
33193319 });
33203320
tools/doctest.zig+3-3
......@@ -915,11 +915,11 @@ fn parseManifest(arena: Allocator, source_bytes: []const u8) !Code {
915915 while (it.next()) |prefixed_line| {
916916 const line = skipPrefix(prefixed_line);
917917 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});
920920 } else if (mem.startsWith(u8, line, "link_mode=")) {
921921 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});
923923 } else if (mem.startsWith(u8, line, "link_object=")) {
924924 try link_objects.append(arena, line["link_object=".len..]);
925925 } 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
319319 return parseError(tokenizer, code_kind_tok, "unrecognized code kind: {s}", .{code_kind_str});
320320 }
321321
322 var mode: std.builtin.OptimizeMode = .Debug;
322 var mode: std.builtin.OptimizeMode = .debug;
323323 var link_objects = std.array_list.Managed([]const u8).init(arena);
324324 var target_str: ?[]const u8 = null;
325325 var link_libc = false;
......@@ -403,7 +403,7 @@ fn walk(arena: Allocator, io: Io, tokenizer: *Tokenizer, out_dir: Dir, w: anytyp
403403 },
404404 }
405405
406 if (mode != .Debug)
406 if (mode != .debug)
407407 try code.print("// optimize={s}\n", .{@tagName(mode)});
408408
409409 for (link_objects.items) |link_object| {