authorgravatar for andrew@ziglang.orgAndrew Kelley <andrew@ziglang.org> 2021-01-04 14:59:18-07:00
committergravatar for andrew@ziglang.orgAndrew Kelley <andrew@ziglang.org> 2021-01-04 14:59:18-07:00
log2fe8a482159762724df93225bd70abbd0c2c5930
treeab2ab1f649f3b42efc5b664b22ac507a94f7fe8c
parent462c1d8c7424547051e643648797b9097245b046

ci: omit stage2 backend from stage1 on Windows

to avoid out-of-memory on the CI runs.

5 files changed, 19 insertions(+), 3 deletions(-)

CMakeLists.txt+7
...@@ -89,6 +89,7 @@ set(ZIG_TARGET_MCPU "baseline" CACHE STRING "-mcpu parameter to output binaries...@@ -89,6 +89,7 @@ set(ZIG_TARGET_MCPU "baseline" CACHE STRING "-mcpu parameter to output binaries
89set(ZIG_EXECUTABLE "" CACHE STRING "(when cross compiling) path to already-built zig binary")89set(ZIG_EXECUTABLE "" CACHE STRING "(when cross compiling) path to already-built zig binary")
90set(ZIG_PREFER_LLVM_CONFIG off CACHE BOOL "(when cross compiling) use llvm-config to find target llvm dependencies if needed")90set(ZIG_PREFER_LLVM_CONFIG off CACHE BOOL "(when cross compiling) use llvm-config to find target llvm dependencies if needed")
91set(ZIG_SINGLE_THREADED off CACHE BOOL "limit the zig compiler to use only 1 thread")91set(ZIG_SINGLE_THREADED off CACHE BOOL "limit the zig compiler to use only 1 thread")
92set(ZIG_OMIT_STAGE2 off CACHE BOOL "omit the stage2 backend from stage1")
9293
93find_package(llvm)94find_package(llvm)
94find_package(clang)95find_package(clang)
...@@ -587,6 +588,12 @@ if(MSVC)...@@ -587,6 +588,12 @@ if(MSVC)
587 endif()588 endif()
588endif()589endif()
589590
591if(ZIG_OMIT_STAGE2)
592 set(ZIG_OMIT_STAGE2_BOOL "true")
593else()
594 set(ZIG_OMIT_STAGE2_BOOL "false")
595endif()
596
590configure_file (597configure_file (
591 "${CMAKE_SOURCE_DIR}/src/stage1/config.h.in"598 "${CMAKE_SOURCE_DIR}/src/stage1/config.h.in"
592 "${ZIG_CONFIG_H_OUT}"599 "${ZIG_CONFIG_H_OUT}"
build.zig+2-1
...@@ -125,7 +125,6 @@ pub fn build(b: *Builder) !void {...@@ -125,7 +125,6 @@ pub fn build(b: *Builder) !void {
125 try addCmakeCfgOptionsToExe(b, cfg, tracy, test_stage2);125 try addCmakeCfgOptionsToExe(b, cfg, tracy, test_stage2);
126 } else {126 } else {
127 // Here we are -Denable-llvm but no cmake integration.127 // Here we are -Denable-llvm but no cmake integration.
128
129 try addStaticLlvmOptionsToExe(exe);128 try addStaticLlvmOptionsToExe(exe);
130 try addStaticLlvmOptionsToExe(test_stage2);129 try addStaticLlvmOptionsToExe(test_stage2);
131 }130 }
...@@ -194,6 +193,7 @@ pub fn build(b: *Builder) !void {...@@ -194,6 +193,7 @@ pub fn build(b: *Builder) !void {
194 exe.addBuildOption([]const []const u8, "log_scopes", log_scopes);193 exe.addBuildOption([]const []const u8, "log_scopes", log_scopes);
195 exe.addBuildOption(bool, "enable_tracy", tracy != null);194 exe.addBuildOption(bool, "enable_tracy", tracy != null);
196 exe.addBuildOption(bool, "is_stage1", is_stage1);195 exe.addBuildOption(bool, "is_stage1", is_stage1);
196 exe.addBuildOption(bool, "omit_stage2", false);
197 if (tracy) |tracy_path| {197 if (tracy) |tracy_path| {
198 const client_cpp = fs.path.join(198 const client_cpp = fs.path.join(
199 b.allocator,199 b.allocator,
...@@ -216,6 +216,7 @@ pub fn build(b: *Builder) !void {...@@ -216,6 +216,7 @@ pub fn build(b: *Builder) !void {
216216
217 test_stage2.addBuildOption(bool, "skip_non_native", skip_non_native);217 test_stage2.addBuildOption(bool, "skip_non_native", skip_non_native);
218 test_stage2.addBuildOption(bool, "is_stage1", is_stage1);218 test_stage2.addBuildOption(bool, "is_stage1", is_stage1);
219 test_stage2.addBuildOption(bool, "omit_stage2", false);
219 test_stage2.addBuildOption(bool, "have_llvm", enable_llvm);220 test_stage2.addBuildOption(bool, "have_llvm", enable_llvm);
220 test_stage2.addBuildOption(bool, "enable_qemu", is_qemu_enabled);221 test_stage2.addBuildOption(bool, "enable_qemu", is_qemu_enabled);
221 test_stage2.addBuildOption(bool, "enable_wine", is_wine_enabled);222 test_stage2.addBuildOption(bool, "enable_wine", is_wine_enabled);
ci/azure/windows_msvc_script.bat+3-2
...@@ -23,11 +23,12 @@ git.exe fetch --tags...@@ -23,11 +23,12 @@ git.exe fetch --tags
2323
24mkdir %ZIGBUILDDIR%24mkdir %ZIGBUILDDIR%
25cd %ZIGBUILDDIR%25cd %ZIGBUILDDIR%
26cmake.exe .. -Thost=x64 -G"Visual Studio 16 2019" -A x64 "-DCMAKE_INSTALL_PREFIX=%ZIGINSTALLDIR%" "-DCMAKE_PREFIX_PATH=%ZIGPREFIXPATH%" -DCMAKE_BUILD_TYPE=Release || exit /b26cmake.exe .. -Thost=x64 -G"Visual Studio 16 2019" -A x64 "-DCMAKE_INSTALL_PREFIX=%ZIGINSTALLDIR%" "-DCMAKE_PREFIX_PATH=%ZIGPREFIXPATH%" -DCMAKE_BUILD_TYPE=Release -DZIG_OMIT_STAGE2=ON || exit /b
27msbuild /maxcpucount /p:Configuration=Release INSTALL.vcxproj || exit /b27msbuild /maxcpucount /p:Configuration=Release INSTALL.vcxproj || exit /b
2828
29"%ZIGINSTALLDIR%\bin\zig.exe" build test-behavior -Dskip-non-native || exit /b29"%ZIGINSTALLDIR%\bin\zig.exe" build test-behavior -Dskip-non-native || exit /b
30"%ZIGINSTALLDIR%\bin\zig.exe" build test-stage2 -Dskip-non-native || exit /b30REM Disabled to prevent OOM
31REM "%ZIGINSTALLDIR%\bin\zig.exe" build test-stage2 -Dskip-non-native || exit /b
31"%ZIGINSTALLDIR%\bin\zig.exe" build test-fmt -Dskip-non-native || exit /b32"%ZIGINSTALLDIR%\bin\zig.exe" build test-fmt -Dskip-non-native || exit /b
32"%ZIGINSTALLDIR%\bin\zig.exe" build test-std -Dskip-non-native || exit /b33"%ZIGINSTALLDIR%\bin\zig.exe" build test-std -Dskip-non-native || exit /b
33"%ZIGINSTALLDIR%\bin\zig.exe" build test-compiler-rt -Dskip-non-native || exit /b34"%ZIGINSTALLDIR%\bin\zig.exe" build test-compiler-rt -Dskip-non-native || exit /b
src/Compilation.zig+6
...@@ -1461,6 +1461,8 @@ pub fn performAllTheWork(self: *Compilation) error{ TimerUnsupported, OutOfMemor...@@ -1461,6 +1461,8 @@ pub fn performAllTheWork(self: *Compilation) error{ TimerUnsupported, OutOfMemor
1461 => continue,1461 => continue,
14621462
1463 .complete, .codegen_failure_retryable => {1463 .complete, .codegen_failure_retryable => {
1464 if (build_options.omit_stage2)
1465 @panic("sadly stage2 is omitted from this build to save memory on the CI server");
1464 const module = self.bin_file.options.module.?;1466 const module = self.bin_file.options.module.?;
1465 if (decl.typed_value.most_recent.typed_value.val.castTag(.function)) |payload| {1467 if (decl.typed_value.most_recent.typed_value.val.castTag(.function)) |payload| {
1466 const func = payload.data;1468 const func = payload.data;
...@@ -1532,6 +1534,8 @@ pub fn performAllTheWork(self: *Compilation) error{ TimerUnsupported, OutOfMemor...@@ -1532,6 +1534,8 @@ pub fn performAllTheWork(self: *Compilation) error{ TimerUnsupported, OutOfMemor
1532 },1534 },
1533 },1535 },
1534 .analyze_decl => |decl| {1536 .analyze_decl => |decl| {
1537 if (build_options.omit_stage2)
1538 @panic("sadly stage2 is omitted from this build to save memory on the CI server");
1535 const module = self.bin_file.options.module.?;1539 const module = self.bin_file.options.module.?;
1536 module.ensureDeclAnalyzed(decl) catch |err| switch (err) {1540 module.ensureDeclAnalyzed(decl) catch |err| switch (err) {
1537 error.OutOfMemory => return error.OutOfMemory,1541 error.OutOfMemory => return error.OutOfMemory,
...@@ -1539,6 +1543,8 @@ pub fn performAllTheWork(self: *Compilation) error{ TimerUnsupported, OutOfMemor...@@ -1539,6 +1543,8 @@ pub fn performAllTheWork(self: *Compilation) error{ TimerUnsupported, OutOfMemor
1539 };1543 };
1540 },1544 },
1541 .update_line_number => |decl| {1545 .update_line_number => |decl| {
1546 if (build_options.omit_stage2)
1547 @panic("sadly stage2 is omitted from this build to save memory on the CI server");
1542 const module = self.bin_file.options.module.?;1548 const module = self.bin_file.options.module.?;
1543 self.bin_file.updateDeclLineNumber(module, decl) catch |err| {1549 self.bin_file.updateDeclLineNumber(module, decl) catch |err| {
1544 try module.failed_decls.ensureCapacity(module.gpa, module.failed_decls.items().len + 1);1550 try module.failed_decls.ensureCapacity(module.gpa, module.failed_decls.items().len + 1);
src/config.zig.in+1
...@@ -5,3 +5,4 @@ pub const log_scopes: []const []const u8 = &[_][]const u8{};...@@ -5,3 +5,4 @@ pub const log_scopes: []const []const u8 = &[_][]const u8{};
5pub const enable_tracy = false;5pub const enable_tracy = false;
6pub const is_stage1 = true;6pub const is_stage1 = true;
7pub const skip_non_native = false;7pub const skip_non_native = false;
8pub const omit_stage2: bool = @ZIG_OMIT_STAGE2_BOOL@;