Stream: git-wasmtime

Topic: wasmtime / PR #13842 Defer DRC drops in host-side `write_...


view this post on Zulip Wasmtime GitHub notifications bot (Jul 07 2026 at 20:54):

alexcrichton requested fitzgen for a review on PR #13842.

view this post on Zulip Wasmtime GitHub notifications bot (Jul 07 2026 at 20:54):

alexcrichton opened PR #13842 from alexcrichton:drc-defer-drop to bytecodealliance:main:

This commit is an update to the DRC collector to avoid immediately dropping GC references in write_gc_ref. This is done today by threading contextual information such as ExternRefHostDataTable all the way down to write_gc_ref and drop_gc_ref hooks, but a refactoring that I'm planning to do is going to make it significantly more complicated to thread all necessary contextual information through to these hooks. Specifically I'm hoping to store TraceInfo outside of stores and instead inside of Module and RegisteredType to avoid the need for per-type work done during module instantiation. Threading this context through these hooks is effectively ergonomically a no-go.

The strategy then taken in this commit is to change the DRC allocator, the only allocator we have that needs this information during these barriers. The DRC allocator now defers full deallocation of GC allocations to a later point in time where contextual information is available (e.g. during a GC itself). This means that host-initiated writes/drops are no longer guaranteed to actually run destructors immediately (same as with the copying collector). Internally the DRC heap already has a stack of references to decrement, and previously it was only needed during a decrement operation and now it's instead modified to persist between GC barriers through to a GC itself.

<!--
Please make sure you include the following information:

Our development process is documented in the Wasmtime book:
https://docs.wasmtime.dev/contributing-development-process.html

Please ensure all communication follows the code of conduct:
https://github.com/bytecodealliance/wasmtime/blob/main/CODE_OF_CONDUCT.md
-->

view this post on Zulip Wasmtime GitHub notifications bot (Jul 07 2026 at 20:54):

alexcrichton requested wasmtime-core-reviewers for a review on PR #13842.

view this post on Zulip Wasmtime GitHub notifications bot (Jul 07 2026 at 22:05):

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

view this post on Zulip Wasmtime GitHub notifications bot (Jul 07 2026 at 22:05):

github-actions[bot] added the label wasmtime:ref-types on PR #13842.

view this post on Zulip Wasmtime GitHub notifications bot (Jul 07 2026 at 22:06):

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

Subscribe to Label Action

cc @fitzgen

<details>
This issue or pull request has been labeled: "wasmtime:api", "wasmtime:ref-types"

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 (Jul 09 2026 at 20:38):

:thumbs_up: fitzgen submitted PR review.

view this post on Zulip Wasmtime GitHub notifications bot (Jul 09 2026 at 20:38):

:speech_balloon: fitzgen created PR review comment:

This would only happen when both we didn't trace anything on the stack and there was som write_gc_ref that enqueued a GC reference for processing, right? Otherwise the dec_ref_and_maybe_dealloc inside the loop would have processed the ones enqueued by the host, because the host can't run GC barriers for this store while we are in this method.

What if we didn't call dec_ref_and_maybe_dealloc inside the stack-tracing loop above, and just enqueued them (similar to host writes), and then had a single place where we do the dec_ref_and_maybe_dealloc call to process all the enqueued things at the end? I think that should be more performant and also lets us avoid "special" calls to dec_ref_and_maybe_dealloc, consolidating them all into a single call, which is cleaner as well.

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

alexcrichton updated PR #13842.

view this post on Zulip Wasmtime GitHub notifications bot (Jul 09 2026 at 22:14):

:memo: alexcrichton submitted PR review.

view this post on Zulip Wasmtime GitHub notifications bot (Jul 09 2026 at 22:14):

:speech_balloon: alexcrichton created PR review comment:

Sounds good to me, refactored as such now

view this post on Zulip Wasmtime GitHub notifications bot (Jul 09 2026 at 22:39):

alexcrichton added PR #13842 Defer DRC drops in host-side write_gc_ref to the merge queue

view this post on Zulip Wasmtime GitHub notifications bot (Jul 09 2026 at 23:27):

github-merge-queue[bot] removed PR #13842 Defer DRC drops in host-side write_gc_ref from the merge queue

view this post on Zulip Wasmtime GitHub notifications bot (Jul 09 2026 at 23:56):

alexcrichton added PR #13842 Defer DRC drops in host-side write_gc_ref to the merge queue

view this post on Zulip Wasmtime GitHub notifications bot (Jul 10 2026 at 00:22):

:check: alexcrichton merged PR #13842.

view this post on Zulip Wasmtime GitHub notifications bot (Jul 10 2026 at 00:22):

alexcrichton removed PR #13842 Defer DRC drops in host-side write_gc_ref from the merge queue


Last updated: Jul 29 2026 at 05:03 UTC