RFR: 8334650: Add debug information about whether an Assertion Predicate is for the init or last value

Christian Hagedorn chagedorn at openjdk.org
Tue Jun 25 06:22:24 UTC 2024


It is sometimes hard to see if an Assertion Predicate is about the init or the last value of a range check. This patch therefore adds debugging information when dumping an Assertion Predicate node to tty or for IGV:

Template Assertion Predicate:

 292  Opaque4  === _ 291 25  [[ 295 ]]  !orig=[174]
 293  IfTrue  === 295  [[ 401 ]] #1 !orig=[176]
 294  IfFalse  === 295  [[ 297 ]] #0 !orig=[177]
 295  RangeCheck  === 273 292  [[ 293 294 ]] #Init Value Assertion Predicate  P=0.999999, C=-1.000000 !orig=[175]
...
 272  Opaque4  === _ 271 25  [[ 275 ]]  !orig=[184]
 273  IfTrue  === 275  [[ 295 ]] #1 !orig=[186]
 274  IfFalse  === 275  [[ 277 ]] #0 !orig=[187]
 275  RangeCheck  === 262 272  [[ 273 274 ]] #Last Value Assertion Predicate  P=0.999999, C=-1.000000 !orig=[185]

Initialized Assertion Predicate:

 398  OpaqueInitializedAssertionPredicate  === _ 396  [[ 401 ]] 
 399  IfTrue  === 401  [[ 413 ]] #1 !orig=293,[176]
 400  IfFalse  === 401  [[ 403 ]] #0 !orig=294,[177]
 401  RangeCheck  === 293 398  [[ 399 400 ]] #Init Value Assertion Predicate  P=0.999999, C=-1.000000 !orig=295,[175]
...
 410  OpaqueInitializedAssertionPredicate  === _ 408  [[ 413 ]] 
 411  IfTrue  === 413  [[ 149 ]] #1 !orig=273,[186]
 412  IfFalse  === 413  [[ 415 ]] #0 !orig=274,[187]
 413  RangeCheck  === 399 410  [[ 411 412 ]] #Last Value Assertion Predicate  P=0.999999, C=-1.000000 !orig=275,[185]


IGV:
![image](https://github.com/openjdk/jdk/assets/17833009/4d2725f7-ea8e-4304-8ad6-2c7bf76b072b)

I could have added an additional "initialized" or "template" to better distinguish them but I eventually plan to get rid of `If` nodes for templates and introduce a dedicated `TemplateAssertionPredicateNode`. I therefore use the same strings for templates and initialized versions for now. Moreover, one can easily look at the input nodes to see if it is a template (with `Opaque4`) or an initialized version (with `OpaqueInitializedAssertionPredicate`).

Since this is only useful for debugging, I've guarded everything with `NOT_PRODUCT`.

Thanks,
Christian

-------------

Commit messages:
 - 8334650: Add debug information about whether an Assertion Predicate is for the init or last value

Changes: https://git.openjdk.org/jdk/pull/19856/files
  Webrev: https://webrevs.openjdk.org/?repo=jdk&pr=19856&range=00
  Issue: https://bugs.openjdk.org/browse/JDK-8334650
  Stats: 106 lines in 6 files changed: 70 ins; 9 del; 27 mod
  Patch: https://git.openjdk.org/jdk/pull/19856.diff
  Fetch: git fetch https://git.openjdk.org/jdk.git pull/19856/head:pull/19856

PR: https://git.openjdk.org/jdk/pull/19856


More information about the hotspot-compiler-dev mailing list