Expand description
Implementation of Wasm to CLIF memory access translation.
Given
- a dynamic Wasm memory index operand,
- a static offset immediate, and
- a static access size,
bounds check the memory access and translate it into a native memory access.
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! !!! !!! !!! THIS CODE IS VERY SUBTLE, HAS MANY SPECIAL CASES, AND IS ALSO !!! !!! ABSOLUTELY CRITICAL FOR MAINTAINING THE SAFETY OF THE WASM HEAP !!! !!! SANDBOX. !!! !!! !!! !!! A good rule of thumb is to get two reviews on any substantive !!! !!! changes in here. !!! !!! !!! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
Enumsยง
- AddrPcc ๐
- Which facts do we want to emit for proof-carrying code, if any, on address computations?
Functionsยง
- bounds_
check_ and_ compute_ addr - Helper used to emit bounds checks (as necessary) and compute the native address of a heap access.
- cast_
index_ ๐to_ pointer_ ty - compute_
addr ๐ - Emit code for the native address computation of a Wasm address, without any bounds checks or overflow checks.
- explicit_
check_ ๐oob_ condition_ and_ compute_ addr - Emit explicit checks on the given out-of-bounds condition for the Wasm address and return the native address.
- get_
dynamic_ ๐heap_ bound - Get the bound of a dynamic heap as an
ir::Value
. - offset_
plus_ ๐size