--- a/src/hotspot/share/oops/instanceKlass.cpp Thu Jun 06 13:46:01 2019 +0300
+++ b/src/hotspot/share/oops/instanceKlass.cpp Thu Jun 06 13:46:03 2019 +0300
@@ -438,6 +438,8 @@
_static_field_size(parser.static_field_size()),
_nonstatic_oop_map_size(nonstatic_oop_map_size(parser.total_oop_map_count())),
_itable_len(parser.itable_size()),
+ _init_thread(NULL),
+ _init_state(allocated),
_reference_type(parser.reference_type())
{
set_vtable_length(parser.vtable_size());
@@ -1071,11 +1073,13 @@
Handle h_init_lock(THREAD, init_lock());
if (h_init_lock() != NULL) {
ObjectLocker ol(h_init_lock, THREAD);
+ set_init_thread(NULL); // reset _init_thread before changing _init_state
set_init_state(state);
fence_and_clear_init_lock();
ol.notify_all(CHECK);
} else {
assert(h_init_lock() != NULL, "The initialization state should never be set twice");
+ set_init_thread(NULL); // reset _init_thread before changing _init_state
set_init_state(state);
}
}
@@ -3710,6 +3714,7 @@
: (_init_state < state);
assert(good_state || state == allocated, "illegal state transition");
#endif
+ assert(_init_thread == NULL, "should be cleared before state change");
_init_state = (u1)state;
}