< prev index next >

src/share/vm/runtime/arguments.cpp

Print this page

        

@@ -30,10 +30,11 @@
 #include "code/codeCacheExtensions.hpp"
 #include "gc/shared/cardTableRS.hpp"
 #include "gc/shared/genCollectedHeap.hpp"
 #include "gc/shared/referenceProcessor.hpp"
 #include "gc/shared/taskqueue.hpp"
+#include "logging/log.hpp"
 #include "logging/logConfiguration.hpp"
 #include "memory/allocation.inline.hpp"
 #include "memory/universe.inline.hpp"
 #include "oops/oop.inline.hpp"
 #include "prims/jvmtiExport.hpp"

@@ -1613,47 +1614,33 @@
     if (!FLAG_IS_DEFAULT(NewSize)) {   // NewSize explicitly set at command-line
       FLAG_SET_ERGO(size_t, MaxNewSize, MAX2(NewSize, preferred_max_new_size));
     } else {
       FLAG_SET_ERGO(size_t, MaxNewSize, preferred_max_new_size);
     }
-    if (PrintGCDetails && Verbose) {
-      // Too early to use gclog_or_tty
-      tty->print_cr("CMS ergo set MaxNewSize: " SIZE_FORMAT, MaxNewSize);
-    }
+    log_trace(gc, init)("CMS ergo set MaxNewSize: " SIZE_FORMAT, MaxNewSize);
 
     // Code along this path potentially sets NewSize and OldSize
-    if (PrintGCDetails && Verbose) {
-      // Too early to use gclog_or_tty
-      tty->print_cr("CMS set min_heap_size: " SIZE_FORMAT
-           " initial_heap_size:  " SIZE_FORMAT
-           " max_heap: " SIZE_FORMAT,
+    log_trace(gc, init)("CMS set min_heap_size: " SIZE_FORMAT " initial_heap_size:  " SIZE_FORMAT " max_heap: " SIZE_FORMAT,
            min_heap_size(), InitialHeapSize, max_heap);
-    }
     size_t min_new = preferred_max_new_size;
     if (FLAG_IS_CMDLINE(NewSize)) {
       min_new = NewSize;
     }
     if (max_heap > min_new && min_heap_size() > min_new) {
       // Unless explicitly requested otherwise, make young gen
       // at least min_new, and at most preferred_max_new_size.
       if (FLAG_IS_DEFAULT(NewSize)) {
         FLAG_SET_ERGO(size_t, NewSize, MAX2(NewSize, min_new));
         FLAG_SET_ERGO(size_t, NewSize, MIN2(preferred_max_new_size, NewSize));
-        if (PrintGCDetails && Verbose) {
-          // Too early to use gclog_or_tty
-          tty->print_cr("CMS ergo set NewSize: " SIZE_FORMAT, NewSize);
-        }
+        log_trace(gc, init)("CMS ergo set NewSize: " SIZE_FORMAT, NewSize);
       }
       // Unless explicitly requested otherwise, size old gen
       // so it's NewRatio x of NewSize.
       if (FLAG_IS_DEFAULT(OldSize)) {
         if (max_heap > NewSize) {
           FLAG_SET_ERGO(size_t, OldSize, MIN2(NewRatio*NewSize, max_heap - NewSize));
-          if (PrintGCDetails && Verbose) {
-            // Too early to use gclog_or_tty
-            tty->print_cr("CMS ergo set OldSize: " SIZE_FORMAT, OldSize);
-          }
+          log_trace(gc, init)("CMS ergo set OldSize: " SIZE_FORMAT, OldSize);
         }
       }
     }
   }
   // Unless explicitly requested otherwise, definitely

@@ -1693,15 +1680,12 @@
   if (!ClassUnloading) {
     FLAG_SET_CMDLINE(bool, CMSClassUnloadingEnabled, false);
     FLAG_SET_CMDLINE(bool, ExplicitGCInvokesConcurrentAndUnloadsClasses, false);
   }
 
