src/share/vm/oops/instanceKlass.cpp

changeset 9806
758c07667682
parent 9756
2be326848943
parent 9799
2c1e9fab6964
child 9931
fd44df5e3bc3
     1.1 --- a/src/share/vm/oops/instanceKlass.cpp	Tue Feb 04 17:38:01 2020 +0800
     1.2 +++ b/src/share/vm/oops/instanceKlass.cpp	Tue Feb 04 18:13:14 2020 +0800
     1.3 @@ -294,6 +294,7 @@
     1.4    set_has_unloaded_dependent(false);
     1.5    set_init_state(InstanceKlass::allocated);
     1.6    set_init_thread(NULL);
     1.7 +  set_init_state(allocated);
     1.8    set_reference_type(rt);
     1.9    set_oop_map_cache(NULL);
    1.10    set_jni_ids(NULL);
    1.11 @@ -978,11 +979,13 @@
    1.12    oop init_lock = this_oop->init_lock();
    1.13    if (init_lock != NULL) {
    1.14      ObjectLocker ol(init_lock, THREAD);
    1.15 +    this_oop->set_init_thread(NULL); // reset _init_thread before changing _init_state
    1.16      this_oop->set_init_state(state);
    1.17      this_oop->fence_and_clear_init_lock();
    1.18      ol.notify_all(CHECK);
    1.19    } else {
    1.20      assert(init_lock != NULL, "The initialization state should never be set twice");
    1.21 +    this_oop->set_init_thread(NULL); // reset _init_thread before changing _init_state
    1.22      this_oop->set_init_state(state);
    1.23    }
    1.24  }
    1.25 @@ -3602,6 +3605,7 @@
    1.26    bool good_state = is_shared() ? (_init_state <= state)
    1.27                                                 : (_init_state < state);
    1.28    assert(good_state || state == allocated, "illegal state transition");
    1.29 +  assert(_init_thread == NULL, "should be cleared before state change");
    1.30    _init_state = (u1)state;
    1.31  }
    1.32  #endif

mercurial