Skip to main content

AddressIndex

Struct AddressIndex 

Source
pub struct AddressIndex { /* private fields */ }
Expand description

An immutable, disposable address-to-entity snapshot.

Implementations§

Source§

impl AddressIndex

Source

pub fn analyze(ctx: &Context<'_>) -> Self

Computes an index for the current live shape of ctx.

Primary and extra block addresses are indexed. Functions are installed last so a function wins the intentional collision with its entry block.

Source

pub fn refresh(&mut self, ctx: &Context<'_>)

Recomputes this index after a structural mutation that changes several addresses at once (for example function splitting or block rehoming).

Source

pub fn rehome_block(&mut self, addr: u64, old: BlockId, new: BlockId)

Re-point addr from a relocated block old to its clone new, in place.

The incremental analogue of a refresh after a block rehome: the caller already knows exactly which address moved and where, so there is no need to re-scan the whole module. A no-op unless addr is currently indexed to old — this preserves analyze’s function-over-block precedence (a function entry that deliberately shadows its root block, or another block that already owns the address, is left untouched).

Source

pub fn forget(&mut self, address: u64)

Drops address from the index, so it resolves to nothing until it is registered again. Used when a block stops covering an address.

Source

pub fn set_block(&mut self, address: u64, block: BlockId)

Points address at block, whatever it pointed at before.

For a caller that has just made block cover an address another block used to — absorbing that block, typically, which leaves the index naming something deleted.

Source

pub fn mark_boundary(&mut self, address: u64)

Records that address starts a block, and must keep starting one.

Source

pub fn is_boundary(&self, address: u64) -> bool

Whether address is known to start a block.

Source

pub fn register( &mut self, ctx: &mut Context<'_>, address: u64, target: AddressTarget, ) -> Result<()>

Registers one address-bearing entity during module construction.

A function and one of its own blocks may intentionally share an entry address; the function remains the indexed target and the block becomes its root. Every other collision is rejected.

Source

pub fn get(&self, address: u64) -> Option<AddressTarget>

Returns the live target registered at address in this snapshot.

Source

pub fn function_at(&self, address: u64) -> Option<FunctionId>

Returns the function registered at address, if that is the target kind.

Source

pub fn block_at(&self, address: u64) -> Option<BlockId>

Returns the block registered at address, if that is the target kind.

Source

pub fn len(&self) -> usize

Returns the number of distinct indexed addresses.

Source

pub fn is_empty(&self) -> bool

Returns whether the snapshot contains no addresses.

Trait Implementations§

Source§

impl Clone for AddressIndex

Source§

fn clone(&self) -> AddressIndex

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 AddressIndex

Source§

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

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

impl Default for AddressIndex

Source§

fn default() -> AddressIndex

Returns the “default value” for a type. Read more
Source§

impl Eq for AddressIndex

Source§

impl PartialEq for AddressIndex

Source§

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

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

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

Inequality operator !=. Read more
Source§

impl StructuralPartialEq for AddressIndex

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 = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

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.