Stream: git-wasmtime

Topic: wasmtime / PR #13312 Add separate libcalls for array.copy...


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

fitzgen opened PR #13312 from fitzgen:wasmtime-array-copy-non-gc-ref to bytecodealliance:main:

Addresses a long-standing TODO comment whose performance implications were also observed in https://github.com/bytecodealliance/wasmtime/issues/13279

(Still investigating the panic that issue's benchmarks trigger in the copying collector, however.)

<!--
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 06 2026 at 23:09):

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

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

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

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

fitzgen requested alexcrichton for a review on PR #13312.

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

:memo: alexcrichton submitted PR review:

Could you add a test as well that takes ~little time with this PR but maybe ~many seconds without this PR? Out of curiosity, how much does this help https://github.com/bytecodealliance/wasmtime/issues/13279?

Also, as a separate question, would it make sense to delete one or both of these libcalls eventually? For example with GC arrays I figure it'd be best to just do the loop in Cranelift, and for non-GC arrays I figure it might be best to have a single memcpy libcall that's pretty raw and that way we could funnel memory.copy through there too. That way we could const-propagate a lot of things here like the checked_mul and array offsets and such which might be a noticable boost.

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

:speech_balloon: alexcrichton created PR review comment:

Were we to run this through miri I think it would flag this as a violation as data.slice_mut I believe invalidates the previous src_ptr derived. Would it be possible to use copy_within here?

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

:thumbs_up: alexcrichton submitted PR review.

view this post on Zulip Wasmtime GitHub notifications bot (May 07 2026 at 03:59):

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

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

fitzgen commented on PR #13312:

Could you add a test as well that takes ~little time with this PR but maybe ~many seconds without this PR? Out of curiosity, how much does this help #13279?

That benchmark still takes 45 minutes to complete for me locally. Something strange is going on, but I haven't looked in any further.

Therefore, I'll hold off on adding a test that takes ~little time now but ~lots of time before, because I don't think we are done here.

Also, as a separate question, would it make sense to delete one or both of these libcalls eventually? For example with GC arrays I figure it'd be best to just do the loop in Cranelift, and for non-GC arrays I figure it might be best to have a single memcpy libcall that's pretty raw and that way we could funnel memory.copy through there too. That way we could const-propagate a lot of things here like the checked_mul and array offsets and such which might be a noticable boost.

That makes sense, I can look into this sometime soon ish. Want to do some benchmarking, as mentioned above, to understand more about what's going on here tho.

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

fitzgen updated PR #13312.

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

fitzgen has enabled auto merge for PR #13312.

view this post on Zulip Wasmtime GitHub notifications bot (May 07 2026 at 19:02):

fitzgen updated PR #13312.

view this post on Zulip Wasmtime GitHub notifications bot (May 07 2026 at 19:17):

fitzgen added PR #13312 Add separate libcalls for array.copy w/ vs. w/out GC ref elems to the merge queue.

view this post on Zulip Wasmtime GitHub notifications bot (May 07 2026 at 19:42):

:check: fitzgen merged PR #13312.

view this post on Zulip Wasmtime GitHub notifications bot (May 07 2026 at 19:42):

fitzgen removed PR #13312 Add separate libcalls for array.copy w/ vs. w/out GC ref elems from the merge queue.


Last updated: Jun 01 2026 at 09:49 UTC