Skip to content

Releases: tobocop2/opencode-bun-pre-avx2-mac

Baseline macOS x64 — WebAssembly fix (bun + opencode 1.18.1)

Choose a tag to compare

@tobocop2 tobocop2 released this 15 Jul 17:12

Fixes the WebAssembly crash. The previous release fixed startup and plain JIT code on Macs with no AVX, but any WebAssembly workload still died with SIGILL.

JSC assumed AVX on macOS in two places, not one. The first release fixed the feature detection (collectCPUFeatures()); the probe trampoline still used vmovaps unconditionally, and WebAssembly reaches it via BBQ loop OSR entry, tier-up, and the catch prologue. Both are now fixed — oven-sh/WebKit#292.

Caught in code review on that PR, after I had wrongly assumed the trampoline was only reachable from debug-gated paths.

Verified — Apple M1 under Rosetta 2 (no AVX), macOS 14.6.1

test first release previous release this release
bun --version ❌ 132 ✅ rc=0 ✅ rc=0
JIT-heavy loop ❌ 132 ✅ rc=0 ✅ rc=0
WebAssembly hot loop ❌ 132 132 rc=0
opencode --version ❌ 132 ✅ rc=0 ✅ rc=0
14-case suite ❌ SIGILL ✅ ALL PASS ✅ ALL PASS

Not yet confirmed on real pre-AVX silicon. Rosetta 2 reports no AVX and matched a real Xeon X5690 exactly on the first release, which is what makes it a usable proxy — but it is emulation, not Westmere. Reports from a real pre-AVX Mac welcome.

Notes

The bun inside is built from bun main @ 1e35118008 and self-reports 1.4.0-canary.1. It is not an official 1.3.14/1.18.x baseline — the release tag tracks opencode's version, not bun's.

e7ede2b3f9361f6a9875f75cd79c6d0d7c90af373c290fe207a3e3a80882aa01  bun-darwin-x64-baseline
f425f035a5f00a93e1ba93d426e6687a0b58a1443b594ea75d8b35d99d11bd7f  opencode-darwin-x64-baseline

Upstream: WebKit#290 (baseline WebKit) → bun#34207 (build lane) → WebKit#292 (JIT AVX detection + probe trampoline). Tracked in bun#34215.

Baseline macOS x64 — now works on Macs with no AVX (bun + opencode 1.18.1)

Choose a tag to compare

@tobocop2 tobocop2 released this 15 Jul 06:31

Fixes the second SIGILL: these builds now run on Macs with no AVX at all (Westmere/Nehalem, 2010 and older), not just Sandy/Ivy Bridge.

The previous release fixed startup but still crashed once code tiered up, because JavaScriptCore hardcodes "AVX is available" on macOS instead of asking the CPU. Rebuilt against oven-sh/WebKit#292.

Thanks to @WolfgangFahl, who tested the previous release on a real Mac Pro 5,1 (Xeon X5690, Westmere, macOS 14.7.8) and reported that --version worked but JIT-heavy code still died — which isolated it to the JIT rather than the build flags.

Verified

Real Xeon X5690 (Westmere) and an Apple M1 under Rosetta 2 (which also reports no AVX) agree exactly:

test previous release this release
bun --version ✅ rc=0 ✅ rc=0
JIT-heavy loop ❌ rc=132 SIGILL ✅ rc=0
opencode --version ❌ rc=132 SIGILL ✅ rc=0

A 14-case suite (YarrJIT SIMD regex, strings/UTF-8, JSON, DFG/FTL tier-up, typed arrays) passes on this build; the previous one SIGILLs partway through the same suite on the same machine.

Also fixed

opencode --version now reports 1.18.1 instead of 0.0.0--<timestamp>.

Notes

The bun inside is built from bun main @ 1e35118008 and self-reports 1.4.0-canary.1. It is not an official 1.3.14/1.18.x baseline — the release tag tracks opencode's version, not bun's.

873868a92fc1de5eb3bbae81a85e234186eb00f2b51da956e1835017d813d824  bun-darwin-x64-baseline
afe0fe21fc9b6ea43c33239aac990bb180c1025cc2d7044db5fab5ef4fc60915  opencode-darwin-x64-baseline

Upstream: WebKit#290 (baseline WebKit) → bun#34207 (build lane) → WebKit#292 (JIT AVX detection). Tracked in bun#34215.

Baseline (non-AVX2) macOS x64 — bun + opencode v1.18.1

Choose a tag to compare

@tobocop2 tobocop2 released this 15 Jul 03:59

Baseline (non-AVX2) macOS x64 builds for pre-Haswell Intel Macs, where the official -baseline packages are byte-identical to the AVX2 builds and crash with SIGILL.

Most people want opencode-darwin-x64-baseline.

chmod +x opencode-darwin-x64-baseline
./opencode-darwin-x64-baseline --version

Why this exists

The shipped opencode-darwin-x64-baseline is the same file as opencode-darwin-x64 (both AVX2), because bun's darwin packages are identical, because oven-sh/WebKit never builds a baseline macOS WebKit (bun-webkit-macos-amd64-baseline.tar.gz → HTTP 404). See opencode#29039, opencode#24876.

Does it work?

binary AVX2 (ymm)
shipped opencode-darwin-x64-baseline 248,019
this build 14,407
@oven/bun-linux-x64-baseline (verified on real pre-AVX2 hardware) 12,328

A baseline isn't "zero AVX2" — the residual is behind CPUID runtime dispatch. This matches the linux baseline profile, which I verified on a real Sandy Bridge CPU (no AVX2): it runs opencode run "say hi" to completion, while the AVX2 build crashes (~21s, ~3.9 GB, segfault).

Caveat: I could not test these macOS binaries on a real pre-AVX2 Mac — nobody rents one. If you try it, please report back.

Provenance

  • bun: built from main @ 1e35118008 — reports as 1.4.0-dev, not an official 1.3.14 baseline
  • opencode: v1.18.1 compiled against that bun
  • WebKit: 4895f45dfbd0d1226c4d41799887bc0ecb9f341b, built with -march=nehalem
bede5eb3c917fa353d6b067fd7055d42774db7a7d5a09c21fa6cdd05e3d8efee  bun-darwin-x64-baseline
7daf210676d2efa9627619ab1823b141c861aa362f8a828db836472d9790e61f  opencode-darwin-x64-baseline

Build steps: see the README. Unofficial; not affiliated with oven-sh or anomalyco.