diff --git a/src/share/vm/gc_implementation/parallelScavenge/psPromotionLAB.cpp b/src/share/vm/gc_implementation/parallelScavenge/psPromotionLAB.cpp index 3569ed7b63df7adc2654ffafc3c89e5f313a5c79..fc05b2e95d810961f590374a8eca2e118571ebd5 100644 --- a/src/share/vm/gc_implementation/parallelScavenge/psPromotionLAB.cpp +++ b/src/share/vm/gc_implementation/parallelScavenge/psPromotionLAB.cpp @@ -102,17 +102,15 @@ void PSPromotionLAB::flush() { _state = flushed; } -bool PSPromotionLAB::unallocate_object(oop obj) { +bool PSPromotionLAB::unallocate_object(HeapWord* obj, size_t obj_size) { assert(Universe::heap()->is_in(obj), "Object outside heap"); if (contains(obj)) { - HeapWord* object_end = (HeapWord*)obj + obj->size(); - assert(object_end <= top(), "Object crosses promotion LAB boundary"); + HeapWord* object_end = obj + obj_size; + assert(object_end == top(), "Not matching last allocation"); - if (object_end == top()) { - set_top((HeapWord*)obj); - return true; - } + set_top(obj); + return true; } return false; diff --git a/src/share/vm/gc_implementation/parallelScavenge/psPromotionLAB.hpp b/src/share/vm/gc_implementation/parallelScavenge/psPromotionLAB.hpp index bed0c0cdeeb34d3d32c940089c2e13812ea9849e..fd6a7bf561b41161963428a0d2ce1d540b18de8d 100644 --- a/src/share/vm/gc_implementation/parallelScavenge/psPromotionLAB.hpp +++ b/src/share/vm/gc_implementation/parallelScavenge/psPromotionLAB.hpp @@ -73,7 +73,7 @@ class PSPromotionLAB : public CHeapObj { bool is_flushed() { return _state == flushed; } - bool unallocate_object(oop obj); + bool unallocate_object(HeapWord* obj, size_t obj_size); // Returns a subregion containing all objects in this space. MemRegion used_region() { return MemRegion(bottom(), top()); } diff --git a/src/share/vm/gc_implementation/parallelScavenge/psPromotionManager.cpp b/src/share/vm/gc_implementation/parallelScavenge/psPromotionManager.cpp index ad58a90fcd8632b79b77b8addc54e0bcafe5cf73..255bb8ee8c714bc31caf5e0c44d18f901cfb5441 100644 --- a/src/share/vm/gc_implementation/parallelScavenge/psPromotionManager.cpp +++ b/src/share/vm/gc_implementation/parallelScavenge/psPromotionManager.cpp @@ -380,10 +380,10 @@ oop PSPromotionManager::copy_to_survivor_space(oop o) { // deallocate it, so we have to test. If the deallocation fails, // overwrite with a filler object. if (new_obj_is_tenured) { - if (!_old_lab.unallocate_object(new_obj)) { + if (!_old_lab.unallocate_object((HeapWord*) new_obj, new_obj_size)) { CollectedHeap::fill_with_object((HeapWord*) new_obj, new_obj_size); } - } else if (!_young_lab.unallocate_object(new_obj)) { + } else if (!_young_lab.unallocate_object((HeapWord*) new_obj, new_obj_size)) { CollectedHeap::fill_with_object((HeapWord*) new_obj, new_obj_size); }