fitzgen requested wasmtime-core-reviewers for a review on PR #10462.
fitzgen requested pchickey for a review on PR #10462.
fitzgen opened PR #10462 from fitzgen:generalize-vm-gc-object-data
to bytecodealliance:main
:
Depends on https://github.com/bytecodealliance/wasmtime/pull/10461
This makes it generic over a
T
and then shared+immutable accesses are bound by
T: AsRef<[u8]>
and exclusive+mutable accesses are bound byT: AsMut<[u8]>
.This allows reusing these accessors in more places in the future, and means
there are fewer places to bounds check accesses and remember to do little-endian
conversion and all that.
fitzgen updated PR #10462.
alexcrichton submitted PR review.
alexcrichton created PR review comment:
Style nit:
&'_ T
I think can always be rewritten as&T
alexcrichton created PR review comment:
If you want to get really fancy one option is to define this as
VmGcObjectData([u8])
to avoid needing generics here at all.
fitzgen submitted PR review.
fitzgen created PR review comment:
Then we need unsafe code to construct it tho, because we can't use the unbox feature, right?
fitzgen submitted PR review.
fitzgen created PR review comment:
I thought that underscores were preferred for elided return lifetimes these days?
alexcrichton submitted PR review.
alexcrichton created PR review comment:
I think that's advice for lifetime parameters because
Foo
is equivalent toFoo<'_>
, but withFoo
it's easy to forget there's a lifetime in there. With&T
vs&'_ T
though it's mostly just visual noise
alexcrichton submitted PR review.
alexcrichton created PR review comment:
Right yeah, we'd have to have a transmute for that (but IMO is reasonable, nothing compared to the other unsafe bits we have)
fitzgen updated PR #10462.
fitzgen updated PR #10462.
fitzgen has enabled auto merge for PR #10462.
fitzgen merged PR #10462.
Last updated: Apr 17 2025 at 10:03 UTC