Repository navigation
[Core] Add a selector with explicit coverage updates - #526
Open
CaelmBleidd wants to merge 8 commits into
Open
CaelmBleidd wants to merge 8 commits into
CaelmBleidd wants to merge 8 commits into
Conversation
Reuse closest-to-uncovered and weighted selectors with revisioned goals supplied by callers. Refresh pending priorities after coverage changes while retaining queued states and existing reporting semantics.
Restore existing statistics and selector APIs. Keep goal updates and lazy priority refresh inside CoverageGuidedPathSelector, and remove the unsolicited README.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Coverage changes can invalidate every queued state's priority. Refreshing the whole queue on every changed-coverage peek repeatedly drains and reinserts all states and recalculates their distances.
Add CoverageGuidedPathSelector with explicit markCovered/addTargets updates and snapshot-based priority refreshes. The configurable interval defaults to 128 completed selections. Updating or removing the selected state completes a selection; repeated peek calls do not advance the interval. New and updated states use the same snapshot. Goal sets and snapshots use HashSet because their order is irrelevant. Unknown/repeated reports do not trigger work, covered goals stay covered, and saturation retains states while avoiding distance calculations. Stopped-work draining bypasses refresh.
Add DeterministicPriorityCollection.updatePriorities to evaluate each queued element once, including the cached selection, then heapify in O(N). It replaces drain/toList/add and preserves the old queue if priority evaluation fails. The PR includes the cached-ordering prerequisite from #538 as a separate commit. WeightedPathSelector, CoverageStatistics and PathSelectorFactory remain unchanged.
Manual JVM measurements now cover Commons Codec BinaryCodec, Guava IntMath.gcd and LoanExam: 28 retained runs, 2,422,205 interpreter steps, queues up to 4,921 states. The periodic selector still spends substantial time scanning every snapshot goal on ordinary state updates:
Increasing the interval to 512 did not remove the per-update target-scan cost. These local runs do not demonstrate a stable whole-analysis speedup: exploration order and solver work differ, and only 1-26 coverage-guided refresh peeks occurred per run. Dynamic goal discovery is unmeasured. The next API improvement would allow a caller-supplied batched minimum-distance calculation over a snapshot with domain-specific caching; that proposal is not implemented here.
Uniform random and the production RANDOM_PATH selector were also measured with selector RNG seeds 0 and 1:
These two seeds support using cheap uniform random as a baseline; they do not prove universal dominance. Different path order also changes work outside the selector, which has not been separately profiled. Covered-goal counts do not establish equality of covered-goal sets or concrete replay coverage. Production selection defaults have not been changed by the benchmark.
Full methodology, raw data and reproduction runner.
Validation on Zulu JDK 11.0.32.1:
Tests cover the 128-selection boundary, repeated peeks, shared snapshots, selection accounting, batched updates, interval reset, saturation/later goals, retry after failed refresh, both comparator directions, cached selections, equal-priority retention and linear heapify comparisons. Existing goal semantics, CFG distance reuse and selector composition also pass.
Goals may be statements, exact edges or caller-defined types; distance semantics, PBT admission, source/runtime identity and native confirmation remain caller responsibilities. Core building block for #524; refs #399.