Skip to main content

VtableSlot

Enum VtableSlot 

Source
#[repr(u32)]
pub enum VtableSlot { RelonStrContains = 0, RelonCallNative = 1, RelonF64ToStr = 2, }
Expand description

One slot per host helper the LLVM codegen indirects through, in the same order cranelift pins them in its data-vtable. Adding a new helper appends a variant (NEVER reorder existing variants).

Slotcranelift analogueLLVM symbol
0RelonGlobMatch (slot 3)relon_llvm_str_contains_arena
1RelonCallNative (slot 4)relon_llvm_call_native
2RelonF64ToStr (slot 5)relon_llvm_f64_to_str

cranelift’s slots 0..=2 (RelonNow / RelonRaiseTrap / RelonCapLookup) have no LLVM counterpart: the LLVM gate is an inline caps-bitmask test baked into the object by Op::CheckCap (no cap_lookup helper), trap codes are written directly to ArenaState::trap_code by the helper / trap arm (no raise_trap helper), and the deadline clock (now) is reserved for the LLVM deadline work. Only the two helpers the LLVM emitter actually declares as externs are represented here.

Variants§

§

RelonStrContains = 0

extern "C" fn(s_ptr: *const u8, n_ptr: *const u8) -> i32. Tier-2 substring matcher; the LLVM mirror of cranelift’s RelonGlobMatch. Declared lazily on the first Op::Call { contains } site.

§

RelonCallNative = 1

extern "C" fn(state: *const ArenaState, import_idx: u32, args_ptr: *const i64, arg_count: u32) -> i64. Dynamic host-fn dispatch; the LLVM mirror of cranelift’s RelonCallNative. See [crate::state::relon_llvm_call_native].

§

RelonF64ToStr = 2

extern "C" fn(bits: i64, dest: *mut u8) -> i32. Wave B float Display renderer; the LLVM mirror of cranelift’s RelonF64ToStr. Declared lazily on the first Op::FloatToStr site. See crate::str_helpers::relon_llvm_f64_to_str.

Implementations§

Source§

impl VtableSlot

Source

pub const COUNT: u32 = 3

Number of slots the LLVM emitter can declare. Mirrors cranelift’s VtableSlot::COUNT; bumping it needs a matching variant + a populate_global_mappings arm.

Source

pub const ALL: [VtableSlot; 3]

All slots, in declaration order. Used by populate_global_mappings and the parity tests.

Source

pub fn symbol(self) -> &'static str

Stable symbol name the emitted LLVM module declares this helper under. The host binds it via add_global_mapping (JIT) or the linker resolves it against relon-rs-shims (native object).

Source

pub fn host_addr(self) -> usize

Host-side address of the helper backing this slot, as a usize suitable for ExecutionEngine::add_global_mapping. The cranelift analogue is the *const u8 fn pointer populate_vtable writes into the data slot.

Trait Implementations§

Source§

impl Clone for VtableSlot

Source§

fn clone(&self) -> VtableSlot

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 VtableSlot

Source§

impl Debug for VtableSlot

Source§

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

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

impl Eq for VtableSlot

Source§

impl PartialEq for VtableSlot

Source§

fn eq(&self, other: &VtableSlot) -> 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 VtableSlot

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<Q, K> Equivalent<K> for Q
where Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,

Source§

fn equivalent(&self, key: &K) -> bool

Checks if this value is equivalent to the given key. 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> IntoEither for T

Source§

fn into_either(self, into_left: bool) -> Either<Self, Self>

Converts self into a Left variant of Either<Self, Self> if into_left is true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

Converts self into a Left variant of Either<Self, Self> if into_left(&self) returns true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Source§

impl<T> Pointable for T

Source§

const ALIGN: usize

The alignment of pointer.
Source§

type Init = T

The type for initializers.
Source§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
Source§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
Source§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
Source§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
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.