Skip to content

review: fix(control-flow): Handle synchronized statement in CFG#5740

Open
Mr-Pine wants to merge 2 commits into
INRIA:masterfrom
Mr-Pine:controlflow-synchronized
Open

review: fix(control-flow): Handle synchronized statement in CFG#5740
Mr-Pine wants to merge 2 commits into
INRIA:masterfrom
Mr-Pine:controlflow-synchronized

Conversation

@Mr-Pine

@Mr-Pine Mr-Pine commented Apr 5, 2024

Copy link
Copy Markdown
Contributor

Currently, a synchronized statement is completely ignored in the CFG. This PR adds it to the CFG properly.

@MartinWitt

Copy link
Copy Markdown
Collaborator

LGTM will merge

public void visitCtSynchronized(CtSynchronized synchro) {
ControlFlowNode expressionNode = new ControlFlowNode(synchro.getExpression(), result, BranchKind.STATEMENT);
tryAddEdge(lastNode, expressionNode);
lastNode = expressionNode;

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Do we want to preserve the synchronized statement itself in the graph? I.e. call defaultAction(synchro, BranchKind.STATEMENT) or w/e somewhere? Currently it looks like the synchronized is unrolled and no trace of it is left?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Ideally yes, but in the current CFG model this is not possible in any way I like. This is one of the things I would like to improve with the redesign started in #5742

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