pub struct AddressIndex { /* private fields */ }Expand description
An immutable, disposable address-to-entity snapshot.
Implementations§
Source§impl AddressIndex
impl AddressIndex
Sourcepub fn analyze(ctx: &Context<'_>) -> Self
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.
Sourcepub fn refresh(&mut self, ctx: &Context<'_>)
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).
Sourcepub fn rehome_block(&mut self, addr: u64, old: BlockId, new: BlockId)
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).
Sourcepub fn forget(&mut self, address: u64)
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.
Sourcepub fn set_block(&mut self, address: u64, block: BlockId)
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.
Sourcepub fn mark_boundary(&mut self, address: u64)
pub fn mark_boundary(&mut self, address: u64)
Records that address starts a block, and must keep starting one.
Sourcepub fn is_boundary(&self, address: u64) -> bool
pub fn is_boundary(&self, address: u64) -> bool
Whether address is known to start a block.
Sourcepub fn register(
&mut self,
ctx: &mut Context<'_>,
address: u64,
target: AddressTarget,
) -> Result<()>
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.
Sourcepub fn get(&self, address: u64) -> Option<AddressTarget>
pub fn get(&self, address: u64) -> Option<AddressTarget>
Returns the live target registered at address in this snapshot.
Sourcepub fn function_at(&self, address: u64) -> Option<FunctionId>
pub fn function_at(&self, address: u64) -> Option<FunctionId>
Returns the function registered at address, if that is the target kind.
Trait Implementations§
Source§impl Clone for AddressIndex
impl Clone for AddressIndex
Source§fn clone(&self) -> AddressIndex
fn clone(&self) -> AddressIndex
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more