hotspot/src/share/vm/oops/constantPoolOop.cpp
int constantPoolOopDesc::impl_klass_ref_index_at(int which, bool uncached) {
{- -------------------------------------------
(1) (guarantee) (≈ assert)
---------------------------------------- -}
guarantee(!constantPoolCacheOopDesc::is_secondary_index(which),
"an invokedynamic instruction does not have a klass");
{- -------------------------------------------
(1) (変数宣言など)
(i は, 対象の constant pool エントリの index.
なお, 引数として constant pool の index ではなく
constant pool cache の index が渡された場合は,
constantPoolOopDesc::remap_instruction_operand_from_cache() で変換する)
---------------------------------------- -}
int i = which;
if (!uncached && cache() != NULL) {
// change byte-ordering and go via cache
i = remap_instruction_operand_from_cache(which);
}
{- -------------------------------------------
(1) (assert)
(この関数は CONSTANT_Fieldref, CONSTANT_Methodre, もしくは CONSTANT_InterfaceMethodref の処理用)
---------------------------------------- -}
assert(tag_at(i).is_field_or_method(), "Corrupted constant pool");
{- -------------------------------------------
(1) int_at_addr() で, i 番目のエントリの constant pool 情報を取得する.
---------------------------------------- -}
jint ref_index = *int_at_addr(i);
{- -------------------------------------------
(1) 取得した constant pool 情報から class_index 部分を取り出し, リターン.
(参考: class_index と name_and_type index からなる constant pool 情報は,
class_index を下位16bit に埋め込む形で constantPoolOop 内に納めている.
(See: field_at_put() 等))
---------------------------------------- -}
return extract_low_short_from_int(ref_index);
}
This document is available under the GNU GENERAL PUBLIC LICENSE Version 2.