Struct ExceptionTableData

Source
pub struct ExceptionTableData { /* private fields */ }
Expand description

Contents of an exception table.

The “no exception” target for is stored as the last element of the underlying vector. It can be accessed through the normal_return and normal_return_mut functions. Exceptional catch clauses may be iterated using the catches and catches_mut functions. All targets may be iterated over using the all_targets and all_targets_mut functions.

Implementations§

Source§

impl ExceptionTableData

Source

pub fn new( sig: SigRef, normal_return: BlockCall, tags_and_targets: impl IntoIterator<Item = (Option<ExceptionTag>, BlockCall)>, ) -> Self

Create new exception-table data.

This data represents the destinations upon return from try_call or try_call_indirect instruction. There are two possibilities: “normal return” (no exception thrown), or an exceptional return corresponding to one of the listed exception tags.

The given tags are passed through to the metadata provided alongside the provided function body, and Cranelift itself does not implement an unwinder; thus, the meaning of the tags is ultimately up to the embedder of Cranelift. The tags are wrapped in Option to allow encoding a “catch-all” handler.

The BlockCalls must have signatures that match the targeted blocks, as usual. These calls are allowed to use BlockArg::TryCallRet in the normal-return case, with types corresponding to the signature’s return values, and BlockArg::TryCallExn in the exceptional-return cases, with types corresponding to native machine words and an arity corresponding to the number of payload values that the calling convention and platform support. (See [isa::CallConv] for more details.)

Source

pub fn display<'a>( &'a self, pool: &'a ValueListPool, ) -> DisplayExceptionTable<'a>

Return a value that can display the contents of this exception table.

Source

pub fn normal_return(&self) -> &BlockCall

Get the default target for the non-exceptional return case.

Source

pub fn normal_return_mut(&mut self) -> &mut BlockCall

Get the default target for the non-exceptional return case.

Source

pub fn catches( &self, ) -> impl Iterator<Item = (Option<ExceptionTag>, &BlockCall)> + '_

Get the targets for exceptional return cases, together with their tags.

Source

pub fn catches_mut( &mut self, ) -> impl Iterator<Item = (Option<ExceptionTag>, &mut BlockCall)> + '_

Get the targets for exceptional return cases, together with their tags.

Source

pub fn all_branches(&self) -> &[BlockCall]

Get all branch targets.

Source

pub fn all_branches_mut(&mut self) -> &mut [BlockCall]

Get all branch targets.

Source

pub fn signature(&self) -> SigRef

Get the signature of the function called with this exception table.

Source

pub fn clear(&mut self)

Clears all entries in this exception table, but leaves the function signature.

Trait Implementations§

Source§

impl Clone for ExceptionTableData

Source§

fn clone(&self) -> ExceptionTableData

Returns a copy of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for ExceptionTableData

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl<'de> Deserialize<'de> for ExceptionTableData

Source§

fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>
where __D: Deserializer<'de>,

Deserialize this value from the given Serde deserializer. Read more
Source§

impl Hash for ExceptionTableData

Source§

fn hash<__H: Hasher>(&self, state: &mut __H)

Feeds this value into the given Hasher. Read more
1.3.0 · Source§

fn hash_slice<H>(data: &[Self], state: &mut H)
where H: Hasher, Self: Sized,

Feeds a slice of this type into the given Hasher. Read more
Source§

impl PartialEq for ExceptionTableData

Source§

fn eq(&self, other: &ExceptionTableData) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl Serialize for ExceptionTableData

Source§

fn serialize<__S>(&self, __serializer: __S) -> Result<__S::Ok, __S::Error>
where __S: Serializer,

Serialize this value into the given Serde serializer. Read more
Source§

impl StructuralPartialEq for ExceptionTableData

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<T> DeserializeOwned for T
where T: for<'de> Deserialize<'de>,