RFR: 8349835: C2: simplify IGV property printing

Damon Fenacci dfenacci at openjdk.org
Mon Sep 22 06:46:20 UTC 2025


On Fri, 22 Aug 2025 13:28:22 GMT, Saranya Natarajan <snatarajan at openjdk.org> wrote:

> The code that prints node properties and live range properties is very verbose and repetitive and could be simplified by applying a refactoring suggested [here](https://github.com/openjdk/jdk/pull/23558#discussion_r1950785708).
> 
> ### Fix 
> Implemented the suggested refactoring. 
> 
> ### Testing 
> Github Actions, Tier 1-3

Thanks @sarannat for cleaning this up! The fix looks ok for me. I just left a couple of inline comments for minor things.

src/hotspot/share/opto/idealGraphPrinter.cpp line 259:

> 257: }
> 258: 
> 259: void IdealGraphPrinter::print_prop_record(const IdealGraphPrintRecord rec[], int size) {

Just a small naming note: the method actually prints multiple records. Could it be preferable to use the plural form?

src/hotspot/share/opto/idealGraphPrinter.cpp line 534:

> 532:         {((flags & Node::Flag_has_call) != 0), "has_call", "true"},
> 533:         {((flags & Node::Flag_has_swapped_edges) != 0), "has_swapped_edges", "true"}
> 534:       };

The indentation seems a bit off.

src/hotspot/share/opto/idealGraphPrinter.cpp line 1089:

> 1087:           {1, "cost", nullptr, (int) lrg._cost},
> 1088:           {1, "area", nullptr, (int) lrg._area},
> 1089:           {1, "score", nullptr, (int) lrg.score()},

It is mainly a style matter but as `_cond` is a `bool` it might be better to use `true` rather than `1`

src/hotspot/share/opto/idealGraphPrinter.cpp line 1109:

> 1107:           {(lrg._is_bound != 0), "is_bound", TRUE_VALUE},
> 1108:           {lrg._msize_valid && lrg._degree_valid && lrg.lo_degree(), "trivial", TRUE_VALUE}
> 1109:         };

Same intentation issue here.

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

PR Review: https://git.openjdk.org/jdk/pull/26902#pullrequestreview-3250796143
PR Review Comment: https://git.openjdk.org/jdk/pull/26902#discussion_r2366871980
PR Review Comment: https://git.openjdk.org/jdk/pull/26902#discussion_r2366873355
PR Review Comment: https://git.openjdk.org/jdk/pull/26902#discussion_r2366858280
PR Review Comment: https://git.openjdk.org/jdk/pull/26902#discussion_r2366874365


More information about the hotspot-compiler-dev mailing list