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

fix and implement ConditionalBranchFolder, Unreachable Code Eliminator #1041

Draft
wants to merge 20 commits into
base: develop
Choose a base branch
from

Conversation

sahilagichani14
Copy link
Collaborator

Todo: fix for try-catch blocks

@sahilagichani14 sahilagichani14 self-assigned this Aug 26, 2024
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.

this seems expensive - old Soot did cut the connection to the never reached branch and was calling UnreachableCodeEliminator afterwards, which at least looks simpler/cleaner than the current state (havent checked if the proposed algorithm is faster e.g. due to a possible smaller n?)

@sahilagichani14
Copy link
Collaborator Author

this seems expensive - old Soot did cut the connection to the never reached branch and was calling UnreachableCodeEliminator afterwards, which at least looks simpler/cleaner than the current state (havent checked if the proposed algorithm is faster e.g. due to a possible smaller n?)

Old soot has a connection to statements and not blocks, so removing a statement is simpler than removing intermediate blocks.

@swissiety
Copy link
Collaborator

this seems expensive - old Soot did cut the connection to the never reached branch and was calling UnreachableCodeEliminator afterwards, which at least looks simpler/cleaner than the current state (havent checked if the proposed algorithm is faster e.g. due to a possible smaller n?)

Old soot has a connection to statements and not blocks, so removing a statement is simpler than removing intermediate blocks.

can you explain why? I would assume it is instantly "infecting" the complete block (so all its following FallsthroughStmts) if that (head)stmt needs to be removed and not just unlinked from the IfStmt. So it would skip the checks on the "infected" block and only has to go on with the checks on the next block instead of each Stmt of the infected Block. -- Lets have a call.

@swissiety
Copy link
Collaborator

fixing the iterator should have fixed:

@sahilagichani14 sahilagichani14 marked this pull request as draft September 5, 2024 12:49
@sahilagichani14
Copy link
Collaborator Author

#996

@sahilagichani14 sahilagichani14 changed the title fix and implement ConditionalBranchFolder fix and implement ConditionalBranchFolder, Unreachable Code Eliminator Sep 15, 2024
swissiety and others added 10 commits September 16, 2024 08:06
…r-removes-complete-tail-of-the-cfg

# Conflicts:
#	sootup.java.bytecode.frontend/src/test/java/sootup/java/bytecode/frontend/TryCatchFinallyTests.java
#	sootup.java.bytecode.frontend/src/test/java/sootup/java/bytecode/frontend/interceptors/ConditionalBranchFolderTest.java
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.

[Bug]: ConditionalBranchfolder removes complete tail of the CFG
3 participants