Skip to main content

InlineClaimSite

Struct InlineClaimSite 

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

Everything generated code may bake in to claim and initialize a block inline, and nothing else (ADR-119).

§What it makes unrepresentable

InlineInternSite confines which table the backend may probe. This confines something stronger: which descriptors have a claim sequence at all. InlineClaimSite::of is a const fn returning Option, and it answers None for a descriptor the sequence cannot reproduce the runtime’s bookkeeping for —

  • one that carries an owned_bytes callback, because Heap::occupy charges stride + owned_bytes_of(payload) against the pacing counter and the second term is a call the sequence has no way to make. Every scalar descriptor answers None to it; every Text and Vec answers Some, and those are exactly the descriptors this refuses;
  • one whose block [SizeClass::of] rejects, because a large page is claimed by a linear scan of empty_large keyed on the whole layout, which is not a bitmap claim in any sense.

Both refusals are const, so a praxis-codegen-cranelift arm that named a descriptor with an owned_bytes charge would fail to build rather than silently under-charge the collector — the failure mode ADR-113’s “What was deliberately not done” identified as this path’s whole risk. The one place a site is minted is crate::scalars, beside the descriptors it describes.

§And the half it cannot make unrepresentable

The same half as InlineInternSite’s, and one more. It cannot force the backend to emit the pacing compare, to emit the stores in an order, or to emit all of them — those are claims about an instruction stream, and ADR-119 decision 4 carries all three with tests that read the emitted Cranelift. What this type does is make the numbers one authority’s, so that the tests are checking a shape rather than checking arithmetic.

Implementations§

Source§

impl InlineClaimSite

Source

pub const fn pacing(self) -> PacingOffsets

The pacing predicate’s operands — the three displacements the guard in front of this sequence is emitted from, and the one whose bytes_since_collect the sequence loads a second time and stores back, once, at the end.

The same value InlineInternSite::pacing answers: see Heap::collection_is_due, which is the one statement of the predicate those two words are the operands of, and PacingOffsets, which is the one value the backend transcribes it from.

Source

pub const fn heap_id_offset(self) -> usize

Where the owning HeapId sits within a Heap — the u32 the sequence copies into every header it writes.

Source

pub const fn heap_live_count_offset(self) -> usize

Where Heap::live_count sits. One of the two counters ADR-119 decision 1 part 3 is about: sweep decrements it and never recomputes it, so a claim that skips this bump underflows it on the first collection.

Source

pub const fn partial_head_offset(self) -> usize

Where this descriptor’s size class’s availability-list head sits within a Heap. A null here is the sequence’s first bail-out: growing a class is Heap::grow_class, which allocates a page.

Source

pub const fn page_cursor_offset(self) -> usize

Where PageHeader::cursor sits. The word the scan starts at, and — since the inline sequence scans exactly one word — the word it claims from.

Source

pub const fn page_last_word_offset(self) -> usize

Where PageHeader::last_word sits. The sequence bails when cursor >= last_word, which is both the “past the end” test claim_free_block’s loop condition performs and the tail-word refusal ADR-119 decision 3 measures — one compare doing both.

Source

pub const fn page_allocated_offset(self) -> usize

Where the allocated bitmap begins. Indexed by the cursor word, scaled by eight.

Source

pub const fn page_live_count_offset(self) -> usize

Where PageHeader::live_count sits. The other counter of decision 1 part 3: relink_pages reads it to decide which availability list a page joins, so a skipped bump puts a page holding live blocks on the empty pool, where reclass hands its storage to another layout.

Source

pub const fn header_descriptor_offset(self) -> usize

Where a GcHeader’s descriptor pointer sits. The first store, and the one whose absence is unrecoverable — see ADR-119 decision 1’s severity ranking.

Source

pub const fn header_payload_offset_offset(self) -> usize

Where a GcHeader’s recorded payload displacement sits. A u16.

Source

pub const fn header_heap_id_offset(self) -> usize

Where a GcHeader’s owning-heap id sits. A u32.

Source

pub const fn first_block(self) -> usize

Byte offset of block 0 from a page’s base, for this descriptor’s class.

Folded rather than loaded from PageHeader::first_block, because it is a function of the stride alone and every page on this class’s list has the same one — [PageHeader::first_block_of] is the derivation, stated in the module that owns the geometry.

Source

pub const fn stride(self) -> usize

The byte stride between blocks of this descriptor’s class, which is also exactly what Heap::occupy charges against the pacing counter for one of them — the owned_bytes term being None is what InlineClaimSite::of refused a descriptor for.

Source

pub const fn payload_offset(self) -> usize

Where this descriptor’s payload begins within its block, which is also the value the header records. GcHeader::payload_offset_for’s answer, carried beside the offset it is stored at so the two cannot be paired wrongly.

Trait Implementations§

Source§

impl Clone for InlineClaimSite

Source§

fn clone(&self) -> InlineClaimSite

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 Copy for InlineClaimSite

Source§

impl Debug for InlineClaimSite

Source§

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

Formats the value using the given formatter. 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> 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 = 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.