hotspot/src/share/vm/oops/instanceKlass.cpp
instanceOop instanceKlass::allocate_instance(TRAPS) {
{- -------------------------------------------
(1) (変数宣言など)
---------------------------------------- -}
assert(!oop_is_instanceMirror(), "wrong allocation path");
bool has_finalizer_flag = has_finalizer(); // Query before possible GC
int size = size_helper(); // Query before forming handle.
KlassHandle h_k(THREAD, as_klassOop());
instanceOop i;
{- -------------------------------------------
(1) CollectedHeap::obj_allocate() を呼び出す
---------------------------------------- -}
i = (instanceOop)CollectedHeap::obj_allocate(h_k, size, CHECK_NULL);
{- -------------------------------------------
(1) finalizer を持つクラスで(= has_finalizer_flag), かつ
finalizer の登録処理をロード時のバイトコード書き換えでやっていなければ(= RegisterFinalizersAtInit が false),
register_finalizer() を呼び出して finalizer を登録しておく.
(See: RegisterFinalizersAtInit)
---------------------------------------- -}
if (has_finalizer_flag && !RegisterFinalizersAtInit) {
i = register_finalizer(i, CHECK_NULL);
}
return i;
}
This document is available under the GNU GENERAL PUBLIC LICENSE Version 2.