mirror of
https://github.com/ziglang/zig.git
synced 2026-02-21 16:54:52 +00:00
stage2: fix -Domit-stage2 regression
This flag is used when building stage1 to omit the stage2 backends from the compiler to save memory on the CI server. It regressed with the merging of e8813b296bc55a13b534bd9b2a03e1f6af366915 because Value functions started calling into Sema functions. The end goal for this build option is to eliminate it.
This commit is contained in:
parent
2e0de0b4e2
commit
2f9264d8dc
@ -2042,7 +2042,8 @@ pub fn update(comp: *Compilation) !void {
|
||||
comp.c_object_work_queue.writeItemAssumeCapacity(key);
|
||||
}
|
||||
|
||||
const use_stage1 = build_options.is_stage1 and comp.bin_file.options.use_stage1;
|
||||
const use_stage1 = build_options.omit_stage2 or
|
||||
(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;
|
||||
@ -2198,7 +2199,8 @@ fn flush(comp: *Compilation) !void {
|
||||
try comp.bin_file.flush(comp); // This is needed before reading the error flags.
|
||||
comp.link_error_flags = comp.bin_file.errorFlags();
|
||||
|
||||
const use_stage1 = build_options.is_stage1 and comp.bin_file.options.use_stage1;
|
||||
const use_stage1 = build_options.omit_stage2 or
|
||||
(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);
|
||||
|
||||
@ -89,6 +89,7 @@ const RangeSet = @import("RangeSet.zig");
|
||||
const target_util = @import("target.zig");
|
||||
const Package = @import("Package.zig");
|
||||
const crash_report = @import("crash_report.zig");
|
||||
const build_options = @import("build_options");
|
||||
|
||||
pub const InstMap = std.AutoHashMapUnmanaged(Zir.Inst.Index, Air.Inst.Ref);
|
||||
|
||||
@ -20808,6 +20809,9 @@ 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),
|
||||
@ -20974,6 +20978,8 @@ 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;
|
||||
@ -22256,6 +22262,8 @@ 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,
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user