Skip to main content

JitProtoState

Enum JitProtoState 

Source
pub enum JitProtoState {
    Untried,
    Failed,
    Compiled {
        entry: *const u8,
        num_args: u8,
        returns_one: bool,
        arg_float_mask: u8,
        arg_table_mask: u8,
        ret_is_float: bool,
        ret_is_table: bool,
    },
}
Expand description

P11-S2 / S2c — per-Proto JIT cache state. Copy so it fits a plain Cell on the dispatch hot path (no RefCell borrow check); the fn pointer’s mmap is kept alive by Vm.jit_handles.

Variants§

§

Untried

Compilation hasn’t been attempted yet.

§

Failed

Compilation was attempted and the body fell outside the whitelist; subsequent calls skip the attempt.

§

Compiled

Native code is installed and callable through the recorded entry.

Fields

§entry: *const u8

Raw mmap’d code address. Transmute to the unsafe extern "C" fn(i64, …) -> i64 shape matching num_args at the call site.

§num_args: u8

0..=MAX_JIT_ARITY. Picks the transmute target.

§returns_one: bool

True when the Lua chunk terminates with Return1 (single observable return value). False means the chunk only side-effects + Return0 — host gets an empty Vec<Value> from Vm::call_value, an interpreter Op::Call gets zero results pushed (PUC nresults handling).

§arg_float_mask: u8

P11-S3 — per-arg Float bit. Bit i = 1 ↔ arg slot i is f64 (passed as i64 bit-pattern across the ABI, bitcast inside the JIT). Bit i = 0 ↔ Int. Bits ≥ MAX_JIT_ARITY are zero.

§arg_table_mask: u8

P11-S5d — per-arg Table bit. Bit i = 1 ↔ arg slot i is Gc<Table> raw ptr (passed as the i64 pointer value directly, since Gc<Table> is NonNull<Table> = pointer-shaped). Mutually exclusive with arg_float_mask for the same bit. Required so try_jit_call_op’s arg marshalling can accept Value::Table(t) and pack t.as_ptr() as i64; without it a Table arg would fall into the dispatcher’s default-deny match arm and the callee couldn’t be reached via JIT.

§ret_is_float: bool

P11-S3 — true iff the chunk’s Return1 value is f64. Dispatcher wraps r as Value::Float(f64::from_bits(r)) vs Value::Int(r) accordingly. Meaningful only when returns_one == true.

§ret_is_table: bool

P11-S5d — true iff the chunk’s Return1 value is a Gc<Table> ptr. Mutually exclusive with ret_is_float. Dispatcher wraps r as Value::Table(Gc::from_ptr(r as *mut Table)).

Trait Implementations§

Source§

impl Clone for JitProtoState

Source§

fn clone(&self) -> JitProtoState

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 JitProtoState

Source§

impl Debug for JitProtoState

Source§

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

Formats the value using the given formatter. Read more

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.