Stream: git-wasmtime

Topic: wasmtime / PR #10897 Refactor the representation of `Func`


view this post on Zulip Wasmtime GitHub notifications bot (Jun 02 2025 at 18:34):

alexcrichton requested fitzgen for a review on PR #10897.

view this post on Zulip Wasmtime GitHub notifications bot (Jun 02 2025 at 18:34):

alexcrichton opened PR #10897 from alexcrichton:refactor-func-representation to bytecodealliance:main:

This commit rewrites the internals of wasmtime::Func. The Stored type is no longer used meaning that it's now free to create a wasmtime::Func at any time. It is effectively a store-tagged NonNull<VMFuncRef>. This required a few internal changes to how functions are passed around:

Closes #10868

<!--
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 (Jun 02 2025 at 18:34):

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

view this post on Zulip Wasmtime GitHub notifications bot (Jun 02 2025 at 18:34):

alexcrichton commented on PR #10897:

I'll also note that this is split out of https://github.com/bytecodealliance/wasmtime/pull/10870/commits/b228b9718ab0c7e405ff98f62207d63f0e8484a7

view this post on Zulip Wasmtime GitHub notifications bot (Jun 02 2025 at 18:36):

alexcrichton edited a comment on PR #10897:

I'll also note that this is split out of https://github.com/bytecodealliance/wasmtime/pull/10870

view this post on Zulip Wasmtime GitHub notifications bot (Jun 02 2025 at 18:39):

alexcrichton updated PR #10897.

view this post on Zulip Wasmtime GitHub notifications bot (Jun 02 2025 at 21:19):

fitzgen created PR review comment:

Kind of an aside but should all of these assertions actually live in the wasmtime-c-api crate so that we don't need to have a dummy struct which itself needs to be kept in sync with the struct that we actually care about? We've removed one syncing problem but added another, so we haven't really changed anything. I guess the only assertion that would remain in the wasmtime crate would be the one for the offset of the store field.

view this post on Zulip Wasmtime GitHub notifications bot (Jun 02 2025 at 21:19):

fitzgen created PR review comment:

/// Attempts to fill the `wasm_call` field of `func_ref` given `modules`
/// registered and returns `true` if the field was filled, `false` otherwise.

view this post on Zulip Wasmtime GitHub notifications bot (Jun 02 2025 at 21:19):

fitzgen created PR review comment:

Sooooooo nice to get rid of FuncKind

view this post on Zulip Wasmtime GitHub notifications bot (Jun 02 2025 at 21:19):

fitzgen submitted PR review:

Very nice!!

view this post on Zulip Wasmtime GitHub notifications bot (Jun 02 2025 at 21:19):

fitzgen created PR review comment:

Just to clarify, since there isn't any assert! here:

                // Note that this is a load-bearing `unwrap` here, but is

view this post on Zulip Wasmtime GitHub notifications bot (Jun 02 2025 at 23:03):

alexcrichton updated PR #10897.

view this post on Zulip Wasmtime GitHub notifications bot (Jun 02 2025 at 23:03):

alexcrichton updated PR #10897.

view this post on Zulip Wasmtime GitHub notifications bot (Jun 02 2025 at 23:04):

alexcrichton submitted PR review.

view this post on Zulip Wasmtime GitHub notifications bot (Jun 02 2025 at 23:04):

alexcrichton created PR review comment:

Oh I think you might be assuming there's a struct wasmtime_func_t { ... } in Rust in crates/c-api but that doesn't exist. In that sense this struct C is the only C-version-written-in-Rust anywhere in the codebase, and I figured here was a good as place as any to test things out.

view this post on Zulip Wasmtime GitHub notifications bot (Jun 02 2025 at 23:04):

alexcrichton has enabled auto merge for PR #10897.

view this post on Zulip Wasmtime GitHub notifications bot (Jun 02 2025 at 23:23):

fitzgen submitted PR review.

view this post on Zulip Wasmtime GitHub notifications bot (Jun 02 2025 at 23:23):

fitzgen created PR review comment:

Ah, I was indeed

view this post on Zulip Wasmtime GitHub notifications bot (Jun 03 2025 at 00:18):

alexcrichton merged PR #10897.


Last updated: Dec 06 2025 at 07:03 UTC