pub struct NativeFrame<'a> { /* private fields */ }Expand description
A validated safe view of a ShadowFrame and its register (handle)
array. Constructed only inside the bamts_* wrappers, which reject a null,
misaligned, or malformed frame before dispatching.
Implementations§
Source§impl<'a> NativeFrame<'a>
impl<'a> NativeFrame<'a>
Sourcepub fn new(
frame: &'a mut ShadowFrame,
handles: &'a mut [Value],
) -> Option<NativeFrame<'a>>
pub fn new( frame: &'a mut ShadowFrame, handles: &'a mut [Value], ) -> Option<NativeFrame<'a>>
Builds a safe view from an already-borrowed frame and register slice.
Returns None unless the frame’s handle_len and handles metadata
describe exactly handles. This lets runtime-owned execution paths use
the same checked view without raw pointers or unsafe code.
Sourcepub unsafe fn from_raw(frame: *mut ShadowFrame) -> Option<NativeFrame<'a>>
pub unsafe fn from_raw(frame: *mut ShadowFrame) -> Option<NativeFrame<'a>>
Validates a raw frame pointer into a safe view.
§Safety
frame, when non-null, must point to a live, unaliased ShadowFrame
whose handles field addresses exactly handle_len initialized
Values (or is unused when handle_len == 0). Generated native code
upholds this: it owns the frame for the synchronous duration of the
helper call, and the register array is a distinct allocation from the
32-byte header. Returns None for a null or misaligned pointer.
Sourcepub fn handle_len(&self) -> u32
pub fn handle_len(&self) -> u32
The number of live registers (ShadowFrame::handle_len).
Sourcepub fn set_resume(&mut self, token: u32)
pub fn set_resume(&mut self, token: u32)
Stores a resume token into the frame (yield path).
Sourcepub fn registers_mut(&mut self) -> &mut [Value]
pub fn registers_mut(&mut self) -> &mut [Value]
The register array, mutably.
Sourcepub fn register(&self, index: u32) -> Value
pub fn register(&self, index: u32) -> Value
Register index. Panics if out of range; the wrapper turns the panic
into a CompletionTag::FatalTrap. Use NativeFrame::try_register to
branch instead.
Sourcepub fn set_register(&mut self, index: u32, value: Value)
pub fn set_register(&mut self, index: u32, value: Value)
Sets register index. Panics if out of range (see NativeFrame::register).
Sourcepub fn try_register(&self, index: u32) -> Option<Value>
pub fn try_register(&self, index: u32) -> Option<Value>
Register index, or None when out of range.
Sourcepub fn try_set_register(&mut self, index: u32, value: Value) -> bool
pub fn try_set_register(&mut self, index: u32, value: Value) -> bool
Sets register index, returning false when out of range.
Sourcepub fn previous(&self) -> *mut ShadowFrame
pub fn previous(&self) -> *mut ShadowFrame
The caller’s frame, or null at the base of the stack.