Uh oh!
There was an error while loading. Please reload this page.
Java: Assume normal termination in post-dominance. - #20163
Conversation
This comment was marked as outdated.
This comment was marked as outdated.
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
aschackmull
commented
Aug 4, 2025
I've started dca with the only two queries using post-dominance: |
aschackmull
commented
Aug 5, 2025
Dca shows zero impact (as could be expected). |
85d7b7a to
273429dCompareThere 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 |
Uh oh!
There was an error while loading. Please reload this page.
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).