< prev index next >

src/share/vm/gc_implementation/g1/g1ParScanThreadState.cpp

Print this page




 209 
 210   uint age = 0;
 211   InCSetState dest_state = next_state(state, old_mark, age);
 212   HeapWord* obj_ptr = _g1_par_allocator->plab_allocate(dest_state, word_sz, context);
 213 
 214   // PLAB allocations should succeed most of the time, so we'll
 215   // normally check against NULL once and that's it.
 216   if (obj_ptr == NULL) {
 217     obj_ptr = _g1_par_allocator->allocate_direct_or_new_plab(dest_state, word_sz, context);
 218     if (obj_ptr == NULL) {
 219       obj_ptr = allocate_in_next_plab(state, &dest_state, word_sz, context);
 220       if (obj_ptr == NULL) {
 221         // This will either forward-to-self, or detect that someone else has
 222         // installed a forwarding pointer.
 223         return _g1h->handle_evacuation_failure_par(this, old);
 224       }
 225     }
 226   }
 227 
 228   assert(obj_ptr != NULL, "when we get here, allocation should have succeeded");


 229 #ifndef PRODUCT
 230   // Should this evacuation fail?
 231   if (_g1h->evacuation_should_fail()) {
 232     // Doing this after all the allocation attempts also tests the
 233     // undo_allocation() method too.
 234     _g1_par_allocator->undo_allocation(dest_state, obj_ptr, word_sz, context);
 235     return _g1h->handle_evacuation_failure_par(this, old);
 236   }
 237 #endif // !PRODUCT
 238 
 239   // We're going to allocate linearly, so might as well prefetch ahead.
 240   Prefetch::write(obj_ptr, PrefetchCopyIntervalInBytes);
 241 
 242   const oop obj = oop(obj_ptr);
 243   const oop forward_ptr = old->forward_to_atomic(obj);
 244   if (forward_ptr == NULL) {
 245     Copy::aligned_disjoint_words((HeapWord*) old, obj_ptr, word_sz);
 246 
 247     if (dest_state.is_young()) {
 248       if (age < markOopDesc::max_age) {




 209 
 210   uint age = 0;
 211   InCSetState dest_state = next_state(state, old_mark, age);
 212   HeapWord* obj_ptr = _g1_par_allocator->plab_allocate(dest_state, word_sz, context);
 213 
 214   // PLAB allocations should succeed most of the time, so we'll
 215   // normally check against NULL once and that's it.
 216   if (obj_ptr == NULL) {
 217     obj_ptr = _g1_par_allocator->allocate_direct_or_new_plab(dest_state, word_sz, context);
 218     if (obj_ptr == NULL) {
 219       obj_ptr = allocate_in_next_plab(state, &dest_state, word_sz, context);
 220       if (obj_ptr == NULL) {
 221         // This will either forward-to-self, or detect that someone else has
 222         // installed a forwarding pointer.
 223         return _g1h->handle_evacuation_failure_par(this, old);
 224       }
 225     }
 226   }
 227 
 228   assert(obj_ptr != NULL, "when we get here, allocation should have succeeded");
 229   assert(_g1h->is_in_reserved(obj_ptr), "Allocated memory should be in the heap");
 230 
 231 #ifndef PRODUCT
 232   // Should this evacuation fail?
 233   if (_g1h->evacuation_should_fail()) {
 234     // Doing this after all the allocation attempts also tests the
 235     // undo_allocation() method too.
 236     _g1_par_allocator->undo_allocation(dest_state, obj_ptr, word_sz, context);
 237     return _g1h->handle_evacuation_failure_par(this, old);
 238   }
 239 #endif // !PRODUCT
 240 
 241   // We're going to allocate linearly, so might as well prefetch ahead.
 242   Prefetch::write(obj_ptr, PrefetchCopyIntervalInBytes);
 243 
 244   const oop obj = oop(obj_ptr);
 245   const oop forward_ptr = old->forward_to_atomic(obj);
 246   if (forward_ptr == NULL) {
 247     Copy::aligned_disjoint_words((HeapWord*) old, obj_ptr, word_sz);
 248 
 249     if (dest_state.is_young()) {
 250       if (age < markOopDesc::max_age) {


< prev index next >