Java: Assume normal termination in post-dominance.#20163
Merged
aschackmull merged 2 commits intogithub:mainfrom Aug 5, 2025
Merged
Java: Assume normal termination in post-dominance.#20163aschackmull merged 2 commits intogithub:mainfrom
aschackmull merged 2 commits intogithub:mainfrom
Conversation
Contributor
Author
|
I've started dca with the only two queries using post-dominance: |
Contributor
Author
|
Dca shows zero impact (as could be expected). |
85d7b7a to
273429d
Compare
Contributor
There was a problem hiding this comment.
Pull Request Overview
This PR modifies Java's post-dominance calculation to assume normal termination rather than accounting for exceptions. This aligns Java with the shared CFG library approach and fixes a bug where exception handling was inconsistent due to elided exception edges in the CFG when no try-block is present.
- Changes post-dominance exit nodes from general
ExitNodetoNormalExitNodeonly - Updates test expectations to reflect the new post-dominance relationships
Reviewed Changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
| java/ql/lib/semmle/code/java/controlflow/BasicBlocks.qll | Changes post-dominance calculation to use normal exit nodes only |
| java/ql/test-kotlin1/library-tests/controlflow/basic/strictPostDominance.expected | Updated test expectations for new post-dominance behavior |
| java/ql/test-kotlin2/library-tests/controlflow/basic/strictPostDominance.expected | Updated test expectations for new post-dominance behavior |
hvitved
approved these changes
Aug 5, 2025
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This is a followup for #19885, which made this possible.
The concept of post-dominance may either assume normal termination of a callable, or try to account for exceptions. This PR switches Java to the former, which is in line with the shared CFG library. Indeed, trying to account for exceptions in post-dominance usually isn't what's desired, and it's also somewhat meaningless, since many potential exception edges are elided in the CFG if there's no enclosing try-block. As such, I'll consider this to be a bug-fix (and a somewhat minor one given that post-dominance is only rarely used).