RFR 8233389: Add PrintIdeal to compiler directives

Nikola Grcevski Nikola.Grcevski at microsoft.com
Fri Nov 1 18:26:57 UTC 2019


Hi Jorn and hotspot-compiler-dev!

I'm a VM engineer at Microsoft and we recently signed the OCA agreement so we can properly contribute to OpenJDK. I was recently also in need of this option, as I have been educating myself on Ideal Graph and how the C2 optimizations work. I initially went ahead and added a very similar change in my local build to be able to log only certain methods in larger applications, however I later on discovered that a similar effect can be achieved by using the following combination of options:

1. On the main java command line you would need to add: -XX:+PrintIdealGraph -XX:PrintIdealGraphLevel=0

2. With the compile command (or through the .hotspot_compiler file) you can then use IGVPrintLevel to increase the level to greater than 0 on the methods you'd like, e.g:
option path.class_name::method_name,intx,IGVPrintLevel,2

The idea is to enable the Ideal Graph printing globally, set the global level to 0, and then control which methods would get logged by setting their level through the compiler directive.

This is not as good as having a direct option properly documented as suggested by Jorn, but it works.

Thank you and please let me know if you think this is valid approach and if I should add this comment in the bug report.
Nikola

-----Original Message-----
From: hotspot-compiler-dev <hotspot-compiler-dev-bounces at openjdk.java.net> On Behalf Of Jorn Vernee
Sent: November 1, 2019 11:10 AM
To: hotspot-compiler-dev at openjdk.java.net
Subject: RFR 8233389: Add PrintIdeal to compiler directives

Hi,

I'd like to add PrintIdeal as a compiler directive in order to enable PrintIdeal for only a single method when combining it with the 'match' 
directive.

Please review the following:

Bug: https://nam06.safelinks.protection.outlook.com/?url=https%3A%2F%2Fbugs.openjdk.java.net%2Fbrowse%2FJDK-8233389&data=02%7C01%7CNikola.Grcevski%40microsoft.com%7Cda3a597a49d94f4c541008d75ede29b2%7C72f988bf86f141af91ab2d7cd011db47%7C1%7C0%7C637082181241665037&sdata=24uDd9T1ncKsAPzcvxYI70XUZ1WvXdJ8eX5jHrNHNhk%3D&reserved=0
Webrev: https://nam06.safelinks.protection.outlook.com/?url=http:%2F%2Fcr.openjdk.java.net%2F~jvernee%2Fprint_ideal%2Fwebrev.00%2F&data=02%7C01%7CNikola.Grcevski%40microsoft.com%7Cda3a597a49d94f4c541008d75ede29b2%7C72f988bf86f141af91ab2d7cd011db47%7C1%7C0%7C637082181241665037&sdata=GD8GvzGdJljn4gDWsLTGxbtbvVl5KCv0RgmMPNH3UKU%3D&reserved=0
(Testing = tier1, manual)

As a heads-up; I'm not a committer on the jdk project, so if this sounds like a good idea, I would require a sponsor to push the changes.

Thanks,
Jorn



More information about the hotspot-compiler-dev mailing list