Stream: git-wasmtime

Topic: wasmtime / PR #14683 Optimize the implementation of `ref....


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

alexcrichton opened PR #14683 from alexcrichton:optimize-ref-func to bytecodealliance:main:

This PR is a series of commits which ends up optimizing the ref.func implementation within Wasmtime to notably not require a hostcall and additionally not require any function lookups within the compiled function tables. There's a number of linked issues to poor performance of ref.func and while this isn't a truly "zero cost" implementation it is significantly faster than it otherwise is today. The same implementation as before, where the fields are unconditionally initialized, is used no matter what. Conditional initialization could be part of a later runtime refactoring, if needed.

Note: this is a draft PR since there's an open design question around the Cranelift side of things I'd like to discuss this coming Wednesday.

view this post on Zulip Wasmtime GitHub notifications bot (Oct 12 2026 at 20:29):

alexcrichton updated PR #14683.

view this post on Zulip Wasmtime GitHub notifications bot (Oct 12 2026 at 21:47):

github-actions[bot] added the label cranelift on PR #14683.

view this post on Zulip Wasmtime GitHub notifications bot (Oct 12 2026 at 21:47):

github-actions[bot] added the label cranelift:area:aarch64 on PR #14683.

view this post on Zulip Wasmtime GitHub notifications bot (Oct 12 2026 at 21:47):

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

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

alexcrichton updated PR #14683.

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

alexcrichton updated PR #14683.

view this post on Zulip Wasmtime GitHub notifications bot (Oct 19 2026 at 22:22):

alexcrichton has marked PR #14683 as ready for review.

view this post on Zulip Wasmtime GitHub notifications bot (Oct 19 2026 at 22:22):

alexcrichton requested cfallin for a review on PR #14683.

view this post on Zulip Wasmtime GitHub notifications bot (Oct 19 2026 at 22:22):

alexcrichton removed the review request for wasmtime-compiler-reviewers from PR #14683.

view this post on Zulip Wasmtime GitHub notifications bot (Oct 19 2026 at 22:22):

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

view this post on Zulip Wasmtime GitHub notifications bot (Oct 19 2026 at 22:22):

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

view this post on Zulip Wasmtime GitHub notifications bot (Oct 19 2026 at 22:22):

alexcrichton edited PR #14683:

This PR is a series of commits which ends up optimizing the ref.func implementation within Wasmtime to notably not require a hostcall and additionally not require any function lookups within the compiled function tables. There's a number of linked issues to poor performance of ref.func and while this isn't a truly "zero cost" implementation it is significantly faster than it otherwise is today. The same implementation as before, where the fields are unconditionally initialized, is used no matter what. Conditional initialization could be part of a later runtime refactoring, if needed.

Note: this is a draft PR since there's an open design question around the Cranelift side of things I'd like to discuss this coming Wednesday.

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

:memo: alexcrichton submitted PR review.

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

:speech_balloon: alexcrichton created PR review comment:

I've a thread on Zulip about why this isn't optimizing

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

:memo: fitzgen submitted PR review.

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

:speech_balloon: fitzgen created PR review comment:

I don't think this is something that can be inferred, because that would require determining whether a given function call writes to the location (or alias region) in question.

I think we may want to, in the limit of time, annotate signatures with the set of alias regions they use (and maybe, in the fullness of time, split that into observe vs mutate), but that is a bit separate from this TODO I think.

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

:speech_balloon: fitzgen created PR review comment:

"the this"

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

:speech_balloon: fitzgen created PR review comment:

This is going to lose whether the field is aligned or not, for example. I think this should instead be something like

let flags = self.flags_with_region(cursor.func).with_readonly(false);

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

:speech_balloon: fitzgen created PR review comment:

Can the new relocations be added in a separate PR, just to help split this up and make it easier to review?

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

:speech_balloon: fitzgen created PR review comment:

doc comment needs fixing

view this post on Zulip Wasmtime GitHub notifications bot (Oct 21 2026 at 15:54):

:speech_balloon: alexcrichton created PR review comment:

Unfortunately the core change here can't land without this since otherwise tests on aarch64/riscv64 will fail. I can land the change for relocations separately, but then they're not tested until this lands. I split them out into separate commits for this PR, but if you'd like I can land them ahead of time on main

view this post on Zulip Wasmtime GitHub notifications bot (Oct 21 2026 at 15:55):

:memo: alexcrichton submitted PR review.

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

:speech_balloon: alexcrichton created PR review comment:

Do you think it's worth having this comment at all? I tried to capture some of the Cranelift meeting discussion in this, but you're right that actually removing the need for this would be a pretty ambitious project

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

:memo: alexcrichton submitted PR review.

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

alexcrichton updated PR #14683.

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

alexcrichton updated PR #14683.

view this post on Zulip Wasmtime GitHub notifications bot (Oct 26 2026 at 17:59):

:memo: fitzgen submitted PR review.

view this post on Zulip Wasmtime GitHub notifications bot (Oct 26 2026 at 17:59):

:speech_balloon: fitzgen created PR review comment:

Sorry for the delayed response. Yeah I think we can remove this comment now, especially given the other changes that have landed or are in-progress clarifying readonly and adding GVN of readonly loads.

view this post on Zulip Wasmtime GitHub notifications bot (Oct 26 2026 at 18:00):

:memo: fitzgen submitted PR review.

view this post on Zulip Wasmtime GitHub notifications bot (Oct 26 2026 at 18:00):

:speech_balloon: fitzgen created PR review comment:

I think landing them without tests in a separate PR first would have been easier to review (since Github makes it hard to mark files read while reviewing commit by commit) but I think it is fine at this point.

view this post on Zulip Wasmtime GitHub notifications bot (Oct 26 2026 at 18:01):

:thumbs_up: fitzgen submitted PR review:

Thanks!

view this post on Zulip Wasmtime GitHub notifications bot (Oct 26 2026 at 22:34):

alexcrichton updated PR #14683.

view this post on Zulip Wasmtime GitHub notifications bot (Oct 26 2026 at 22:36):

alexcrichton has enabled auto merge for PR #14683.

view this post on Zulip Wasmtime GitHub notifications bot (Oct 26 2026 at 22:51):

alexcrichton added PR #14683 Optimize the implementation of ref.func to the merge queue

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

:check: alexcrichton merged PR #14683.

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

alexcrichton removed PR #14683 Optimize the implementation of ref.func from the merge queue


Last updated: Oct 31 2026 at 23:03 UTC