pub struct ControlStackFrame {
pub ty: ControlStackFrameType,
pub original_pc_offset: u16,
result: BlockType,
pub original_sp: u16,
pub might_return_early: bool,
}
Expand description
Holds the necessary metadata to support the smission of control flow instructions.
NOTE: The output of control flow should be placed on the stack, so we don’t need to store the result type.
Fields§
§ty: ControlStackFrameType
The type of the control stack frame.
If loop, break it while popping.
original_pc_offset: u16
The program counter offset at the beginning of if.
result: BlockType
The return values of the block.
Could be useful for validation.
original_sp: u16
Original stack pointer.
might_return_early: bool
Flag to mark frames that might contain early returns
Implementations§
Source§impl ControlStackFrame
impl ControlStackFrame
Sourcepub fn new(
ty: ControlStackFrameType,
original_pc_offset: u16,
original_sp: u16,
result: BlockType,
) -> Self
pub fn new( ty: ControlStackFrameType, original_pc_offset: u16, original_sp: u16, result: BlockType, ) -> Self
Create a new control stack frame.
Sourcepub fn set_might_return_early(&mut self, value: bool)
pub fn set_might_return_early(&mut self, value: bool)
Set the flag indicating this frame might contain early returns
Sourcepub fn is_function_boundary(&self) -> bool
pub fn is_function_boundary(&self) -> bool
Check if this frame is at a function boundary
Trait Implementations§
Source§impl Clone for ControlStackFrame
impl Clone for ControlStackFrame
Source§fn clone(&self) -> ControlStackFrame
fn clone(&self) -> ControlStackFrame
Returns a copy of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source
. Read moreAuto Trait Implementations§
impl Freeze for ControlStackFrame
impl RefUnwindSafe for ControlStackFrame
impl Send for ControlStackFrame
impl Sync for ControlStackFrame
impl Unpin for ControlStackFrame
impl UnwindSafe for ControlStackFrame
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