changeset 6457:b7e42ada4898

8036672: G1: alloc_purpose in copy_to_survivor_space() used incorrectly Reviewed-by: brutisso, tschatzl
author pliden
date Mon, 17 Mar 2014 15:18:38 +0100
parents d60ecdb2773e
children f53edbc2b728
files src/share/vm/gc_implementation/g1/g1CollectedHeap.cpp
diffstat 1 files changed, 6 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/src/share/vm/gc_implementation/g1/g1CollectedHeap.cpp	Thu Feb 06 14:12:43 2014 +0100
+++ b/src/share/vm/gc_implementation/g1/g1CollectedHeap.cpp	Mon Mar 17 15:18:38 2014 +0100
@@ -4743,6 +4743,12 @@
   oop forward_ptr = old->forward_to_atomic(obj);
   if (forward_ptr == NULL) {
     Copy::aligned_disjoint_words((HeapWord*) old, obj_ptr, word_sz);
+
+    // alloc_purpose is just a hint to allocate() above, recheck the type of region
+    // we actually allocated from and update alloc_purpose accordingly
+    HeapRegion* to_region = _g1h->heap_region_containing_raw(obj_ptr);
+    alloc_purpose = to_region->is_young() ? GCAllocForSurvived : GCAllocForTenured;
+
     if (g1p->track_object_age(alloc_purpose)) {
       // We could simply do obj->incr_age(). However, this causes a
       // performance issue. obj->incr_age() will first check whether