368 assert(max_level < n_gens(), "sanity check");
369
370 if (GC_locker::check_active_before_gc()) {
371 return; // GC is disabled (e.g. JNI GetXXXCritical operation)
372 }
373
374 const bool do_clear_all_soft_refs = clear_all_soft_refs ||
375 collector_policy()->should_clear_all_soft_refs();
376
377 ClearedAllSoftRefs casr(do_clear_all_soft_refs, collector_policy());
378
379 const size_t metadata_prev_used = MetaspaceAux::used_in_bytes();
380
381 print_heap_before_gc();
382
383 {
384 FlagSetting fl(_is_gc_active, true);
385
386 bool complete = full && (max_level == (n_gens()-1));
387 const char* gc_cause_prefix = complete ? "Full GC" : "GC";
388 gclog_or_tty->date_stamp(PrintGC && PrintGCDateStamps);
389 TraceCPUTime tcpu(PrintGCDetails, true, gclog_or_tty);
390 TraceTime t(GCCauseString(gc_cause_prefix, gc_cause()), PrintGCDetails, false, gclog_or_tty);
391
392 gc_prologue(complete);
393 increment_total_collections(complete);
394
395 size_t gch_prev_used = used();
396
397 int starting_level = 0;
398 if (full) {
399 // Search for the oldest generation which will collect all younger
400 // generations, and start collection loop there.
401 for (int i = max_level; i >= 0; i--) {
402 if (_gens[i]->full_collects_younger_generations()) {
403 starting_level = i;
404 break;
405 }
406 }
407 }
408
|
368 assert(max_level < n_gens(), "sanity check");
369
370 if (GC_locker::check_active_before_gc()) {
371 return; // GC is disabled (e.g. JNI GetXXXCritical operation)
372 }
373
374 const bool do_clear_all_soft_refs = clear_all_soft_refs ||
375 collector_policy()->should_clear_all_soft_refs();
376
377 ClearedAllSoftRefs casr(do_clear_all_soft_refs, collector_policy());
378
379 const size_t metadata_prev_used = MetaspaceAux::used_in_bytes();
380
381 print_heap_before_gc();
382
383 {
384 FlagSetting fl(_is_gc_active, true);
385
386 bool complete = full && (max_level == (n_gens()-1));
387 const char* gc_cause_prefix = complete ? "Full GC" : "GC";
388 TraceCPUTime tcpu(PrintGCDetails, true, gclog_or_tty);
389 TraceTime t(GCCauseString(gc_cause_prefix, gc_cause()), PrintGCDetails, false, gclog_or_tty);
390
391 gc_prologue(complete);
392 increment_total_collections(complete);
393
394 size_t gch_prev_used = used();
395
396 int starting_level = 0;
397 if (full) {
398 // Search for the oldest generation which will collect all younger
399 // generations, and start collection loop there.
400 for (int i = max_level; i >= 0; i--) {
401 if (_gens[i]->full_collects_younger_generations()) {
402 starting_level = i;
403 break;
404 }
405 }
406 }
407
|