forked from bytecodealliance/wasmtime
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
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.
- Loading branch information
1 parent
84852f7
commit 1858f1a
Showing
1 changed file
with
32 additions
and
40 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters