Stream: git-wasmtime

Topic: wasmtime / PR #13424 Reimplement `table.{grow,fill}`


view this post on Zulip Wasmtime GitHub notifications bot (May 20 2026 at 21:25):

alexcrichton opened PR #13424 from alexcrichton:refactor-table-grow-and-fill to bytecodealliance:main:

This commit refactors the implementation of the table.{grow,fill} WebAssembly instructions to perform more work in compiled code rather than within the runtime itself. This shrinks the amount of libcalls needed, for example, simplifies some internals by having them build on each other, and additionally helps address #13387 by routing more bulk operations through a "narrow waist".

This refactors the internals of memory.fill and array.fill, previously refactored before, to share more implementation details. The end result is that the implementation of table.fill is a one-liner to a generic "fill this thing with this value" helper. Additionally the table.grow instruction is reimplemented in terms of this, meaning that the host is responsible for growth, but compiled code is responsible for initializing the table.

<!--
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 (May 20 2026 at 21:25):

alexcrichton requested wasmtime-compiler-reviewers for a review on PR #13424.

view this post on Zulip Wasmtime GitHub notifications bot (May 20 2026 at 21:25):

alexcrichton requested cfallin for a review on PR #13424.

view this post on Zulip Wasmtime GitHub notifications bot (May 20 2026 at 21:25):

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

view this post on Zulip Wasmtime GitHub notifications bot (May 20 2026 at 21:33):

alexcrichton updated PR #13424.

view this post on Zulip Wasmtime GitHub notifications bot (May 20 2026 at 21:36):

alexcrichton updated PR #13424.

view this post on Zulip Wasmtime GitHub notifications bot (May 20 2026 at 22:11):

:thumbs_up: cfallin submitted PR review:

Looks good!

view this post on Zulip Wasmtime GitHub notifications bot (May 20 2026 at 22:11):

:speech_balloon: cfallin created PR review comment:

Add a comment here that we must not have any epoch-yield points within the fill?

(This also seems important in a CM async / cooperative threads context, because otherwise, if an epoch-yield someday becomes run-concurrent-compatible and another async activation runs, it could otherwise observe state halfway through an instruction, right? I don't know if that's a valid concern or if it is statically disallowed but in any case noting the relevant invariants here, and maybe at the bulk-fill loop implementation too, seems like a good idea)

view this post on Zulip Wasmtime GitHub notifications bot (May 20 2026 at 22:11):

:speech_balloon: cfallin created PR review comment:

s/seew hether/see whether/

view this post on Zulip Wasmtime GitHub notifications bot (May 20 2026 at 23:05):

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

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

:memo: alexcrichton submitted PR review.

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

:speech_balloon: alexcrichton created PR review comment:

That's a good point/question, and definitely related to https://github.com/bytecodealliance/wasmtime/issues/11869. For now we're fine insofar as async libcalls like yield points will lock up the entire store making it statically impossible to read or write anything within the store. While we do want to fix that (at least somewhat) in the future it's a bit of an open question how to do so. One issue is that we definitely cannot allow mutations during yield points, but that'd still be a problem here if we allow reads. I'll leave comments on that issue since I think that's probably the best place (as opposed to the code) since it's a pervasive concern and not necessarily isolated to just this part of the code.

It's unfortunate as well because I think we explicitly want epoch yields here in table growth in case it's a massive table growth...

view this post on Zulip Wasmtime GitHub notifications bot (May 21 2026 at 05:16):

alexcrichton updated PR #13424.

view this post on Zulip Wasmtime GitHub notifications bot (May 21 2026 at 05:16):

alexcrichton has enabled auto merge for PR #13424.

view this post on Zulip Wasmtime GitHub notifications bot (May 21 2026 at 05:27):

alexcrichton added PR #13424 Reimplement table.{grow,fill} to the merge queue

view this post on Zulip Wasmtime GitHub notifications bot (May 21 2026 at 05:52):

github-merge-queue[bot] removed PR #13424 Reimplement table.{grow,fill} from the merge queue

view this post on Zulip Wasmtime GitHub notifications bot (May 21 2026 at 05:53):

alexcrichton added PR #13424 Reimplement table.{grow,fill} to the merge queue

view this post on Zulip Wasmtime GitHub notifications bot (May 21 2026 at 06:18):

:check: alexcrichton merged PR #13424.

view this post on Zulip Wasmtime GitHub notifications bot (May 21 2026 at 06:18):

alexcrichton removed PR #13424 Reimplement table.{grow,fill} from the merge queue


Last updated: Jun 01 2026 at 09:49 UTC