< prev index next >

src/share/vm/gc/shared/genCollectedHeap.cpp

Print this page




 441     GCTraceCPUTime tcpu;
 442     GCTraceTime(Info, gc) t(gc_string, NULL, gc_cause(), true);
 443 
 444     gc_prologue(complete);
 445     increment_total_collections(complete);
 446 
 447     size_t young_prev_used = _young_gen->used();
 448     size_t old_prev_used = _old_gen->used();
 449 
 450     bool run_verification = total_collections() >= VerifyGCStartAt;
 451 
 452     bool prepared_for_verification = false;
 453     bool collected_old = false;
 454 
 455     if (do_young_collection) {
 456       if (run_verification && VerifyGCLevel <= 0 && VerifyBeforeGC) {
 457         prepare_for_verify();
 458         prepared_for_verification = true;
 459       }
 460 
 461       assert(!_young_gen->performs_in_place_marking(), "No young generation do in place marking");
 462       collect_generation(_young_gen,
 463                          full,
 464                          size,
 465                          is_tlab,
 466                          run_verification && VerifyGCLevel <= 0,
 467                          do_clear_all_soft_refs,
 468                          false);
 469 
 470       if (size > 0 && (!is_tlab || _young_gen->supports_tlab_allocation()) &&
 471           size * HeapWordSize <= _young_gen->unsafe_max_alloc_nogc()) {
 472         // Allocation request was met by young GC.
 473         size = 0;
 474       }
 475     }
 476 
 477     bool must_restore_marks_for_biased_locking = false;
 478 
 479     if (max_generation == OldGen && _old_gen->should_collect(full, size, is_tlab)) {
 480       if (!complete) {
 481         // The full_collections increment was missed above.
 482         increment_total_full_collections();
 483       }
 484 
 485       pre_full_gc_dump(NULL);    // do any pre full gc dumps
 486 
 487       if (!prepared_for_verification && run_verification &&
 488           VerifyGCLevel <= 1 && VerifyBeforeGC) {
 489         prepare_for_verify();
 490       }
 491 
 492       assert(_old_gen->performs_in_place_marking(), "All old generations do in place marking");
 493 
 494       if (do_young_collection) {
 495         // We did a young GC. Need a new GC id for the old GC.
 496         GCIdMarkAndRestore gc_id_mark;
 497         GCTraceTime(Info, gc) t("Pause Full", NULL, gc_cause(), true);
 498         collect_generation(_old_gen, full, size, is_tlab, run_verification && VerifyGCLevel <= 1, do_clear_all_soft_refs, true);
 499       } else {
 500         // No young GC done. Use the same GC id as was set up earlier in this method.
 501         collect_generation(_old_gen, full, size, is_tlab, run_verification && VerifyGCLevel <= 1, do_clear_all_soft_refs, true);
 502       }
 503 
 504       must_restore_marks_for_biased_locking = true;
 505       collected_old = true;
 506     }
 507 
 508     // Update "complete" boolean wrt what actually transpired --
 509     // for instance, a promotion failure could have led to
 510     // a whole heap collection.
 511     complete = complete || collected_old;
 512 




 441     GCTraceCPUTime tcpu;
 442     GCTraceTime(Info, gc) t(gc_string, NULL, gc_cause(), true);
 443 
 444     gc_prologue(complete);
 445     increment_total_collections(complete);
 446 
 447     size_t young_prev_used = _young_gen->used();
 448     size_t old_prev_used = _old_gen->used();
 449 
 450     bool run_verification = total_collections() >= VerifyGCStartAt;
 451 
 452     bool prepared_for_verification = false;
 453     bool collected_old = false;
 454 
 455     if (do_young_collection) {
 456       if (run_verification && VerifyGCLevel <= 0 && VerifyBeforeGC) {
 457         prepare_for_verify();
 458         prepared_for_verification = true;
 459       }
 460 

 461       collect_generation(_young_gen,
 462                          full,
 463                          size,
 464                          is_tlab,
 465                          run_verification && VerifyGCLevel <= 0,
 466                          do_clear_all_soft_refs,
 467                          false);
 468 
 469       if (size > 0 && (!is_tlab || _young_gen->supports_tlab_allocation()) &&
 470           size * HeapWordSize <= _young_gen->unsafe_max_alloc_nogc()) {
 471         // Allocation request was met by young GC.
 472         size = 0;
 473       }
 474     }
 475 
 476     bool must_restore_marks_for_biased_locking = false;
 477 
 478     if (max_generation == OldGen && _old_gen->should_collect(full, size, is_tlab)) {
 479       if (!complete) {
 480         // The full_collections increment was missed above.
 481         increment_total_full_collections();
 482       }
 483 
 484       pre_full_gc_dump(NULL);    // do any pre full gc dumps
 485 
 486       if (!prepared_for_verification && run_verification &&
 487           VerifyGCLevel <= 1 && VerifyBeforeGC) {
 488         prepare_for_verify();
 489       }


 490 
 491       if (do_young_collection) {
 492         // We did a young GC. Need a new GC id for the old GC.
 493         GCIdMarkAndRestore gc_id_mark;
 494         GCTraceTime(Info, gc) t("Pause Full", NULL, gc_cause(), true);
 495         collect_generation(_old_gen, full, size, is_tlab, run_verification && VerifyGCLevel <= 1, do_clear_all_soft_refs, true);
 496       } else {
 497         // No young GC done. Use the same GC id as was set up earlier in this method.
 498         collect_generation(_old_gen, full, size, is_tlab, run_verification && VerifyGCLevel <= 1, do_clear_all_soft_refs, true);
 499       }
 500 
 501       must_restore_marks_for_biased_locking = true;
 502       collected_old = true;
 503     }
 504 
 505     // Update "complete" boolean wrt what actually transpired --
 506     // for instance, a promotion failure could have led to
 507     // a whole heap collection.
 508     complete = complete || collected_old;
 509 


< prev index next >