8215097: Do not create NonJavaThreads before BarrierSet

G1 and CMS delay worker thread creation until BarrierSet exists.

Reviewed-by: dholmes, tschatzl
This commit is contained in:
Kim Barrett 2018-12-11 18:00:17 -05:00
parent c2364ff9e0
commit 13b56530f4
5 changed files with 32 additions and 52 deletions

View file

@ -306,15 +306,19 @@ Thread::Thread() {
}
#endif // ASSERT
// Notify the barrier set that a thread is being created. Note that some
// threads are created before a barrier set is available. The call to
// BarrierSet::on_thread_create() for these threads is therefore deferred
// Notify the barrier set that a thread is being created. The initial
// thread is created before the barrier set is available. The call to
// BarrierSet::on_thread_create() for this thread is therefore deferred
// to BarrierSet::set_barrier_set().
BarrierSet* const barrier_set = BarrierSet::barrier_set();
if (barrier_set != NULL) {
barrier_set->on_thread_create(this);
} else {
DEBUG_ONLY(Threads::inc_threads_before_barrier_set();)
#ifdef ASSERT
static bool initial_thread_created = false;
assert(!initial_thread_created, "creating thread before barrier set");
initial_thread_created = true;
#endif // ASSERT
}
}
@ -3395,7 +3399,6 @@ size_t JavaThread::_stack_size_at_create = 0;
#ifdef ASSERT
bool Threads::_vm_complete = false;
size_t Threads::_threads_before_barrier_set = 0;
#endif
static inline void *prefetch_and_load_ptr(void **addr, intx prefetch_interval) {