RFR: 8349835: C2: simplify IGV property printing [v6]
Roberto Castañeda Lozano
rcastanedalo at openjdk.org
Wed Nov 19 13:28:38 UTC 2025
On Mon, 17 Nov 2025 10:27:05 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
>
> Saranya Natarajan has updated the pull request with a new target base due to a merge or a rebase. The pull request now contains nine commits:
>
> - Merge branch 'master' into JDK-8349835
> - testing and review on moving code to cpp
> - Merge branch 'master' into JDK-8349835
> - addressing review comments#2
> - fixing test failure
> - addressing review comments
> - changing int to bool in a struct
> - fix to failing test
> - initial fix
Thanks for cleaning up this code and testing it thoroughly, Saranya. The changes look good to me overall, I just have a few minor suggestions.
There may be more properties that could be printed using the new abstraction, but I am OK with addressing those separately.
src/hotspot/share/opto/idealGraphPrinter.cpp line 46:
> 44: public:
> 45: PrintProperties(IdealGraphPrinter* printer) : _printer(printer) {}
> 46: void print_node_properties(Node* node, Compile* C);
I suggest to fetch the `Compile` reference within `print_node_properties` from `_printer->C` instead.
Suggestion:
void print_node_properties(Node* node);
src/hotspot/share/opto/idealGraphPrinter.cpp line 47:
> 45: PrintProperties(IdealGraphPrinter* printer) : _printer(printer) {}
> 46: void print_node_properties(Node* node, Compile* C);
> 47: void print_lrg_properties(const LRG &lrg, const char* buffer);
Suggestion:
void print_lrg_properties(const LRG& lrg, const char* buffer);
src/hotspot/share/opto/idealGraphPrinter.cpp line 72:
> 70: Node* old = C->matcher()->find_old_node(node);
> 71: if (old != nullptr) {
> 72: print_property(true, "old_node_idx", C->matcher()->find_old_node(node)->_idx);
Suggestion:
print_property(true, "old_node_idx", old->_idx);
src/hotspot/share/opto/idealGraphPrinter.hpp line 45:
> 43: class ciMethod;
> 44: class JVMState;
> 45: class LRG;
This forward declaration is not needed anymore.
-------------
PR Review: https://git.openjdk.org/jdk/pull/26902#pullrequestreview-3482570982
PR Review Comment: https://git.openjdk.org/jdk/pull/26902#discussion_r2541981094
PR Review Comment: https://git.openjdk.org/jdk/pull/26902#discussion_r2541975521
PR Review Comment: https://git.openjdk.org/jdk/pull/26902#discussion_r2541920560
PR Review Comment: https://git.openjdk.org/jdk/pull/26902#discussion_r2541898950
More information about the hotspot-compiler-dev
mailing list