Stream: git-wasmtime

Topic: wasmtime / PR #13080 Add separate GC heap tunables


view this post on Zulip Wasmtime GitHub notifications bot (Apr 13 2026 at 20:15):

fitzgen opened PR #13080 from fitzgen:wasmtime-gc-heap-tunables to bytecodealliance:main:

Before this commit, the GC heap used a memory with identical tunables as regular Wasm linear memories.

After this commit, the GC heap now uses a memory with its own tunables (gc_heap_reservation, gc_heap_guard_size, gc_heap_reservation_for_growth, and gc_heap_may_move) so that GC heaps can be configured independently from linear memories. These new GC heap tunables are also exposed as CLI flags and Config methods. We also generate pseudorandom values for these tunables in our fuzzing config generator.

The pooling allocator uses the same pool for memories and GC heaps, so we validate that if you are using GC and the pooling allocator, then the new tunables must match the memory tunables.

cc https://github.com/bytecodealliance/wasmtime/issues/11256

view this post on Zulip Wasmtime GitHub notifications bot (Apr 13 2026 at 20:15):

fitzgen requested wasmtime-fuzz-reviewers for a review on PR #13080.

view this post on Zulip Wasmtime GitHub notifications bot (Apr 13 2026 at 20:15):

fitzgen requested wasmtime-compiler-reviewers for a review on PR #13080.

view this post on Zulip Wasmtime GitHub notifications bot (Apr 13 2026 at 20:15):

fitzgen requested alexcrichton for a review on PR #13080.

view this post on Zulip Wasmtime GitHub notifications bot (Apr 13 2026 at 20:15):

fitzgen requested wasmtime-core-reviewers for a review on PR #13080.

view this post on Zulip Wasmtime GitHub notifications bot (Apr 13 2026 at 21:44):

fitzgen updated PR #13080.

view this post on Zulip Wasmtime GitHub notifications bot (Apr 13 2026 at 22:02):

alexcrichton created PR review comment:

I think that this is a duplication of MemoryType's equivalent method. In the spirit of keeping things together, could this be refactored to share the same code there like I mentioned above?

That might necessitate a WhichTunables::{Memory,Gc} argument to some internal helper, but I'd imagine that public-facing methods (e.g. gc_heap_memory_may_move here) would not take extra arguments and would just delegate internally

view this post on Zulip Wasmtime GitHub notifications bot (Apr 13 2026 at 22:02):

alexcrichton created PR review comment:

Personally I'm pretty hesitant to duplicate this sort of logic (same for may_move as a bool rather than a function call.

Would it be possible to store a MemoryType within the heap itself, in addition to the guard/reservation as necessary? I'd ideally like to ensure that everything always unconditionally funnels thruogh the MemoryType methods so we've only got one place to look.

view this post on Zulip Wasmtime GitHub notifications bot (Apr 13 2026 at 22:02):

alexcrichton submitted PR review.

view this post on Zulip Wasmtime GitHub notifications bot (Apr 13 2026 at 22:02):

alexcrichton created PR review comment:

This makes sense to me, but the user experience here is going to be pretty annoying on the CLI unfortunately. For example if you're manually twiddling things locally you might pass -Opooling-allocator and configure a guard size, and that'll fail with "ok but also pass the gc guard size".

