< prev index next >

src/hotspot/share/gc/parallel/psPromotionManager.inline.hpp

Print this page




 207       new_obj = (oop) _old_lab.allocate(new_obj_size);
 208       new_obj_is_tenured = true;
 209 
 210       if (new_obj == NULL) {
 211         if (!_old_gen_is_full) {
 212           // Do we allocate directly, or flush and refill?
 213           if (new_obj_size > (OldPLABSize / 2)) {
 214             // Allocate this object directly
 215             new_obj = (oop)old_gen()->cas_allocate(new_obj_size);
 216             promotion_trace_event(new_obj, o, new_obj_size, age, true, NULL);
 217           } else {
 218             // Flush and fill
 219             _old_lab.flush();
 220 
 221             HeapWord* lab_base = old_gen()->cas_allocate(OldPLABSize);
 222             if(lab_base != NULL) {
 223 #ifdef ASSERT
 224               // Delay the initialization of the promotion lab (plab).
 225               // This exposes uninitialized plabs to card table processing.
 226               if (GCWorkerDelayMillis > 0) {
 227                 os::sleep(Thread::current(), GCWorkerDelayMillis, false);
 228               }
 229 #endif
 230               _old_lab.initialize(MemRegion(lab_base, OldPLABSize));
 231               // Try the old lab allocation again.
 232               new_obj = (oop) _old_lab.allocate(new_obj_size);
 233               promotion_trace_event(new_obj, o, new_obj_size, age, true, &_old_lab);
 234             }
 235           }
 236         }
 237 
 238         // This is the promotion failed test, and code handling.
 239         // The code belongs here for two reasons. It is slightly
 240         // different than the code below, and cannot share the
 241         // CAS testing code. Keeping the code here also minimizes
 242         // the impact on the common case fast path code.
 243 
 244         if (new_obj == NULL) {
 245           _old_gen_is_full = true;
 246           return oop_promotion_failed(o, test_mark);
 247         }




 207       new_obj = (oop) _old_lab.allocate(new_obj_size);
 208       new_obj_is_tenured = true;
 209 
 210       if (new_obj == NULL) {
 211         if (!_old_gen_is_full) {
 212           // Do we allocate directly, or flush and refill?
 213           if (new_obj_size > (OldPLABSize / 2)) {
 214             // Allocate this object directly
 215             new_obj = (oop)old_gen()->cas_allocate(new_obj_size);
 216             promotion_trace_event(new_obj, o, new_obj_size, age, true, NULL);
 217           } else {
 218             // Flush and fill
 219             _old_lab.flush();
 220 
 221             HeapWord* lab_base = old_gen()->cas_allocate(OldPLABSize);
 222             if(lab_base != NULL) {
 223 #ifdef ASSERT
 224               // Delay the initialization of the promotion lab (plab).
 225               // This exposes uninitialized plabs to card table processing.
 226               if (GCWorkerDelayMillis > 0) {
 227                 os::naked_sleep(GCWorkerDelayMillis);
 228               }
 229 #endif
 230               _old_lab.initialize(MemRegion(lab_base, OldPLABSize));
 231               // Try the old lab allocation again.
 232               new_obj = (oop) _old_lab.allocate(new_obj_size);
 233               promotion_trace_event(new_obj, o, new_obj_size, age, true, &_old_lab);
 234             }
 235           }
 236         }
 237 
 238         // This is the promotion failed test, and code handling.
 239         // The code belongs here for two reasons. It is slightly
 240         // different than the code below, and cannot share the
 241         // CAS testing code. Keeping the code here also minimizes
 242         // the impact on the common case fast path code.
 243 
 244         if (new_obj == NULL) {
 245           _old_gen_is_full = true;
 246           return oop_promotion_failed(o, test_mark);
 247         }


< prev index next >