Mon, 12 Sep 2011 16:09:50 +0200
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
1.1 --- a/src/share/vm/gc_implementation/parallelScavenge/psPromotionLAB.cpp Mon Oct 03 19:04:14 2011 -0400 1.2 +++ b/src/share/vm/gc_implementation/parallelScavenge/psPromotionLAB.cpp Mon Sep 12 16:09:50 2011 +0200 1.3 @@ -102,17 +102,15 @@ 1.4 _state = flushed; 1.5 } 1.6 1.7 -bool PSPromotionLAB::unallocate_object(oop obj) { 1.8 +bool PSPromotionLAB::unallocate_object(HeapWord* obj, size_t obj_size) { 1.9 assert(Universe::heap()->is_in(obj), "Object outside heap"); 1.10 1.11 if (contains(obj)) { 1.12 - HeapWord* object_end = (HeapWord*)obj + obj->size(); 1.13 - assert(object_end <= top(), "Object crosses promotion LAB boundary"); 1.14 + HeapWord* object_end = obj + obj_size; 1.15 + assert(object_end == top(), "Not matching last allocation"); 1.16 1.17 - if (object_end == top()) { 1.18 - set_top((HeapWord*)obj); 1.19 - return true; 1.20 - } 1.21 + set_top(obj); 1.22 + return true; 1.23 } 1.24 1.25 return false;
2.1 --- a/src/share/vm/gc_implementation/parallelScavenge/psPromotionLAB.hpp Mon Oct 03 19:04:14 2011 -0400 2.2 +++ b/src/share/vm/gc_implementation/parallelScavenge/psPromotionLAB.hpp Mon Sep 12 16:09:50 2011 +0200 2.3 @@ -73,7 +73,7 @@ 2.4 2.5 bool is_flushed() { return _state == flushed; } 2.6 2.7 - bool unallocate_object(oop obj); 2.8 + bool unallocate_object(HeapWord* obj, size_t obj_size); 2.9 2.10 // Returns a subregion containing all objects in this space. 2.11 MemRegion used_region() { return MemRegion(bottom(), top()); }
3.1 --- a/src/share/vm/gc_implementation/parallelScavenge/psPromotionManager.cpp Mon Oct 03 19:04:14 2011 -0400 3.2 +++ b/src/share/vm/gc_implementation/parallelScavenge/psPromotionManager.cpp Mon Sep 12 16:09:50 2011 +0200 3.3 @@ -380,10 +380,10 @@ 3.4 // deallocate it, so we have to test. If the deallocation fails, 3.5 // overwrite with a filler object. 3.6 if (new_obj_is_tenured) { 3.7 - if (!_old_lab.unallocate_object(new_obj)) { 3.8 + if (!_old_lab.unallocate_object((HeapWord*) new_obj, new_obj_size)) { 3.9 CollectedHeap::fill_with_object((HeapWord*) new_obj, new_obj_size); 3.10 } 3.11 - } else if (!_young_lab.unallocate_object(new_obj)) { 3.12 + } else if (!_young_lab.unallocate_object((HeapWord*) new_obj, new_obj_size)) { 3.13 CollectedHeap::fill_with_object((HeapWord*) new_obj, new_obj_size); 3.14 } 3.15