Fri, 05 Sep 2014 12:36:37 -0700
8057623: add an extension class for argument handling
Reviewed-by: brutisso, mgerdin, tschatzl
1.1 --- a/src/share/vm/runtime/arguments.cpp Fri Sep 05 00:28:43 2014 +0200 1.2 +++ b/src/share/vm/runtime/arguments.cpp Fri Sep 05 12:36:37 2014 -0700 1.3 @@ -35,6 +35,7 @@ 1.4 #include "oops/oop.inline.hpp" 1.5 #include "prims/jvmtiExport.hpp" 1.6 #include "runtime/arguments.hpp" 1.7 +#include "runtime/arguments_ext.hpp" 1.8 #include "runtime/globals_extension.hpp" 1.9 #include "runtime/java.hpp" 1.10 #include "services/management.hpp" 1.11 @@ -1544,7 +1545,7 @@ 1.12 1.13 void Arguments::select_gc() { 1.14 if (!gc_selected()) { 1.15 - select_gc_ergonomically(); 1.16 + ArgumentsExt::select_gc_ergonomically(); 1.17 } 1.18 } 1.19 1.20 @@ -2033,7 +2034,7 @@ 1.21 } 1.22 1.23 // Check consistency of GC selection 1.24 -bool Arguments::check_gc_consistency() { 1.25 +bool Arguments::check_gc_consistency_user() { 1.26 check_gclog_consistency(); 1.27 bool status = true; 1.28 // Ensure that the user has not selected conflicting sets 1.29 @@ -2199,7 +2200,7 @@ 1.30 FLAG_SET_DEFAULT(UseGCOverheadLimit, false); 1.31 } 1.32 1.33 - status = status && check_gc_consistency(); 1.34 + status = status && ArgumentsExt::check_gc_consistency_user(); 1.35 status = status && check_stack_pages(); 1.36 1.37 if (CMSIncrementalMode) { 1.38 @@ -2447,8 +2448,6 @@ 1.39 warning("The VM option CICompilerCountPerCPU overrides CICompilerCount."); 1.40 } 1.41 1.42 - status &= check_vm_args_consistency_ext(); 1.43 - 1.44 return status; 1.45 } 1.46 1.47 @@ -3419,7 +3418,7 @@ 1.48 } 1.49 } 1.50 1.51 - if (!check_vm_args_consistency()) { 1.52 + if (!ArgumentsExt::check_vm_args_consistency()) { 1.53 return JNI_ERR; 1.54 } 1.55 1.56 @@ -3793,7 +3792,7 @@ 1.57 set_shared_spaces_flags(); 1.58 1.59 // Check the GC selections again. 1.60 - if (!check_gc_consistency()) { 1.61 + if (!ArgumentsExt::check_gc_consistency_ergo()) { 1.62 return JNI_EINVAL; 1.63 } 1.64
2.1 --- a/src/share/vm/runtime/arguments.hpp Fri Sep 05 00:28:43 2014 +0200 2.2 +++ b/src/share/vm/runtime/arguments.hpp Fri Sep 05 12:36:37 2014 -0700 2.3 @@ -465,12 +465,12 @@ 2.4 static bool verify_MaxHeapFreeRatio(FormatBuffer<80>& err_msg, uintx max_heap_free_ratio); 2.5 2.6 // Check for consistency in the selection of the garbage collector. 2.7 - static bool check_gc_consistency(); 2.8 + static bool check_gc_consistency_user(); // Check user-selected gc 2.9 + static inline bool check_gc_consistency_ergo(); // Check ergonomic-selected gc 2.10 static void check_deprecated_gcs(); 2.11 static void check_deprecated_gc_flags(); 2.12 // Check consistecy or otherwise of VM argument settings 2.13 static bool check_vm_args_consistency(); 2.14 - static bool check_vm_args_consistency_ext(); 2.15 // Check stack pages settings 2.16 static bool check_stack_pages(); 2.17 // Used by os_solaris 2.18 @@ -611,4 +611,9 @@ 2.19 return UseConcMarkSweepGC || UseG1GC || UseParallelGC || UseParallelOldGC || 2.20 UseParNewGC || UseSerialGC; 2.21 } 2.22 + 2.23 +bool Arguments::check_gc_consistency_ergo() { 2.24 + return check_gc_consistency_user(); 2.25 +} 2.26 + 2.27 #endif // SHARE_VM_RUNTIME_ARGUMENTS_HPP
3.1 --- a/src/share/vm/runtime/arguments_ext.cpp Fri Sep 05 00:28:43 2014 +0200 3.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 3.3 @@ -1,30 +0,0 @@ 3.4 -/* 3.5 - * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved. 3.6 - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 3.7 - * 3.8 - * This code is free software; you can redistribute it and/or modify it 3.9 - * under the terms of the GNU General Public License version 2 only, as 3.10 - * published by the Free Software Foundation. 3.11 - * 3.12 - * This code is distributed in the hope that it will be useful, but WITHOUT 3.13 - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 3.14 - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 3.15 - * version 2 for more details (a copy is included in the LICENSE file that 3.16 - * accompanied this code). 3.17 - * 3.18 - * You should have received a copy of the GNU General Public License version 3.19 - * 2 along with this work; if not, write to the Free Software Foundation, 3.20 - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 3.21 - * 3.22 - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 3.23 - * or visit www.oracle.com if you need additional information or have any 3.24 - * questions. 3.25 - * 3.26 - */ 3.27 - 3.28 -#include "precompiled.hpp" 3.29 -#include "runtime/arguments.hpp" 3.30 - 3.31 -bool Arguments::check_vm_args_consistency_ext() { 3.32 - return true; 3.33 -}
4.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 4.2 +++ b/src/share/vm/runtime/arguments_ext.hpp Fri Sep 05 12:36:37 2014 -0700 4.3 @@ -0,0 +1,55 @@ 4.4 +/* 4.5 + * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved. 4.6 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 4.7 + * 4.8 + * This code is free software; you can redistribute it and/or modify it 4.9 + * under the terms of the GNU General Public License version 2 only, as 4.10 + * published by the Free Software Foundation. 4.11 + * 4.12 + * This code is distributed in the hope that it will be useful, but WITHOUT 4.13 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 4.14 + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 4.15 + * version 2 for more details (a copy is included in the LICENSE file that 4.16 + * accompanied this code). 4.17 + * 4.18 + * You should have received a copy of the GNU General Public License version 4.19 + * 2 along with this work; if not, write to the Free Software Foundation, 4.20 + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 4.21 + * 4.22 + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 4.23 + * or visit www.oracle.com if you need additional information or have any 4.24 + * questions. 4.25 + * 4.26 + */ 4.27 + 4.28 +#ifndef SHARE_VM_RUNTIME_ARGUMENTS_EXT_HPP 4.29 +#define SHARE_VM_RUNTIME_ARGUMENTS_EXT_HPP 4.30 + 4.31 +#include "memory/allocation.hpp" 4.32 +#include "runtime/arguments.hpp" 4.33 + 4.34 +class ArgumentsExt: AllStatic { 4.35 +public: 4.36 + static inline void select_gc_ergonomically(); 4.37 + static inline bool check_gc_consistency_user(); 4.38 + static inline bool check_gc_consistency_ergo(); 4.39 + static inline bool check_vm_args_consistency(); 4.40 +}; 4.41 + 4.42 +void ArgumentsExt::select_gc_ergonomically() { 4.43 + Arguments::select_gc_ergonomically(); 4.44 +} 4.45 + 4.46 +bool ArgumentsExt::check_gc_consistency_user() { 4.47 + return Arguments::check_gc_consistency_user(); 4.48 +} 4.49 + 4.50 +bool ArgumentsExt::check_gc_consistency_ergo() { 4.51 + return Arguments::check_gc_consistency_ergo(); 4.52 +} 4.53 + 4.54 +bool ArgumentsExt::check_vm_args_consistency() { 4.55 + return Arguments::check_vm_args_consistency(); 4.56 +} 4.57 + 4.58 +#endif // SHARE_VM_RUNTIME_ARGUMENTS_EXT_HPP