Enable WAMR bulk-memory opcodes (memory.copy/fill)#1
Merged
Conversation
Go's GOOS=js GOARCH=wasm compiler (and TinyGo, Rust wasm-bindgen) emit bulk-memory opcodes unconditionally. WASM_ENABLE_BULK_MEMORY and WASM_ENABLE_REF_TYPES were already set via -D in native.ex, but the _OPT sub-feature gating memory.copy (fc 0a) / memory.fill (fc 0b) was not, so any such module failed to instantiate with 'unsupported opcode fc 0a'. Add -DWASM_ENABLE_BULK_MEMORY_OPT=1 beside the existing flags (the build's single source of truth; the vendored config.h #ifndef defaults are overridden by these -D defines). Regression test runs a module exercising all four bulk-memory opcodes (memory.fill/copy/init + data.drop) via both the native WASM API and the JS WebAssembly API, asserting run() == 43998.
The precompile workflow only uploaded to a GitHub release on v* tags, so a workflow_dispatch run on a feature branch built the NIF but left it unreachable. Add an actions/upload-artifact step (always) so a manual dispatch on any branch yields a downloadable per-target build (e.g. aarch64-macos-none) without cutting a release.
There was a problem hiding this comment.
Pull request overview
Enables WebAssembly bulk-memory “opt” opcodes in the embedded WAMR build so modules using memory.copy / memory.fill (commonly emitted by Go/TinyGo/Rust wasm toolchains) compile and run correctly in QuickBEAM’s WASM runtime. Adds regression tests to cover the affected opcode set via both the native WASM API and the JS WebAssembly API, and tweaks the precompile workflow to always upload build artifacts for easier branch testing.
Changes:
- Enable WAMR bulk-memory opt support by adding
-DWASM_ENABLE_BULK_MEMORY_OPT=1to native build flags. - Add a bulk-memory regression fixture and tests validating
memory.fill,memory.copy,memory.init, anddata.drop. - Upload precompiled NIF tarballs as GitHub Actions run artifacts on all workflow runs (not just tag releases).
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
test/wasm_test.exs |
Adds a byte-level bulk-memory WASM fixture plus native + JS API regression tests asserting run() == 43_998. |
lib/quickbeam/native.ex |
Enables WAMR’s bulk-memory opt gate (WASM_ENABLE_BULK_MEMORY_OPT) in the NIF build CFLAGS. |
.github/workflows/precompile.yml |
Uploads produced .tar.gz artifacts for workflow runs to support downloading per-branch builds. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Adds
-DWASM_ENABLE_BULK_MEMORY_OPT=1so WAMR accepts memory.copy (fc 0a) / memory.fill (fc 0b) — emitted unconditionally by Go (GOOS=js), TinyGo, and Rust wasm-bindgen. Includes a regression test exercising memory.fill/copy/init + data.drop via both the native WASM API and the JS WebAssembly API (asserts run() == 43998).Opened to run CI (builds the NIF from source on Linux + full suite) — local arm64 builds are blocked by the macOS 26.5 CLT arm64e-only SDK vs Zig 0.15.2 linker bug.