< prev index next >

src/share/vm/gc/shared/collectedHeap.cpp

Print this page




 333     // ensure that the returned space is not considered parsable by
 334     // any concurrent GC thread.
 335     size_t hdr_size = oopDesc::header_size();
 336     Copy::fill_to_words(obj + hdr_size, new_tlab_size - hdr_size, badHeapWordVal);
 337 #endif // ASSERT
 338   }
 339   thread->tlab().fill(obj, obj + size, new_tlab_size);
 340   return obj;
 341 }
 342 
 343 void CollectedHeap::flush_deferred_store_barrier(JavaThread* thread) {
 344   MemRegion deferred = thread->deferred_card_mark();
 345   if (!deferred.is_empty()) {
 346     assert(_defer_initial_card_mark, "Otherwise should be empty");
 347     {
 348       // Verify that the storage points to a parsable object in heap
 349       DEBUG_ONLY(oop old_obj = oop(deferred.start());)
 350       assert(is_in(old_obj), "Not in allocated heap");
 351       assert(!can_elide_initializing_store_barrier(old_obj),
 352              "Else should have been filtered in new_store_pre_barrier()");
 353       assert(old_obj->is_oop(true), "Not an oop");
 354       assert(deferred.word_size() == (size_t)(old_obj->size()),
 355              "Mismatch: multiple objects?");
 356     }
 357     BarrierSet* bs = barrier_set();
 358     assert(bs->has_write_region_opt(), "No write_region() on BarrierSet");
 359     bs->write_region(deferred);
 360     // "Clear" the deferred_card_mark field
 361     thread->set_deferred_card_mark(MemRegion());
 362   }
 363   assert(thread->deferred_card_mark().is_empty(), "invariant");
 364 }
 365 
 366 size_t CollectedHeap::max_tlab_size() const {
 367   // TLABs can't be bigger than we can fill with a int[Integer.MAX_VALUE].
 368   // This restriction could be removed by enabling filling with multiple arrays.
 369   // If we compute that the reasonable way as
 370   //    header_size + ((sizeof(jint) * max_jint) / HeapWordSize)
 371   // we'll overflow on the multiply, so we do the divide first.
 372   // We actually lose a little by dividing first,
 373   // but that just makes the TLAB  somewhat smaller than the biggest array,




 333     // ensure that the returned space is not considered parsable by
 334     // any concurrent GC thread.
 335     size_t hdr_size = oopDesc::header_size();
 336     Copy::fill_to_words(obj + hdr_size, new_tlab_size - hdr_size, badHeapWordVal);
 337 #endif // ASSERT
 338   }
 339   thread->tlab().fill(obj, obj + size, new_tlab_size);
 340   return obj;
 341 }
 342 
 343 void CollectedHeap::flush_deferred_store_barrier(JavaThread* thread) {
 344   MemRegion deferred = thread->deferred_card_mark();
 345   if (!deferred.is_empty()) {
 346     assert(_defer_initial_card_mark, "Otherwise should be empty");
 347     {
 348       // Verify that the storage points to a parsable object in heap
 349       DEBUG_ONLY(oop old_obj = oop(deferred.start());)
 350       assert(is_in(old_obj), "Not in allocated heap");
 351       assert(!can_elide_initializing_store_barrier(old_obj),
 352              "Else should have been filtered in new_store_pre_barrier()");
 353       assert(oopDesc::is_oop(old_obj, true), "Not an oop");
 354       assert(deferred.word_size() == (size_t)(old_obj->size()),
 355              "Mismatch: multiple objects?");
 356     }
 357     BarrierSet* bs = barrier_set();
 358     assert(bs->has_write_region_opt(), "No write_region() on BarrierSet");
 359     bs->write_region(deferred);
 360     // "Clear" the deferred_card_mark field
 361     thread->set_deferred_card_mark(MemRegion());
 362   }
 363   assert(thread->deferred_card_mark().is_empty(), "invariant");
 364 }
 365 
 366 size_t CollectedHeap::max_tlab_size() const {
 367   // TLABs can't be bigger than we can fill with a int[Integer.MAX_VALUE].
 368   // This restriction could be removed by enabling filling with multiple arrays.
 369   // If we compute that the reasonable way as
 370   //    header_size + ((sizeof(jint) * max_jint) / HeapWordSize)
 371   // we'll overflow on the multiply, so we do the divide first.
 372   // We actually lose a little by dividing first,
 373   // but that just makes the TLAB  somewhat smaller than the biggest array,


< prev index next >