Skip to content
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

add ReversePostOrderBlockTraversal and update DominanceFinder #928

Merged
merged 5 commits into from
Apr 23, 2024

Conversation

shenjunjiekoda
Copy link
Contributor

@shenjunjiekoda shenjunjiekoda commented Apr 20, 2024

Summary

Implement RPO Traversal to Enhance CFG Analysis in Soot

Details

This PR addresses the specific issue raised in the Issue #923 concerning the potential problems due to the lack of Reverse Post-Order (RPO) traversal in the dominance analysis.

The proposed changes introduce an RPO traversal algorithm, which is integrated into the existing ForwardStmtGraph and BackwardStmtGraph via the getBlocksSorted interface. Additionally, the changes apply RPO in the DominanceFinder to enhance the accuracy and performance of dominator calculations.

Key changes include:

  • Implementation of an PO traversal algorithm in sootup/core/graph/ReversePostOrderBlockTraversal.java and create RPO one as a wrapper of PO.
  • Integration of RPO/PO traversal into ForwardStmtGraph and BackwardStmtGraph.
  • Application of RPO in DominanceFinder to ensure the correctness of dominator tree generation.
  • Correction in handling of the CFG head node in DominanceFinder(the head node should not have an immediate dominator). This was addressed by removing the @Nonnull annotation from getImmediateDominator and allowing a return value of null when the input is the head node.
  • Addition of tests for DominatorFinder, PostDominatorFinder, PostOrderBlockTraversal, ReversePostOrderBlockTraversal to verify the fixes.

Thank you for reviewing this pull request and considering this update!

@shenjunjiekoda shenjunjiekoda marked this pull request as draft April 20, 2024 04:22
@shenjunjiekoda shenjunjiekoda marked this pull request as ready for review April 20, 2024 10:52
Copy link

codecov bot commented Apr 20, 2024

Codecov Report

Attention: Patch coverage is 84.21053% with 12 lines in your changes are missing coverage. Please review.

Project coverage is 70.11%. Comparing base (0ff4b1c) to head (26e2b35).
Report is 11 commits behind head on develop.

❗ Current head 26e2b35 differs from pull request most recent head c40e877. Consider uploading reports for the commit c40e877 to get more accurate results

Files Patch % Lines
...ava/sootup/core/graph/PostOrderBlockTraversal.java 81.57% 5 Missing and 2 partials ⚠️
...tup/core/graph/ReversePostOrderBlockTraversal.java 80.00% 4 Missing and 1 partial ⚠️
Additional details and impacted files
@@              Coverage Diff              @@
##             develop     #928      +/-   ##
=============================================
+ Coverage      70.04%   70.11%   +0.06%     
- Complexity      4069     4085      +16     
=============================================
  Files            312      315       +3     
  Lines          15303    15389      +86     
  Branches        2618     2626       +8     
=============================================
+ Hits           10719    10790      +71     
- Misses          3727     3738      +11     
- Partials         857      861       +4     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

Copy link
Collaborator

@swissiety swissiety left a comment

Choose a reason for hiding this comment

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

👍 thanks for your contribution!

@swissiety swissiety merged commit 8482da6 into soot-oss:develop Apr 23, 2024
7 checks passed
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.

2 participants