One option might be to broadcast all the memory options to the GC options by default (e.g. if GC opts aren't specified), but that has a minor downside of making it a bit surprising and difficult to test just memories in isolation (would require passing both memory/gc options). Another option is to broadcast the options only when the pooling allocator is enabled, but that also makes things pretty surprising.

Personally given the niche nature of these configuration options I'd lean towards broadcasting the memory options to the GC options by default. What do you think about that? (that wouldn't remove the need for this validation, it'd just improve the user experience IMO)

view this post on Zulip Wasmtime GitHub notifications bot (Apr 13 2026 at 22:03):

alexcrichton created PR review comment:

Could this and the above block be refactored as:

if signals_based_traps && pulley {
    if memory_needs_adjusting { /* .. */ }
    if gc_needs_adjusting { /* ... */ }
}

view this post on Zulip Wasmtime GitHub notifications bot (Apr 13 2026 at 23:57):

github-actions[bot] added the label fuzzing on PR #13080.

view this post on Zulip Wasmtime GitHub notifications bot (Apr 13 2026 at 23:57):

github-actions[bot] added the label wasmtime:api on PR #13080.

view this post on Zulip Wasmtime GitHub notifications bot (Apr 13 2026 at 23:57):

github-actions[bot] added the label wasmtime:config on PR #13080.

view this post on Zulip Wasmtime GitHub notifications bot (Apr 14 2026 at 01:10):

github-actions[bot] commented on PR #13080:

Subscribe to Label Action

cc @fitzgen

<details>
This issue or pull request has been labeled: "fuzzing", "wasmtime:api", "wasmtime:config"

Thus the following users have been cc'd because of the following labels:

To subscribe or unsubscribe from this label, edit the <code>.github/subscribe-to-label.json</code> configuration file.

Learn more.
</details>

view this post on Zulip Wasmtime GitHub notifications bot (Apr 14 2026 at 02:34):

github-actions[bot] commented on PR #13080:

Label Messager: wasmtime:config

It looks like you are changing Wasmtime's configuration options. Make sure to
complete this check list:

[fuzzing-config]: https://github.com/bytecodealliance/wasmtime/blob/ca0e8d0a1d8cefc0496dba2f77a670571d8fdcab/crates/fuzzing/src/generators.rs#L182-L194
[fuzzing-docs]: https://docs.wasmtime.dev/contributing-fuzzing.html


<details>

To modify this label's message, edit the <code>.github/label-messager/wasmtime-config.md</code> file.

To add new label messages or remove existing label messages, edit the
<code>.github/label-messager.json</code> configuration file.

Learn more.

</details>

view this post on Zulip Wasmtime GitHub notifications bot (Apr 14 2026 at 13:20):

fitzgen edited a comment on PR #13080:

Label Messager: wasmtime:config

It looks like you are changing Wasmtime's configuration options. Make sure to
complete this check list:

[fuzzing-config]: https://github.com/bytecodealliance/wasmtime/blob/ca0e8d0a1d8cefc0496dba2f77a670571d8fdcab/crates/fuzzing/src/generators.rs#L182-L194
[fuzzing-docs]: https://docs.wasmtime.dev/contributing-fuzzing.html


<details>

To modify this label's message, edit the <code>.github/label-messager/wasmtime-config.md</code> file.

To add new label messages or remove existing label messages, edit the
<code>.github/label-messager.json</code> configuration file.

Learn more.

</details>

view this post on Zulip Wasmtime GitHub notifications bot (Apr 14 2026 at 13:20):

fitzgen edited a comment on PR #13080:

Label Messager: wasmtime:config

It looks like you are changing Wasmtime's configuration options. Make sure to
complete this check list:

[fuzzing-config]: https://github.com/bytecodealliance/wasmtime/blob/ca0e8d0a1d8cefc0496dba2f77a670571d8fdcab/crates/fuzzing/src/generators.rs#L182-L194
[fuzzing-docs]: https://docs.wasmtime.dev/contributing-fuzzing.html


<details>

To modify this label's message, edit the <code>.github/label-messager/wasmtime-config.md</code> file.

To add new label messages or remove existing label messages, edit the
<code>.github/label-messager.json</code> configuration file.

Learn more.

</details>

view this post on Zulip Wasmtime GitHub notifications bot (Apr 14 2026 at 13:20):

fitzgen edited a comment on PR #13080:

Label Messager: wasmtime:config

It looks like you are changing Wasmtime's configuration options. Make sure to
complete this check list:

[fuzzing-config]: https://github.com/bytecodealliance/wasmtime/blob/ca0e8d0a1d8cefc0496dba2f77a670571d8fdcab/crates/fuzzing/src/generators.rs#L182-L194
[fuzzing-docs]: https://docs.wasmtime.dev/contributing-fuzzing.html


<details>

To modify this label's message, edit the <code>.github/label-messager/wasmtime-config.md</code> file.

To add new label messages or remove existing label messages, edit the
<code>.github/label-messager.json</code> configuration file.

Learn more.

</details>

view this post on Zulip Wasmtime GitHub notifications bot (Apr 14 2026 at 14:03):

fitzgen updated PR #13080.

view this post on Zulip Wasmtime GitHub notifications bot (Apr 14 2026 at 14:05):

fitzgen commented on PR #13080:

@alexcrichton okay I created a MemoryTunables type that brings together a enum MemoryKind { LinearMemory, GcHeap } and a &Tunables and then exposes methods to get either self.tunables.gc_heap_* or self.tunables.memory_* depending on the MemoryKind. Then I plumbed this through everywhere we were using Tunables in memory-related code. The hope is that this should make it so that we can't ever access the wrong tunable, and have completely unified handling/code paths with no duplication between GC heap vs linear memory.

Mind taking another look?

view this post on Zulip Wasmtime GitHub notifications bot (Apr 14 2026 at 14:06):

fitzgen commented on PR #13080:

(Probably easiest to just view the diff against main, rather than on a per-commit basis)

view this post on Zulip Wasmtime GitHub notifications bot (Apr 14 2026 at 14:06):

fitzgen updated PR #13080.

view this post on Zulip Wasmtime GitHub notifications bot (Apr 14 2026 at 14:26):

alexcrichton submitted PR review:

:+1:

view this post on Zulip Wasmtime GitHub notifications bot (Apr 14 2026 at 14:27):

alexcrichton added PR #13080 Add separate GC heap tunables to the merge queue.

view this post on Zulip Wasmtime GitHub notifications bot (Apr 14 2026 at 14:51):

github-merge-queue[bot] removed PR #13080 Add separate GC heap tunables from the merge queue.

view this post on Zulip Wasmtime GitHub notifications bot (Apr 14 2026 at 14:57):

fitzgen updated PR #13080.

view this post on Zulip Wasmtime GitHub notifications bot (Apr 14 2026 at 15:44):

fitzgen requested dicej for a review on PR #13080.

view this post on Zulip Wasmtime GitHub notifications bot (Apr 14 2026 at 15:44):

fitzgen requested wasmtime-default-reviewers for a review on PR #13080.

view this post on Zulip Wasmtime GitHub notifications bot (Apr 14 2026 at 15:44):

fitzgen updated PR #13080.

view this post on Zulip Wasmtime GitHub notifications bot (Apr 14 2026 at 15:45):

fitzgen has enabled auto merge for PR #13080.

view this post on Zulip Wasmtime GitHub notifications bot (Apr 14 2026 at 15:58):

fitzgen added PR #13080 Add separate GC heap tunables to the merge queue.

view this post on Zulip Wasmtime GitHub notifications bot (Apr 14 2026 at 16:42):

github-merge-queue[bot] removed PR #13080 Add separate GC heap tunables from the merge queue.

view this post on Zulip Wasmtime GitHub notifications bot (Apr 14 2026 at 17:04):

github-actions[bot] added the label winch on PR #13080.

view this post on Zulip Wasmtime GitHub notifications bot (Apr 14 2026 at 17:25):

fitzgen updated PR #13080.

view this post on Zulip Wasmtime GitHub notifications bot (Apr 14 2026 at 17:25):

fitzgen has enabled auto merge for PR #13080.

view this post on Zulip Wasmtime GitHub notifications bot (Apr 14 2026 at 17:37):

fitzgen added PR #13080 Add separate GC heap tunables to the merge queue.

view this post on Zulip Wasmtime GitHub notifications bot (Apr 14 2026 at 18:02):

fitzgen merged PR #13080.

view this post on Zulip Wasmtime GitHub notifications bot (Apr 14 2026 at 18:02):

fitzgen removed PR #13080 Add separate GC heap tunables from the merge queue.


Last updated: May 03 2026 at 22:13 UTC