Skip to main content

CompiledCode

Struct CompiledCode 

Source
pub struct CompiledCode {
    pub buffer: MachBufferFinalized,
    pub vcode: Option<String>,
    pub value_labels_ranges: ValueLabelsRanges,
    pub bb_starts: Vec<CodeOffset>,
    pub bb_edges: Vec<(CodeOffset, CodeOffset)>,
}
Expand description

The result of a MachBackend::compile_function() call. Contains machine code (as bytes) and a disassembly, if requested.

Fields§

§buffer: MachBufferFinalized

Machine code.

§vcode: Option<String>

Disassembly, if requested.

§value_labels_ranges: ValueLabelsRanges

Debug info: value labels to registers/stackslots at code offsets.

§bb_starts: Vec<CodeOffset>

Basic-block layout info: block start offsets.

This info is generated only if the machine_code_cfg_info flag is set.

§bb_edges: Vec<(CodeOffset, CodeOffset)>

Basic-block layout info: block edges. Each edge is (from, to), where from and to are basic-block start offsets of the respective blocks.

This info is generated only if the machine_code_cfg_info flag is set.

Implementations§

Source§

impl CompiledCode

Source

pub fn code_info(&self) -> CodeInfo

Get a CodeInfo describing section sizes from this compilation result.

Source

pub fn code_buffer(&self) -> &[u8]

Returns a reference to the machine code generated for this function compilation.

Source

pub fn disassemble( &self, params: Option<&FunctionParameters>, cs: &Capstone, ) -> Result<String, Error>

Available on crate feature disas only.

Get the disassembly of the buffer, using the given capstone context.

Source

pub fn get_code_bb_layout(&self) -> (Vec<usize>, Vec<(usize, usize)>)

If available, return information about the code layout in the final machine code: the offsets (in bytes) of each basic-block start, and all basic-block edges.

Source

pub fn create_unwind_info( &self, isa: &dyn TargetIsa, ) -> CodegenResult<Option<UnwindInfo>>

Available on crate feature unwind only.

Creates unwind information for the function.

Returns None if the function has no unwind information.

Source

pub fn create_unwind_info_of_kind( &self, isa: &dyn TargetIsa, unwind_info_kind: UnwindInfoKind, ) -> CodegenResult<Option<UnwindInfo>>

Available on crate feature unwind only.

Creates unwind information for the function using the supplied “kind”. Supports cross-OS (but not cross-arch) generation.

Returns None if the function has no unwind information.

Trait Implementations§

Source§

impl Clone for CompiledCode

Source§

fn clone(&self) -> CompiledCode

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 Debug for CompiledCode

Source§

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

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

impl<'de> Deserialize<'de> for CompiledCode

Available on crate feature enable-serde only.
Source§

fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>
where __D: Deserializer<'de>,

Deserialize this value from the given Serde deserializer. Read more
Source§

impl PartialEq for CompiledCode

Source§

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

Equality operator ==. Read more
1.0.0 (const: unstable) · Source§

fn ne(&self, other: &Rhs) -> bool

Inequality operator !=. Read more
Source§

impl Serialize for CompiledCode

Available on crate feature enable-serde only.
Source§

fn serialize<__S>(&self, __serializer: __S) -> Result<__S::Ok, __S::Error>
where __S: Serializer,

Serialize this value into the given Serde serializer. Read more
Source§

impl StructuralPartialEq for CompiledCode

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> DeserializeOwned for T
where T: for<'de> Deserialize<'de>,

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