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>
impl<'a> LinkedProgram<'a>
Sourcepub unsafe fn from_descriptor(
descriptor: &'a ProgramDescriptor,
) -> Result<LinkedProgram<'a>, AbiError>
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.
Sourcepub fn bytecode(&self) -> &'a [u8] ⓘ
pub fn bytecode(&self) -> &'a [u8] ⓘ
The embedded canonical [bamts_bytecode::Program::encode] bytes (opaque to native code).
Sourcepub fn units(&self) -> &'a [UnitDescriptor]
pub fn units(&self) -> &'a [UnitDescriptor]
The validated unit table.
Sourcepub fn entry_module(&self) -> u32
pub fn entry_module(&self) -> u32
The entry module id.
Sourcepub fn entry_function(&self) -> u32
pub fn entry_function(&self) -> u32
The entry function id.
Trait Implementations§
Source§impl NativeEntryTable for LinkedProgram<'_>
impl NativeEntryTable for LinkedProgram<'_>
Source§fn program_bytes(&self) -> &[u8] ⓘ
fn program_bytes(&self) -> &[u8] ⓘ
bamts_bytecode::Program::encode] bytes compiled into these entries. Read moreSource§fn invoke(
&self,
module_id: u32,
function_id: u32,
frame: &mut ShadowFrame,
out: &mut Completion,
) -> Result<CompletionTag, AbiError>
fn invoke( &self, module_id: u32, function_id: u32, frame: &mut ShadowFrame, out: &mut Completion, ) -> Result<CompletionTag, AbiError>
(module_id, function_id), returning its completion tag.