authorgravatar for andrew@ziglang.orgAndrew Kelley <andrew@ziglang.org> 2022-08-07 18:17:31-07:00
committergravatar for andrew@ziglang.orgAndrew Kelley <andrew@ziglang.org> 2022-08-19 16:45:15-07:00
log73bbd1069a993a0e663033ea3b8cd4ed1a123566
tree1e2b148425da2359d720d6d5048ad94151788bb9
parent39f43fea8d0f6aa1c69cb7c3209f57f5ce00b273

build: remove the option to omit stage2


6 files changed, 7 insertions(+), 52 deletions(-)

build.zig+5-9
......@@ -65,7 +65,6 @@ pub fn build(b: *Builder) !void {
6565 const only_install_lib_files = b.option(bool, "lib-files-only", "Only install library files") orelse false;
6666
6767 const is_stage1 = b.option(bool, "stage1", "Build the stage1 compiler, put stage2 behind a feature flag") orelse false;
68 const omit_stage2 = b.option(bool, "omit-stage2", "Do not include stage2 behind a feature flag inside stage1") orelse false;
6968 const static_llvm = b.option(bool, "static-llvm", "Disable integration with system-installed LLVM, Clang, LLD, and libc++") orelse false;
7069 const enable_llvm = b.option(bool, "enable-llvm", "Build self-hosted compiler with LLVM backend enabled") orelse (is_stage1 or static_llvm);
7170 const llvm_has_m68k = b.option(
......@@ -361,7 +360,6 @@ pub fn build(b: *Builder) !void {
361360 exe_options.addOption(bool, "enable_tracy_allocation", tracy_allocation);
362361 exe_options.addOption(bool, "value_tracing", value_tracing);
363362 exe_options.addOption(bool, "is_stage1", is_stage1);
364 exe_options.addOption(bool, "omit_stage2", omit_stage2);
365363 if (tracy) |tracy_path| {
366364 const client_cpp = fs.path.join(
367365 b.allocator,
......@@ -397,7 +395,6 @@ pub fn build(b: *Builder) !void {
397395 test_cases_options.addOption(bool, "skip_non_native", skip_non_native);
398396 test_cases_options.addOption(bool, "skip_stage1", skip_stage1);
399397 test_cases_options.addOption(bool, "is_stage1", is_stage1);
400 test_cases_options.addOption(bool, "omit_stage2", omit_stage2);
401398 test_cases_options.addOption(bool, "have_llvm", enable_llvm);
402399 test_cases_options.addOption(bool, "llvm_has_m68k", llvm_has_m68k);
403400 test_cases_options.addOption(bool, "llvm_has_csky", llvm_has_csky);
......@@ -457,7 +454,7 @@ pub fn build(b: *Builder) !void {
457454 skip_non_native,
458455 skip_libc,
459456 skip_stage1,
460 omit_stage2,
457 false,
461458 is_stage1,
462459 ));
463460
......@@ -472,7 +469,7 @@ pub fn build(b: *Builder) !void {
472469 skip_non_native,
473470 true, // skip_libc
474471 skip_stage1,
475 omit_stage2 or true, // TODO get these all passing
472 true, // TODO get these all passing
476473 is_stage1,
477474 ));
478475
......@@ -487,7 +484,7 @@ pub fn build(b: *Builder) !void {
487484 skip_non_native,
488485 true, // skip_libc
489486 skip_stage1,
490 omit_stage2 or true, // TODO get these all passing
487 true, // TODO get these all passing
491488 is_stage1,
492489 ));
493490
......@@ -499,14 +496,13 @@ pub fn build(b: *Builder) !void {
499496 skip_non_native,
500497 enable_macos_sdk,
501498 target,
502 omit_stage2,
503499 b.enable_darling,
504500 b.enable_qemu,
505501 b.enable_rosetta,
506502 b.enable_wasmtime,
507503 b.enable_wine,
508504 ));
509 toolchain_step.dependOn(tests.addLinkTests(b, test_filter, modes, enable_macos_sdk, omit_stage2));
505 toolchain_step.dependOn(tests.addLinkTests(b, test_filter, modes, enable_macos_sdk));
510506 toolchain_step.dependOn(tests.addStackTraceTests(b, test_filter, modes));
511507 toolchain_step.dependOn(tests.addCliTests(b, test_filter, modes));
512508 toolchain_step.dependOn(tests.addAssembleAndLinkTests(b, test_filter, modes));
......@@ -528,7 +524,7 @@ pub fn build(b: *Builder) !void {
528524 skip_non_native,
529525 skip_libc,
530526 skip_stage1,
531 omit_stage2 or true, // TODO get these all passing
527 true, // TODO get these all passing
532528 is_stage1,
533529 );
534530
ci/azure/build.zig-2
......@@ -38,7 +38,6 @@ pub fn build(b: *Builder) !void {
3838 docs_step.dependOn(&docgen_cmd.step);
3939
4040 const is_stage1 = b.option(bool, "stage1", "Build the stage1 compiler, put stage2 behind a feature flag") orelse false;
41 const omit_stage2 = b.option(bool, "omit-stage2", "Do not include stage2 behind a feature flag inside stage1") orelse false;
4241 const static_llvm = b.option(bool, "static-llvm", "Disable integration with system-installed LLVM, Clang, LLD, and libc++") orelse false;
4342 const enable_llvm = b.option(bool, "enable-llvm", "Build self-hosted compiler with LLVM backend enabled") orelse (is_stage1 or static_llvm);
4443 const llvm_has_m68k = b.option(
......@@ -300,7 +299,6 @@ pub fn build(b: *Builder) !void {
300299 exe_options.addOption(bool, "enable_tracy_allocation", tracy_allocation);
301300 exe_options.addOption(bool, "value_tracing", value_tracing);
302301 exe_options.addOption(bool, "is_stage1", is_stage1);
303 exe_options.addOption(bool, "omit_stage2", omit_stage2);
304302 if (tracy) |tracy_path| {
305303 const client_cpp = fs.path.join(
306304 b.allocator,
src/Compilation.zig+2-27
......@@ -1044,8 +1044,6 @@ pub fn create(gpa: Allocator, options: InitOptions) !*Compilation {
10441044 // Even though we may have no Zig code to compile (depending on `options.main_pkg`),
10451045 // we may need to use stage1 for building compiler-rt and other dependencies.
10461046
1047 if (build_options.omit_stage2)
1048 break :blk true;
10491047 if (options.use_llvm) |use_llvm| {
10501048 if (!use_llvm) {
10511049 break :blk false;
......@@ -2213,8 +2211,7 @@ pub fn update(comp: *Compilation) !void {
22132211 comp.c_object_work_queue.writeItemAssumeCapacity(key);
22142212 }
22152213
2216 const use_stage1 = build_options.omit_stage2 or
2217 (build_options.is_stage1 and comp.bin_file.options.use_stage1);
2214 const use_stage1 = build_options.is_stage1 and comp.bin_file.options.use_stage1;
22182215 if (comp.bin_file.options.module) |module| {
22192216 module.compile_log_text.shrinkAndFree(module.gpa, 0);
22202217 module.generation += 1;
......@@ -2390,8 +2387,7 @@ fn flush(comp: *Compilation, prog_node: *std.Progress.Node) !void {
23902387 };
23912388 comp.link_error_flags = comp.bin_file.errorFlags();
23922389
2393 const use_stage1 = build_options.omit_stage2 or
2394 (build_options.is_stage1 and comp.bin_file.options.use_stage1);
2390 const use_stage1 = build_options.is_stage1 and comp.bin_file.options.use_stage1;
23952391 if (!use_stage1) {
23962392 if (comp.bin_file.options.module) |module| {
23972393 try link.File.C.flushEmitH(module);
......@@ -2952,9 +2948,6 @@ pub fn performAllTheWork(
29522948fn processOneJob(comp: *Compilation, job: Job) !void {
29532949 switch (job) {
29542950 .codegen_decl => |decl_index| {
2955 if (build_options.omit_stage2)
2956 @panic("sadly stage2 is omitted from this build to save memory on the CI server");
2957
29582951 const module = comp.bin_file.options.module.?;
29592952 const decl = module.declPtr(decl_index);
29602953
......@@ -2989,9 +2982,6 @@ fn processOneJob(comp: *Compilation, job: Job) !void {
29892982 }
29902983 },
29912984 .codegen_func => |func| {
2992 if (build_options.omit_stage2)
2993 @panic("sadly stage2 is omitted from this build to save memory on the CI server");
2994
29952985 const named_frame = tracy.namedFrame("codegen_func");
29962986 defer named_frame.end();
29972987
......@@ -3002,9 +2992,6 @@ fn processOneJob(comp: *Compilation, job: Job) !void {
30022992 };
30032993 },
30042994 .emit_h_decl => |decl_index| {
3005 if (build_options.omit_stage2)
3006 @panic("sadly stage2 is omitted from this build to save memory on the CI server");
3007
30082995 const module = comp.bin_file.options.module.?;
30092996 const decl = module.declPtr(decl_index);
30102997
......@@ -3063,9 +3050,6 @@ fn processOneJob(comp: *Compilation, job: Job) !void {
30633050 }
30643051 },
30653052 .analyze_decl => |decl_index| {
3066 if (build_options.omit_stage2)
3067 @panic("sadly stage2 is omitted from this build to save memory on the CI server");
3068
30693053 const module = comp.bin_file.options.module.?;
30703054 module.ensureDeclAnalyzed(decl_index) catch |err| switch (err) {
30713055 error.OutOfMemory => return error.OutOfMemory,
......@@ -3073,9 +3057,6 @@ fn processOneJob(comp: *Compilation, job: Job) !void {
30733057 };
30743058 },
30753059 .update_embed_file => |embed_file| {
3076 if (build_options.omit_stage2)
3077 @panic("sadly stage2 is omitted from this build to save memory on the CI server");
3078
30793060 const named_frame = tracy.namedFrame("update_embed_file");
30803061 defer named_frame.end();
30813062
......@@ -3086,9 +3067,6 @@ fn processOneJob(comp: *Compilation, job: Job) !void {
30863067 };
30873068 },
30883069 .update_line_number => |decl_index| {
3089 if (build_options.omit_stage2)
3090 @panic("sadly stage2 is omitted from this build to save memory on the CI server");
3091
30923070 const named_frame = tracy.namedFrame("update_line_number");
30933071 defer named_frame.end();
30943072
......@@ -3107,9 +3085,6 @@ fn processOneJob(comp: *Compilation, job: Job) !void {
31073085 };
31083086 },
31093087 .analyze_pkg => |pkg| {
3110 if (build_options.omit_stage2)
3111 @panic("sadly stage2 is omitted from this build to save memory on the CI server");
3112
31133088 const named_frame = tracy.namedFrame("analyze_pkg");
31143089 defer named_frame.end();
31153090
src/Sema.zig-7
......@@ -27358,9 +27358,6 @@ pub fn resolveTypeLayout(
2735827358 src: LazySrcLoc,
2735927359 ty: Type,
2736027360) CompileError!void {
27361 if (build_options.omit_stage2)
27362 @panic("sadly stage2 is omitted from this build to save memory on the CI server");
27363
2736427361 switch (ty.zigTypeTag()) {
2736527362 .Struct => return sema.resolveStructLayout(block, src, ty),
2736627363 .Union => return sema.resolveUnionLayout(block, src, ty),
......@@ -27699,8 +27696,6 @@ fn resolveUnionFully(
2769927696}
2770027697
2770127698pub fn resolveTypeFields(sema: *Sema, block: *Block, src: LazySrcLoc, ty: Type) CompileError!Type {
27702 if (build_options.omit_stage2)
27703 @panic("sadly stage2 is omitted from this build to save memory on the CI server");
2770427699 switch (ty.tag()) {
2770527700 .@"struct" => {
2770627701 const struct_obj = ty.castTag(.@"struct").?.data;
......@@ -29323,8 +29318,6 @@ fn typePtrOrOptionalPtrTy(
2932329318/// TODO merge these implementations together with the "advanced"/sema_kit pattern seen
2932429319/// elsewhere in value.zig
2932529320pub fn typeRequiresComptime(sema: *Sema, block: *Block, src: LazySrcLoc, ty: Type) CompileError!bool {
29326 if (build_options.omit_stage2)
29327 @panic("sadly stage2 is omitted from this build to save memory on the CI server");
2932829321 return switch (ty.tag()) {
2932929322 .u1,
2933029323 .u8,
src/config.zig.in-1
......@@ -10,4 +10,3 @@ pub const enable_tracy = false;
1010pub const value_tracing = false;
1111pub const is_stage1 = true;
1212pub const skip_non_native = false;
13pub const omit_stage2: bool = @ZIG_OMIT_STAGE2_BOOL@;
test/tests.zig-6
......@@ -462,7 +462,6 @@ pub fn addStandaloneTests(
462462 skip_non_native: bool,
463463 enable_macos_sdk: bool,
464464 target: std.zig.CrossTarget,
465 omit_stage2: bool,
466465 enable_darling: bool,
467466 enable_qemu: bool,
468467 enable_rosetta: bool,
......@@ -479,7 +478,6 @@ pub fn addStandaloneTests(
479478 .skip_non_native = skip_non_native,
480479 .enable_macos_sdk = enable_macos_sdk,
481480 .target = target,
482 .omit_stage2 = omit_stage2,
483481 .enable_darling = enable_darling,
484482 .enable_qemu = enable_qemu,
485483 .enable_rosetta = enable_rosetta,
......@@ -497,7 +495,6 @@ pub fn addLinkTests(
497495 test_filter: ?[]const u8,
498496 modes: []const Mode,
499497 enable_macos_sdk: bool,
500 omit_stage2: bool,
501498) *build.Step {
502499 const cases = b.allocator.create(StandaloneContext) catch unreachable;
503500 cases.* = StandaloneContext{
......@@ -509,7 +506,6 @@ pub fn addLinkTests(
509506 .skip_non_native = true,
510507 .enable_macos_sdk = enable_macos_sdk,
511508 .target = .{},
512 .omit_stage2 = omit_stage2,
513509 };
514510 link.addCases(cases);
515511 return cases.step;
......@@ -978,7 +974,6 @@ pub const StandaloneContext = struct {
978974 skip_non_native: bool,
979975 enable_macos_sdk: bool,
980976 target: std.zig.CrossTarget,
981 omit_stage2: bool,
982977 enable_darling: bool = false,
983978 enable_qemu: bool = false,
984979 enable_rosetta: bool = false,
......@@ -1003,7 +998,6 @@ pub const StandaloneContext = struct {
1003998 const b = self.b;
1004999
10051000 if (features.requires_macos_sdk and !self.enable_macos_sdk) return;
1006 if (features.requires_stage2 and self.omit_stage2) return;
10071001
10081002 const annotated_case_name = b.fmt("build {s}", .{build_file});
10091003 if (self.test_filter) |filter| {