src/share/vm/gc_implementation/parallelScavenge/psPromotionManager.cpp

Print this page
rev 2661 : 7021322: assert(object_end <= top()) failed: Object crosses promotion LAB boundary
Summary: Pass the same object size value to both allocate and unallocate_object
Reviewed-by: duke


 363       // So, the is->objArray() test would be very infrequent.
 364       if (new_obj_size > _min_array_size_for_chunking &&
 365           new_obj->is_objArray() &&
 366           PSChunkLargeArrays) {
 367         // we'll chunk it
 368         oop* const masked_o = mask_chunked_array_oop(o);
 369         push_depth(masked_o);
 370         TASKQUEUE_STATS_ONLY(++_arrays_chunked; ++_masked_pushes);
 371       } else {
 372         // we'll just push its contents
 373         new_obj->push_contents(this);
 374       }
 375     }  else {
 376       // We lost, someone else "owns" this object
 377       guarantee(o->is_forwarded(), "Object must be forwarded if the cas failed.");
 378 
 379       // Try to deallocate the space.  If it was directly allocated we cannot
 380       // deallocate it, so we have to test.  If the deallocation fails,
 381       // overwrite with a filler object.
 382       if (new_obj_is_tenured) {
 383         if (!_old_lab.unallocate_object(new_obj)) {
 384           CollectedHeap::fill_with_object((HeapWord*) new_obj, new_obj_size);
 385         }
 386       } else if (!_young_lab.unallocate_object(new_obj)) {
 387         CollectedHeap::fill_with_object((HeapWord*) new_obj, new_obj_size);
 388       }
 389 
 390       // don't update this before the unallocation!
 391       new_obj = o->forwardee();
 392     }
 393   } else {
 394     assert(o->is_forwarded(), "Sanity");
 395     new_obj = o->forwardee();
 396   }
 397 
 398 #ifdef DEBUG
 399   // This code must come after the CAS test, or it will print incorrect
 400   // information.
 401   if (TraceScavenge) {
 402     gclog_or_tty->print_cr("{%s %s " PTR_FORMAT " -> " PTR_FORMAT " (" SIZE_FORMAT ")}",
 403        PSScavenge::should_scavenge(&new_obj) ? "copying" : "tenuring",
 404        new_obj->blueprint()->internal_name(), o, new_obj, new_obj->size());
 405   }
 406 #endif




 363       // So, the is->objArray() test would be very infrequent.
 364       if (new_obj_size > _min_array_size_for_chunking &&
 365           new_obj->is_objArray() &&
 366           PSChunkLargeArrays) {
 367         // we'll chunk it
 368         oop* const masked_o = mask_chunked_array_oop(o);
 369         push_depth(masked_o);
 370         TASKQUEUE_STATS_ONLY(++_arrays_chunked; ++_masked_pushes);
 371       } else {
 372         // we'll just push its contents
 373         new_obj->push_contents(this);
 374       }
 375     }  else {
 376       // We lost, someone else "owns" this object
 377       guarantee(o->is_forwarded(), "Object must be forwarded if the cas failed.");
 378 
 379       // Try to deallocate the space.  If it was directly allocated we cannot
 380       // deallocate it, so we have to test.  If the deallocation fails,
 381       // overwrite with a filler object.
 382       if (new_obj_is_tenured) {
 383         if (!_old_lab.unallocate_object((HeapWord*) new_obj, new_obj_size)) {
 384           CollectedHeap::fill_with_object((HeapWord*) new_obj, new_obj_size);
 385         }
 386       } else if (!_young_lab.unallocate_object((HeapWord*) new_obj, new_obj_size)) {
 387         CollectedHeap::fill_with_object((HeapWord*) new_obj, new_obj_size);
 388       }
 389 
 390       // don't update this before the unallocation!
 391       new_obj = o->forwardee();
 392     }
 393   } else {
 394     assert(o->is_forwarded(), "Sanity");
 395     new_obj = o->forwardee();
 396   }
 397 
 398 #ifdef DEBUG
 399   // This code must come after the CAS test, or it will print incorrect
 400   // information.
 401   if (TraceScavenge) {
 402     gclog_or_tty->print_cr("{%s %s " PTR_FORMAT " -> " PTR_FORMAT " (" SIZE_FORMAT ")}",
 403        PSScavenge::should_scavenge(&new_obj) ? "copying" : "tenuring",
 404        new_obj->blueprint()->internal_name(), o, new_obj, new_obj->size());
 405   }
 406 #endif