mirror of
https://github.com/openjdk/jdk.git
synced 2025-08-28 07:14:30 +02:00
8145180: Add back PrintGC, PrintGCDetails and -Xloggc
Reviewed-by: sjohanss, david
This commit is contained in:
parent
1fdb299974
commit
31ca2b7010
4 changed files with 146 additions and 0 deletions
|
@ -83,6 +83,7 @@ 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;
|
||||
|
@ -3090,6 +3091,10 @@ jint Arguments::parse_each_vm_init_arg(const JavaVMInitArgs* args,
|
|||
// -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)) {
|
||||
// Deprecated flag to redirect GC output to a file. -Xloggc:<filename>
|
||||
log_warning(gc)("-Xloggc is deprecated. Will use -Xlog:gc:%s instead.", tail);
|
||||
_gc_log_filename = os::strdup_check_oom(tail);
|
||||
} else if (match_option(option, "-Xlog", &tail)) {
|
||||
bool ret = false;
|
||||
if (strcmp(tail, ":help") == 0) {
|
||||
|
@ -3999,6 +4004,24 @@ static void print_options(const JavaVMInitArgs *args) {
|
|||
}
|
||||
}
|
||||
|
||||
bool Arguments::handle_deprecated_print_gc_flags() {
|
||||
if (PrintGC) {
|
||||
log_warning(gc)("-XX:+PrintGC is deprecated. Will use -Xlog:gc instead.");
|
||||
}
|
||||
if (PrintGCDetails) {
|
||||
log_warning(gc)("-XX:+PrintGCDetails is deprecated. Will use -Xlog:gc* instead.");
|
||||
}
|
||||
|
||||
if (_gc_log_filename != NULL) {
|
||||
// -Xloggc was used to specify a filename
|
||||
const char* gc_conf = PrintGCDetails ? "gc*" : "gc";
|
||||
return LogConfiguration::parse_log_arguments(_gc_log_filename, gc_conf, NULL, NULL, NULL);
|
||||
} else if (PrintGC || PrintGCDetails) {
|
||||
LogConfiguration::configure_stdout(LogLevel::Info, !PrintGCDetails, LOG_TAGS(gc));
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
// Parse entry point called from JNI_CreateJavaVM
|
||||
|
||||
jint Arguments::parse(const JavaVMInitArgs* initial_cmd_args) {
|
||||
|
@ -4147,6 +4170,10 @@ jint Arguments::parse(const JavaVMInitArgs* initial_cmd_args) {
|
|||
ScavengeRootsInCode = 1;
|
||||
}
|
||||
|
||||
if (!handle_deprecated_print_gc_flags()) {
|
||||
return JNI_EINVAL;
|
||||
}
|
||||
|
||||
// Set object alignment values.
|
||||
set_object_alignment();
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue