Search code examples
javajvmintrinsicsjvm-hotspot

Where is the assembly implementation code of the intrinsic method in Java HotSpot?


from http://hg.openjdk.java.net/jdk8/jdk8/hotspot/file/87ee5ee27509/src/share/vm/classfile/vmSymbols.hpp, I can see the intrinsic method declare like:

do_intrinsic(_getByte, sun_misc_Unsafe, getByte_name, getByte_signature, F_RN) \

but how to find the actually implementation(assembly code I think) of the method _getByte?


Solution

  • but how to find the actually implementation(assembly code I think) of the method _getByte

    By looking for vmIntrinsics::_getByte in your IDE or simply by grepping HotSpot sources.

    However, you won't find the assembly code. Calls to intrinsic methods in HotSpot are typically translated to JIT compiler's intermediate representation (IR). Corresponding IR nodes are manually added to the node graph at the parsing stage of compilation.

    Since different JIT compilers have different IRs, intrinsics need to be implemented separately for C1 and C2.

    For example, as to _getByte,