# HG changeset patch # User stefank # Date 1315836590 -7200 # Node ID c63b928b212bc0ea2d2db473e29044d1df16fe9a # Parent 81aa07130d301848e4b98e849963b8625033f447 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: ysr, brutisso diff -r 81aa07130d30 -r c63b928b212b src/share/vm/gc_implementation/parallelScavenge/psPromotionLAB.cpp --- a/src/share/vm/gc_implementation/parallelScavenge/psPromotionLAB.cpp Mon Oct 03 19:04:14 2011 -0400 +++ b/src/share/vm/gc_implementation/parallelScavenge/psPromotionLAB.cpp Mon Sep 12 16:09:50 2011 +0200 @@ -102,17 +102,15 @@ _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 -r 81aa07130d30 -r c63b928b212b src/share/vm/gc_implementation/parallelScavenge/psPromotionLAB.hpp --- a/src/share/vm/gc_implementation/parallelScavenge/psPromotionLAB.hpp Mon Oct 03 19:04:14 2011 -0400 +++ b/src/share/vm/gc_implementation/parallelScavenge/psPromotionLAB.hpp Mon Sep 12 16:09:50 2011 +0200 @@ -73,7 +73,7 @@ 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 -r 81aa07130d30 -r c63b928b212b src/share/vm/gc_implementation/parallelScavenge/psPromotionManager.cpp --- a/src/share/vm/gc_implementation/parallelScavenge/psPromotionManager.cpp Mon Oct 03 19:04:14 2011 -0400 +++ b/src/share/vm/gc_implementation/parallelScavenge/psPromotionManager.cpp Mon Sep 12 16:09:50 2011 +0200 @@ -380,10 +380,10 @@ // 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); }