Skip to content

Conversation

@Mr-Pine
Copy link
Contributor

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

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

@MartinWitt
Copy link
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
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
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