hotspot/src/share/vm/oops/instanceKlass.cpp
changeset 20379 a4c59d30d67d
parent 20284 595a25ab9474
child 20391 7b146c5ebb18
equal deleted inserted replaced
20377:393ee12eccc8 20379:a4c59d30d67d
   454 objArrayOop InstanceKlass::signers() const {
   454 objArrayOop InstanceKlass::signers() const {
   455   // return the signers from the mirror
   455   // return the signers from the mirror
   456   return java_lang_Class::signers(java_mirror());
   456   return java_lang_Class::signers(java_mirror());
   457 }
   457 }
   458 
   458 
   459 volatile oop InstanceKlass::init_lock() const {
   459 oop InstanceKlass::init_lock() const {
   460   // return the init lock from the mirror
   460   // return the init lock from the mirror
   461   return java_lang_Class::init_lock(java_mirror());
   461   return java_lang_Class::init_lock(java_mirror());
   462 }
   462 }
   463 
   463 
   464 void InstanceKlass::eager_initialize_impl(instanceKlassHandle this_oop) {
   464 void InstanceKlass::eager_initialize_impl(instanceKlassHandle this_oop) {
   465   EXCEPTION_MARK;
   465   EXCEPTION_MARK;
   466   volatile oop init_lock = this_oop->init_lock();
   466   oop init_lock = this_oop->init_lock();
   467   ObjectLocker ol(init_lock, THREAD);
   467   ObjectLocker ol(init_lock, THREAD);
   468 
   468 
   469   // abort if someone beat us to the initialization
   469   // abort if someone beat us to the initialization
   470   if (!this_oop->is_not_initialized()) return;  // note: not equivalent to is_initialized()
   470   if (!this_oop->is_not_initialized()) return;  // note: not equivalent to is_initialized()
   471 
   471 
   606                              jt->get_thread_stat()->perf_timers_addr(),
   606                              jt->get_thread_stat()->perf_timers_addr(),
   607                              PerfClassTraceTime::CLASS_LINK);
   607                              PerfClassTraceTime::CLASS_LINK);
   608 
   608 
   609   // verification & rewriting
   609   // verification & rewriting
   610   {
   610   {
   611     volatile oop init_lock = this_oop->init_lock();
   611     oop init_lock = this_oop->init_lock();
   612     ObjectLocker ol(init_lock, THREAD);
   612     ObjectLocker ol(init_lock, THREAD);
   613     // rewritten will have been set if loader constraint error found
   613     // rewritten will have been set if loader constraint error found
   614     // on an earlier link attempt
   614     // on an earlier link attempt
   615     // don't verify or rewrite if already rewritten
   615     // don't verify or rewrite if already rewritten
   616 
   616 
   729   bool wait = false;
   729   bool wait = false;
   730 
   730 
   731   // refer to the JVM book page 47 for description of steps
   731   // refer to the JVM book page 47 for description of steps
   732   // Step 1
   732   // Step 1
   733   {
   733   {
   734     volatile oop init_lock = this_oop->init_lock();
   734     oop init_lock = this_oop->init_lock();
   735     ObjectLocker ol(init_lock, THREAD);
   735     ObjectLocker ol(init_lock, THREAD);
   736 
   736 
   737     Thread *self = THREAD; // it's passed the current thread
   737     Thread *self = THREAD; // it's passed the current thread
   738 
   738 
   739     // Step 2
   739     // Step 2
   877   instanceKlassHandle kh(THREAD, this);
   877   instanceKlassHandle kh(THREAD, this);
   878   set_initialization_state_and_notify_impl(kh, state, CHECK);
   878   set_initialization_state_and_notify_impl(kh, state, CHECK);
   879 }
   879 }
   880 
   880 
   881 void InstanceKlass::set_initialization_state_and_notify_impl(instanceKlassHandle this_oop, ClassState state, TRAPS) {
   881 void InstanceKlass::set_initialization_state_and_notify_impl(instanceKlassHandle this_oop, ClassState state, TRAPS) {
   882   volatile oop init_lock = this_oop->init_lock();
   882   oop init_lock = this_oop->init_lock();
   883   ObjectLocker ol(init_lock, THREAD);
   883   ObjectLocker ol(init_lock, THREAD);
   884   this_oop->set_init_state(state);
   884   this_oop->set_init_state(state);
   885   ol.notify_all(CHECK);
   885   ol.notify_all(CHECK);
   886 }
   886 }
   887 
   887