abrown opened PR #5475 from wiggle-copied-str-reads
to main
:
Along the same lines as https://github.com/bytecodealliance/wasmtime/pull/5471, this change adds a new smart pointer,
GuestStrCow
, to copy the string bytes over from Wasm memory to the
host when the string is found in shared memory. This is necessary to
maintain Rust guarantees: with shared memory, the bytes backing a
GuestStr
could be altered by another thread and this would invalidate
the assumption that we can dereference at any point to&str
.
GuestStrCow
is essentially a wrapper aroundGuestStr
when the memory
is not shared but copies the memory region into aString
when the
memory is shared.
abrown updated PR #5475 from wiggle-copied-str-reads
to main
.
abrown updated PR #5475 from wiggle-copied-str-reads
to main
.
alexcrichton submitted PR review.
alexcrichton submitted PR review.
alexcrichton created PR review comment:
I think this may need a
.try_into()
or otherwise it's skipping the utf-8 check?
abrown updated PR #5475 from wiggle-copied-str-reads
to main
.
abrown submitted PR review.
abrown created PR review comment:
Ah, good catch! Rebased with that additional change as a follow-on commit.
abrown has marked PR #5475 as ready for review.
alexcrichton submitted PR review.
alexcrichton merged PR #5475.
Last updated: Dec 23 2024 at 13:07 UTC