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:25 UTC 2024
On Mon, 24 Jun 2024 12:23:56 GMT, Christian Hagedorn <chagedorn at openjdk.org> wrote:
> 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:
> 
>
> 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
src/hotspot/share/opto/cfgnode.hpp line 324:
> 322: public:
> 323: float _prob; // Probability of true path being taken.
> 324: float _fcnt; // Frequency counter
Moved these fields up to the start of the class to have them together with the new field.
src/hotspot/share/opto/cfgnode.hpp line 430:
> 428:
> 429: IfNode(Node* control, Node* bol, float p, float fcnt);
> 430: NOT_PRODUCT(IfNode(Node* control, Node* bol, float p, float fcnt, AssertionPredicateType assertion_predicate_type);)
New constructor to set the Assertion Predicate type explicitly. Otherwise, it is just `None`. Same for `RangeCheck`.
src/hotspot/share/opto/ifnode.cpp line 2216:
> 2214: if (_useless) {
> 2215: st->print("#useless ");
> 2216: }
Squeezed this in here for Parse Predicates. It's probably not worth to create a separate RFE just for that.
-------------
PR Review Comment: https://git.openjdk.org/jdk/pull/19856#discussion_r1650944899
PR Review Comment: https://git.openjdk.org/jdk/pull/19856#discussion_r1650946000
PR Review Comment: https://git.openjdk.org/jdk/pull/19856#discussion_r1650946920
More information about the hotspot-compiler-dev
mailing list