Skip to content

Conversation

@ImkoMarijnissen
Copy link
Contributor

@ImkoMarijnissen ImkoMarijnissen commented Jan 26, 2026

Currently, the predicate notification system is convoluted and carries a lot of duplicate information with several levels of indirection to reach a specific tracker for a predicate type.

This PR addresses this issue by merging all of these trackers for different types into a single PredicateTracker, which keeps track of the status of all predicate types at once.

To accomodate this, two new TrailedIntegers are required, which, rather than being moved when a bound is greater (lesser) than or equal to the tracked value, are moved when the bound is strictly greater (lesser) than the tracked value. This allows us to track all of the different predicate types using a single tracker.

TODO

  • Currently, we store a Vec<Vec<PredicateType>> to track which predicates are attached to a value. However, we can use 4 bits to store this information more concisely Using only 27 bits for representation was too little, so it is now stored as with an additional EnumSet
  • Need to do profiling to determine the impact of this change

Copy link
Contributor

@maartenflippo maartenflippo left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We should take into account that we do not track predicates becoming false.

#[derive(Clone, Copy)]
struct TrackedValue {
value: i32,
flags: u8,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can be done using EnumSet. It will have the same packing

Comment on lines 78 to 88
impl Debug for TrackedValue {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
f.debug_struct("TrackedValue")
.field("value", &self.get_value())
.field(
"PredicateTypes",
&self.get_predicate_types().collect::<Vec<_>>(),
)
.finish()
}
}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

When using enumset, this can be derived

Copy link
Contributor

@maartenflippo maartenflippo left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please add tests to the PredicateTracker

@github-actions github-actions bot dismissed stale reviews from maartenflippo and maartenflippo January 27, 2026 16:00

Review re-requested

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants