问题
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
?
回答1:
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
,
- C1 implementation of the intrinsic is in GraphBuilder::append_unsafe_get_obj;
- C2 implementation of the intrinsic is in LibraryCallKit::inline_unsafe_access.
来源:https://stackoverflow.com/questions/48198982/where-is-the-assembly-implementation-code-of-the-intrinsic-method-in-java-hotspo