cfallin edited PR #15191.
cfallin updated PR #15191.
:thumbs_up: fitzgen submitted PR review:
Thanks! LGTM modulo a bunch of nitpicks
:speech_balloon: fitzgen created PR review comment:
_suffix here as well
:speech_balloon: fitzgen created PR review comment:
_-suffix instead of prefix:pub(crate) fn to_unrooted_(&self, store: &StoreOpaque) -> Result<crate::Unrooted<T>> {
:speech_balloon: fitzgen created PR review comment:
For this and the non-owned
Rootedversion: does it make sense for callers to pass in an&mut Vec<_>that we push onto so they can reuse an allocation if they have one handy?
:speech_balloon: fitzgen created PR review comment:
We intentionally do not implement
Eq/PartialEqforRootedbecause it isn't clear what the correct thing to do is: reference equality or Wasm semantics-level equality (which is only valid foreqrefsubtypes). Instead we haveRooted::ref_eqand alsoRooted::rooted_eq. AlsoRooted::ref_hashfor hashing.We should do the same for
Unrooted.
:speech_balloon: fitzgen created PR review comment:
Let's maybe not include "weak" here, and just say "In exchange, ..." because otherwise we are potentially misleading people into thinking that this is a weak reference that remains valid as the referent is alive (regardless whether we have GC'd since the reference was taken, or relocated the object, etc...)
:speech_balloon: fitzgen created PR review comment:
And then here I would skip the first sentence, and make the paragraph dedicated only to the idiom/convention of returning
Unrootedreferences.
:speech_balloon: fitzgen created PR review comment:
_suffix instead of prefix
:speech_balloon: fitzgen created PR review comment:
Can we reuse
wasmtime::I31for this payload, instead of open-coding a bunch of new i31 stuff?
:speech_balloon: fitzgen created PR review comment:
I don't think we need to discuss the internals/implementation here either. I think it is fine to just say something like
In exchange, because
Unrootedreferences are not recorded in the root set, they can be used in non-mutStorecontexts and operations on them are very cheap.
:speech_balloon: fitzgen created PR review comment:
And
unchecked_to_rootedorto_rooted_uncheckedhere?
:speech_balloon: fitzgen created PR review comment:
Document that the returned
Valis not rooted as well?
:speech_balloon: fitzgen created PR review comment:
ditto
:speech_balloon: fitzgen created PR review comment:
_suffix instead of prefix
:speech_balloon: fitzgen created PR review comment:
This method name sounds like it is prevalidating the GC ref and returning it. Maybe
unchecked_gc_ref?
:speech_balloon: fitzgen created PR review comment:
Ditto regarding documenting unrootedness.
Also, can this return an
impl ExactSizeIterator<Item = Val>instead of aVec<_> likeStructRef::fields` does?
:speech_balloon: fitzgen created PR review comment:
Ditto regarding documenting unrootedness
:speech_balloon: fitzgen created PR review comment:
Ditto regarding documenting unrootedness
:speech_balloon: fitzgen created PR review comment:
Ditto regarding documenting unrootedness and
ExactSizeIterator
:speech_balloon: fitzgen created PR review comment:
Maybe also
#[track_caller]. (And similar forunwrap_rooted-- should have caught that in the first PR)
:speech_balloon: fitzgen created PR review comment:
_suffix instead of prefix
:speech_balloon: fitzgen created PR review comment:
This doesn't seem necessary to put in the doc comment
:speech_balloon: fitzgen created PR review comment:
_suffix instead of prefix
:speech_balloon: fitzgen created PR review comment:
_suffix instead of prefix
:speech_balloon: fitzgen created PR review comment:
_suffix instead of prefix
:speech_balloon: fitzgen created PR review comment:
Ditto regarding "unchecked" instead of "prevalidated"
:speech_balloon: fitzgen created PR review comment:
Can we also assert the size and align are the same, which LLVM should trivially boil away, just for extra future proofing?
:speech_balloon: fitzgen created PR review comment:
Maybe exhaustive so we don't forget new kinds of references? E.g continuation refs, which are omitted here now but will need to be handled in the future
:speech_balloon: fitzgen created PR review comment:
ditto
:speech_balloon: fitzgen created PR review comment:
I might be missing it, but I think we need these conversions for
EqReftoo
:speech_balloon: fitzgen created PR review comment:
Should this take
vals: impl IntoIterator<&mut Val>to be more general and work with other collections?
:speech_balloon: fitzgen created PR review comment:
Ditto
:memo: cfallin submitted PR review.
:speech_balloon: cfallin created PR review comment:
Unfortunately it can't be: it has to make two passes, the first one to validate all values (they could be stale unrooted values) and only then the second to root them all.
:memo: cfallin submitted PR review.
:speech_balloon: cfallin created PR review comment:
Unfortunately we can't: we need to be able to return a borrow of a
VMGcRef, which we do with the unsafe cast below, and that won't work if we use awasmtime::I31instead.
cfallin updated PR #15191.
:memo: cfallin submitted PR review.
:speech_balloon: cfallin created PR review comment:
Done!
:memo: cfallin submitted PR review.
:speech_balloon: cfallin created PR review comment:
Done!
:memo: cfallin submitted PR review.
:speech_balloon: cfallin created PR review comment:
Done!
:memo: cfallin submitted PR review.
:speech_balloon: cfallin created PR review comment:
Yep, good idea -- done!
:memo: cfallin submitted PR review.
:speech_balloon: cfallin created PR review comment:
Done!
:memo: cfallin submitted PR review.
:speech_balloon: cfallin created PR review comment:
Done!
:memo: cfallin submitted PR review.
:speech_balloon: cfallin created PR review comment:
Done!
:memo: cfallin submitted PR review.
:speech_balloon: cfallin created PR review comment:
Updated!
:memo: cfallin submitted PR review.
:speech_balloon: cfallin created PR review comment:
Done!
:memo: cfallin submitted PR review.
:speech_balloon: cfallin created PR review comment:
Done!
:memo: cfallin submitted PR review.
:speech_balloon: cfallin created PR review comment:
Done!
:memo: cfallin submitted PR review.
:speech_balloon: cfallin created PR review comment:
Done!
:memo: cfallin submitted PR review.
:speech_balloon: cfallin created PR review comment:
Done!
:memo: cfallin submitted PR review.
:speech_balloon: cfallin created PR review comment:
Done!
:memo: cfallin submitted PR review.
:speech_balloon: cfallin created PR review comment:
Done!
:memo: cfallin submitted PR review.
:speech_balloon: cfallin created PR review comment:
Done!
:memo: cfallin submitted PR review.
:speech_balloon: cfallin created PR review comment:
Removed!
:memo: cfallin submitted PR review.
:speech_balloon: cfallin created PR review comment:
Done!
:memo: cfallin submitted PR review.
:speech_balloon: cfallin created PR review comment:
Done!
:memo: cfallin submitted PR review.
:speech_balloon: cfallin created PR review comment:
Done!
:memo: cfallin submitted PR review.
:speech_balloon: cfallin created PR review comment:
Done!
:memo: cfallin submitted PR review.
:speech_balloon: cfallin created PR review comment:
Done!
:memo: cfallin submitted PR review.
:speech_balloon: cfallin created PR review comment:
Done!
:memo: cfallin submitted PR review.
:speech_balloon: cfallin created PR review comment:
Done!
:memo: cfallin submitted PR review.
:speech_balloon: cfallin created PR review comment:
Done!
:memo: cfallin submitted PR review.
:speech_balloon: cfallin created PR review comment:
Done!
:memo: cfallin submitted PR review.
:speech_balloon: cfallin created PR review comment:
Done!
:memo: cfallin submitted PR review.
:speech_balloon: cfallin created PR review comment:
Done!
:memo: cfallin submitted PR review.
:speech_balloon: cfallin created PR review comment:
Added!
cfallin has enabled auto merge for PR #15191.
cfallin has disabled auto merge for PR #15191.
cfallin updated PR #15191.
cfallin has enabled auto merge for PR #15191.
cfallin added PR #15191 GC: implement Unrooted references. to the merge queue
github-merge-queue[bot] removed PR #15191 GC: implement Unrooted references. from the merge queue
cfallin updated PR #15191.
cfallin updated PR #15191.
cfallin has enabled auto merge for PR #15191.
cfallin added PR #15191 GC: implement Unrooted references. to the merge queue
github-merge-queue[bot] removed PR #15191 GC: implement Unrooted references. from the merge queue
cfallin updated PR #15191.
cfallin has enabled auto merge for PR #15191.
cfallin added PR #15191 GC: implement Unrooted references. to the merge queue
:check: cfallin merged PR #15191.
cfallin removed PR #15191 GC: implement Unrooted references. from the merge queue
Last updated: Nov 19 2026 at 20:05 UTC