Instead read directly from tunables and MemoryType with new helper methods that can be shared between Cranelift, Winch, and the rest of the memory subsystem.
Note that this is intended to be a pure-refactoring change. The diff here is large-ish but it's mostly accounted for via code movement and indentation changes. The high-level changes made to the structure of the code are:
Metadata for PCC is de-indented and uses similar coarse determination for what facts to attach as before. Note that there's still a disconnect between PCC facts being applied and the actual load/store itself and so fully supporting PCC will probably require more refactoring in the future.
Cases have been reordered for actually emitting a bounds check. Due to there no longer being a top-level static/dynamic branch the cases have been reordered in terms of priority -- for example unconditional trapping is first, then elision of bounds checks, then the assumption the bound limit is a constant, etc.
Cases for bounds checks have had their arms rewritten in terms of the new properties. The main new one is that the fallback case for static memories previously which had a bounds check is a little more complicated as it additionally factors in memory_may_move in addition to memory_reservation. This is captured in the expanded documentation for this case, however.
Documentation was updated to avoid talking about static/dynamic memories.
Instead read directly from
tunables
andMemoryType
with new helper methods that can be shared between Cranelift, Winch, and the rest of the memory subsystem.Note that this is intended to be a pure-refactoring change. The diff here is large-ish but it's mostly accounted for via code movement and indentation changes. The high-level changes made to the structure of the code are:
Metadata for PCC is de-indented and uses similar coarse determination for what facts to attach as before. Note that there's still a disconnect between PCC facts being applied and the actual load/store itself and so fully supporting PCC will probably require more refactoring in the future.
Cases have been reordered for actually emitting a bounds check. Due to there no longer being a top-level static/dynamic branch the cases have been reordered in terms of priority -- for example unconditional trapping is first, then elision of bounds checks, then the assumption the bound limit is a constant, etc.
Cases for bounds checks have had their arms rewritten in terms of the new properties. The main new one is that the fallback case for static memories previously which had a bounds check is a little more complicated as it additionally factors in
memory_may_move
in addition tomemory_reservation
. This is captured in the expanded documentation for this case, however.Documentation was updated to avoid talking about static/dynamic memories.