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_bytescallback, becauseHeap::occupychargesstride + 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 answersNoneto it; everyTextandVecanswersSome, and those are exactly the descriptors this refuses; - one whose block [
SizeClass::of] rejects, because a large page is claimed by a linear scan ofempty_largekeyed 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
impl InlineClaimSite
Sourcepub const fn pacing(self) -> PacingOffsets
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.
Sourcepub const fn heap_id_offset(self) -> usize
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.
Sourcepub const fn heap_live_count_offset(self) -> usize
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.
Sourcepub const fn partial_head_offset(self) -> usize
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.
Sourcepub const fn page_cursor_offset(self) -> usize
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.
Sourcepub const fn page_last_word_offset(self) -> usize
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.
Sourcepub const fn page_allocated_offset(self) -> usize
pub const fn page_allocated_offset(self) -> usize
Where the allocated bitmap begins. Indexed by the cursor word, scaled
by eight.
Sourcepub const fn page_live_count_offset(self) -> usize
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.
Sourcepub const fn header_descriptor_offset(self) -> usize
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.
Sourcepub const fn header_payload_offset_offset(self) -> usize
pub const fn header_payload_offset_offset(self) -> usize
Where a GcHeader’s recorded payload displacement sits. A u16.
Sourcepub const fn header_heap_id_offset(self) -> usize
pub const fn header_heap_id_offset(self) -> usize
Where a GcHeader’s owning-heap id sits. A u32.
Sourcepub const fn first_block(self) -> usize
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.
Sourcepub const fn stride(self) -> usize
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.
Sourcepub const fn payload_offset(self) -> usize
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
impl Clone for InlineClaimSite
Source§fn clone(&self) -> InlineClaimSite
fn clone(&self) -> InlineClaimSite
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more