-  if (PrintGCDetails && Verbose) {
-    tty->print_cr("MarkStackSize: %uk  MarkStackSizeMax: %uk",
-      (unsigned int) (MarkStackSize / K), (uint) (MarkStackSizeMax / K));
-    tty->print_cr("ConcGCThreads: %u", ConcGCThreads);
-  }
+  log_trace(gc, init)("MarkStackSize: %uk  MarkStackSizeMax: %uk", (unsigned int) (MarkStackSize / K), (uint) (MarkStackSizeMax / K));
+  log_trace(gc, init)("ConcGCThreads: %u", ConcGCThreads);
 }
 #endif // INCLUDE_ALL_GCS
 
 void set_object_alignment() {
   // Object alignment.

@@ -1744,15 +1728,11 @@
 
 bool Arguments::should_auto_select_low_pause_collector() {
   if (UseAutoGCSelectPolicy &&
       !FLAG_IS_DEFAULT(MaxGCPauseMillis) &&
       (MaxGCPauseMillis <= AutoGCSelectPauseMillis)) {
-    if (PrintGCDetails) {
-      // Cannot use gclog_or_tty yet.
-      tty->print_cr("Automatic selection of the low pause collector"
-       " based on pause goal of %d (ms)", (int) MaxGCPauseMillis);
-    }
+    log_trace(gc, init)("Automatic selection of the low pause collector based on pause goal of %d (ms)", (int) MaxGCPauseMillis);
     return true;
   }
   return false;
 }
 

@@ -2086,14 +2066,11 @@
       // after call to limit_by_allocatable_memory because that
       // method might reduce the allocation size.
       reasonable_max = MAX2(reasonable_max, (julong)InitialHeapSize);
     }
 
-    if (PrintGCDetails && Verbose) {
-      // Cannot use gclog_or_tty yet.
-      tty->print_cr("  Maximum heap size " SIZE_FORMAT, (size_t) reasonable_max);
-    }
+    log_trace(gc, init)("  Maximum heap size " SIZE_FORMAT, (size_t) reasonable_max);
     FLAG_SET_ERGO(size_t, MaxHeapSize, (size_t)reasonable_max);
   }
 
   // If the minimum or initial heap_size have not been set or requested to be set
   // ergonomically, set them accordingly.

@@ -2110,24 +2087,18 @@
       reasonable_initial = MAX3(reasonable_initial, reasonable_minimum, (julong)min_heap_size());
       reasonable_initial = MIN2(reasonable_initial, (julong)MaxHeapSize);
 
       reasonable_initial = limit_by_allocatable_memory(reasonable_initial);
 
-      if (PrintGCDetails && Verbose) {
-        // Cannot use gclog_or_tty yet.
-        tty->print_cr("  Initial heap size " SIZE_FORMAT, (size_t)reasonable_initial);
-      }
+      log_trace(gc, init)("  Initial heap size " SIZE_FORMAT, (size_t)reasonable_initial);
       FLAG_SET_ERGO(size_t, InitialHeapSize, (size_t)reasonable_initial);
     }
     // If the minimum heap size has not been set (via -Xms),
     // synchronize with InitialHeapSize to avoid errors with the default value.
     if (min_heap_size() == 0) {
       set_min_heap_size(MIN2((size_t)reasonable_minimum, InitialHeapSize));
-      if (PrintGCDetails && Verbose) {
-        // Cannot use gclog_or_tty yet.
-        tty->print_cr("  Minimum heap size " SIZE_FORMAT, min_heap_size());
-      }
+      log_trace(gc, init)("  Minimum heap size " SIZE_FORMAT, min_heap_size());
     }
   }
 }
 
 // This option inspects the machine and attempts to set various

@@ -3198,13 +3169,10 @@
         return JNI_EINVAL;
       }
       if (FLAG_SET_CMDLINE(bool, PrintGC, true) != Flag::SUCCESS) {
         return JNI_EINVAL;
       }
-      if (FLAG_SET_CMDLINE(bool, PrintGCTimeStamps, true) != Flag::SUCCESS) {
-        return JNI_EINVAL;
-      }
     } else if (match_option(option, "-Xlog", &tail)) {
       bool ret = false;
       if (strcmp(tail, ":help") == 0) {
         LogConfiguration::print_command_line_help(defaultStream::output_stream());
         vm_exit(0);

@@ -4241,13 +4209,17 @@
       warning("Forcing ScavengeRootsInCode non-zero");
     }
     ScavengeRootsInCode = 1;
   }
 
+  if (PrintGC) {
+    warning("-XX:+PrintGC not supported in this build. Will turn it off.");
+    PrintGC = false;
+  }
   if (PrintGCDetails) {
-    // Turn on -verbose:gc options as well
-    PrintGC = true;
+    warning("-XX:+PrintGCDetails not supported in this build. Will turn it off.");
+    PrintGCDetails = false;
   }
 
   // Set object alignment values.
   set_object_alignment();
 
< prev index next >