Where does the openjdk JVM interpreter execute the bytecode instanceof operation

Julian Waters tanksherman27 at gmail.com
Fri May 3 03:02:30 UTC 2024


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/20240503/24eccfd3/attachment.htm>


More information about the hotspot-dev mailing list