build: remove the option to omit stage2

This commit is contained in:
Andrew Kelley 2022-08-07 18:17:31 -07:00
parent 39f43fea8d
commit 73bbd1069a
6 changed files with 7 additions and 52 deletions

View File

@ -65,7 +65,6 @@ pub fn build(b: *Builder) !void {
const only_install_lib_files = b.option(bool, "lib-files-only", "Only install library files") orelse false;
const is_stage1 = b.option(bool, "stage1", "Build the stage1 compiler, put stage2 behind a feature flag") orelse false;
const omit_stage2 = b.option(bool, "omit-stage2", "Do not include stage2 behind a feature flag inside stage1") orelse false;
const static_llvm = b.option(bool, "static-llvm", "Disable integration with system-installed LLVM, Clang, LLD, and libc++") orelse false;
const enable_llvm = b.option(bool, "enable-llvm", "Build self-hosted compiler with LLVM backend enabled") orelse (is_stage1 or static_llvm);
const llvm_has_m68k = b.option(
@ -361,7 +360,6 @@ pub fn build(b: *Builder) !void {
exe_options.addOption(bool, "enable_tracy_allocation", tracy_allocation);
exe_options.addOption(bool, "value_tracing", value_tracing);
exe_options.addOption(bool, "is_stage1", is_stage1);
exe_options.addOption(bool, "omit_stage2", omit_stage2);
if (tracy) |tracy_path| {
const client_cpp = fs.path.join(
b.allocator,
@ -397,7 +395,6 @@ pub fn build(b: *Builder) !void {
test_cases_options.addOption(bool, "skip_non_native", skip_non_native);
test_cases_options.addOption(bool, "skip_stage1", skip_stage1);
test_cases_options.addOption(bool, "is_stage1", is_stage1);
test_cases_options.addOption(bool, "omit_stage2", omit_stage2);
test_cases_options.addOption(bool, "have_llvm", enable_llvm);
test_cases_options.addOption(bool, "llvm_has_m68k", llvm_has_m68k);
test_cases_options.addOption(bool, "llvm_has_csky", llvm_has_csky);
@ -457,7 +454,7 @@ pub fn build(b: *Builder) !void {
skip_non_native,
skip_libc,
skip_stage1,
omit_stage2,
false,
is_stage1,
));
@ -472,7 +469,7 @@ pub fn build(b: *Builder) !void {
skip_non_native,
true, // skip_libc
skip_stage1,
omit_stage2 or true, // TODO get these all passing
true, // TODO get these all passing
is_stage1,
));
@ -487,7 +484,7 @@ pub fn build(b: *Builder) !void {
skip_non_native,
true, // skip_libc
skip_stage1,
omit_stage2 or true, // TODO get these all passing
true, // TODO get these all passing
is_stage1,
));
@ -499,14 +496,13 @@ pub fn build(b: *Builder) !void {
skip_non_native,
enable_macos_sdk,
target,
omit_stage2,
b.enable_darling,
b.enable_qemu,
b.enable_rosetta,
b.enable_wasmtime,
b.enable_wine,
));
toolchain_step.dependOn(tests.addLinkTests(b, test_filter, modes, enable_macos_sdk, omit_stage2));
toolchain_step.dependOn(tests.addLinkTests(b, test_filter, modes, enable_macos_sdk));
toolchain_step.dependOn(tests.addStackTraceTests(b, test_filter, modes));
toolchain_step.dependOn(tests.addCliTests(b, test_filter, modes));
toolchain_step.dependOn(tests.addAssembleAndLinkTests(b, test_filter, modes));
@ -528,7 +524,7 @@ pub fn build(b: *Builder) !void {
skip_non_native,
skip_libc,
skip_stage1,
omit_stage2 or true, // TODO get these all passing
true, // TODO get these all passing
is_stage1,
);

View File

@ -38,7 +38,6 @@ pub fn build(b: *Builder) !void {
docs_step.dependOn(&docgen_cmd.step);
const is_stage1 = b.option(bool, "stage1", "Build the stage1 compiler, put stage2 behind a feature flag") orelse false;
const omit_stage2 = b.option(bool, "omit-stage2", "Do not include stage2 behind a feature flag inside stage1") orelse false;
const static_llvm = b.option(bool, "static-llvm", "Disable integration with system-installed LLVM, Clang, LLD, and libc++") orelse false;
const enable_llvm = b.option(bool, "enable-llvm", "Build self-hosted compiler with LLVM backend enabled") orelse (is_stage1 or static_llvm);
const llvm_has_m68k = b.option(
@ -300,7 +299,6 @@ pub fn build(b: *Builder) !void {
exe_options.addOption(bool, "enable_tracy_allocation", tracy_allocation);
exe_options.addOption(bool, "value_tracing", value_tracing);
exe_options.addOption(bool, "is_stage1", is_stage1);
exe_options.addOption(bool, "omit_stage2", omit_stage2);
if (tracy) |tracy_path| {
const client_cpp = fs.path.join(
b.allocator,

View File

@ -1044,8 +1044,6 @@ pub fn create(gpa: Allocator, options: InitOptions) !*Compilation {
// Even though we may have no Zig code to compile (depending on `options.main_pkg`),
// we may need to use stage1 for building compiler-rt and other dependencies.
if (build_options.omit_stage2)
break :blk true;
if (options.use_llvm) |use_llvm| {
if (!use_llvm) {
break :blk false;
@ -2213,8 +2211,7 @@ pub fn update(comp: *Compilation) !void {
comp.c_object_work_queue.writeItemAssumeCapacity(key);
}
const use_stage1 = build_options.omit_stage2 or
(build_options.is_stage1 and comp.bin_file.options.use_stage1);
const use_stage1 = build_options.is_stage1 and comp.bin_file.options.use_stage1;
if (comp.bin_file.options.module) |module| {
module.compile_log_text.shrinkAndFree(module.gpa, 0);
module.generation += 1;
@ -2390,8 +2387,7 @@ fn flush(comp: *Compilation, prog_node: *std.Progress.Node) !void {
};
comp.link_error_flags = comp.bin_file.errorFlags();
const use_stage1 = build_options.omit_stage2 or
(build_options.is_stage1 and comp.bin_file.options.use_stage1);
const use_stage1 = build_options.is_stage1 and comp.bin_file.options.use_stage1;
if (!use_stage1) {
if (comp.bin_file.options.module) |module| {
try link.File.C.flushEmitH(module);
@ -2952,9 +2948,6 @@ pub fn performAllTheWork(
fn processOneJob(comp: *Compilation, job: Job) !void {
switch (job) {
.codegen_decl => |decl_index| {
if (build_options.omit_stage2)
@panic("sadly stage2 is omitted from this build to save memory on the CI server");
const module = comp.bin_file.options.module.?;
const decl = module.declPtr(decl_index);
@ -2989,9 +2982,6 @@ fn processOneJob(comp: *Compilation, job: Job) !void {
}
},
.codegen_func => |func| {
if (build_options.omit_stage2)
@panic("sadly stage2 is omitted from this build to save memory on the CI server");
const named_frame = tracy.namedFrame("codegen_func");
defer named_frame.end();
@ -3002,9 +2992,6 @@ fn processOneJob(comp: *Compilation, job: Job) !void {
};
},
.emit_h_decl => |decl_index| {
if (build_options.omit_stage2)
@panic("sadly stage2 is omitted from this build to save memory on the CI server");
const module = comp.bin_file.options.module.?;
const decl = module.declPtr(decl_index);
@ -3063,9 +3050,6 @@ fn processOneJob(comp: *Compilation, job: Job) !void {
}
},
.analyze_decl => |decl_index| {
if (build_options.omit_stage2)
@panic("sadly stage2 is omitted from this build to save memory on the CI server");
const module = comp.bin_file.options.module.?;
module.ensureDeclAnalyzed(decl_index) catch |err| switch (err) {
error.OutOfMemory => return error.OutOfMemory,
@ -3073,9 +3057,6 @@ fn processOneJob(comp: *Compilation, job: Job) !void {
};
},
.update_embed_file => |embed_file| {
if (build_options.omit_stage2)
@panic("sadly stage2 is omitted from this build to save memory on the CI server");
const named_frame = tracy.namedFrame("update_embed_file");
defer named_frame.end();
@ -3086,9 +3067,6 @@ fn processOneJob(comp: *Compilation, job: Job) !void {
};
},
.update_line_number => |decl_index| {
if (build_options.omit_stage2)
@panic("sadly stage2 is omitted from this build to save memory on the CI server");
const named_frame = tracy.namedFrame("update_line_number");
defer named_frame.end();
@ -3107,9 +3085,6 @@ fn processOneJob(comp: *Compilation, job: Job) !void {
};
},
.analyze_pkg => |pkg| {
if (build_options.omit_stage2)
@panic("sadly stage2 is omitted from this build to save memory on the CI server");
const named_frame = tracy.namedFrame("analyze_pkg");
defer named_frame.end();

View File

@ -27358,9 +27358,6 @@ pub fn resolveTypeLayout(
src: LazySrcLoc,
ty: Type,
) CompileError!void {
if (build_options.omit_stage2)
@panic("sadly stage2 is omitted from this build to save memory on the CI server");
switch (ty.zigTypeTag()) {
.Struct => return sema.resolveStructLayout(block, src, ty),
.Union => return sema.resolveUnionLayout(block, src, ty),
@ -27699,8 +27696,6 @@ fn resolveUnionFully(
}
pub fn resolveTypeFields(sema: *Sema, block: *Block, src: LazySrcLoc, ty: Type) CompileError!Type {
if (build_options.omit_stage2)
@panic("sadly stage2 is omitted from this build to save memory on the CI server");
switch (ty.tag()) {
.@"struct" => {
const struct_obj = ty.castTag(.@"struct").?.data;
@ -29323,8 +29318,6 @@ fn typePtrOrOptionalPtrTy(
/// TODO merge these implementations together with the "advanced"/sema_kit pattern seen
/// elsewhere in value.zig
pub fn typeRequiresComptime(sema: *Sema, block: *Block, src: LazySrcLoc, ty: Type) CompileError!bool {
if (build_options.omit_stage2)
@panic("sadly stage2 is omitted from this build to save memory on the CI server");
return switch (ty.tag()) {
.u1,
.u8,

View File

@ -10,4 +10,3 @@ pub const enable_tracy = false;
pub const value_tracing = false;
pub const is_stage1 = true;
pub const skip_non_native = false;
pub const omit_stage2: bool = @ZIG_OMIT_STAGE2_BOOL@;

View File

@ -462,7 +462,6 @@ pub fn addStandaloneTests(
skip_non_native: bool,
enable_macos_sdk: bool,
target: std.zig.CrossTarget,
omit_stage2: bool,
enable_darling: bool,
enable_qemu: bool,
enable_rosetta: bool,
@ -479,7 +478,6 @@ pub fn addStandaloneTests(
.skip_non_native = skip_non_native,
.enable_macos_sdk = enable_macos_sdk,
.target = target,
.omit_stage2 = omit_stage2,
.enable_darling = enable_darling,
.enable_qemu = enable_qemu,
.enable_rosetta = enable_rosetta,
@ -497,7 +495,6 @@ pub fn addLinkTests(
test_filter: ?[]const u8,
modes: []const Mode,
enable_macos_sdk: bool,
omit_stage2: bool,
) *build.Step {
const cases = b.allocator.create(StandaloneContext) catch unreachable;
cases.* = StandaloneContext{
@ -509,7 +506,6 @@ pub fn addLinkTests(
.skip_non_native = true,
.enable_macos_sdk = enable_macos_sdk,
.target = .{},
.omit_stage2 = omit_stage2,
};
link.addCases(cases);
return cases.step;
@ -978,7 +974,6 @@ pub const StandaloneContext = struct {
skip_non_native: bool,
enable_macos_sdk: bool,
target: std.zig.CrossTarget,
omit_stage2: bool,
enable_darling: bool = false,
enable_qemu: bool = false,
enable_rosetta: bool = false,
@ -1003,7 +998,6 @@ pub const StandaloneContext = struct {
const b = self.b;
if (features.requires_macos_sdk and !self.enable_macos_sdk) return;
if (features.requires_stage2 and self.omit_stage2) return;
const annotated_case_name = b.fmt("build {s}", .{build_file});
if (self.test_filter) |filter| {