Skip to main content

TypeRepr

Enum TypeRepr 

Source
pub enum TypeRepr {
    Int {
        size: usize,
    },
    Bool,
    SpaceAddress {
        size: usize,
        space: MemorySpaceId,
    },
    Aggregate {
        fields: Vec<AggregateField>,
    },
    Struct {
        name: String,
        size: usize,
        fields: Vec<AggregateField>,
    },
    StructPointer {
        size: usize,
        pointee: TypeId,
    },
    Array {
        elem: TypeId,
        count: usize,
    },
    List {
        elem: TypeId,
        bound: Option<usize>,
    },
    FunctionReturn {
        owner: FunctionId,
        fields: Vec<AggregateField>,
    },
    CodePointer {
        size: usize,
    },
}
Expand description

Serializable description of a concrete Type.

There are only three concrete types, each fully described by a byte width and (for pointers) the memory space it points into. TypeManager serializes its type table as a Vec<TypeRepr> and replays the get_or_make_* constructors on load, which reproduces both the interned TypeId indices and the lookup maps exactly.

Variants§

§

Int

Fields

§size: usize
§

Bool

A byte-stored boolean whose value domain is {0, 1}. Minted only by comparisons and the true/false literals; size() is always 1.

§

SpaceAddress

Fields

§size: usize
§

Aggregate

A fixed, ordered group of named field types — the functional-IR representation of a tuple. Used by argpromote to return (real_return, write-set). Abstract: it has no physical return-register ABI.

Fields

§

Struct

A named, nominal struct with explicit per-field byte offsets — the pointee of a StructPointer. Identity is the name, not the field list, so two structs with coincident layouts stay distinct. Sparse: only the fields of interest are listed; size is the real struct size and need not equal the fields’ extent.

Fields

§name: String
§size: usize
§

StructPointer

A pointer to a nominal Struct (or any other type), of the given byte width. pointee is the TypeId it points at.

Fields

§size: usize
§pointee: TypeId
§

Array

A fixed-length homogeneous array of count elements of type elem, laid out contiguously. Its byte width is count * sizeof(elem).

Deliberately disguised as a width-N scalar: it answers Type::size like any integer and does not expose Type::fields, so structural passes (mem2reg, alias, DCE, GVN value-numbering) handle it unchanged. Only element-aware sites (argpromote, the Extract/Range over Map rewrite, emulation) consult Type::array. Lane projection is defined as a contiguous bit-slice: Extract(arr, k) ≡ Range(arr, k*sizeof(elem), sizeof(elem)).

Fields

§elem: TypeId
§count: usize
§

List

A variable-length homogeneous sequence of elem — the result of take_while. bound is the static storage upper bound in elements (Some(n) for a take_while over a fixed [T; n] array), or None when the source is an unbounded pointer (a char* string of unknown length). Like Array a bounded list is disguised as a width-N scalar (its size is the bound footprint); an unbounded list has no materialized footprint (size 0) — it is a handle consumed only by len/map, never stored. Only Type::list tells either apart from a fixed array; the runtime length is the position of the first failing element.

Fields

§elem: TypeId
§bound: Option<usize>
§

FunctionReturn

A function-owned return record. Unlike structural Aggregate values, identity belongs to owner: two functions with identical fields still have distinct types, and the owner may revise the fields later while preserving the same TypeId. Kept last to preserve the existing bincode discriminants of previously persisted type variants.

Fields

§

CodePointer

A pointer to code — a function/callable address, of the given byte width. Minted by the infer_code_pointers pass for a value used as the target of an indirect call. Deliberately structureless (no signature yet): it marks “this scalar is a code address,” enough to drive call-target typing and (future) resolution/exploration. Kept last to preserve the bincode discriminants of previously persisted variants.

Fields

§size: usize

Trait Implementations§

Source§

impl Clone for TypeRepr

Source§

fn clone(&self) -> TypeRepr

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<'de> Deserialize<'de> for TypeRepr

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 Serialize for TypeRepr

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

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