fitzgen opened PR #15316 from fitzgen:main-backport-48d37339a3 to bytecodealliance:main:
…_heap = true`
We previously set
needs_gc_heap = truewhen creating aGcCompiler, but unfortunately this was not a complete bottleneck for GC heap access because collector-agnostic accesses (e.g.ref.tests that only read the GC header word) do not construct aGcCompilerbefore emitting code to access the GC heap. This meant thatneeds_gc_heapwas not set, and therefore we didn't pre-allocate a GC heap upon the module's instantiation, which meant that compiled Wasm code could read the initial dangling GC heap base pointer, read the null page, and trigger a process abort.This commit fixes the bug by setting
needs_gc_heap = truewhen creating the GC heap'sHeapand when emitting code to access its base and bound. It additionally adds a few tactical assertions that we have markedneeds_gc_heap = true, such as when getting the GC memflags.<!--
Please make sure you include the following information:
If this work has been discussed elsewhere, please include a link to that
conversation. If it was discussed in an issue, just mention "issue #...".Explain why this change is needed. If the details are in an issue already,
this can be brief.Our development process is documented in the Wasmtime book:
https://docs.wasmtime.dev/contributing-development-process.htmlPlease review the Bytecode Alliance's AI tool usage policy at
https://github.com/bytecodealliance/governance/blob/main/AI_TOOL_POLICY.mdPlease ensure all communication follows the code of conduct:
https://github.com/bytecodealliance/wasmtime/blob/main/CODE_OF_CONDUCT.md
-->
fitzgen requested cfallin for a review on PR #15316.
fitzgen removed the review request for wasmtime-compiler-reviewers from PR #15316.
fitzgen requested wasmtime-compiler-reviewers for a review on PR #15316.
fitzgen requested wasmtime-core-reviewers for a review on PR #15316.
:thumbs_up: alexcrichton submitted PR review.
:speech_balloon: alexcrichton created PR review comment:
Could this move to a
*.wasttest?
fitzgen updated PR #15316.
fitzgen has enabled auto merge for PR #15316.
fitzgen updated PR #15316.
fitzgen added PR #15316 Ensure that collector-agnostic GC heap access emission sets `needs_gc… to the merge queue.
github-merge-queue[bot] removed PR #15316 Ensure that collector-agnostic GC heap access emission sets `needs_gc… from the merge queue.
alexcrichton added PR #15316 Ensure that collector-agnostic GC heap access emission sets `needs_gc… to the merge queue.
:check: alexcrichton merged PR #15316.
alexcrichton removed PR #15316 Ensure that collector-agnostic GC heap access emission sets `needs_gc… from the merge queue.
Last updated: Nov 19 2026 at 20:05 UTC