hotspot/src/share/vm/oops/klassVtable.cpp
int klassVtable::initialize_from_super(KlassHandle super) {
{- -------------------------------------------
(1) スーパークラスがなければ何もすることはない. ここでリターン
---------------------------------------- -}
if (super.is_null()) {
return 0;
} else {
{- -------------------------------------------
(1) (変数宣言など)
(superVtable は, super 引数で指定されたスーパークラスの vtable)
---------------------------------------- -}
// copy methods from superKlass
// can't inherit from array class, so must be instanceKlass
assert(super->oop_is_instance(), "must be instance klass");
instanceKlass* sk = (instanceKlass*)super()->klass_part();
klassVtable* superVtable = sk->vtable();
assert(superVtable->length() <= _length, "vtable too short");
{- -------------------------------------------
(1) (デバッグ用の処理) (#ifdef ASSERT 時にのみ実行)
---------------------------------------- -}
#ifdef ASSERT
superVtable->verify(tty, true);
#endif
{- -------------------------------------------
(1) klassVtable::copy_vtable_to() を呼んで,
スーパークラスの vtable の中身を
この vtable にコピーする.
---------------------------------------- -}
superVtable->copy_vtable_to(table());
{- -------------------------------------------
(1) (デバッグ用の処理) (#ifndef PRODUCT 時にのみ実行)
---------------------------------------- -}
#ifndef PRODUCT
if (PrintVtables && Verbose) {
ResourceMark rm;
tty->print_cr("copy vtable from %s to %s size %d", sk->internal_name(), klass()->internal_name(), _length);
}
#endif
{- -------------------------------------------
(1) コピーした長さをリターン
---------------------------------------- -}
return superVtable->length();
}
}
This document is available under the GNU GENERAL PUBLIC LICENSE Version 2.