Skip to main content

Shared

Struct Shared 

Source
pub struct Shared<'str> {
    pub default_space: SpaceId,
    pub pcode_ops: Registry<PCodeOpId, Box<str>>,
    pub named_spaces: FxHashMap<Box<str>, SpaceId>,
    pub registers: FxHashMap<RegisterId, VarnodeId>,
    pub values: ValueRegistry<'str>,
    pub types: TypeManager,
    /* private fields */
}
Expand description

Module-shared IR state: regimes 1–3 of the context-split design (see docs/plans/context-split/00-overview.md). Holds the frozen architecture (spaces, registers, memory image), the append-interned value arenas (literals, bytes, varnodes, types) inside values, and the phase-mutable module maps (names, truths, discoveries, call sites). Everything here is reachable through a frozen &Shared view; nothing per-function-body lives here.

Fields§

§default_space: SpaceId§pcode_ops: Registry<PCodeOpId, Box<str>>

A mapping of pcode ops to their names

§named_spaces: FxHashMap<Box<str>, SpaceId>

A mapping of names to spaces

§registers: FxHashMap<RegisterId, VarnodeId>

A mapping of register IDs to their corresponding value IDs

§values: ValueRegistry<'str>

The values available in the context, indexed by their ID

§types: TypeManager

Type registry: owns all Type objects and hands out TypeIds.

Implementations§

Source§

impl<'str> Shared<'str>

Source

pub fn get_named(&self, name: &str) -> Option<ValueId>

The value id currently bound to the module-global name, if any. Shared-only mirror of Context::get_named.

Source

pub fn varnode(&self, id: VarnodeId) -> &Varnode<'str>

The varnode id. Shared-only accessor (varnodes live in the interners).

Source

pub fn space(&self, id: SpaceId) -> &Space

The space id. Shared-only accessor (spaces are frozen architecture).

Source

pub fn spaces(&self) -> impl Iterator<Item = Identified<SpaceId, &Space>> + '_

Iterates over every space registered in this module, in id order, each paired with its SpaceId.

Source

pub fn get_const(&self, value: u64, size: usize) -> ValueId

An interned integer constant of the given byte width, as a ValueId. Shared-only mirror of Context::get_const returning the id directly (the LiteralRef wrapper needs a whole &Context).

Source

pub fn get_bool_const(&self, value: bool) -> ValueId

A bool-typed constant (true/false), byte-stored. Shared-only mirror of Context::get_bool_const returning the id directly.

Source

pub fn get_typed_const(&self, value: u64, type_id: TypeId) -> ValueId

A typed constant literal. Shared-only mirror of Context::get_typed_const returning the id directly.

Source

pub fn get_bytes(&self, data: Vec<u8>) -> ValueId

An opaque Array(i8, len) byte-blob constant, as a ValueId. Shared-only mirror of Context::get_bytes returning the id directly.

Source

pub fn bytes_display(&self, id: BytesId) -> BytesDisplay

The forced rendering mode for a Bytes blob, or BytesDisplay::Auto if unset. Shared-only mirror of Context::bytes_display (the override map lives in the interners), for the &Shared-backed BytesRef.

Source

pub fn get_typed_bytes(&self, data: Vec<u8>, type_id: TypeId) -> ValueId

Like get_bytes but with an explicit array/sequence TypeId. Shared-only mirror of Context::get_typed_bytes returning the id directly.

Source

pub fn truth(&self, prop: Proposition) -> Option<Truth>

The recorded Truth of prop, if any. Shared-only mirror of Context::truth (truths live in the phase-mutable shared maps), for &Shared-served pass reads.

Source

pub fn assumed_call_convention(&self) -> Option<&AssumedCallEffect>

The cached AssumedCallEffect for the opt-in AssumeCallingConvention hypothesis, if the assume_calling_convention pass installed one this round. Shared-only accessor so the &Shared-served mem2reg / alias register classifier can consult it. None when the hypothesis is inactive.

Source

pub fn varnodes(&self) -> impl Iterator<Item = VarnodeRef<'str, '_>> + '_

Iterate every varnode as a VarnodeRef. Shared-only mirror of Context::varnodes (varnodes live in the interners).

Source

pub fn varnode_count(&self) -> usize

Number of varnodes. Shared-only mirror of Context::varnode_count; append-only, so an unchanged value means an unchanged varnode set.

Source

pub fn stored_type_of(&self, id: ValueId) -> Option<TypeId>

The stored TypeId of a shared-leaf value (literal, bytes, or varnode-with-override). Shared-only mirror of Context::stored_type_of: instruction/block-param/block/function ids live in function bodies and are out of a &Shared’s reach, so they return None here (callers route those through the body). Matches the actual call pattern, where only shared-leaf ids are passed to the shared path.

Trait Implementations§

Source§

impl<'a, 'str> AsShared<'a, 'str> for &'a Shared<'str>

Source§

fn as_shared(self) -> &'a Shared<'str>

Source§

impl<'str> Clone for Shared<'str>

Source§

fn clone(&self) -> Shared<'str>

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<'str> Default for Shared<'str>

Source§

fn default() -> Shared<'str>

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

impl<'de, 'str> Deserialize<'de> for Shared<'str>

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<'str> Serialize for Shared<'str>

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 SpaceStore for Shared<'_>

Lets Space::from_id resolve against a bare &Shared, matching the pre-existing AsShared call shape.

Source§

fn spaces(&self) -> &Registry<SpaceId, Space>

The space table this store holds.

Auto Trait Implementations§

§

impl<'str> !Freeze for Shared<'str>

§

impl<'str> !UnwindSafe for Shared<'str>

§

impl<'str> RefUnwindSafe for Shared<'str>

§

impl<'str> Send for Shared<'str>

§

impl<'str> Sync for Shared<'str>

§

impl<'str> Unpin for Shared<'str>

§

impl<'str> UnsafeUnpin for Shared<'str>

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