--- old/src/share/vm/gc_implementation/g1/g1ParScanThreadState.cpp 2014-08-25 13:32:28.563320523 -0700 +++ new/src/share/vm/gc_implementation/g1/g1ParScanThreadState.cpp 2014-08-25 13:32:28.479320526 -0700 @@ -160,11 +160,11 @@ (!from_region->is_young() && young_index == 0), "invariant" ); G1CollectorPolicy* g1p = _g1h->g1_policy(); markOop m = old->mark(); - int age = m->has_displaced_mark_helper() ? m->displaced_mark_helper()->age() + uint age = m->has_displaced_mark_helper() ? m->displaced_mark_helper()->age() : m->age(); GCAllocPurpose alloc_purpose = g1p->evacuation_destination(from_region, age, word_sz); - HeapWord* obj_ptr = allocate(alloc_purpose, word_sz); + HeapWord* obj_ptr = allocate(alloc_purpose, old, age); #ifndef PRODUCT // Should this evacuation fail? if (_g1h->evacuation_should_fail()) { @@ -252,15 +252,17 @@ return obj; } -HeapWord* G1ParScanThreadState::allocate_slow(GCAllocPurpose purpose, size_t word_sz) { +HeapWord* G1ParScanThreadState::allocate_slow(GCAllocPurpose purpose, + oop const old, uint age) { HeapWord* obj = NULL; + size_t word_sz = old->size(); size_t gclab_word_size = _g1h->desired_plab_sz(purpose); if (word_sz * 100 < gclab_word_size * ParallelGCBufferWastePct) { G1ParGCAllocBuffer* alloc_buf = alloc_buffer(purpose); add_to_alloc_buffer_waste(alloc_buf->words_remaining()); alloc_buf->retire(false /* end_of_gc */, false /* retain */); - HeapWord* buf = _g1h->par_allocate_during_gc(purpose, gclab_word_size); + HeapWord* buf = _g1h->par_allocate_during_gc(purpose, gclab_word_size, old, age); if (buf == NULL) { return NULL; // Let caller handle allocation failure. } @@ -271,7 +273,7 @@ obj = alloc_buf->allocate(word_sz); assert(obj != NULL, "buffer was definitely big enough..."); } else { - obj = _g1h->par_allocate_during_gc(purpose, word_sz); + obj = _g1h->par_allocate_during_gc(purpose, word_sz, old, age); } return obj; } @@ -287,8 +289,9 @@ } } -HeapWord* G1ParScanThreadState::allocate(GCAllocPurpose purpose, size_t word_sz) { +HeapWord* G1ParScanThreadState::allocate(GCAllocPurpose purpose, oop const old, uint age) { HeapWord* obj = NULL; + size_t word_sz = old->size(); if (purpose == GCAllocForSurvived) { obj = alloc_buffer(GCAllocForSurvived)->allocate_aligned(word_sz, SurvivorAlignmentInBytes); } else { @@ -297,7 +300,7 @@ if (obj != NULL) { return obj; } - return allocate_slow(purpose, word_sz); + return allocate_slow(purpose, old, age); } void G1ParScanThreadState::retire_alloc_buffers() {