问题描述
来自 http://hg.openjdk.java.net/jdk8/jdk8/hotspot/file/87ee5ee27509/src/share/vm/classfile/vmSymbols.hpp ,我可以看到内部方法声明如下:
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) \
但是如何找到方法_getByte
的实际实现(我认为是汇编代码)?
but how to find the actually implementation(assembly code I think) of the method _getByte
?
推荐答案
通过在IDE中寻找vmIntrinsics::_getByte
或简单地greping HotSpot源.
By looking for vmIntrinsics::_getByte
in your IDE or simply by grepping HotSpot sources.
但是,找不到汇编代码.通常,将对HotSpot中内在方法的调用转换为JIT编译器的中间表示(IR).在编译的解析阶段,会将相应的IR节点手动添加到节点图中.
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.
由于不同的JIT编译器具有不同的IR,因此需要分别为C1和C2实现内在函数.
Since different JIT compilers have different IRs, intrinsics need to be implemented separately for C1 and C2.
例如,关于_getByte
,
- C1内在函数的实现位于
GraphBuilder::append_unsafe_get_obj
; - 内部函数的C2实现在
LibraryCallKit::inline_unsafe_access
.
这篇关于Java HotSpot中固有方法的汇编实现代码在哪里?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!