534 }
535
536 void CollectedHeap::ensure_parsability(bool retire_tlabs) {
537 // The second disjunct in the assertion below makes a concession
538 // for the start-up verification done while the VM is being
539 // created. Callers be careful that you know that mutators
540 // aren't going to interfere -- for instance, this is permissible
541 // if we are still single-threaded and have either not yet
542 // started allocating (nothing much to verify) or we have
543 // started allocating but are now a full-fledged JavaThread
544 // (and have thus made our TLAB's) available for filling.
545 assert(SafepointSynchronize::is_at_safepoint() ||
546 !is_init_completed(),
547 "Should only be called at a safepoint or at start-up"
548 " otherwise concurrent mutator activity may make heap "
549 " unparsable again");
550 const bool use_tlab = UseTLAB;
551 const bool deferred = _defer_initial_card_mark;
552 // The main thread starts allocating via a TLAB even before it
553 // has added itself to the threads list at vm boot-up.
554 ThreadsListHandle tlh;
555 assert(!use_tlab || tlh.length() > 0,
556 "Attempt to fill tlabs before main thread has been added"
557 " to threads list is doomed to failure!");
558 JavaThreadIterator jti(tlh.list());
559 for (JavaThread *thread = jti.first(); thread != NULL; thread = jti.next()) {
560 if (use_tlab) thread->tlab().make_parsable(retire_tlabs);
561 #if defined(COMPILER2) || INCLUDE_JVMCI
562 // The deferred store barriers must all have been flushed to the
563 // card-table (or other remembered set structure) before GC starts
564 // processing the card-table (or other remembered set).
565 if (deferred) flush_deferred_store_barrier(thread);
566 #else
567 assert(!deferred, "Should be false");
568 assert(thread->deferred_card_mark().is_empty(), "Should be empty");
569 #endif
570 }
571 }
572
573 void CollectedHeap::accumulate_statistics_all_tlabs() {
574 if (UseTLAB) {
575 assert(SafepointSynchronize::is_at_safepoint() ||
576 !is_init_completed(),
577 "should only accumulate statistics on tlabs at safepoint");
578
579 ThreadLocalAllocBuffer::accumulate_statistics_before_gc();
|
534 }
535
536 void CollectedHeap::ensure_parsability(bool retire_tlabs) {
537 // The second disjunct in the assertion below makes a concession
538 // for the start-up verification done while the VM is being
539 // created. Callers be careful that you know that mutators
540 // aren't going to interfere -- for instance, this is permissible
541 // if we are still single-threaded and have either not yet
542 // started allocating (nothing much to verify) or we have
543 // started allocating but are now a full-fledged JavaThread
544 // (and have thus made our TLAB's) available for filling.
545 assert(SafepointSynchronize::is_at_safepoint() ||
546 !is_init_completed(),
547 "Should only be called at a safepoint or at start-up"
548 " otherwise concurrent mutator activity may make heap "
549 " unparsable again");
550 const bool use_tlab = UseTLAB;
551 const bool deferred = _defer_initial_card_mark;
552 // The main thread starts allocating via a TLAB even before it
553 // has added itself to the threads list at vm boot-up.
554 JavaThreadIteratorWithHandle jtiwh;
555 assert(!use_tlab || jtiwh.length() > 0,
556 "Attempt to fill tlabs before main thread has been added"
557 " to threads list is doomed to failure!");
558 for (; JavaThread *thread = jtiwh.next(); ) {
559 if (use_tlab) thread->tlab().make_parsable(retire_tlabs);
560 #if defined(COMPILER2) || INCLUDE_JVMCI
561 // The deferred store barriers must all have been flushed to the
562 // card-table (or other remembered set structure) before GC starts
563 // processing the card-table (or other remembered set).
564 if (deferred) flush_deferred_store_barrier(thread);
565 #else
566 assert(!deferred, "Should be false");
567 assert(thread->deferred_card_mark().is_empty(), "Should be empty");
568 #endif
569 }
570 }
571
572 void CollectedHeap::accumulate_statistics_all_tlabs() {
573 if (UseTLAB) {
574 assert(SafepointSynchronize::is_at_safepoint() ||
575 !is_init_completed(),
576 "should only accumulate statistics on tlabs at safepoint");
577
578 ThreadLocalAllocBuffer::accumulate_statistics_before_gc();
|