Skip to content

Commit b4d4e4c

Browse files
andrewrkkubkon
authored andcommitted
build: remove the option to omit stage2
1 parent f45264e commit b4d4e4c

File tree

6 files changed

+7
-52
lines changed

6 files changed

+7
-52
lines changed

build.zig

Lines changed: 5 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -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

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -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

Lines changed: 2 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -1033,8 +1033,6 @@ pub fn create(gpa: Allocator, options: InitOptions) !*Compilation {
10331033
// Even though we may have no Zig code to compile (depending on `options.main_pkg`),
10341034
// we may need to use stage1 for building compiler-rt and other dependencies.
10351035

1036-
if (build_options.omit_stage2)
1037-
break :blk true;
10381036
if (options.use_llvm) |use_llvm| {
10391037
if (!use_llvm) {
10401038
break :blk false;
@@ -2176,8 +2174,7 @@ pub fn update(comp: *Compilation) !void {
21762174
comp.c_object_work_queue.writeItemAssumeCapacity(key);
21772175
}
21782176

2179-
const use_stage1 = build_options.omit_stage2 or
2180-
(build_options.is_stage1 and comp.bin_file.options.use_stage1);
2177+
const use_stage1 = build_options.is_stage1 and comp.bin_file.options.use_stage1;
21812178
if (comp.bin_file.options.module) |module| {
21822179
module.compile_log_text.shrinkAndFree(module.gpa, 0);
21832180
module.generation += 1;
@@ -2353,8 +2350,7 @@ fn flush(comp: *Compilation, prog_node: *std.Progress.Node) !void {
23532350
};
23542351
comp.link_error_flags = comp.bin_file.errorFlags();
23552352

2356-
const use_stage1 = build_options.omit_stage2 or
2357-
(build_options.is_stage1 and comp.bin_file.options.use_stage1);
2353+
const use_stage1 = build_options.is_stage1 and comp.bin_file.options.use_stage1;
23582354
if (!use_stage1) {
23592355
if (comp.bin_file.options.module) |module| {
23602356
try link.File.C.flushEmitH(module);
@@ -2915,9 +2911,6 @@ pub fn performAllTheWork(
29152911
fn processOneJob(comp: *Compilation, job: Job) !void {
29162912
switch (job) {
29172913
.codegen_decl => |decl_index| {
2918-
if (build_options.omit_stage2)
2919-
@panic("sadly stage2 is omitted from this build to save memory on the CI server");
2920-
29212914
const module = comp.bin_file.options.module.?;
29222915
const decl = module.declPtr(decl_index);
29232916

@@ -2952,9 +2945,6 @@ fn processOneJob(comp: *Compilation, job: Job) !void {
29522945
}
29532946
},
29542947
.codegen_func => |func| {
2955-
if (build_options.omit_stage2)
2956-
@panic("sadly stage2 is omitted from this build to save memory on the CI server");
2957-
29582948
const named_frame = tracy.namedFrame("codegen_func");
29592949
defer named_frame.end();
29602950

@@ -2965,9 +2955,6 @@ fn processOneJob(comp: *Compilation, job: Job) !void {
29652955
};
29662956
},
29672957
.emit_h_decl => |decl_index| {
2968-
if (build_options.omit_stage2)
2969-
@panic("sadly stage2 is omitted from this build to save memory on the CI server");
2970-
29712958
const module = comp.bin_file.options.module.?;
29722959
const decl = module.declPtr(decl_index);
29732960

@@ -3026,19 +3013,13 @@ fn processOneJob(comp: *Compilation, job: Job) !void {
30263013
}
30273014
},
30283015
.analyze_decl => |decl_index| {
3029-
if (build_options.omit_stage2)
3030-
@panic("sadly stage2 is omitted from this build to save memory on the CI server");
3031-
30323016
const module = comp.bin_file.options.module.?;
30333017
module.ensureDeclAnalyzed(decl_index) catch |err| switch (err) {
30343018
error.OutOfMemory => return error.OutOfMemory,
30353019
error.AnalysisFail => return,
30363020
};
30373021
},
30383022
.update_embed_file => |embed_file| {
3039-
if (build_options.omit_stage2)
3040-
@panic("sadly stage2 is omitted from this build to save memory on the CI server");
3041-
30423023
const named_frame = tracy.namedFrame("update_embed_file");
30433024
defer named_frame.end();
30443025

@@ -3049,9 +3030,6 @@ fn processOneJob(comp: *Compilation, job: Job) !void {
30493030
};
30503031
},
30513032
.update_line_number => |decl_index| {
3052-
if (build_options.omit_stage2)
3053-
@panic("sadly stage2 is omitted from this build to save memory on the CI server");
3054-
30553033
const named_frame = tracy.namedFrame("update_line_number");
30563034
defer named_frame.end();
30573035

@@ -3070,9 +3048,6 @@ fn processOneJob(comp: *Compilation, job: Job) !void {
30703048
};
30713049
},
30723050
.analyze_pkg => |pkg| {
3073-
if (build_options.omit_stage2)
3074-
@panic("sadly stage2 is omitted from this build to save memory on the CI server");
3075-
30763051
const named_frame = tracy.namedFrame("analyze_pkg");
30773052
defer named_frame.end();
30783053

src/Sema.zig

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -27038,9 +27038,6 @@ pub fn resolveTypeLayout(
2703827038
src: LazySrcLoc,
2703927039
ty: Type,
2704027040
) CompileError!void {
27041-
if (build_options.omit_stage2)
27042-
@panic("sadly stage2 is omitted from this build to save memory on the CI server");
27043-
2704427041
switch (ty.zigTypeTag()) {
2704527042
.Struct => return sema.resolveStructLayout(block, src, ty),
2704627043
.Union => return sema.resolveUnionLayout(block, src, ty),
@@ -27271,8 +27268,6 @@ fn resolveUnionFully(
2727127268
}
2727227269

2727327270
pub fn resolveTypeFields(sema: *Sema, block: *Block, src: LazySrcLoc, ty: Type) CompileError!Type {
27274-
if (build_options.omit_stage2)
27275-
@panic("sadly stage2 is omitted from this build to save memory on the CI server");
2727627271
switch (ty.tag()) {
2727727272
.@"struct" => {
2727827273
const struct_obj = ty.castTag(.@"struct").?.data;
@@ -28857,8 +28852,6 @@ fn typePtrOrOptionalPtrTy(
2885728852
/// TODO merge these implementations together with the "advanced"/sema_kit pattern seen
2885828853
/// elsewhere in value.zig
2885928854
pub fn typeRequiresComptime(sema: *Sema, block: *Block, src: LazySrcLoc, ty: Type) CompileError!bool {
28860-
if (build_options.omit_stage2)
28861-
@panic("sadly stage2 is omitted from this build to save memory on the CI server");
2886228855
return switch (ty.tag()) {
2886328856
.u1,
2886428857
.u8,

src/config.zig.in

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,4 +10,3 @@ pub const enable_tracy = false;
1010
pub const value_tracing = false;
1111
pub const is_stage1 = true;
1212
pub const skip_non_native = false;
13-
pub const omit_stage2: bool = @ZIG_OMIT_STAGE2_BOOL@;

test/tests.zig

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -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;
@@ -971,7 +967,6 @@ pub const StandaloneContext = struct {
971967
skip_non_native: bool,
972968
enable_macos_sdk: bool,
973969
target: std.zig.CrossTarget,
974-
omit_stage2: bool,
975970
enable_darling: bool = false,
976971
enable_qemu: bool = false,
977972
enable_rosetta: bool = false,
@@ -996,7 +991,6 @@ pub const StandaloneContext = struct {
996991
const b = self.b;
997992

998993
if (features.requires_macos_sdk and !self.enable_macos_sdk) return;
999-
if (features.requires_stage2 and self.omit_stage2) return;
1000994

1001995
const annotated_case_name = b.fmt("build {s}", .{build_file});
1002996
if (self.test_filter) |filter| {

0 commit comments

Comments
 (0)