Up Top

Class のロード/リンク/初期化 : リンク処理 (1) : リンク処理の開始点


概要(Summary)

クラスのリンク処理は以下の契機で開始される.

(初期化前にはリンクされている必要があるため, 念のため常にリンク処理が呼び出される)

処理の流れ (概要)(Execution Flows : Summary)

起動中の標準ライブラリクラスの初期化処理

(HotSpot の起動時処理) (See: here for details)
-> Threads::create_vm()
   -> init_globals()
      -> universe_post_init()
         -> instanceKlass::link_class()
            -> (See: here for details)
         -> instanceKlass::link_class_or_fail()
            -> instanceKlass::link_class_impl()
               -> (See: here for details)

クラスの初期化処理

(See: here for details)
-> instanceKlass::initialize()
   -> instanceKlass::initialize_impl()
      -> instanceKlass::link_class()
         -> (See: here for details)

Reflection 処理

(See: here for details)
-> JVM_GetClassDeclaredFields()
   -> instanceKlass::link_class()
      -> (See: here for details)
  
(See: here for details)
-> JVM_GetClassDeclaredMethods()
   -> instanceKlass::link_class()
      -> (See: here for details)
  
(See: here for details)
-> JVM_GetClassDeclaredConstructors()
   -> instanceKlass::link_class()
      -> (See: here for details)
  
(See: here for details)
-> Reflection::reflect_field()
   -> instanceKlass::link_class()
      -> (See: here for details)
  
(See: here for details)
-> Reflection::reflect_fields()
   -> instanceKlass::link_class()
      -> (See: here for details)
  
(See: here for details)
-> Reflection::reflect_method()
   -> instanceKlass::link_class()
      -> (See: here for details)
  
(See: here for details)
-> Reflection::reflect_methods()
   -> instanceKlass::link_class()
      -> (See: here for details)
  
(See: here for details)
-> Reflection::reflect_constructor()
   -> instanceKlass::link_class()
      -> (See: here for details)
  
(See: here for details)
-> Reflection::reflect_constructors()
   -> instanceKlass::link_class()
      -> (See: here for details)

JVMTI の RedefineClasses() 処理

(See: here for details)
-> VM_RedefineClasses::load_new_class_versions()
   -> instanceKlass::link_class()
      -> (See: here for details)

MethodHandles 関係の処理(#TODO)

MethodHandles::resolve_MemberName()
-> instanceKlass::link_class()
    -> (See: here for details)

MethodHandles::init_DirectMethodHandle()
-> instanceKlass::link_class()
    -> (See: here for details)

Class Data Sharing (CDS) のダンプ出力処理

(See: here for details)
-> GenCollectedHeap::preload_and_dump()
   -> instanceKlass::link_class()
      -> (See: here for details)

(See: here for details)
-> LinkClassesClosure::do_object()
   -> instanceKlass::link_class()
      -> (See: here for details)

デバッグ用の処理 (EagerInitialization オプションの処理)

(See: here for details)
-> instanceKlass::eager_initialize()
   -> instanceKlass::eager_initialize_impl() @ hotspot/src/share/vm/oops/instanceKlass.cpp
      -> instanceKlass::link_class_impl()
         -> (See: here for details)

This document is available under the GNU GENERAL PUBLIC LICENSE Version 2.