RFR: 8271461: CompileCommand support for hidden class methods [v9]
Jie Fu
jiefu at openjdk.java.net
Fri Aug 6 07:41:53 UTC 2021
On Thu, 5 Aug 2021 02:44:50 GMT, Jie Fu <jiefu at openjdk.org> wrote:
>> Hi all,
>>
>> We'd like to improve the CompileCommand to support hidden class methods, which is helpful for debugging and perfmance analysis.
>>
>> Current implementation of CompileCommand doesn't work for hidden class methods.
>> For example, if you run with `java -Xcomp -Xbatch -XX:+PrintCompilation`
>> The following hidden class methods were compiled:
>>
>> 5317 1573 b 3 java.util.ResourceBundle$$Lambda$1/0x00000008010413c8::run (8 bytes)
>> 5318 1574 b 4 java.util.ResourceBundle$$Lambda$1/0x00000008010413c8::run (8 bytes)
>> 6735 1938 b 3 java.util.ResourceBundle$ResourceBundleProviderHelper$$Lambda$2/0x0000000801041e80::run (12 bytes)
>> 6736 1939 b 4 java.util.ResourceBundle$ResourceBundleProviderHelper$$Lambda$2/0x0000000801041e80::run (12 bytes)
>> 7060 2029 b 3 java.util.ResourceBundle$ResourceBundleProviderHelper$$Lambda$58/0x800000060::run (8 bytes)
>> 7061 2030 b 4 java.util.ResourceBundle$ResourceBundleProviderHelper$$Lambda$58/0x800000060::run (8 bytes)
>> 7688 2153 b 3 java.util.ResourceBundle$ResourceBundleProviderHelper$$Lambda$4/0x0000000801043218::run (16 bytes)
>> 7688 2154 b 4 java.util.ResourceBundle$ResourceBundleProviderHelper$$Lambda$4/0x0000000801043218::run (16 bytes)
>>
>>
>> Then people may want to exclude the compilation of `java.util.ResourceBundle$$Lambda$1/0x00000008010413c8::run` like this
>>
>> -XX:CompileCommand=exclude,'java.util.ResourceBundle$$Lambda$1/0x00000008010413c8::run'
>>
>>
>> But unfortunately, it doesn't work.
>>
>> CompileCommand: An error occurred during parsing
>> Error: Method pattern uses '/' together with '::'
>> Line: 'exclude,java.util.ResourceBundle$$Lambda$1/0x00000008010413c8::run'
>>
>> Usage: '-XX:CompileCommand=<option>,<method pattern>' - to set boolean option to true
>> Usage: '-XX:CompileCommand=<option>,<method pattern>,<value>'
>> Use: '-XX:CompileCommand=help' for more information and to list all option.
>>
>>
>> The failing reason is that the name of `java.util.ResourceBundle$$Lambda$1/0x00000008010413c8::run` is actually `java.util.ResourceBundle$$Lambda$1+0x00000008010413c8::run` in the VM.
>> But "+" had been replaced with "/" when it was printed by PrintCompilation [1].
>>
>> So for a hidden class method, "/" should be replaced with "+" to make CompileCommand work.
>>
>> Thanks.
>> Best regards,
>> Jie
>>
>>
>> [1] https://github.com/openjdk/jdk/blob/master/src/hotspot/share/oops/klass.cpp#L685
>
> Jie Fu has updated the pull request incrementally with one additional commit since the last revision:
>
> Fix code style
I've tried my best to find a way to support hidden class methods directly, but it seems too hard to do so.
I agree with @iklam that `java.util/*::method` shouldn't be considered as a hidden class pattern since `java.util` is a well known package name.
And I also agree with @dean-long that `java.util.ResourceBundle$$Lambda$1/*::method` should be supported as hidden classes.
But I failed to find a solution to distinguish them precisely without too much complexity.
So I decide to withdraw the patch, which seems to be already complicated and still with false positive cases.
Thank you all, especially @iklam and @dean-long , for your review and discussion.
But I think we can still do something to make CompileCommand be more friendly with hidden classes.
I suggest to improve the error msg to print the tips that '/' should be replaced with '+' for hidden classes since not all people know the fact.
And patch has been updated.
Before:
CompileCommand: An error occurred during parsing
Error: Method pattern uses '/' together with '::'
Line: 'exclude,java.util.ResourceBundle$ResourceBundleProviderHelper$$Lambda$2/0x00000008010420e0::run'
After:
CompileCommand: An error occurred during parsing
Error: Method pattern uses '/' together with '::' (tips: replace '/' with '+' for hidden classes)
Line: 'exclude,java.util.ResourceBundle$ResourceBundleProviderHelper$$Lambda$2/0x00000008010420e0::run'
Testing:
==============================
Test summary
==============================
TEST TOTAL PASS FAIL ERROR
jtreg:test/hotspot/jtreg/compiler/oracle 5 5 0 0
jtreg:test/hotspot/jtreg/compiler/compilercontrol 37 37 0 0
==============================
TEST SUCCESS
What do you think?
Thanks.
-------------
PR: https://git.openjdk.java.net/jdk/pull/4926
More information about the hotspot-compiler-dev
mailing list