1 /*
2 * Copyright (c) 1997, 2019, Oracle and/or its affiliates. All rights reserved.
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 *
5 * This code is free software; you can redistribute it and/or modify it
6 * under the terms of the GNU General Public License version 2 only, as
7 * published by the Free Software Foundation.
8 *
9 * This code is distributed in the hope that it will be useful, but WITHOUT
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
12 * version 2 for more details (a copy is included in the LICENSE file that
13 * accompanied this code).
14 *
15 * You should have received a copy of the GNU General Public License version
16 * 2 along with this work; if not, write to the Free Software Foundation,
17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
18 *
19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
20 * or visit www.oracle.com if you need additional information or have any
21 * questions.
22 *
25 #include "precompiled.hpp"
26 #include "jvm.h"
27 #include "classfile/classLoader.hpp"
28 #include "classfile/javaAssertions.hpp"
29 #include "classfile/moduleEntry.hpp"
30 #include "classfile/stringTable.hpp"
31 #include "classfile/symbolTable.hpp"
32 #include "gc/shared/gcArguments.hpp"
33 #include "gc/shared/gcConfig.hpp"
34 #include "logging/log.hpp"
35 #include "logging/logConfiguration.hpp"
36 #include "logging/logStream.hpp"
37 #include "logging/logTag.hpp"
38 #include "memory/allocation.inline.hpp"
39 #include "memory/filemap.hpp"
40 #include "oops/oop.inline.hpp"
41 #include "prims/jvmtiExport.hpp"
42 #include "runtime/arguments.hpp"
43 #include "runtime/flags/jvmFlag.hpp"
44 #include "runtime/flags/jvmFlagConstraintList.hpp"
45 #include "runtime/flags/jvmFlagWriteableList.hpp"
46 #include "runtime/flags/jvmFlagRangeList.hpp"
47 #include "runtime/globals_extension.hpp"
48 #include "runtime/java.hpp"
49 #include "runtime/os.inline.hpp"
50 #include "runtime/safepoint.hpp"
51 #include "runtime/safepointMechanism.hpp"
52 #include "runtime/vm_version.hpp"
53 #include "services/management.hpp"
54 #include "services/memTracker.hpp"
55 #include "utilities/align.hpp"
56 #include "utilities/defaultStream.hpp"
57 #include "utilities/macros.hpp"
58 #include "utilities/stringUtils.hpp"
59 #if INCLUDE_JFR
60 #include "jfr/jfr.hpp"
61 #endif
62
63 #define DEFAULT_JAVA_LAUNCHER "generic"
64
65 char* Arguments::_jvm_flags_file = NULL;
3802 // -Xloggc was used to specify a filename
3803 const char* gc_conf = PrintGCDetails ? "gc*" : "gc";
3804
3805 LogTarget(Error, logging) target;
3806 LogStream errstream(target);
3807 return LogConfiguration::parse_log_arguments(_gc_log_filename, gc_conf, NULL, NULL, &errstream);
3808 } else if (PrintGC || PrintGCDetails) {
3809 LogConfiguration::configure_stdout(LogLevel::Info, !PrintGCDetails, LOG_TAGS(gc));
3810 }
3811 return true;
3812 }
3813
3814 // Parse entry point called from JNI_CreateJavaVM
3815
3816 jint Arguments::parse(const JavaVMInitArgs* initial_cmd_args) {
3817 assert(verify_special_jvm_flags(), "deprecated and obsolete flag table inconsistent");
3818
3819 // Initialize ranges, constraints and writeables
3820 JVMFlagRangeList::init();
3821 JVMFlagConstraintList::init();
3822 JVMFlagWriteableList::init();
3823
3824 // If flag "-XX:Flags=flags-file" is used it will be the first option to be processed.
3825 const char* hotspotrc = ".hotspotrc";
3826 bool settings_file_specified = false;
3827 bool needs_hotspotrc_warning = false;
3828 ScopedVMInitArgs initial_vm_options_args("");
3829 ScopedVMInitArgs initial_java_tool_options_args("env_var='JAVA_TOOL_OPTIONS'");
3830 ScopedVMInitArgs initial_java_options_args("env_var='_JAVA_OPTIONS'");
3831
3832 // Pointers to current working set of containers
3833 JavaVMInitArgs* cur_cmd_args;
3834 JavaVMInitArgs* cur_vm_options_args;
3835 JavaVMInitArgs* cur_java_options_args;
3836 JavaVMInitArgs* cur_java_tool_options_args;
3837
3838 // Containers for modified/expanded options
3839 ScopedVMInitArgs mod_cmd_args("cmd_line_args");
3840 ScopedVMInitArgs mod_vm_options_args("vm_options_args");
3841 ScopedVMInitArgs mod_java_tool_options_args("env_var='JAVA_TOOL_OPTIONS'");
3842 ScopedVMInitArgs mod_java_options_args("env_var='_JAVA_OPTIONS'");
|
1 /*
2 * Copyright (c) 1997, 2020, Oracle and/or its affiliates. All rights reserved.
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 *
5 * This code is free software; you can redistribute it and/or modify it
6 * under the terms of the GNU General Public License version 2 only, as
7 * published by the Free Software Foundation.
8 *
9 * This code is distributed in the hope that it will be useful, but WITHOUT
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
12 * version 2 for more details (a copy is included in the LICENSE file that
13 * accompanied this code).
14 *
15 * You should have received a copy of the GNU General Public License version
16 * 2 along with this work; if not, write to the Free Software Foundation,
17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
18 *
19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
20 * or visit www.oracle.com if you need additional information or have any
21 * questions.
22 *
25 #include "precompiled.hpp"
26 #include "jvm.h"
27 #include "classfile/classLoader.hpp"
28 #include "classfile/javaAssertions.hpp"
29 #include "classfile/moduleEntry.hpp"
30 #include "classfile/stringTable.hpp"
31 #include "classfile/symbolTable.hpp"
32 #include "gc/shared/gcArguments.hpp"
33 #include "gc/shared/gcConfig.hpp"
34 #include "logging/log.hpp"
35 #include "logging/logConfiguration.hpp"
36 #include "logging/logStream.hpp"
37 #include "logging/logTag.hpp"
38 #include "memory/allocation.inline.hpp"
39 #include "memory/filemap.hpp"
40 #include "oops/oop.inline.hpp"
41 #include "prims/jvmtiExport.hpp"
42 #include "runtime/arguments.hpp"
43 #include "runtime/flags/jvmFlag.hpp"
44 #include "runtime/flags/jvmFlagConstraintList.hpp"
45 #include "runtime/flags/jvmFlagRangeList.hpp"
46 #include "runtime/globals_extension.hpp"
47 #include "runtime/java.hpp"
48 #include "runtime/os.inline.hpp"
49 #include "runtime/safepoint.hpp"
50 #include "runtime/safepointMechanism.hpp"
51 #include "runtime/vm_version.hpp"
52 #include "services/management.hpp"
53 #include "services/memTracker.hpp"
54 #include "utilities/align.hpp"
55 #include "utilities/defaultStream.hpp"
56 #include "utilities/macros.hpp"
57 #include "utilities/stringUtils.hpp"
58 #if INCLUDE_JFR
59 #include "jfr/jfr.hpp"
60 #endif
61
62 #define DEFAULT_JAVA_LAUNCHER "generic"
63
64 char* Arguments::_jvm_flags_file = NULL;
3801 // -Xloggc was used to specify a filename
3802 const char* gc_conf = PrintGCDetails ? "gc*" : "gc";
3803
3804 LogTarget(Error, logging) target;
3805 LogStream errstream(target);
3806 return LogConfiguration::parse_log_arguments(_gc_log_filename, gc_conf, NULL, NULL, &errstream);
3807 } else if (PrintGC || PrintGCDetails) {
3808 LogConfiguration::configure_stdout(LogLevel::Info, !PrintGCDetails, LOG_TAGS(gc));
3809 }
3810 return true;
3811 }
3812
3813 // Parse entry point called from JNI_CreateJavaVM
3814
3815 jint Arguments::parse(const JavaVMInitArgs* initial_cmd_args) {
3816 assert(verify_special_jvm_flags(), "deprecated and obsolete flag table inconsistent");
3817
3818 // Initialize ranges, constraints and writeables
3819 JVMFlagRangeList::init();
3820 JVMFlagConstraintList::init();
3821
3822 // If flag "-XX:Flags=flags-file" is used it will be the first option to be processed.
3823 const char* hotspotrc = ".hotspotrc";
3824 bool settings_file_specified = false;
3825 bool needs_hotspotrc_warning = false;
3826 ScopedVMInitArgs initial_vm_options_args("");
3827 ScopedVMInitArgs initial_java_tool_options_args("env_var='JAVA_TOOL_OPTIONS'");
3828 ScopedVMInitArgs initial_java_options_args("env_var='_JAVA_OPTIONS'");
3829
3830 // Pointers to current working set of containers
3831 JavaVMInitArgs* cur_cmd_args;
3832 JavaVMInitArgs* cur_vm_options_args;
3833 JavaVMInitArgs* cur_java_options_args;
3834 JavaVMInitArgs* cur_java_tool_options_args;
3835
3836 // Containers for modified/expanded options
3837 ScopedVMInitArgs mod_cmd_args("cmd_line_args");
3838 ScopedVMInitArgs mod_vm_options_args("vm_options_args");
3839 ScopedVMInitArgs mod_java_tool_options_args("env_var='JAVA_TOOL_OPTIONS'");
3840 ScopedVMInitArgs mod_java_options_args("env_var='_JAVA_OPTIONS'");
|