< prev index next >

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

Print this page

        

@@ -30,10 +30,11 @@
 #include "gc/shared/gcPolicyCounters.hpp"
 #include "gc/shared/genCollectedHeap.hpp"
 #include "gc/shared/generationSpec.hpp"
 #include "gc/shared/space.hpp"
 #include "gc/shared/vmGCOperations.hpp"
+#include "logging/log.hpp"
 #include "memory/universe.hpp"
 #include "runtime/arguments.hpp"
 #include "runtime/globals_extension.hpp"
 #include "runtime/handles.inline.hpp"
 #include "runtime/java.hpp"

@@ -135,15 +136,12 @@
 
   DEBUG_ONLY(CollectorPolicy::assert_flags();)
 }
 
 void CollectorPolicy::initialize_size_info() {
-  if (PrintGCDetails && Verbose) {
-    gclog_or_tty->print_cr("Minimum heap " SIZE_FORMAT "  Initial heap "
-      SIZE_FORMAT "  Maximum heap " SIZE_FORMAT,
+  log_debug(gc, heap)("Minimum heap " SIZE_FORMAT "  Initial heap " SIZE_FORMAT "  Maximum heap " SIZE_FORMAT,
       _min_heap_byte_size, _initial_heap_byte_size, _max_heap_byte_size);
-  }
 
   DEBUG_ONLY(CollectorPolicy::assert_size_info();)
 }
 
 bool CollectorPolicy::use_should_clear_all_soft_refs(bool v) {

@@ -486,15 +484,12 @@
       _initial_young_size =
         MIN2(_max_young_size, MAX2(scale_by_NewRatio_aligned(_initial_heap_byte_size), NewSize));
     }
   }
 
-  if (PrintGCDetails && Verbose) {
-    gclog_or_tty->print_cr("1: Minimum young " SIZE_FORMAT "  Initial young "
-      SIZE_FORMAT "  Maximum young " SIZE_FORMAT,
+  log_trace(gc, heap)("1: Minimum young " SIZE_FORMAT "  Initial young " SIZE_FORMAT "  Maximum young " SIZE_FORMAT,
       _min_young_size, _initial_young_size, _max_young_size);
-  }
 
   // At this point the minimum, initial and maximum sizes
   // of the overall heap and of the young generation have been determined.
   // The maximum old size can be determined from the maximum young
   // and maximum heap size since no explicit flags exist

@@ -556,16 +551,13 @@
       // The young generation boundaries allow us to only update the
       // young generation.
       _initial_young_size = desired_young_size;
     }
 
-    if (PrintGCDetails && Verbose) {
-      gclog_or_tty->print_cr("2: Minimum young " SIZE_FORMAT "  Initial young "
-        SIZE_FORMAT "  Maximum young " SIZE_FORMAT,
+    log_trace(gc, heap)("2: Minimum young " SIZE_FORMAT "  Initial young " SIZE_FORMAT "  Maximum young " SIZE_FORMAT,
         _min_young_size, _initial_young_size, _max_young_size);
     }
-  }
 
   // Write back to flags if necessary.
   if (NewSize != _initial_young_size) {
     FLAG_SET_ERGO(size_t, NewSize, _initial_young_size);
   }

@@ -576,15 +568,12 @@
 
   if (OldSize != _initial_old_size) {
     FLAG_SET_ERGO(size_t, OldSize, _initial_old_size);
   }
 
-  if (PrintGCDetails && Verbose) {
-    gclog_or_tty->print_cr("Minimum old " SIZE_FORMAT "  Initial old "
-      SIZE_FORMAT "  Maximum old " SIZE_FORMAT,
+  log_trace(gc, heap)("Minimum old " SIZE_FORMAT "  Initial old " SIZE_FORMAT "  Maximum old " SIZE_FORMAT,
       _min_old_size, _initial_old_size, _max_old_size);
-  }
 
   DEBUG_ONLY(GenCollectorPolicy::assert_size_info();)
 }
 
 HeapWord* GenCollectorPolicy::mem_allocate_work(size_t size,

@@ -618,14 +607,11 @@
       }
     }
     uint gc_count_before;  // Read inside the Heap_lock locked region.
     {
       MutexLocker ml(Heap_lock);
-      if (PrintGC && Verbose) {
-        gclog_or_tty->print_cr("GenCollectorPolicy::mem_allocate_work:"
-                               " attempting locked slow path allocation");
-      }
+      log_trace(gc, alloc)("GenCollectorPolicy::mem_allocate_work: attempting locked slow path allocation");
       // Note that only large objects get a shot at being
       // allocated in later generations.
       bool first_only = ! should_try_older_generation_allocation(size);
 
       result = gch->attempt_allocation(size, is_tlab, first_only);

@@ -755,13 +741,11 @@
                        false,                     // clear_all_soft_refs
                        size,                      // size
                        is_tlab,                   // is_tlab
                        GenCollectedHeap::OldGen); // max_generation
   } else {
-    if (Verbose && PrintGCDetails) {
-      gclog_or_tty->print(" :: Trying full because partial may fail :: ");
-    }
+    log_trace(gc)(" :: Trying full because partial may fail :: ");
     // Try a full collection; see delta for bug id 6266275
     // for the original code and why this has been simplified
     // with from-space allocation criteria modified and
     // such allocation moved out of the safepoint path.
     gch->do_collection(true,                      // full
< prev index next >