Struct rustc_mir_transform::coverage::counters::MakeBcbCounters
source · struct MakeBcbCounters<'a> {
coverage_counters: &'a mut CoverageCounters,
basic_coverage_blocks: &'a CoverageGraph,
}Expand description
Traverse the CoverageGraph and add either a Counter or Expression to every BCB, to be
injected with coverage spans. Expressions have no runtime overhead, so if a viable expression
(adding or subtracting two other counters or expressions) can compute the same result as an
embedded counter, an Expression should be used.
Fields§
§coverage_counters: &'a mut CoverageCounters§basic_coverage_blocks: &'a CoverageGraphImplementations§
source§impl<'a> MakeBcbCounters<'a>
impl<'a> MakeBcbCounters<'a>
fn new( coverage_counters: &'a mut CoverageCounters, basic_coverage_blocks: &'a CoverageGraph, ) -> Self
sourcefn make_bcb_counters(
&mut self,
bcb_has_coverage_spans: impl Fn(BasicCoverageBlock) -> bool,
)
fn make_bcb_counters( &mut self, bcb_has_coverage_spans: impl Fn(BasicCoverageBlock) -> bool, )
If two BasicCoverageBlocks branch from another BasicCoverageBlock, one of the branches
can be counted by Expression by subtracting the other branch from the branching
block. Otherwise, the BasicCoverageBlock executed the least should have the Counter.
One way to predict which branch executes the least is by considering loops. A loop is exited
at a branch, so the branch that jumps to a BasicCoverageBlock outside the loop is almost
always executed less than the branch that does not exit the loop.
fn make_node_and_branch_counters( &mut self, traversal: &TraverseCoverageGraphWithLoops<'_>, from_bcb: BasicCoverageBlock, )
fn get_or_make_counter_operand(&mut self, bcb: BasicCoverageBlock) -> BcbCounter
fn get_or_make_edge_counter_operand( &mut self, from_bcb: BasicCoverageBlock, to_bcb: BasicCoverageBlock, ) -> BcbCounter
sourcefn choose_preferred_expression_branch(
&self,
traversal: &TraverseCoverageGraphWithLoops<'_>,
from_bcb: BasicCoverageBlock,
) -> BasicCoverageBlock
fn choose_preferred_expression_branch( &self, traversal: &TraverseCoverageGraphWithLoops<'_>, from_bcb: BasicCoverageBlock, ) -> BasicCoverageBlock
Select a branch for the expression, either the recommended reloop_branch, or if none was
found, select any branch.
sourcefn find_good_reloop_branch(
&self,
traversal: &TraverseCoverageGraphWithLoops<'_>,
from_bcb: BasicCoverageBlock,
) -> Option<BasicCoverageBlock>
fn find_good_reloop_branch( &self, traversal: &TraverseCoverageGraphWithLoops<'_>, from_bcb: BasicCoverageBlock, ) -> Option<BasicCoverageBlock>
Tries to find a branch that leads back to the top of a loop, and that doesn’t already have a counter. Such branches are good candidates to be given an expression (instead of a physical counter), because they will tend to be executed more times than a loop-exit branch.
fn bcb_predecessors(&self, bcb: BasicCoverageBlock) -> &[BasicCoverageBlock]
fn bcb_successors(&self, bcb: BasicCoverageBlock) -> &[BasicCoverageBlock]
fn branch_has_no_counter( &self, from_bcb: BasicCoverageBlock, to_bcb: BasicCoverageBlock, ) -> bool
fn branch_counter( &self, from_bcb: BasicCoverageBlock, to_bcb: BasicCoverageBlock, ) -> Option<&BcbCounter>
Auto Trait Implementations§
impl<'a> DynSend for MakeBcbCounters<'a>
impl<'a> DynSync for MakeBcbCounters<'a>
impl<'a> Freeze for MakeBcbCounters<'a>
impl<'a> RefUnwindSafe for MakeBcbCounters<'a>
impl<'a> Send for MakeBcbCounters<'a>
impl<'a> Sync for MakeBcbCounters<'a>
impl<'a> Unpin for MakeBcbCounters<'a>
impl<'a> !UnwindSafe for MakeBcbCounters<'a>
Blanket Implementations§
source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
source§impl<T, R> CollectAndApply<T, R> for T
impl<T, R> CollectAndApply<T, R> for T
source§impl<T> Filterable for T
impl<T> Filterable for T
source§fn filterable(
self,
filter_name: &'static str,
) -> RequestFilterDataProvider<T, fn(_: DataRequest<'_>) -> bool>
fn filterable( self, filter_name: &'static str, ) -> RequestFilterDataProvider<T, fn(_: DataRequest<'_>) -> bool>
source§impl<T> Instrument for T
impl<T> Instrument for T
source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
source§impl<T> IntoEither for T
impl<T> IntoEither for T
source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moresource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moresource§impl<P> IntoQueryParam<P> for P
impl<P> IntoQueryParam<P> for P
fn into_query_param(self) -> P
source§impl<T> MaybeResult<T> for T
impl<T> MaybeResult<T> for T
source§impl<T> Pointable for T
impl<T> Pointable for T
source§impl<I, T, U> Upcast<I, U> for Twhere
U: UpcastFrom<I, T>,
impl<I, T, U> Upcast<I, U> for Twhere
U: UpcastFrom<I, T>,
source§impl<I, T> UpcastFrom<I, T> for T
impl<I, T> UpcastFrom<I, T> for T
fn upcast_from(from: T, _tcx: I) -> T
source§impl<Tcx, T> Value<Tcx> for Twhere
Tcx: DepContext,
impl<Tcx, T> Value<Tcx> for Twhere
Tcx: DepContext,
default fn from_cycle_error( tcx: Tcx, cycle_error: &CycleError, _guar: ErrorGuaranteed, ) -> T
source§impl<T> WithSubscriber for T
impl<T> WithSubscriber for T
source§fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
source§fn with_current_subscriber(self) -> WithDispatch<Self>
fn with_current_subscriber(self) -> WithDispatch<Self>
impl<'a, T> Captures<'a> for Twhere
T: ?Sized,
impl<'a, T> Captures<'a> for Twhere
T: ?Sized,
impl<T> ErasedDestructor for Twhere
T: 'static,
impl<T> MaybeSendSync for T
Layout§
Note: Most layout information is completely unstable and may even differ between compilations. The only exception is types with certain repr(...) attributes. Please see the Rust Reference's “Type Layout” chapter for details on type layout guarantees.
Size: 16 bytes