hotspot/src/share/vm/prims/jni.cpp
JNI_QUICK_ENTRY(jboolean, jni_IsAssignableFrom(JNIEnv *env, jclass sub, jclass super))
{- -------------------------------------------
(1) (デバッグ用の処理)
(See: JNIWrapper)
---------------------------------------- -}
JNIWrapper("IsSubclassOf");
{- -------------------------------------------
(1) (DTrace のフック点)
---------------------------------------- -}
DTRACE_PROBE3(hotspot_jni, IsAssignableFrom__entry, env, sub, super);
{- -------------------------------------------
(1) (変数宣言など)
---------------------------------------- -}
oop sub_mirror = JNIHandles::resolve_non_null(sub);
oop super_mirror = JNIHandles::resolve_non_null(super);
{- -------------------------------------------
(1) もしどちらかがプリミティブ型であれば, 返値は両方の型が一致するかどうかで判定.
(一致するなら true, しないなら false)
---------------------------------------- -}
if (java_lang_Class::is_primitive(sub_mirror) ||
java_lang_Class::is_primitive(super_mirror)) {
jboolean ret = (sub_mirror == super_mirror);
{- -------------------------------------------
(1.1) (DTrace のフック点)
---------------------------------------- -}
DTRACE_PROBE1(hotspot_jni, IsAssignableFrom__return, ret);
return ret;
}
{- -------------------------------------------
(1) どちらかもプリミティブ型でなければ, Klass::is_subtype_of() の結果を返値とする.
---------------------------------------- -}
klassOop sub_klass = java_lang_Class::as_klassOop(sub_mirror);
klassOop super_klass = java_lang_Class::as_klassOop(super_mirror);
assert(sub_klass != NULL && super_klass != NULL, "invalid arguments to jni_IsAssignableFrom");
jboolean ret = Klass::cast(sub_klass)->is_subtype_of(super_klass) ?
JNI_TRUE : JNI_FALSE;
{- -------------------------------------------
(1) (DTrace のフック点)
---------------------------------------- -}
DTRACE_PROBE1(hotspot_jni, IsAssignableFrom__return, ret);
{- -------------------------------------------
(1) 結果をリターン
---------------------------------------- -}
return ret;
JNI_END
This document is available under the GNU GENERAL PUBLIC LICENSE Version 2.