sunshowers requested alexcrichton for a review on PR #9668.
sunshowers requested wasmtime-core-reviewers for a review on PR #9668.
sunshowers opened PR #9668 from sunshowers:memory-pool-aligned
to bytecodealliance:main
:
Part of work to centralize memory management within Mmap instances -- some of that work becomes easier if the byte counts are known to be aligned.
There were a few overflow cases that I added checks for, and I also added a proptest impl for
HostAlignedByteCount
.
sunshowers submitted PR review.
sunshowers created PR review comment:
Hm I guess it can be added but it would have to be up to the last representable page, not
usize::MAX
. Haven't seen a good use case for it though.
alexcrichton submitted PR review:
Looks great to me, thanks! Just some minor things.Looks great to me, thanks! Just some minor things.
alexcrichton created PR review comment:
I think this is fine to stay as infallible since the
SlabLayout
structure means "everything has been validated" and thecalculate
method below should have returned an error if this were otherwise to fail
alexcrichton created PR review comment:
Could this use
new_unchecked
to get the debug assert there? Naively it feels like there's probably some corner case that produces an un-aligned count but I would also readily believe that some amount of math can be applied here to prove that the output is always aligned as well. In that sense I don't doubt this, but it might be good to have a debug-assert though? (or otherwise if you wouldn't mind writing out some math to show why the output is always aligned)
alexcrichton created PR review comment:
True yeah, but agreed it's reasonable to skip the implementation for now.
alexcrichton submitted PR review:
Looks great to me, thanks! Just some minor things.
sunshowers submitted PR review.
sunshowers created PR review comment:
mmm actually I don't know why I wrote this, I thought I returned usize for this... sorry!
sunshowers submitted PR review.
sunshowers created PR review comment:
Oh, hmm, actually this is fine I think. N * page size % M * page size will always be some multiple of the page size.
sunshowers edited PR review comment.
alexcrichton submitted PR review.
alexcrichton created PR review comment:
Yeah I suspect that this is always aligned now too, but I think it'd be good to have a comment or debug assert to help readers agree too
sunshowers updated PR #9668.
sunshowers submitted PR review.
sunshowers created PR review comment:
DOne.
sunshowers edited PR review comment.
sunshowers submitted PR review.
sunshowers created PR review comment:
Attempted to explain this -- does that look good?
alexcrichton submitted PR review.
alexcrichton has enabled auto merge for PR #9668.
sunshowers commented on PR #9668:
Oh haha, some of the old functions are no longer in use. Fixing.
sunshowers updated PR #9668.
sunshowers commented on PR #9668:
Should be good to go again -- I copied the feature flag for the only use. I'll remove this function entirely in a subsequent PR.
alexcrichton merged PR #9668.
Last updated: Dec 23 2024 at 12:05 UTC