Skip to main content

LinkedProgram

Struct LinkedProgram 

Source
pub struct LinkedProgram<'a> { /* private fields */ }
Expand description

A validated, borrow-checked view of a linked AOT image. The bytecode is carried opaquely (native code never decodes it); reconstruction/verification is the runtime’s job.

Implementations§

Source§

impl<'a> LinkedProgram<'a>

Source

pub unsafe fn from_descriptor( descriptor: &'a ProgramDescriptor, ) -> Result<LinkedProgram<'a>, AbiError>

Validates a program descriptor into a borrowed linked view.

Checks magic, ABI version, zeroed flags, non-null and non-empty bytecode and unit tables, overflow-safe slice extents, unit identities sorted and unique by (module_id, function_id), and that the tuple entry is present. Layout is only defined on 64-bit targets; other widths yield AbiError::UnsupportedPointerWidth.

§Safety

descriptor’s bytecode/units pointers must address bytecode_len bytes / unit_count UnitDescriptors that remain valid and immutable for 'a. The generated bamts_program_descriptor satisfies this for 'static; a caller validating a synthetic descriptor guarantees it.

Source

pub fn bytecode(&self) -> &'a [u8]

The embedded canonical [bamts_bytecode::Program::encode] bytes (opaque to native code).

Source

pub fn units(&self) -> &'a [UnitDescriptor]

The validated unit table.

Source

pub fn entry_module(&self) -> u32

The entry module id.

Source

pub fn entry_function(&self) -> u32

The entry function id.

Source

pub fn unit( &self, module_id: u32, function_id: u32, ) -> Option<&'a UnitDescriptor>

The unit for (module_id, function_id), if present.

Trait Implementations§

Source§

impl NativeEntryTable for LinkedProgram<'_>

Source§

fn program_bytes(&self) -> &[u8]

The exact canonical [bamts_bytecode::Program::encode] bytes compiled into these entries. Read more
Source§

fn invoke( &self, module_id: u32, function_id: u32, frame: &mut ShadowFrame, out: &mut Completion, ) -> Result<CompletionTag, AbiError>

Invokes the entry for (module_id, function_id), returning its completion tag.

Auto Trait Implementations§

§

impl<'a> Freeze for LinkedProgram<'a>

§

impl<'a> RefUnwindSafe for LinkedProgram<'a>

§

impl<'a> Send for LinkedProgram<'a>

§

impl<'a> Sync for LinkedProgram<'a>

§

impl<'a> Unpin for LinkedProgram<'a>

§

impl<'a> UnsafeUnpin for LinkedProgram<'a>

§

impl<'a> UnwindSafe for LinkedProgram<'a>

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