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
impl ExceptionTableData
Sourcepub fn new(
sig: SigRef,
normal_return: BlockCall,
tags_and_targets: impl IntoIterator<Item = (Option<ExceptionTag>, BlockCall)>,
) -> Self
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.)
Sourcepub fn display<'a>(
&'a self,
pool: &'a ValueListPool,
) -> DisplayExceptionTable<'a>
pub fn display<'a>( &'a self, pool: &'a ValueListPool, ) -> DisplayExceptionTable<'a>
Return a value that can display the contents of this exception table.
Sourcepub fn normal_return(&self) -> &BlockCall
pub fn normal_return(&self) -> &BlockCall
Get the default target for the non-exceptional return case.
Sourcepub fn normal_return_mut(&mut self) -> &mut BlockCall
pub fn normal_return_mut(&mut self) -> &mut BlockCall
Get the default target for the non-exceptional return case.
Sourcepub fn catches(
&self,
) -> impl Iterator<Item = (Option<ExceptionTag>, &BlockCall)> + '_
pub fn catches( &self, ) -> impl Iterator<Item = (Option<ExceptionTag>, &BlockCall)> + '_
Get the targets for exceptional return cases, together with their tags.
Sourcepub fn catches_mut(
&mut self,
) -> impl Iterator<Item = (Option<ExceptionTag>, &mut BlockCall)> + '_
pub fn catches_mut( &mut self, ) -> impl Iterator<Item = (Option<ExceptionTag>, &mut BlockCall)> + '_
Get the targets for exceptional return cases, together with their tags.
Sourcepub fn all_branches(&self) -> &[BlockCall]
pub fn all_branches(&self) -> &[BlockCall]
Get all branch targets.
Sourcepub fn all_branches_mut(&mut self) -> &mut [BlockCall]
pub fn all_branches_mut(&mut self) -> &mut [BlockCall]
Get all branch targets.
Trait Implementations§
Source§impl Clone for ExceptionTableData
impl Clone for ExceptionTableData
Source§fn clone(&self) -> ExceptionTableData
fn clone(&self) -> ExceptionTableData
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read more