< prev index next >

src/share/vm/runtime/arguments.cpp

Print this page

        

*** 30,39 **** --- 30,40 ---- #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"
*** 79,89 **** int Arguments::_num_jvm_flags = 0; char** Arguments::_jvm_args_array = NULL; int Arguments::_num_jvm_args = 0; char* Arguments::_java_command = NULL; SystemProperty* Arguments::_system_properties = NULL; - const char* Arguments::_gc_log_filename = NULL; bool Arguments::_has_profile = false; size_t Arguments::_conservative_max_heap_alignment = 0; size_t Arguments::_min_heap_size = 0; Arguments::Mode Arguments::_mode = _mixed; bool Arguments::_java_compiler = false; --- 80,89 ----
*** 1598,1644 **** 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); ! } // 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, 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); ! } } // 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); ! } } } } } // Unless explicitly requested otherwise, definitely --- 1598,1630 ---- 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); } ! log_trace(gc, heap)("CMS ergo set MaxNewSize: " SIZE_FORMAT, MaxNewSize); // Code along this path potentially sets NewSize and OldSize ! log_trace(gc, heap)("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)); ! log_trace(gc, heap)("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)); ! log_trace(gc, heap)("CMS ergo set OldSize: " SIZE_FORMAT, OldSize); } } } } // Unless explicitly requested otherwise, definitely
*** 1678,1692 **** 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); ! } } #endif // INCLUDE_ALL_GCS void set_object_alignment() { // Object alignment. --- 1664,1675 ---- if (!ClassUnloading) { FLAG_SET_CMDLINE(bool, CMSClassUnloadingEnabled, false); FLAG_SET_CMDLINE(bool, ExplicitGCInvokesConcurrentAndUnloadsClasses, false); } ! log_trace(gc)("MarkStackSize: %uk MarkStackSizeMax: %uk", (unsigned int) (MarkStackSize / K), (uint) (MarkStackSizeMax / K)); ! log_trace(gc)("ConcGCThreads: %u", ConcGCThreads); } #endif // INCLUDE_ALL_GCS void set_object_alignment() { // Object alignment.
*** 1729,1743 **** 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); ! } return true; } return false; } --- 1712,1722 ---- bool Arguments::should_auto_select_low_pause_collector() { if (UseAutoGCSelectPolicy && !FLAG_IS_DEFAULT(MaxGCPauseMillis) && (MaxGCPauseMillis <= AutoGCSelectPauseMillis)) { ! log_trace(gc)("Automatic selection of the low pause collector based on pause goal of %d (ms)", (int) MaxGCPauseMillis); return true; } return false; }
*** 1952,1966 **** // it is for PS, or the heap might be expanded too aggressively. // We set it here to ~8%. FLAG_SET_DEFAULT(GCTimeRatio, 12); } ! if (PrintGCDetails && Verbose) { ! tty->print_cr("MarkStackSize: %uk MarkStackSizeMax: %uk", ! (unsigned int) (MarkStackSize / K), (uint) (MarkStackSizeMax / K)); ! tty->print_cr("ConcGCThreads: %u", ConcGCThreads); ! } } #if !INCLUDE_ALL_GCS #ifdef ASSERT static bool verify_serial_gc_flags() { --- 1931,1942 ---- // it is for PS, or the heap might be expanded too aggressively. // We set it here to ~8%. FLAG_SET_DEFAULT(GCTimeRatio, 12); } ! log_trace(gc)("MarkStackSize: %uk MarkStackSizeMax: %uk", (unsigned int) (MarkStackSize / K), (uint) (MarkStackSizeMax / K)); ! log_trace(gc)("ConcGCThreads: %u", ConcGCThreads); } #if !INCLUDE_ALL_GCS #ifdef ASSERT static bool verify_serial_gc_flags() {
*** 2068,2081 **** // 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); ! } 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. --- 2044,2054 ---- // after call to limit_by_allocatable_memory because that // method might reduce the allocation size. reasonable_max = MAX2(reasonable_max, (julong)InitialHeapSize); } ! log_trace(gc, heap)(" 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.
*** 2092,2115 **** 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); ! } 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()); ! } } } } // This option inspects the machine and attempts to set various --- 2065,2082 ---- 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); ! log_trace(gc, heap)(" 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)); ! log_trace(gc, heap)(" Minimum heap size " SIZE_FORMAT, min_heap_size()); } } } // This option inspects the machine and attempts to set various
*** 2308,2388 **** } //=========================================================================================================== // Parsing of main arguments - // check if do gclog rotation - // +UseGCLogFileRotation is a must, - // no gc log rotation when log file not supplied or - // NumberOfGCLogFiles is 0 - void check_gclog_consistency() { - if (UseGCLogFileRotation) { - if ((Arguments::gc_log_filename() == NULL) || (NumberOfGCLogFiles == 0)) { - jio_fprintf(defaultStream::output_stream(), - "To enable GC log rotation, use -Xloggc:<filename> -XX:+UseGCLogFileRotation -XX:NumberOfGCLogFiles=<num_of_files>\n" - "where num_of_file > 0\n" - "GC log rotation is turned off\n"); - UseGCLogFileRotation = false; - } - } - - if (UseGCLogFileRotation && (GCLogFileSize != 0) && (GCLogFileSize < 8*K)) { - if (FLAG_SET_CMDLINE(size_t, GCLogFileSize, 8*K) == Flag::SUCCESS) { - jio_fprintf(defaultStream::output_stream(), - "GCLogFileSize changed to minimum 8K\n"); - } - } - } - - // This function is called for -Xloggc:<filename>, it can be used - // to check if a given file name(or string) conforms to the following - // specification: - // A valid string only contains "[A-Z][a-z][0-9].-_%[p|t]" - // %p and %t only allowed once. We only limit usage of filename not path - bool is_filename_valid(const char *file_name) { - const char* p = file_name; - char file_sep = os::file_separator()[0]; - const char* cp; - // skip prefix path - for (cp = file_name; *cp != '\0'; cp++) { - if (*cp == '/' || *cp == file_sep) { - p = cp + 1; - } - } - - int count_p = 0; - int count_t = 0; - while (*p != '\0') { - if ((*p >= '0' && *p <= '9') || - (*p >= 'A' && *p <= 'Z') || - (*p >= 'a' && *p <= 'z') || - *p == '-' || - *p == '_' || - *p == '.') { - p++; - continue; - } - if (*p == '%') { - if(*(p + 1) == 'p') { - p += 2; - count_p ++; - continue; - } - if (*(p + 1) == 't') { - p += 2; - count_t ++; - continue; - } - } - return false; - } - return count_p < 2 && count_t < 2; - } - // Check consistency of GC selection bool Arguments::check_gc_consistency() { - check_gclog_consistency(); // Ensure that the user has not selected conflicting sets // of collectors. uint i = 0; if (UseSerialGC) i++; if (UseConcMarkSweepGC) i++; --- 2275,2286 ----
*** 2721,2731 **** } if (FLAG_SET_CMDLINE(bool, TraceClassUnloading, true) != Flag::SUCCESS) { return JNI_EINVAL; } } else if (!strcmp(tail, ":gc")) { ! if (FLAG_SET_CMDLINE(bool, PrintGC, true) != Flag::SUCCESS) { return JNI_EINVAL; } } else if (!strcmp(tail, ":jni")) { if (FLAG_SET_CMDLINE(bool, PrintJNIResolving, true) != Flag::SUCCESS) { return JNI_EINVAL; --- 2619,2631 ---- } if (FLAG_SET_CMDLINE(bool, TraceClassUnloading, true) != Flag::SUCCESS) { return JNI_EINVAL; } } else if (!strcmp(tail, ":gc")) { ! // LogConfiguration_lock is not set up yet, but this code is executed by a single thread ! bool ret = LogConfiguration::parse_log_arguments("stdout", "gc", NULL, NULL, NULL); ! if (!ret) { return JNI_EINVAL; } } else if (!strcmp(tail, ":jni")) { if (FLAG_SET_CMDLINE(bool, PrintJNIResolving, true) != Flag::SUCCESS) { return JNI_EINVAL;
*** 3154,3181 **** // note this flag has been used, then ignore set_xdebug_mode(true); // -Xnoagent } else if (match_option(option, "-Xnoagent")) { // For compatibility with classic. HotSpot refuses to load the old style agent.dll. - } else if (match_option(option, "-Xloggc:", &tail)) { - // Redirect GC output to the file. -Xloggc:<filename> - // ostream_init_log(), when called will use this filename - // to initialize a fileStream. - _gc_log_filename = os::strdup_check_oom(tail); - if (!is_filename_valid(_gc_log_filename)) { - jio_fprintf(defaultStream::output_stream(), - "Invalid file name for use with -Xloggc: Filename can only contain the " - "characters [A-Z][a-z][0-9]-_.%%[p|t] but it has been %s\n" - "Note %%p or %%t can only be used once\n", _gc_log_filename); - 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); --- 3054,3063 ----
*** 4176,4190 **** warning("Forcing ScavengeRootsInCode non-zero"); } ScavengeRootsInCode = 1; } - if (PrintGCDetails) { - // Turn on -verbose:gc options as well - PrintGC = true; - } - // Set object alignment values. set_object_alignment(); #if !INCLUDE_ALL_GCS force_serial_gc(); --- 4058,4067 ----
< prev index next >