PROMETHIA-27 opened PR #6421 from PROMETHIA-27:entity_list_copy_from
to bytecodealliance:main
:
This PR adds a new method to
EntityList
calledcopy_from
, which works very similarly tocopy_within
onVec
in stdlib. It allows copying a slice from oneEntityList
to a given index in another, with only one reference to aListPool
. IfNone
is passed for the otherEntityList
argument, it copies from within a single list.This method allows efficiently copying between and within
EntityList
s without requiring unsafe (of which I'm not sure there are any sound public-facing approaches) or intermediateVec
s to storeT
in.I'm not entirely confident that I've implemented this fully correctly, but I'm unaware of any ways in which it is incorrect and the moderately complex test I've added passes, as well as all others (which shouldn't be affected anyway).
PROMETHIA-27 requested elliottt for a review on PR #6421.
PROMETHIA-27 requested wasmtime-compiler-reviewers for a review on PR #6421.
PROMETHIA-27 updated PR #6421.
elliottt created PR review comment:
Which of these asserts is expected to panic?
PROMETHIA-27 created PR review comment:
Neither; it would panic in the
copy_from
. I just copied them from the other test since they were examples that are now prohibited.
elliottt created PR review comment:
Would you mind commenting the call where you expect the exception to happen, just so that it's super clear for anyone debugging the test?
PROMETHIA-27 updated PR #6421.
elliottt submitted PR review:
This looks good to me with comments addressed, thank you!
elliottt created PR review comment:
Thank you for this assertion, it definitely makes it easier to see that the use of
copy_within
is fine. Do you plan to follow-up with a PR to remove the need for the assert?
elliottt created PR review comment:
Could you add a note to the doc comment that the function will panic if
other
is the same asself
?
elliottt submitted PR review:
This looks good to me with comments addressed, thank you!
PROMETHIA-27 created PR review comment:
I'll try to get around to it, but it might be a minute
PROMETHIA-27 updated PR #6421.
PROMETHIA-27 created PR review comment:
Done!
elliottt merged PR #6421.
Last updated: Dec 23 2024 at 13:07 UTC