| author | |
| committer | |
| log | 2fe8a482159762724df93225bd70abbd0c2c5930 |
| tree | ab2ab1f649f3b42efc5b664b22ac507a94f7fe8c |
| parent | 462c1d8c7424547051e643648797b9097245b046 |
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 | 89 | set(ZIG_EXECUTABLE "" CACHE STRING "(when cross compiling) path to already-built zig binary") |
| 90 | 90 | set(ZIG_PREFER_LLVM_CONFIG off CACHE BOOL "(when cross compiling) use llvm-config to find target llvm dependencies if needed") |
| 91 | 91 | set(ZIG_SINGLE_THREADED off CACHE BOOL "limit the zig compiler to use only 1 thread") |
| 92 | set(ZIG_OMIT_STAGE2 off CACHE BOOL "omit the stage2 backend from stage1") | |
| 92 | 93 | |
| 93 | 94 | find_package(llvm) |
| 94 | 95 | find_package(clang) |
| ... | ... | @@ -587,6 +588,12 @@ if(MSVC) |
| 587 | 588 | endif() |
| 588 | 589 | endif() |
| 589 | 590 | |
| 591 | if(ZIG_OMIT_STAGE2) | |
| 592 | set(ZIG_OMIT_STAGE2_BOOL "true") | |
| 593 | else() | |
| 594 | set(ZIG_OMIT_STAGE2_BOOL "false") | |
| 595 | endif() | |
| 596 | ||
| 590 | 597 | configure_file ( |
| 591 | 598 | "${CMAKE_SOURCE_DIR}/src/stage1/config.h.in" |
| 592 | 599 | "${ZIG_CONFIG_H_OUT}" |
build.zig+2-1| ... | ... | @@ -125,7 +125,6 @@ pub fn build(b: *Builder) !void { |
| 125 | 125 | try addCmakeCfgOptionsToExe(b, cfg, tracy, test_stage2); |
| 126 | 126 | } else { |
| 127 | 127 | // Here we are -Denable-llvm but no cmake integration. |
| 128 | ||
| 129 | 128 | try addStaticLlvmOptionsToExe(exe); |
| 130 | 129 | try addStaticLlvmOptionsToExe(test_stage2); |
| 131 | 130 | } |
| ... | ... | @@ -194,6 +193,7 @@ pub fn build(b: *Builder) !void { |
| 194 | 193 | exe.addBuildOption([]const []const u8, "log_scopes", log_scopes); |
| 195 | 194 | exe.addBuildOption(bool, "enable_tracy", tracy != null); |
| 196 | 195 | exe.addBuildOption(bool, "is_stage1", is_stage1); |
| 196 | exe.addBuildOption(bool, "omit_stage2", false); | |
| 197 | 197 | if (tracy) |tracy_path| { |
| 198 | 198 | const client_cpp = fs.path.join( |
| 199 | 199 | b.allocator, |
| ... | ... | @@ -216,6 +216,7 @@ pub fn build(b: *Builder) !void { |
| 216 | 216 | |
| 217 | 217 | test_stage2.addBuildOption(bool, "skip_non_native", skip_non_native); |
| 218 | 218 | test_stage2.addBuildOption(bool, "is_stage1", is_stage1); |
| 219 | test_stage2.addBuildOption(bool, "omit_stage2", false); | |
| 219 | 220 | test_stage2.addBuildOption(bool, "have_llvm", enable_llvm); |
| 220 | 221 | test_stage2.addBuildOption(bool, "enable_qemu", is_qemu_enabled); |
| 221 | 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 | 23 | |
| 24 | 24 | mkdir %ZIGBUILDDIR% |
| 25 | 25 | cd %ZIGBUILDDIR% |
| 26 | cmake.exe .. -Thost=x64 -G"Visual Studio 16 2019" -A x64 "-DCMAKE_INSTALL_PREFIX=%ZIGINSTALLDIR%" "-DCMAKE_PREFIX_PATH=%ZIGPREFIXPATH%" -DCMAKE_BUILD_TYPE=Release || exit /b | |
| 26 | cmake.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 | |
| 27 | 27 | msbuild /maxcpucount /p:Configuration=Release INSTALL.vcxproj || exit /b |
| 28 | 28 | |
| 29 | 29 | "%ZIGINSTALLDIR%\bin\zig.exe" build test-behavior -Dskip-non-native || exit /b |
| 30 | "%ZIGINSTALLDIR%\bin\zig.exe" build test-stage2 -Dskip-non-native || exit /b | |
| 30 | REM Disabled to prevent OOM | |
| 31 | REM "%ZIGINSTALLDIR%\bin\zig.exe" build test-stage2 -Dskip-non-native || exit /b | |
| 31 | 32 | "%ZIGINSTALLDIR%\bin\zig.exe" build test-fmt -Dskip-non-native || exit /b |
| 32 | 33 | "%ZIGINSTALLDIR%\bin\zig.exe" build test-std -Dskip-non-native || exit /b |
| 33 | 34 | "%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 | 1461 | => continue, |
| 1462 | 1462 | |
| 1463 | 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 | 1466 | const module = self.bin_file.options.module.?; |
| 1465 | 1467 | if (decl.typed_value.most_recent.typed_value.val.castTag(.function)) |payload| { |
| 1466 | 1468 | const func = payload.data; |
| ... | ... | @@ -1532,6 +1534,8 @@ pub fn performAllTheWork(self: *Compilation) error{ TimerUnsupported, OutOfMemor |
| 1532 | 1534 | }, |
| 1533 | 1535 | }, |
| 1534 | 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 | 1539 | const module = self.bin_file.options.module.?; |
| 1536 | 1540 | module.ensureDeclAnalyzed(decl) catch |err| switch (err) { |
| 1537 | 1541 | error.OutOfMemory => return error.OutOfMemory, |
| ... | ... | @@ -1539,6 +1543,8 @@ pub fn performAllTheWork(self: *Compilation) error{ TimerUnsupported, OutOfMemor |
| 1539 | 1543 | }; |
| 1540 | 1544 | }, |
| 1541 | 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 | 1548 | const module = self.bin_file.options.module.?; |
| 1543 | 1549 | self.bin_file.updateDeclLineNumber(module, decl) catch |err| { |
| 1544 | 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 | 5 | pub const enable_tracy = false; |
| 6 | 6 | pub const is_stage1 = true; |
| 7 | 7 | pub const skip_non_native = false; |
| 8 | pub const omit_stage2: bool = @ZIG_OMIT_STAGE2_BOOL@; |