Stream: git-wasmtime

Topic: wasmtime / PR #9574 Don't use `MemoryStyle` in `MmapMemory`


view this post on Zulip Wasmtime GitHub notifications bot (Nov 06 2024 at 18:43):

alexcrichton opened PR #9574 from alexcrichton:remove-memory-style-from-mmap-memory to bytecodealliance:main:

This commit removes the use fo MemoryStyle for determining the size of the allocation of a MmapMemory. This should semanatically be the same as before but it's hoped that the new version is clearer to understand as it doesn't require going through the MemoryStyle abstraction to understand how tunables interact with linear memory. The semantics for the allocation of linear memory are:

reservation = tunables.memory_reservation
growth = tunables.memory_reservation_for_growth
if maximum <= reservation {
    growth = 0
} else if minimum <= reservation {
    // use settings above
} else {
    reservation = minimum + growth
}

This means that the initial memory allocation is always tunables.memory_reservation unless that's not large enough to fit the linear memory. In such a situation the other settings, such as memory_reservation_for_growth, kick in.

The logic of clamping the maximum and/or dealing with static/dynamic are now all unnecessary and/or tracked elsewhere. For example the clamping nature of maximum now happens implicitly by rejecting growth when memory_may_move is false which should help keep that complexity localized where necessary rather than conflating multiple settings together.

<!--
Please make sure you include the following information:

Our development process is documented in the Wasmtime book:
https://docs.wasmtime.dev/contributing-development-process.html

Please ensure all communication follows the code of conduct:
https://github.com/bytecodealliance/wasmtime/blob/main/CODE_OF_CONDUCT.md
-->

view this post on Zulip Wasmtime GitHub notifications bot (Nov 06 2024 at 18:43):

alexcrichton requested pchickey for a review on PR #9574.

view this post on Zulip Wasmtime GitHub notifications bot (Nov 06 2024 at 18:43):

alexcrichton requested wasmtime-core-reviewers for a review on PR #9574.

view this post on Zulip Wasmtime GitHub notifications bot (Nov 06 2024 at 19:05):

alexcrichton requested fitzgen for a review on PR #9574.

view this post on Zulip Wasmtime GitHub notifications bot (Nov 06 2024 at 22:49):

fitzgen submitted PR review:

:+1:

view this post on Zulip Wasmtime GitHub notifications bot (Nov 06 2024 at 23:04):

fitzgen merged PR #9574.


Last updated: Dec 23 2024 at 12:05 UTC