src/share/vm/oops/instanceKlass.cpp

changeset 4984
c115fac239eb
parent 4981
d587a5c30bd8
child 5097
92ef81e2f571
     1.1 --- a/src/share/vm/oops/instanceKlass.cpp	Thu Apr 25 03:58:53 2013 -0700
     1.2 +++ b/src/share/vm/oops/instanceKlass.cpp	Thu Apr 25 12:55:49 2013 -0700
     1.3 @@ -419,25 +419,6 @@
     1.4    set_annotations(NULL);
     1.5  }
     1.6  
     1.7 -volatile oop InstanceKlass::init_lock() const {
     1.8 -  volatile oop lock = _init_lock;  // read once
     1.9 -  assert((oop)lock != NULL || !is_not_initialized(), // initialized or in_error state
    1.10 -         "only fully initialized state can have a null lock");
    1.11 -  return lock;
    1.12 -}
    1.13 -
    1.14 -// Set the initialization lock to null so the object can be GC'ed.  Any racing
    1.15 -// threads to get this lock will see a null lock and will not lock.
    1.16 -// That's okay because they all check for initialized state after getting
    1.17 -// the lock and return.
    1.18 -void InstanceKlass::fence_and_clear_init_lock() {
    1.19 -  // make sure previous stores are all done, notably the init_state.
    1.20 -  OrderAccess::storestore();
    1.21 -  klass_oop_store(&_init_lock, NULL);
    1.22 -  assert(!is_not_initialized(), "class must be initialized now");
    1.23 -}
    1.24 -
    1.25 -
    1.26  bool InstanceKlass::should_be_initialized() const {
    1.27    return !is_initialized();
    1.28  }
    1.29 @@ -474,7 +455,7 @@
    1.30  void InstanceKlass::eager_initialize_impl(instanceKlassHandle this_oop) {
    1.31    EXCEPTION_MARK;
    1.32    volatile oop init_lock = this_oop->init_lock();
    1.33 -  ObjectLocker ol(init_lock, THREAD, init_lock != NULL);
    1.34 +  ObjectLocker ol(init_lock, THREAD);
    1.35  
    1.36    // abort if someone beat us to the initialization
    1.37    if (!this_oop->is_not_initialized()) return;  // note: not equivalent to is_initialized()
    1.38 @@ -493,7 +474,6 @@
    1.39    } else {
    1.40      // linking successfull, mark class as initialized
    1.41      this_oop->set_init_state (fully_initialized);
    1.42 -    this_oop->fence_and_clear_init_lock();
    1.43      // trace
    1.44      if (TraceClassInitialization) {
    1.45        ResourceMark rm(THREAD);
    1.46 @@ -620,7 +600,7 @@
    1.47    // verification & rewriting
    1.48    {
    1.49      volatile oop init_lock = this_oop->init_lock();
    1.50 -    ObjectLocker ol(init_lock, THREAD, init_lock != NULL);
    1.51 +    ObjectLocker ol(init_lock, THREAD);
    1.52      // rewritten will have been set if loader constraint error found
    1.53      // on an earlier link attempt
    1.54      // don't verify or rewrite if already rewritten
    1.55 @@ -743,7 +723,7 @@
    1.56    // Step 1
    1.57    {
    1.58      volatile oop init_lock = this_oop->init_lock();
    1.59 -    ObjectLocker ol(init_lock, THREAD, init_lock != NULL);
    1.60 +    ObjectLocker ol(init_lock, THREAD);
    1.61  
    1.62      Thread *self = THREAD; // it's passed the current thread
    1.63  
    1.64 @@ -891,9 +871,8 @@
    1.65  
    1.66  void InstanceKlass::set_initialization_state_and_notify_impl(instanceKlassHandle this_oop, ClassState state, TRAPS) {
    1.67    volatile oop init_lock = this_oop->init_lock();
    1.68 -  ObjectLocker ol(init_lock, THREAD, init_lock != NULL);
    1.69 +  ObjectLocker ol(init_lock, THREAD);
    1.70    this_oop->set_init_state(state);
    1.71 -  this_oop->fence_and_clear_init_lock();
    1.72    ol.notify_all(CHECK);
    1.73  }
    1.74  
    1.75 @@ -2860,7 +2839,7 @@
    1.76    st->print(BULLET"protection domain: "); ((InstanceKlass*)this)->protection_domain()->print_value_on(st); st->cr();
    1.77    st->print(BULLET"host class:        "); host_klass()->print_value_on_maybe_null(st); st->cr();
    1.78    st->print(BULLET"signers:           "); signers()->print_value_on(st);               st->cr();
    1.79 -  st->print(BULLET"init_lock:         "); ((oop)_init_lock)->print_value_on(st);             st->cr();
    1.80 +  st->print(BULLET"init_lock:         "); ((oop)_init_lock)->print_value_on(st);       st->cr();
    1.81    if (source_file_name() != NULL) {
    1.82      st->print(BULLET"source file:       ");
    1.83      source_file_name()->print_value_on(st);

mercurial