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 *
23 */
24
25 #include "precompiled.hpp"
26 #include "cds/cds_globals.hpp"
27 #include "cds/cdsConfig.hpp"
28 #include "cds/filemap.hpp"
29 #include "classfile/classLoader.hpp"
30 #include "classfile/javaAssertions.hpp"
31 #include "classfile/moduleEntry.hpp"
32 #include "classfile/stringTable.hpp"
33 #include "classfile/symbolTable.hpp"
34 #include "compiler/compilerDefinitions.hpp"
35 #include "gc/shared/gcArguments.hpp"
36 #include "gc/shared/gcConfig.hpp"
37 #include "gc/shared/genArguments.hpp"
38 #include "gc/shared/stringdedup/stringDedup.hpp"
39 #include "gc/shared/tlab_globals.hpp"
40 #include "jvm.h"
41 #include "logging/log.hpp"
42 #include "logging/logConfiguration.hpp"
43 #include "logging/logStream.hpp"
44 #include "logging/logTag.hpp"
45 #include "memory/allocation.inline.hpp"
46 #include "nmt/nmtCommon.hpp"
47 #include "oops/compressedKlass.hpp"
48 #include "oops/instanceKlass.hpp"
2933 if (FLAG_IS_DEFAULT(UseLargePages) &&
2934 MaxHeapSize < LargePageHeapSizeThreshold) {
2935 // No need for large granularity pages w/small heaps.
2936 // Note that large pages are enabled/disabled for both the
2937 // Java heap and the code cache.
2938 FLAG_SET_DEFAULT(UseLargePages, false);
2939 }
2940
2941 UNSUPPORTED_OPTION(ProfileInterpreter);
2942 #endif
2943
2944 // Parse the CompilationMode flag
2945 if (!CompilationModeFlag::initialize()) {
2946 return JNI_ERR;
2947 }
2948
2949 if (!check_vm_args_consistency()) {
2950 return JNI_ERR;
2951 }
2952
2953 if (!CDSConfig::check_vm_args_consistency(patch_mod_javabase, mode_flag_cmd_line)) {
2954 return JNI_ERR;
2955 }
2956
2957 #ifndef CAN_SHOW_REGISTERS_ON_ASSERT
2958 UNSUPPORTED_OPTION(ShowRegistersOnAssert);
2959 #endif // CAN_SHOW_REGISTERS_ON_ASSERT
2960
2961 return JNI_OK;
2962 }
2963
2964 // Helper class for controlling the lifetime of JavaVMInitArgs
2965 // objects. The contents of the JavaVMInitArgs are guaranteed to be
2966 // deleted on the destruction of the ScopedVMInitArgs object.
2967 class ScopedVMInitArgs : public StackObj {
2968 private:
2969 JavaVMInitArgs _args;
2970 char* _container_name;
2971 bool _is_set;
2972 char* _vm_options_file_arg;
2973
2974 public:
2975 ScopedVMInitArgs(const char *container_name) {
2976 _args.version = JNI_VERSION_1_2;
3709
3710 // Set compiler flags after GC is selected and GC specific
3711 // flags (LoopStripMiningIter) are set.
3712 CompilerConfig::ergo_initialize();
3713
3714 // Set bytecode rewriting flags
3715 set_bytecode_flags();
3716
3717 // Set flags if aggressive optimization flags are enabled
3718 jint code = set_aggressive_opts_flags();
3719 if (code != JNI_OK) {
3720 return code;
3721 }
3722
3723 if (FLAG_IS_DEFAULT(UseSecondarySupersTable)) {
3724 FLAG_SET_DEFAULT(UseSecondarySupersTable, VM_Version::supports_secondary_supers_table());
3725 } else if (UseSecondarySupersTable && !VM_Version::supports_secondary_supers_table()) {
3726 warning("UseSecondarySupersTable is not supported");
3727 FLAG_SET_DEFAULT(UseSecondarySupersTable, false);
3728 }
3729 if (!UseSecondarySupersTable) {
3730 FLAG_SET_DEFAULT(StressSecondarySupers, false);
3731 FLAG_SET_DEFAULT(VerifySecondarySupers, false);
3732 }
3733
3734 #ifdef ZERO
3735 // Clear flags not supported on zero.
3736 FLAG_SET_DEFAULT(ProfileInterpreter, false);
3737 #endif // ZERO
3738
3739 if (PrintAssembly && FLAG_IS_DEFAULT(DebugNonSafepoints)) {
3740 warning("PrintAssembly is enabled; turning on DebugNonSafepoints to gain additional output");
3741 DebugNonSafepoints = true;
3742 }
3743
3744 if (FLAG_IS_CMDLINE(CompressedClassSpaceSize) && !UseCompressedClassPointers) {
3745 warning("Setting CompressedClassSpaceSize has no effect when compressed class pointers are not used");
3746 }
3747
3748 // Treat the odd case where local verification is enabled but remote
3770 warning("Disabling EnableVectorReboxing since EnableVectorSupport is turned off.");
3771 }
3772 FLAG_SET_DEFAULT(EnableVectorReboxing, false);
3773
3774 if (!FLAG_IS_DEFAULT(EnableVectorAggressiveReboxing) && EnableVectorAggressiveReboxing) {
3775 if (!EnableVectorReboxing) {
3776 warning("Disabling EnableVectorAggressiveReboxing since EnableVectorReboxing is turned off.");
3777 } else {
3778 warning("Disabling EnableVectorAggressiveReboxing since EnableVectorSupport is turned off.");
3779 }
3780 }
3781 FLAG_SET_DEFAULT(EnableVectorAggressiveReboxing, false);
3782
3783 if (!FLAG_IS_DEFAULT(UseVectorStubs) && UseVectorStubs) {
3784 warning("Disabling UseVectorStubs since EnableVectorSupport is turned off.");
3785 }
3786 FLAG_SET_DEFAULT(UseVectorStubs, false);
3787 }
3788 #endif // COMPILER2_OR_JVMCI
3789
3790 if (log_is_enabled(Info, perf, class, link)) {
3791 if (!UsePerfData) {
3792 warning("Disabling -Xlog:perf+class+link since UsePerfData is turned off.");
3793 LogConfiguration::configure_stdout(LogLevel::Off, false, LOG_TAGS(perf, class, link));
3794 }
3795 }
3796
3797 if (FLAG_IS_CMDLINE(DiagnoseSyncOnValueBasedClasses)) {
3798 if (DiagnoseSyncOnValueBasedClasses == ObjectSynchronizer::LOG_WARNING && !log_is_enabled(Info, valuebasedclasses)) {
3799 LogConfiguration::configure_stdout(LogLevel::Info, true, LOG_TAGS(valuebasedclasses));
3800 }
3801 }
3802 return JNI_OK;
3803 }
3804
3805 jint Arguments::adjust_after_os() {
3806 if (UseNUMA) {
3807 if (UseParallelGC) {
3808 if (FLAG_IS_DEFAULT(MinHeapDeltaBytes)) {
3809 FLAG_SET_DEFAULT(MinHeapDeltaBytes, 64*M);
3810 }
3811 }
3812 }
3813 return JNI_OK;
3814 }
3815
|
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 *
23 */
24
25 #include "precompiled.hpp"
26 #include "cds/cds_globals.hpp"
27 #include "cds/cdsConfig.hpp"
28 #include "cds/filemap.hpp"
29 #include "cds/heapShared.hpp"
30 #include "classfile/classLoader.hpp"
31 #include "classfile/javaAssertions.hpp"
32 #include "classfile/moduleEntry.hpp"
33 #include "classfile/stringTable.hpp"
34 #include "classfile/symbolTable.hpp"
35 #include "compiler/compilerDefinitions.hpp"
36 #include "gc/shared/gcArguments.hpp"
37 #include "gc/shared/gcConfig.hpp"
38 #include "gc/shared/genArguments.hpp"
39 #include "gc/shared/stringdedup/stringDedup.hpp"
40 #include "gc/shared/tlab_globals.hpp"
41 #include "jvm.h"
42 #include "logging/log.hpp"
43 #include "logging/logConfiguration.hpp"
44 #include "logging/logStream.hpp"
45 #include "logging/logTag.hpp"
46 #include "memory/allocation.inline.hpp"
47 #include "nmt/nmtCommon.hpp"
48 #include "oops/compressedKlass.hpp"
49 #include "oops/instanceKlass.hpp"
2934 if (FLAG_IS_DEFAULT(UseLargePages) &&
2935 MaxHeapSize < LargePageHeapSizeThreshold) {
2936 // No need for large granularity pages w/small heaps.
2937 // Note that large pages are enabled/disabled for both the
2938 // Java heap and the code cache.
2939 FLAG_SET_DEFAULT(UseLargePages, false);
2940 }
2941
2942 UNSUPPORTED_OPTION(ProfileInterpreter);
2943 #endif
2944
2945 // Parse the CompilationMode flag
2946 if (!CompilationModeFlag::initialize()) {
2947 return JNI_ERR;
2948 }
2949
2950 if (!check_vm_args_consistency()) {
2951 return JNI_ERR;
2952 }
2953
2954 if (!CDSConfig::check_vm_args_consistency(patch_mod_javabase, mode_flag_cmd_line, xshare_auto_cmd_line)) {
2955 return JNI_ERR;
2956 }
2957
2958 if (StoreCachedCode) {
2959 FLAG_SET_ERGO_IF_DEFAULT(CachedCodeMaxSize, 512*M);
2960 }
2961
2962 #ifndef CAN_SHOW_REGISTERS_ON_ASSERT
2963 UNSUPPORTED_OPTION(ShowRegistersOnAssert);
2964 #endif // CAN_SHOW_REGISTERS_ON_ASSERT
2965
2966 return JNI_OK;
2967 }
2968
2969 // Helper class for controlling the lifetime of JavaVMInitArgs
2970 // objects. The contents of the JavaVMInitArgs are guaranteed to be
2971 // deleted on the destruction of the ScopedVMInitArgs object.
2972 class ScopedVMInitArgs : public StackObj {
2973 private:
2974 JavaVMInitArgs _args;
2975 char* _container_name;
2976 bool _is_set;
2977 char* _vm_options_file_arg;
2978
2979 public:
2980 ScopedVMInitArgs(const char *container_name) {
2981 _args.version = JNI_VERSION_1_2;
3714
3715 // Set compiler flags after GC is selected and GC specific
3716 // flags (LoopStripMiningIter) are set.
3717 CompilerConfig::ergo_initialize();
3718
3719 // Set bytecode rewriting flags
3720 set_bytecode_flags();
3721
3722 // Set flags if aggressive optimization flags are enabled
3723 jint code = set_aggressive_opts_flags();
3724 if (code != JNI_OK) {
3725 return code;
3726 }
3727
3728 if (FLAG_IS_DEFAULT(UseSecondarySupersTable)) {
3729 FLAG_SET_DEFAULT(UseSecondarySupersTable, VM_Version::supports_secondary_supers_table());
3730 } else if (UseSecondarySupersTable && !VM_Version::supports_secondary_supers_table()) {
3731 warning("UseSecondarySupersTable is not supported");
3732 FLAG_SET_DEFAULT(UseSecondarySupersTable, false);
3733 }
3734 UseSecondarySupersTable = false; // FIXME: Disabled for Leyden. Neet to fix SCAddressTable::id_for_address()
3735 if (!UseSecondarySupersTable) {
3736 FLAG_SET_DEFAULT(StressSecondarySupers, false);
3737 FLAG_SET_DEFAULT(VerifySecondarySupers, false);
3738 }
3739
3740 #ifdef ZERO
3741 // Clear flags not supported on zero.
3742 FLAG_SET_DEFAULT(ProfileInterpreter, false);
3743 #endif // ZERO
3744
3745 if (PrintAssembly && FLAG_IS_DEFAULT(DebugNonSafepoints)) {
3746 warning("PrintAssembly is enabled; turning on DebugNonSafepoints to gain additional output");
3747 DebugNonSafepoints = true;
3748 }
3749
3750 if (FLAG_IS_CMDLINE(CompressedClassSpaceSize) && !UseCompressedClassPointers) {
3751 warning("Setting CompressedClassSpaceSize has no effect when compressed class pointers are not used");
3752 }
3753
3754 // Treat the odd case where local verification is enabled but remote
3776 warning("Disabling EnableVectorReboxing since EnableVectorSupport is turned off.");
3777 }
3778 FLAG_SET_DEFAULT(EnableVectorReboxing, false);
3779
3780 if (!FLAG_IS_DEFAULT(EnableVectorAggressiveReboxing) && EnableVectorAggressiveReboxing) {
3781 if (!EnableVectorReboxing) {
3782 warning("Disabling EnableVectorAggressiveReboxing since EnableVectorReboxing is turned off.");
3783 } else {
3784 warning("Disabling EnableVectorAggressiveReboxing since EnableVectorSupport is turned off.");
3785 }
3786 }
3787 FLAG_SET_DEFAULT(EnableVectorAggressiveReboxing, false);
3788
3789 if (!FLAG_IS_DEFAULT(UseVectorStubs) && UseVectorStubs) {
3790 warning("Disabling UseVectorStubs since EnableVectorSupport is turned off.");
3791 }
3792 FLAG_SET_DEFAULT(UseVectorStubs, false);
3793 }
3794 #endif // COMPILER2_OR_JVMCI
3795
3796 if (log_is_enabled(Info, init)) {
3797 if (FLAG_IS_DEFAULT(ProfileVMLocks)) {
3798 FLAG_SET_DEFAULT(ProfileVMLocks, true);
3799 }
3800 if (UsePerfData && !log_is_enabled(Info, perf, class, link)) {
3801 // automatically enable -Xlog:perf+class+link
3802 LogConfiguration::configure_stdout(LogLevel::Info, true, LOG_TAGS(perf, class, link));
3803 }
3804 // Don't turn on ProfileVMCalls and ProfileRuntimeCalls by default.
3805 } else {
3806 if (!FLAG_IS_DEFAULT(ProfileVMLocks) && ProfileVMLocks) {
3807 warning("Disabling ProfileVMLocks since logging is turned off.");
3808 FLAG_SET_DEFAULT(ProfileVMLocks, false);
3809 }
3810 if (!FLAG_IS_DEFAULT(ProfileVMCalls) && ProfileVMCalls) {
3811 warning("Disabling ProfileVMCalls since logging is turned off.");
3812 FLAG_SET_DEFAULT(ProfileVMCalls, false);
3813 }
3814 if (!FLAG_IS_DEFAULT(ProfileRuntimeCalls) && ProfileRuntimeCalls) {
3815 warning("Disabling ProfileRuntimeCalls since logging is turned off.");
3816 FLAG_SET_DEFAULT(ProfileRuntimeCalls, false);
3817 }
3818 if (log_is_enabled(Info, perf, class, link)) {
3819 warning("Disabling -Xlog:perf+class+link since logging is turned off.");
3820 LogConfiguration::configure_stdout(LogLevel::Off, false, LOG_TAGS(perf, class, link));
3821 }
3822 }
3823 if (FLAG_IS_DEFAULT(PerfDataMemorySize)) {
3824 if (ProfileVMLocks || ProfileVMCalls || ProfileRuntimeCalls) {
3825 FLAG_SET_DEFAULT(PerfDataMemorySize, 128*K); // reserve more space for extra perf counters
3826 }
3827 }
3828
3829 if (FLAG_IS_CMDLINE(DiagnoseSyncOnValueBasedClasses)) {
3830 if (DiagnoseSyncOnValueBasedClasses == ObjectSynchronizer::LOG_WARNING && !log_is_enabled(Info, valuebasedclasses)) {
3831 LogConfiguration::configure_stdout(LogLevel::Info, true, LOG_TAGS(valuebasedclasses));
3832 }
3833 }
3834 return JNI_OK;
3835 }
3836
3837 jint Arguments::adjust_after_os() {
3838 if (UseNUMA) {
3839 if (UseParallelGC) {
3840 if (FLAG_IS_DEFAULT(MinHeapDeltaBytes)) {
3841 FLAG_SET_DEFAULT(MinHeapDeltaBytes, 64*M);
3842 }
3843 }
3844 }
3845 return JNI_OK;
3846 }
3847
|