src/hotspot/share/oops/instanceKlass.cpp
changeset 55254 36cb654a690f
parent 54927 1512d88b24c6
child 57906 e17f768b3b71
equal deleted inserted replaced
55253:3c905e67e380 55254:36cb654a690f
   436   _nest_host_index(0),
   436   _nest_host_index(0),
   437   _nest_host(NULL),
   437   _nest_host(NULL),
   438   _static_field_size(parser.static_field_size()),
   438   _static_field_size(parser.static_field_size()),
   439   _nonstatic_oop_map_size(nonstatic_oop_map_size(parser.total_oop_map_count())),
   439   _nonstatic_oop_map_size(nonstatic_oop_map_size(parser.total_oop_map_count())),
   440   _itable_len(parser.itable_size()),
   440   _itable_len(parser.itable_size()),
       
   441   _init_thread(NULL),
       
   442   _init_state(allocated),
   441   _reference_type(parser.reference_type())
   443   _reference_type(parser.reference_type())
   442 {
   444 {
   443   set_vtable_length(parser.vtable_size());
   445   set_vtable_length(parser.vtable_size());
   444   set_kind(kind);
   446   set_kind(kind);
   445   set_access_flags(parser.access_flags());
   447   set_access_flags(parser.access_flags());
  1069 
  1071 
  1070 void InstanceKlass::set_initialization_state_and_notify(ClassState state, TRAPS) {
  1072 void InstanceKlass::set_initialization_state_and_notify(ClassState state, TRAPS) {
  1071   Handle h_init_lock(THREAD, init_lock());
  1073   Handle h_init_lock(THREAD, init_lock());
  1072   if (h_init_lock() != NULL) {
  1074   if (h_init_lock() != NULL) {
  1073     ObjectLocker ol(h_init_lock, THREAD);
  1075     ObjectLocker ol(h_init_lock, THREAD);
       
  1076     set_init_thread(NULL); // reset _init_thread before changing _init_state
  1074     set_init_state(state);
  1077     set_init_state(state);
  1075     fence_and_clear_init_lock();
  1078     fence_and_clear_init_lock();
  1076     ol.notify_all(CHECK);
  1079     ol.notify_all(CHECK);
  1077   } else {
  1080   } else {
  1078     assert(h_init_lock() != NULL, "The initialization state should never be set twice");
  1081     assert(h_init_lock() != NULL, "The initialization state should never be set twice");
       
  1082     set_init_thread(NULL); // reset _init_thread before changing _init_state
  1079     set_init_state(state);
  1083     set_init_state(state);
  1080   }
  1084   }
  1081 }
  1085 }
  1082 
  1086 
  1083 Klass* InstanceKlass::implementor() const {
  1087 Klass* InstanceKlass::implementor() const {
  3708 #ifdef ASSERT
  3712 #ifdef ASSERT
  3709   bool good_state = is_shared() ? (_init_state <= state)
  3713   bool good_state = is_shared() ? (_init_state <= state)
  3710                                                : (_init_state < state);
  3714                                                : (_init_state < state);
  3711   assert(good_state || state == allocated, "illegal state transition");
  3715   assert(good_state || state == allocated, "illegal state transition");
  3712 #endif
  3716 #endif
       
  3717   assert(_init_thread == NULL, "should be cleared before state change");
  3713   _init_state = (u1)state;
  3718   _init_state = (u1)state;
  3714 }
  3719 }
  3715 
  3720 
  3716 #if INCLUDE_JVMTI
  3721 #if INCLUDE_JVMTI
  3717 
  3722