Skip to main content

FrameMarker

Struct FrameMarker 

Source
pub struct FrameMarker(/* private fields */);
Expand description

A 64-bit packed activation record marker that lives in the value stack slot base-1 of any Lua frame (LJ_FR2 model). Carries the frame kind (lower 3 bits) + PC-or-delta payload (upper 61 bits).

Construction goes through FrameMarker::new_lua / FrameMarker::new_cont which encode their args correctly; destruction goes through FrameMarker::kind / FrameMarker::payload.

Internally a u64 so it round-trips through Value::Int(i64) safely without losing bits — luna’s Value::Int is a full i64 (no NaN boxing), so the bit pattern survives the stack store/load cleanly.

Implementations§

Source§

impl FrameMarker

Source

pub fn new_lua(pc: u32) -> Self

Build a FrameKind::Lua marker with the given PC. PC must fit in 61 bits (a u32 always does). Panics in debug mode on overflow; production code is expected to pass a u32.

Source

pub fn new_cont(delta: u32) -> Self

Build a FrameKind::Cont marker with the given frame delta (slots between this frame’s base and the previous frame’s base). Delta must fit in 61 bits.

Source

pub fn kind(self) -> Option<FrameKind>

Read the frame kind (lower 3 bits).

Source

pub fn payload(self) -> u32

Read the PC/delta payload (upper 61 bits, shifted down). For Lua frames this is the bytecode PC; for Cont frames the caller-base delta.

Source

pub fn to_raw(self) -> i64

Raw bits, suitable for storing in a Value::Int(i64) slot. The reverse direction is FrameMarker::from_raw.

Source

pub fn from_raw(raw: i64) -> Self

Reconstruct a FrameMarker from raw bits read out of a value stack slot. The caller is responsible for ensuring the slot actually held a marker (otherwise the kind decode may fail).

Trait Implementations§

Source§

impl Clone for FrameMarker

Source§

fn clone(&self) -> FrameMarker

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

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

Performs copy-assignment from source. Read more
Source§

impl Copy for FrameMarker

Source§

impl Debug for FrameMarker

Source§

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

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

impl Eq for FrameMarker

Source§

impl PartialEq for FrameMarker

Source§

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

Tests for self and other values to be equal, and is used by ==.
1.0.0 (const: unstable) · 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 StructuralPartialEq for FrameMarker

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> 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.