pub struct PacingOffsets { /* private fields */ }Expand description
The pacing predicate’s operands, as displacements: where the Heap hangs off
a RuntimeContext, and where its two pacing words
sit inside it.
§Not a constructor argument, anywhere
Self::new takes nothing and reads all three off Heap’s own
Heap::BYTES_SINCE_COLLECT_OFFSET and Heap::COLLECT_THRESHOLD_OFFSET,
so a site that described a table to probe — or a block to claim — without
carrying the pacing predicate’s operands has no spelling. That is the one
thing InlineInternSite exists to withhold, and skipping the predicate is
the one thing ADR-040’s Safepoint exists to make unwritable.
§One value, because the compare has one authority
Heap::collection_is_due is the one statement of the predicate and
generated code is the one reader that cannot call it: it loads these two
words and compares them. The direction (>=, so that a zero threshold is
always due) and the operand order are therefore transcribed from a rule the
compiler cannot check, and every transcription is a fresh chance to write it
backwards. Both InlineInternSite and InlineClaimSite carry this
value rather than three fields each, so the backend’s emit_pacing_test —
the one place the transcription lives — cannot pair one site’s since with
another’s threshold.
Implementations§
Source§impl PacingOffsets
impl PacingOffsets
Sourcepub const fn heap_offset(self) -> usize
pub const fn heap_offset(self) -> usize
Where the Heap pointer sits in a RuntimeContext. The first load of
the sequence, and the base the two pacing loads are relative to.
Sourcepub const fn bytes_since_collect_offset(self) -> usize
pub const fn bytes_since_collect_offset(self) -> usize
Where Heap::bytes_since_collect sits within a Heap.
The predicate’s left operand — and, for the claim sequence, the word it loads a second time and stores back, once, at the end: the pacing charge, which is not the predicate.
Sourcepub const fn collect_threshold_offset(self) -> usize
pub const fn collect_threshold_offset(self) -> usize
Where Heap::collect_threshold sits within a Heap.
Generated code loads this word and the one above and takes the branch
since >= threshold to its cold path. That is
Heap::collection_is_due transcribed, and that function’s doc is where
the obligation is written down.
Trait Implementations§
Source§impl Clone for PacingOffsets
impl Clone for PacingOffsets
Source§fn clone(&self) -> PacingOffsets
fn clone(&self) -> PacingOffsets
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more