Where does the openjdk JVM interpreter execute the bytecode instanceof operation

zhengxianwei baikaishiuc at gmail.com
Sun May 5 08:13:12 UTC 2024


Thank you. This is my first time using the mailing list, and I wasn't aware
of this issue.


I'll make sure to cc o hotspot-dev at openjdk.org now. :-)

On Sun, May 5, 2024 at 3:47 PM Julian Waters <tanksherman27 at gmail.com>
wrote:

> By the way, when you reply to someone, you should also cc to
> hotspot-dev at openjdk.org, for your message to show up on the mailing
> lists. That way, more people will see it and your chances of them helping
> you increase
>
> best regards,
> Julian
>
> On Fri, May 3, 2024 at 3:54 PM zhengxianwei <baikaishiuc at gmail.com> wrote:
>
>> I carefully analyzed it and found that what you said is actually correct.
>>
>> I didn't understand it correctly initially.
>>
>> Thanks again for your explanation
>>
>> On Fri, May 3, 2024 at 11:03 AM Julian Waters <tanksherman27 at gmail.com>
>> wrote:
>>
>>> Hi Xian Wei,
>>>
>>> No, you are right! The code in templateTable_x86.cpp that you linked to
>>> in your post is not part of the Just in Time Compilers, it is part of the
>>> x86 Interpreter! The Java HotSpot VM actually has 2 different Interpreters,
>>> the primary Interpreter is written in large chunks of assembly specific to
>>> each platform, which is then processed by the HotSpot macro assemblers. The
>>> bytecodeInterpreter.cpp file you linked to is part of the second and less
>>> often used Interpreter, which is why modifying the bytecodeInterpreter.cpp
>>> instanceof implementation did nothing in your case (The Interpreter used
>>> actually depends on the platform, and the secondary Interpreter is not used
>>> on ARM or x86). The details on the macro assemblers unfortunately elude me
>>> since I am not a HotSpot expert (Although I hope to be one day), but to
>>> understand how instanceof works on x86 and ARM, you need to understand both
>>> x86 and ARM assembly. The Interpreter's instanceof opcode is implemented on
>>> x86 in
>>> https://github.com/openjdk/jdk/blob/6bef0474c8b8773d0d20c0f25c36a2ce9cdbd7e8/src/hotspot/cpu/x86/templateTable_x86.cpp#L4243
>>> and on ARM, it is implemented in
>>> https://github.com/openjdk/jdk/blob/6bef0474c8b8773d0d20c0f25c36a2ce9cdbd7e8/src/hotspot/cpu/arm/templateTable_arm.cpp#L4182
>>>
>>> Happy to help!
>>>
>>> best regards,
>>> Julian
>>>
>>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://mail.openjdk.org/pipermail/hotspot-dev/attachments/20240505/0d511717/attachment-0001.htm>


More information about the hotspot-dev mailing list