Skip to content

Enable WAMR bulk-memory opcodes (memory.copy/fill)#1

Merged
e-fu merged 2 commits into
masterfrom
wasm-bulk-memory
Jun 18, 2026
Merged

Enable WAMR bulk-memory opcodes (memory.copy/fill)#1
e-fu merged 2 commits into
masterfrom
wasm-bulk-memory

Conversation

@e-fu

@e-fu e-fu commented Jun 18, 2026

Copy link
Copy Markdown

Adds -DWASM_ENABLE_BULK_MEMORY_OPT=1 so 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.

e-fu added 2 commits June 18, 2026 08:26
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.
Copilot AI review requested due to automatic review settings June 18, 2026 01:31

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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=1 to native build flags.
  • Add a bulk-memory regression fixture and tests validating memory.fill, memory.copy, memory.init, and data.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.

@e-fu e-fu merged commit 5bde4bb into master Jun 18, 2026
5 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants