fitzgen requested pchickey for a review on PR #15051.
fitzgen removed the review request for wasmtime-core-reviewers from PR #15051.
fitzgen requested wasmtime-core-reviewers for a review on PR #15051.
fitzgen opened PR #15051 from fitzgen:cm-gc-tuples-of-scalars to bytecodealliance:main:
The first bit of actually interacting with reference types in the CM+GC work. This forces us to build out a bunch of infrastructure, so I'm trying to keep this as minimal as possible by only supporting tuples of scalars. Follow up commits will introduce tuples of tuples and other reference-typed things like records and strings and arrays and all that.
pchickey requested alexcrichton for a review on PR #15051.
pchickey removed the review request for pchickey from PR #15051.
:memo: alexcrichton submitted PR review.
:speech_balloon: alexcrichton created PR review comment:
Might be worth pointing out that
falseis a lie here, but it kind of doesn't matter. Or perhaps alternatively, could there be a separatestruct_get_{s,u}helper and then there's no param here at all? It's a bit odd to have that flag as well for floats for example.
:speech_balloon: alexcrichton created PR review comment:
Technically speaking one theoretical optimization here could be if in the GC ABI the src/destination are immutable and equal the exact struct could be plumbed through as-is, right? (fine to leave for a future PR/issue, just want to confirm my understanding)
:speech_balloon: alexcrichton created PR review comment:
In theory these are pretty easy, right? Mostly just
abstract_(...)?IIRC
ConcreteExnwon't show up here, although I'm not sure about continuations.
:speech_balloon: alexcrichton created PR review comment:
Instead of
.unwrap()could this belet Ok(()) = ...?
:speech_balloon: alexcrichton created PR review comment:
There's no max for the GC ABI, right?
:speech_balloon: alexcrichton created PR review comment:
Instead of duplicating this comment in all blocks, could there be an explanatory comment in one location and the others briefly redirect to that?
:speech_balloon: alexcrichton created PR review comment:
This is a linear search in a loop which might lead to quadratic behavior I think -- could
idxhere, since it's a module-local thing, be compare to the first index in the rec group instead?
:speech_balloon: alexcrichton created PR review comment:
Not that it matters for this test, but technically the
(rec ...)here isn't necessary right?
:speech_balloon: alexcrichton created PR review comment:
FWIW I think that the concurrent code is going to need some relatively invasive changes to handle the GC ABI. Not only because of rooting everywhere but also because limits/maximums in params/results are pretty heavily baked in to the implementation on the host side. It might be best to just reject this for now and have a separate
todo!or component-model-async integration being a big TODO item.For example there's code like this which is definitely not correct for GC.
:speech_balloon: alexcrichton created PR review comment:
I'm a bit confused by this, aren't all interface types representable with a single core wasm type in the GC ABI meaning that
flat_val_typesshould always succeed for GC?
:speech_balloon: alexcrichton created PR review comment:
This feels relatively confusing to me because GC tuples do indeed have a single flat type, so this method is kind of a lie in that respect. Could this method grow documentation about how it's supposed to be used or perhaps renamed to cater to the use case for how this works at call-sites?
:speech_balloon: alexcrichton created PR review comment:
How come these extra vecs are made?
:speech_balloon: alexcrichton created PR review comment:
Should this previous
types.flat_typesmethod get deleted/renamed?
:speech_balloon: alexcrichton created PR review comment:
Could this contain documentation that this panics if
ty's flat representation overflows the limits for linear memory?
:speech_balloon: alexcrichton created PR review comment:
Why use
Destination::Structhere whenDestination::Stackpretty much does the same thing? CouldDestination::Structbe removed entirely?
:speech_balloon: alexcrichton created PR review comment:
What's 525 here refer to?
:speech_balloon: alexcrichton created PR review comment:
Could this be handled in the
record_field_{srcs,dsts}helper instead? That'll probably be needed for structs anyway and it's already trying to handle some of this boilerplate
:speech_balloon: alexcrichton created PR review comment:
I think this limitation is fixed as of https://github.com/bytecodealliance/wasmtime/pull/15044
fitzgen updated PR #15051.
:memo: fitzgen submitted PR review.
:speech_balloon: fitzgen created PR review comment:
Good eye, fixed in latest commit.
:memo: fitzgen submitted PR review.
:speech_balloon: fitzgen created PR review comment:
Done
:memo: fitzgen submitted PR review.
:speech_balloon: fitzgen created PR review comment:
Yep, done
:memo: fitzgen submitted PR review.
:speech_balloon: fitzgen created PR review comment:
Correct, callers passed
usize::MAX, but I just made theSomereturn unconditional.
:memo: fitzgen submitted PR review.
:speech_balloon: fitzgen created PR review comment:
Yes, but
FlatTypecannot represent reference types. I renamedOptions::flat_typestoOptions::scalar_flat_typesto help clarify.
:memo: fitzgen submitted PR review.
:speech_balloon: fitzgen created PR review comment:
Oof, yeah. Okay, I disabled CM-async + GC for now, filed https://github.com/bytecodealliance/wasmtime/issues/15080 to track this.
:speech_balloon: fitzgen created PR review comment:
Refactored to have
struct_get_{s,u}helpers that do the signed or unsigned extension when operating on a packed field.
:memo: fitzgen submitted PR review.
:memo: fitzgen submitted PR review.
:speech_balloon: fitzgen created PR review comment:
Done
:memo: fitzgen submitted PR review.
:speech_balloon: fitzgen created PR review comment:
A borrow issue that was actually pretty easily avoidable. Gone in the latest commit.
:memo: fitzgen submitted PR review.
:speech_balloon: fitzgen created PR review comment:
That is correct, and yes, I am leaving this for the future.
:memo: fitzgen submitted PR review.
:speech_balloon: fitzgen created PR review comment:
Filed https://github.com/bytecodealliance/wasmtime/issues/15081 to track this.
:memo: fitzgen submitted PR review.
:speech_balloon: fitzgen created PR review comment:
Done.
:memo: fitzgen submitted PR review.
:speech_balloon: fitzgen created PR review comment:
Not really because
Destination::Stackholds&[ValType]which doesn't work fori8/i16, but even if we turned it into&[StorageType]then we would also need to know the which field of the struct it is and at this point the sharing is not really that helpful. I thinkDestination::Structstarts making more sense as we start supporting nested tuples in https://github.com/bytecodealliance/wasmtime/pull/15054, e.g.:
:memo: fitzgen submitted PR review.
:speech_balloon: fitzgen created PR review comment:
Renamed, as mentioned above.
:memo: fitzgen submitted PR review.
:speech_balloon: fitzgen created PR review comment:
Done
:memo: fitzgen submitted PR review.
:speech_balloon: fitzgen created PR review comment:
Done
:memo: fitzgen submitted PR review.
:speech_balloon: fitzgen created PR review comment:
Yep, unnecessary. Removed so it isn't a distraction.
:memo: fitzgen submitted PR review.
:speech_balloon: fitzgen created PR review comment:
https://github.com/WebAssembly/component-model/issues/525
I just removed the reference, since it will just become out of date once CM+GC is actually spec'd.
fitzgen commented on PR #15051:
@alexcrichton I believe I have addressed all of your review feedback with the latest commit
:memo: alexcrichton submitted PR review.
:speech_balloon: alexcrichton created PR review comment:
Could this return not a
GcStructbut perhaps the internals of the type, such as a local/type? It feels a bit odd to need sentinel values forfieldand e.g.FIELD_UNSETin the next PR where I think it would be best to model this as theGcStructdestination is directly created inaggregate_field_srcs' iterator.Also, to confirm, I'd expect in the next PR that this method would take
&mut Compilerto fill out the structtodo!here by injecting astruct.getinstruction to get a struct-from-a-struct
:speech_balloon: alexcrichton created PR review comment:
I'm not totally sold on this myself just yet, it seems like this would ideally use
Destination::Stackfor GC types andtranslate_{tuple,record}would have custom follow-ups for the GC ABI which inserts astruct.newwith the desired type. TheDestination::Stackvariant has all the types expected as well asOptionswhich seems like a good fit for all of this.Furthermore the handling of
Destination::Structalready does nothing everywhere which is basically the same forstack_setwhen the types line up (which they always would for the GC ABI).Did you have other plans in mind for
Destination::Structin the future though?
:speech_balloon: alexcrichton created PR review comment:
Question on this: why is this needed? I would naively expect that all GC structs are required to store a component-model
u8in a storage-typei8field, so wouldn't this be dead code in such a situation? Or is this one where a storage ofi32matches a component modelu8type?
Last updated: Oct 31 2026 at 23:03 UTC