Skip to content

C++: Implement DataFlow::BarrierGuard for AST+IR#2213

Merged
geoffw0 merged 2 commits intogithub:masterfrom
jbj:BarrierGuard
Nov 4, 2019
Merged

C++: Implement DataFlow::BarrierGuard for AST+IR#2213
geoffw0 merged 2 commits intogithub:masterfrom
jbj:BarrierGuard

Conversation

@jbj
Copy link
Contributor

@jbj jbj commented Oct 28, 2019

This change mirrors #1807 (C#) and #1718 (Java). It's another step on the way to make our data-flow libraries more similar, and hopefully it's also a convenient interface for using the guards library and the GVN library together to make a data-flow barrier.

The change note is copied from the Java change note.
@jbj jbj added the C++ label Oct 28, 2019
@jbj jbj requested review from a team, jf205 and shati-patel as code owners October 28, 2019 15:26
@jbj jbj requested a review from hvitved October 29, 2019 07:57
Copy link
Contributor

@hvitved hvitved left a comment

Choose a reason for hiding this comment

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

LGTM, just one small comment. Does it make sense to rewrite existing queries to use BarrierGuards on this PR as well (if applicable)?

/** NOT YET SUPPORTED. Holds if this guard validates `e` upon evaluating to `branch`. */
abstract deprecated predicate checks(Expr e, boolean branch);
class BarrierGuard extends GuardCondition {
/** Override this predicate to hold if this guard validates `e` upon evaluating to `b`. */
Copy link
Contributor

Choose a reason for hiding this comment

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

b -> branch (or vice versa)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Good catch. I had trouble with the naming of this Boolean since there's a field named branch on the IRGuardCondition class, and parameters are not allowed to shadow fields. I've named it b so it's consistent between IR and non-IR.

jf205
jf205 previously approved these changes Oct 29, 2019
Copy link
Contributor

@jf205 jf205 left a comment

Choose a reason for hiding this comment

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

Docs LGTM

@geoffw0
Copy link
Contributor

geoffw0 commented Oct 29, 2019

LGTM, though I've only done a shallow review.

Does it make sense to rewrite existing queries to use BarrierGuards on this PR as well (if applicable)?

I suggest any such changes are done in a different PR, to avoid getting this one caught up in the details.

@jbj
Copy link
Contributor Author

jbj commented Nov 1, 2019

Tests passed. @geoffw0, will you merge?

Copy link
Contributor

@geoffw0 geoffw0 left a comment

Choose a reason for hiding this comment

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

👍

@geoffw0 geoffw0 merged commit 3e8b28a into github:master Nov 4, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants