-
Notifications
You must be signed in to change notification settings - Fork 46
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Disjunctive (OR) *filters* #38
Comments
@regexident Is this something that interests you? I think it's feasible, but definitely not trivial. I'm willing to help, of course. We should wait for @lqd to confirm that rust-lang/polonius#157 is still the way forward, and that this would actually help them. |
We unfortunately didn't manage to talk about rust-lang/polonius#157 at the last sprint, but hopefully we may be able to at the next one. (It's also still WIP in that it also lacks the required antijoins that are currently implicit: there are more details in the PR description). It looks like the correct way forward to me too. The maintainability of these manual disjunctive queries is its main drawback, and that would be greatly improved if datafrog offered an API like this issue suggests. (Just for clarification to @ecstatic-morse, rust-lang/polonius#157 doesn't fix the " |
Ah, okay. I guess I conflated "placeholder origin is live at all points" with "placeholder origin subset constraint must hold at all points". It seemed like the first would help the second, since |
Ugh. In addition to being wrong about the motivation for rust-lang/polonius#157, I was also wrong about what kind of leaper we need to express its rules for placeholder liveness. When we have a rule like: live_to_dying_regions(origin1, origin2, point1, point2) :-
subset(origin1, origin2, point1), % main input
cfg_edge(point1, point2), % Leaper 1
(origin_live_on_entry(origin1, point2); placeholder_origin(origin1)), % Leaper 2
!origin_live_on_entry(origin2, point2). % Leaper 3
So basically, all that's needed is to implement an adapter that can take two |
Hey @regexident, let me know if you want to work on this. We will need the ability to compose |
Hey @ecstatic-morse, sorry for not getting back to you in a more timely way. I'd love to give it a shot! |
No worries. I'm not a model for availability myself. Let's talk on Zulip. |
@lqd opened rust-lang/polonius#157 a while ago,
which solves the. Essentially, it transforms all occurrences ofLocation::All
problem in what I think is the "correct" wayorigin_live_at(O, P)
in rule bodies into(origin_live_at(O, P) OR placeholder(O))
. In other words, placeholder regions are live at all points in the CFG.Unfortunately it's actually kind of difficult to express that simple idea as a
datafrog
program with the current API. The PR manually expanded each rule body into two (one for each side of the OR), but this leads to code that is really difficult to maintain. Another option would be to create an intermediateRelation
,origin_live_at_or_placeholder(O, P)
defined below, to hold the disjunction. That would waste memory, however, and we would also need a newis_point
relation that holds all possible points in the CFG.Ideally, we would express this disjunction directly as a leaper. This is possible, but is more work than you might expect. An impl that's generic over
Leaper
s won't work, since (among other things) there's no way to implement a disjunctiveintersect
efficiently with the currentLeaper
interface. I think you could do something like the following, but you'd need to handle heterogeneousValue
types as well:Obviously, this doesn't scale, but maybe it's okay to implement just what we need for rust-lang/polonius#157? The alternative is to adjust the
Leaper
interface so that it composes better, but I don't see a straightforward way to do this without resorting to boxed trait objects, which is not an option since they would be dispatched in a tight loop (GATs + RPIT in traitfn
s would solve this, however).The text was updated successfully, but these errors were encountered: