RFR: JDK-8302335: IGV: Bytecode not showing [v2]
Tobias Holenstein
tholenstein at openjdk.org
Thu Feb 16 13:06:57 UTC 2023
On Wed, 15 Feb 2023 15:36:45 GMT, Tobias Holenstein <tholenstein at openjdk.org> wrote:
>> Currently, IGV does not show the bytecode of a graph in the "Bytecode" window although the bytecode is present in the XML file.
>>
>> # Solution
>>
>> Following is the `<bytecodes>` block of the XML file
>>
>> <bytecodes>
>> <![CDATA[
>> 0 iconst_3
>> 1 istore_1
>> 2 bipush 9
>> 4 istore_2
>> 5 iload_2
>> 6 ifle 34
>> 0 bci: 6 BranchData taken(0) displacement(112) not taken(0)
>> 9 iconst_2
>> 10 istore_3
>> 11 iload_3
>> 12 iload_2
>> 13 if_icmpge 28
>> 32 bci: 13 BranchData taken(0) displacement(56) not taken(0)
>> 16 iload_1
>> 17 istore_1
>> 18 iconst_1
>> 19 iload_3
>> 20 irem
>> 21 istore_1
>> 22 iinc #3 1
>> 25 goto 11
>> 64 bci: 25 JumpData taken(0) displacement(-32)
>> 28 iinc #2 -1
>> 31 goto 5
>> 88 bci: 31 JumpData taken(0) displacement(-88)
>> 34 return
>> ]]>
>> </bytecodes>
>>
>> The problem was that during paring IGV skipped all lines that started with an empty space: This just skipped all bytecodes. We only want to skip bytecode like ` 0 bci: 6 BranchData taken(0) displacement(112) not taken(0)` . Meaning: whitespace - number - exactly two white spaces - and then arbitrary text.
>>
>> <img width="283" alt="bytecode" src="https://user-images.githubusercontent.com/71546117/218495199-2b02a79c-3065-404c-af57-3f8a603ac499.png">
>
> Tobias Holenstein has updated the pull request incrementally with one additional commit since the last revision:
>
> support old and new bytecode format
> The method data still shows up for me:
>
> ![Screenshot from 2023-02-16 13-39-18](https://user-images.githubusercontent.com/5312595/219367453-aed3f86d-de6c-4a54-9df5-bb5095e26026.png)
> The method data still shows up for me:
>
> ![Screenshot from 2023-02-16 13-39-18](https://user-images.githubusercontent.com/5312595/219367453-aed3f86d-de6c-4a54-9df5-bb5095e26026.png)
Thanks for catching that!
This is actually a bug in printing the bytecodes on the VM side: [JDK-8302656](https://bugs.openjdk.org/browse/JDK-8302656)
I adjusted the PR to work even in the presents of the bug (and still work when it is fixed)
-------------
PR: https://git.openjdk.org/jdk/pull/12537
More information about the hotspot-compiler-dev
mailing list