Skip to content

fix web: crash with --optimization-level=0 due to HEAPU8.buffer declared as JSArrayBuffer #521 - #526

Merged
alnitak merged 2 commits into
mainfrom
dev
Aug 1, 2026
Merged

fix web: crash with --optimization-level=0 due to HEAPU8.buffer declared as JSArrayBuffer #521#526
alnitak merged 2 commits into
mainfrom
dev

Conversation

@alnitak

@alnitak alnitak commented Jul 31, 2026

Copy link
Copy Markdown
Owner

Description

fixes #521

The WASM module is compiled with -pthread / SHARED_MEMORY=1, so Module_soloud.HEAPU8.buffer is a SharedArrayBuffer, not an ArrayBuffer. Declaring it as JSArrayBuffer makes the implicit downcast throw on dart2js builds whenever runtime type checks are kept (e.g. by using --optimization-level=0).

Access the heap through its typed-array views (HEAPU8 as JSUint8Array, HEAPF32 as JSFloat32Array) instead, are correct regardless of whether the backing buffer is an ArrayBuffer or a SharedArrayBuffer

Type of Change

  • 🛠️ Bug fix (non-breaking change which fixes an issue)

@alnitak
alnitak merged commit 02d1643 into main Aug 1, 2026
1 check 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.

fix: 4.1.0 not compatible with optimization-level=0 on web (non-wasm)

1 participant