RFR: 8277102: Dubious PrintCompilation output

Doug Simon dnsimon at openjdk.java.net
Thu Nov 18 10:38:31 UTC 2021


On Thu, 18 Nov 2021 09:54:24 GMT, Tobias Hartmann <thartmann at openjdk.org> wrote:

>> The output of PrintCompilation is ill-formed:
>> 
>> 
>>      22 1 3 java.lang.Object::<init> (1 bytes)
>>      25 2 3 java.lang.String::hashCode (60 bytes)
>>      25 3 3 java.lang.String::coder (15 bytes)
>>      27 4 3 Reduced::foo (12 bytes)
>>      27 5 3 java.lang.Boolean::valueOf (14 bytes)
>>      27 6 3 java.lang.Boolean::hashCode (8 bytes)
>>      27 8 4 Reduced::foo (12 bytes)
>>      27 7 2 java.lang.Boolean::hashCode (14 bytes)
>>    4 3 Reduced::foo (12 bytes) made not entrant
>>      29 9 % 3 Reduced::main @ 4 (33 bytes)
>>      29 10 3 Reduced::main (33 bytes)
>>      29 11 % 4 Reduced::main @ 4 (33 bytes)
>>    9 % 3 Reduced::main @ 4 (33 bytes) made not entrant
>>   11 % 4 Reduced::main @ 4 (33 bytes) made not entrant
>> 
>> 
>> This seems related to [JDK-8272586](https://bugs.openjdk.java.net/browse/JDK-8272586), which print timestamp optionally. As #5446 mentioned, printing timestamp would break DisassembleCodeBlobTest.java since it expects disassembling a given nmethod twice to produce the same result. Maybe we should fix DisassembleCodeBlobTest.java.
>
> test/hotspot/jtreg/compiler/jvmci/compilerToVM/DisassembleCodeBlobTest.java line 112:
> 
>> 110:         // Compiled method (c2)     310  463       4       compiler.jvmci.compilerToVM.CompileCodeTestCase$Dummy::staticMethod (1 bytes)
>> 111:         for (int i = 2; i < str2Lines.length; i++) {
>> 112:             Asserts.assertEQ(str2Lines[i], str3Lines[i],
> 
> Splitting the entire string by lines seems like a bit of an overhead. What about something like that (not tested)?
> 
> int idx = str2.indexOf(System.lineSeparator());
> idx = str2.indexOf(System.lineSeparator(), idx + 1);
> str2 = str2.substring(idx + 1);

Doing it by lines will actually provide a more focused error message if there's a problem and I cannot image the overhead matters for a test like this.

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

PR: https://git.openjdk.java.net/jdk/pull/6386


More information about the hotspot-compiler-dev mailing list