pub struct CallIndirectGuards {
pub table_size: Option<u32>,
pub type_reject: Vec<Option<String>>,
}Expand description
#642: everything the call_indirect lowering needs to emit its guards —
computed once per module by DecodedModule::call_indirect_guards and
threaded to the instruction selector via CompileConfig.
WASM Core §4.4.8 requires call_indirect to trap when index >= table.size and when the callee’s type does not match the instruction’s
expected type. synth’s table is a raw array of 4-byte code pointers
(linked at R11 by the runtime/harness) with no size field and no type
ids, so:
- the BOUNDS check is emitted at runtime against the compile-time
table_sizeimmediate (sound: the table cannot change size —table.grow/table.setare unsupported ops whose functions loud-skip at decode), and - the TYPE check is discharged at COMPILE time: for expected type
t,type_reject[t]isNoneonly when every slot of the table is verifiably initialized with a function whose signature structurally equals typet(the closed-world property — no runtime mismatch is then possible). Otherwise it holds the reason, and the lowering declines LOUDLY rather than emit an unchecked indirect branch.
Fields§
§table_size: Option<u32>Compile-time size of table 0 (entries); None = no sound bound known.
type_reject: Vec<Option<String>>Per type index: None = closed-world type property VERIFIED for this
expected type; Some(reason) = not verifiable (the lowering declines).
Trait Implementations§
Source§impl Clone for CallIndirectGuards
impl Clone for CallIndirectGuards
Source§fn clone(&self) -> CallIndirectGuards
fn clone(&self) -> CallIndirectGuards
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for CallIndirectGuards
impl Debug for CallIndirectGuards
Source§impl Default for CallIndirectGuards
impl Default for CallIndirectGuards
Source§fn default() -> CallIndirectGuards
fn default() -> CallIndirectGuards
Returns the “default value” for a type. Read more
impl Eq for CallIndirectGuards
Source§impl PartialEq for CallIndirectGuards
impl PartialEq for CallIndirectGuards
Source§fn eq(&self, other: &CallIndirectGuards) -> bool
fn eq(&self, other: &CallIndirectGuards) -> bool
Tests for
self and other values to be equal, and is used by ==.impl StructuralPartialEq for CallIndirectGuards
Auto Trait Implementations§
impl Freeze for CallIndirectGuards
impl RefUnwindSafe for CallIndirectGuards
impl Send for CallIndirectGuards
impl Sync for CallIndirectGuards
impl Unpin for CallIndirectGuards
impl UnsafeUnpin for CallIndirectGuards
impl UnwindSafe for CallIndirectGuards
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Compare self to
key and return true if they are equal.