RFR: 8255746: Make PrintCompilation available on a per method level [v2]

Christian Hagedorn chagedorn at openjdk.org
Wed Oct 19 11:58:12 UTC 2022


On Thu, 13 Oct 2022 20:34:11 GMT, Joshua Cao <duke at openjdk.org> wrote:

>> Example:
>> 
>> 
>> [~/jdk/jdk]$ build/linux-x86_64-server-fastdebug/jdk/bin/java -XX:CompileCommand=PrintCompilation,java.lang.String::length Hello
>> CompileCommand: PrintCompilation java/lang/String.length bool PrintCompilation = true
>>     223   12       3       java.lang.String::length (11 bytes)
>>     405  307       4       java.lang.String::length (11 bytes)
>> hello world
>> 
>> 
>> Running `java -XX:+PrintCompilation` still prints every method. This change also moves the declaration of `elapsedTimer`, but it should have insignificant impact on actual elapsed time.
>> 
>> ---
>> 
>> Additionally, I make a change to `test/lib-test/jdk/test/whitebox/vm_flags/BooleanTest.java` so that it does not depend on PrintCompilation. The test was failing because it updates global `PrintCompilation` during the middle of the run, but this does not change the value of `PrintCompilationOption` for individual CompileTask directives.
>> 
>> I modified the test so that it is similar to other [WhiteBox vm_flag test](https://github.com/openjdk/jdk/tree/master/test/lib-test/jdk/test/whitebox/vm_flags). It still tests `VmFlagTest.WHITE_BOX::get/setBooleanVMFlag`, without having to depend on the behavior on the specific flag.
>
> Joshua Cao has updated the pull request incrementally with one additional commit since the last revision:
> 
>   Set CompileTask directive on initialization, add tests for
>   PrintCompilation

Otherwise, looks good!

src/hotspot/share/compiler/compileTask.hpp line 130:

> 128:   bool         is_blocking() const               { return _is_blocking; }
> 129:   bool         is_success() const                { return _is_success; }
> 130:   void         set_directive(DirectiveSet* directive) { _directive = directive; }

This method is now unused and can be removed.

src/hotspot/share/compiler/compileTask.hpp line 131:

> 129:   bool         is_success() const                { return _is_success; }
> 130:   void         set_directive(DirectiveSet* directive) { _directive = directive; }
> 131:   DirectiveSet* directive()                      { return _directive; }

The method can still be `const` since we are not changing `this`.
Suggestion:

  DirectiveSet* directive() const                { return _directive; }

test/hotspot/jtreg/compiler/print/CompileCommandPrintCompilation.java line 30:

> 28:  * @library /test/lib
> 29:  * @modules java.base/jdk.internal.misc
> 30:  *          java.management

These modules are not used and can be removed. Same for the other test.

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

Marked as reviewed by chagedorn (Reviewer).

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


More information about the hotspot-compiler-dev mailing list