From 8d310343738c9ae8eebeee9085f89d629a3e2f47 Mon Sep 17 00:00:00 2001 From: fubark Date: Sun, 11 Feb 2024 23:38:00 -0500 Subject: [PATCH] Run tests on M1 runner. --- .github/workflows/latest-build.yml | 16 +++++++++++----- .github/workflows/pr-build.yml | 14 ++++++++++---- build.zig | 3 +++ lib/mimalloc/lib.zig | 8 ++++++-- src/bc_gen.zig | 5 +++-- 5 files changed, 33 insertions(+), 13 deletions(-) diff --git a/.github/workflows/latest-build.yml b/.github/workflows/latest-build.yml index fe0f420ed..91a301aae 100644 --- a/.github/workflows/latest-build.yml +++ b/.github/workflows/latest-build.yml @@ -41,7 +41,7 @@ jobs: target: x86_64-macos-none mode: release cmd: cli - - host: macos-12 + - host: macos-14 target: aarch64-macos-none mode: release cmd: cli @@ -69,7 +69,7 @@ jobs: target: x86_64-macos-none mode: release cmd: lib - - host: macos-12 + - host: macos-14 target: aarch64-macos-none mode: release cmd: lib @@ -138,6 +138,12 @@ jobs: wget -c https://ziglang.org/builds/zig-macos-x86_64-${{ env.ZIG_VERSION }}.tar.xz -O - | tar -xJ --strip-components=1 -C /usr/local/bin xcode-select --print-path + - name: Install zig. + if: env.BUILD_HOST == 'macos-14' + run: | + wget -c https://ziglang.org/builds/zig-macos-aarch64-${{ env.ZIG_VERSION }}.tar.xz -O - | tar -xJ --strip-components=1 -C /usr/local/bin + xcode-select --print-path + - name: Install zig. if: env.BUILD_HOST == 'windows-2022' run: | @@ -189,11 +195,11 @@ jobs: build-${{ env.BUILD_TARGET }}-${{ env.BUILD_MODE }}-1 - name: Run tests. - if: env.BUILD_TARGET != 'aarch64-macos-none' && env.BUILD_TARGET != 'wasm32-wasi' && env.BUILD_CMD == 'cli' + if: env.BUILD_TARGET != 'wasm32-wasi' && env.BUILD_CMD == 'cli' run: zig build test ${{ env.ZIG_TARGET_FLAG }} - name: Run tests. - if: env.BUILD_TARGET != 'aarch64-macos-none' && env.BUILD_TARGET != 'wasm32-freestanding' && env.BUILD_CMD == 'lib' + if: env.BUILD_TARGET != 'wasm32-freestanding' && env.BUILD_CMD == 'lib' run: zig build test-lib ${{ env.ZIG_TARGET_FLAG }} - name: Run tests. @@ -232,7 +238,7 @@ jobs: # zig-out/${{ env.BUILD_TARGET }}/main/cosmic${{ env.BIN_EXT }} - name: Zip. (linux/macos) - if: (env.BUILD_HOST == 'ubuntu-22.04' || env.BUILD_HOST == 'macos-12') && env.BUILD_TARGET != 'wasm32-wasi' && env.BUILD_CMD == 'cli' + if: (env.BUILD_HOST == 'ubuntu-22.04' || env.BUILD_HOST == 'macos-12' || env.BUILD_HOST == 'macos-14') && env.BUILD_TARGET != 'wasm32-wasi' && env.BUILD_CMD == 'cli' run: | tar -C zig-out/bin -czvf ${{ env.BIN_ZIP }} cyber diff --git a/.github/workflows/pr-build.yml b/.github/workflows/pr-build.yml index 6387d7d3c..85c67719b 100644 --- a/.github/workflows/pr-build.yml +++ b/.github/workflows/pr-build.yml @@ -35,7 +35,7 @@ jobs: target: x86_64-macos-none mode: release cmd: cli - - host: macos-12 + - host: macos-14 target: aarch64-macos-none mode: release cmd: cli @@ -63,7 +63,7 @@ jobs: target: x86_64-macos-none mode: release cmd: lib - - host: macos-12 + - host: macos-14 target: aarch64-macos-none mode: release cmd: lib @@ -120,6 +120,12 @@ jobs: wget -c https://ziglang.org/builds/zig-macos-x86_64-${{ env.ZIG_VERSION }}.tar.xz -O - | tar -xJ --strip-components=1 -C /usr/local/bin xcode-select --print-path + - name: Install zig. + if: env.BUILD_HOST == 'macos-14' + run: | + wget -c https://ziglang.org/builds/zig-macos-aarch64-${{ env.ZIG_VERSION }}.tar.xz -O - | tar -xJ --strip-components=1 -C /usr/local/bin + xcode-select --print-path + - name: Install zig. if: env.BUILD_HOST == 'windows-2022' run: | @@ -141,11 +147,11 @@ jobs: pr-build-${{ env.BUILD_TARGET }}-${{ env.BUILD_MODE }}-1 - name: Run tests. - if: env.BUILD_TARGET != 'aarch64-macos-none' && env.BUILD_TARGET != 'wasm32-wasi' && env.BUILD_CMD == 'cli' + if: env.BUILD_TARGET != 'wasm32-wasi' && env.BUILD_CMD == 'cli' run: zig build test ${{ env.ZIG_TARGET_FLAG }} - name: Run tests. - if: env.BUILD_TARGET != 'aarch64-macos-none' && env.BUILD_TARGET != 'wasm32-freestanding' && env.BUILD_CMD == 'lib' + if: env.BUILD_TARGET != 'wasm32-freestanding' && env.BUILD_CMD == 'lib' run: zig build test-lib ${{ env.ZIG_TARGET_FLAG }} - name: Run tests. diff --git a/build.zig b/build.zig index 4a49652b7..b2252906b 100644 --- a/build.zig +++ b/build.zig @@ -275,6 +275,9 @@ pub fn buildAndLinkDeps(step: *std.build.Step.Compile, opts: Options) !void { if (vmEngine == .c) { const lib = try buildCVM(b, opts); + if (opts.target.getCpuArch().isWasm()) { + step.stack_protector = false; + } step.linkLibrary(lib); } diff --git a/lib/mimalloc/lib.zig b/lib/mimalloc/lib.zig index 81933e784..8ad9301e3 100644 --- a/lib/mimalloc/lib.zig +++ b/lib/mimalloc/lib.zig @@ -30,8 +30,12 @@ pub fn buildAndLink(b: *std.Build, step: *std.build.CompileStep, opts: BuildOpti // c_flags.append("-D_GNU_SOURCE=1") catch @panic("error"); if (lib.target.getOsTag() == .windows) { } else if (lib.target.getOsTag() == .macos) { - // Github macos-12 runner (https://github.com/actions/runner-images/blob/main/images/macos/macos-12-Readme.md). - lib.addSystemIncludePath(.{ .path = "/Applications/Xcode_14.0.1.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include" }); + if (lib.target.getCpuArch() == .aarch64) { + lib.addSystemIncludePath(.{ .path = "/Applications/Xcode_15.0.1.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include" }); + } else { + // Github macos-12 runner (https://github.com/actions/runner-images/blob/main/images/macos/macos-12-Readme.md). + lib.addSystemIncludePath(.{ .path = "/Applications/Xcode_14.0.1.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include" }); + } lib.addSystemIncludePath(.{ .path = "/Library/Developer/CommandLineTools/SDKs/MacOSX12.1.sdk/usr/include" }); lib.addSystemIncludePath(.{ .path = "/Library/Developer/CommandLineTools/SDKs/MacOSX12.3.sdk/usr/include" }); } diff --git a/src/bc_gen.zig b/src/bc_gen.zig index af9f60e93..dbd256ee4 100644 --- a/src/bc_gen.zig +++ b/src/bc_gen.zig @@ -1924,7 +1924,7 @@ const SetLocalOptions = struct { fn setLocal(c: *Chunk, data: ir.Local, rightIdx: u32, right_t: cy.TypeId, nodeId: cy.NodeId, opts: SetLocalOptions) !void { const reg = toLocalReg(c, data.id); - const local = getLocalInfoPtr(c, reg); + var local = getLocalInfoPtr(c, reg); var dst: Cstr = undefined; if (local.some.lifted) { @@ -1944,7 +1944,8 @@ fn setLocal(c: *Chunk, data: ir.Local, rightIdx: u32, right_t: cy.TypeId, nodeId rightv = try genExpr(c, rightIdx, dst); } - // Update retained state. + // Update retained state. Refetch local. + local = getLocalInfoPtr(c, reg); local.some.rcCandidate = rightv.retained; if (local.some.isDynamic) { local.some.type = right_t;