# HG changeset patch # User jcoomes # Date 1409945797 25200 # Node ID 76af788b6c16c24964641f24c719045800e577e4 # Parent 9be4ca335650b00516135e174dc6003d6675e0f7 8057623: add an extension class for argument handling Reviewed-by: brutisso, mgerdin, tschatzl diff -r 9be4ca335650 -r 76af788b6c16 src/share/vm/runtime/arguments.cpp --- a/src/share/vm/runtime/arguments.cpp Fri Sep 05 00:28:43 2014 +0200 +++ b/src/share/vm/runtime/arguments.cpp Fri Sep 05 12:36:37 2014 -0700 @@ -35,6 +35,7 @@ #include "oops/oop.inline.hpp" #include "prims/jvmtiExport.hpp" #include "runtime/arguments.hpp" +#include "runtime/arguments_ext.hpp" #include "runtime/globals_extension.hpp" #include "runtime/java.hpp" #include "services/management.hpp" @@ -1544,7 +1545,7 @@ void Arguments::select_gc() { if (!gc_selected()) { - select_gc_ergonomically(); + ArgumentsExt::select_gc_ergonomically(); } } @@ -2033,7 +2034,7 @@ } // Check consistency of GC selection -bool Arguments::check_gc_consistency() { +bool Arguments::check_gc_consistency_user() { check_gclog_consistency(); bool status = true; // Ensure that the user has not selected conflicting sets @@ -2199,7 +2200,7 @@ FLAG_SET_DEFAULT(UseGCOverheadLimit, false); } - status = status && check_gc_consistency(); + status = status && ArgumentsExt::check_gc_consistency_user(); status = status && check_stack_pages(); if (CMSIncrementalMode) { @@ -2447,8 +2448,6 @@ warning("The VM option CICompilerCountPerCPU overrides CICompilerCount."); } - status &= check_vm_args_consistency_ext(); - return status; } @@ -3419,7 +3418,7 @@ } } - if (!check_vm_args_consistency()) { + if (!ArgumentsExt::check_vm_args_consistency()) { return JNI_ERR; } @@ -3793,7 +3792,7 @@ set_shared_spaces_flags(); // Check the GC selections again. - if (!check_gc_consistency()) { + if (!ArgumentsExt::check_gc_consistency_ergo()) { return JNI_EINVAL; } diff -r 9be4ca335650 -r 76af788b6c16 src/share/vm/runtime/arguments.hpp --- a/src/share/vm/runtime/arguments.hpp Fri Sep 05 00:28:43 2014 +0200 +++ b/src/share/vm/runtime/arguments.hpp Fri Sep 05 12:36:37 2014 -0700 @@ -465,12 +465,12 @@ static bool verify_MaxHeapFreeRatio(FormatBuffer<80>& err_msg, uintx max_heap_free_ratio); // Check for consistency in the selection of the garbage collector. - static bool check_gc_consistency(); + static bool check_gc_consistency_user(); // Check user-selected gc + static inline bool check_gc_consistency_ergo(); // Check ergonomic-selected gc static void check_deprecated_gcs(); static void check_deprecated_gc_flags(); // Check consistecy or otherwise of VM argument settings static bool check_vm_args_consistency(); - static bool check_vm_args_consistency_ext(); // Check stack pages settings static bool check_stack_pages(); // Used by os_solaris @@ -611,4 +611,9 @@ return UseConcMarkSweepGC || UseG1GC || UseParallelGC || UseParallelOldGC || UseParNewGC || UseSerialGC; } + +bool Arguments::check_gc_consistency_ergo() { + return check_gc_consistency_user(); +} + #endif // SHARE_VM_RUNTIME_ARGUMENTS_HPP diff -r 9be4ca335650 -r 76af788b6c16 src/share/vm/runtime/arguments_ext.cpp --- a/src/share/vm/runtime/arguments_ext.cpp Fri Sep 05 00:28:43 2014 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,30 +0,0 @@ -/* - * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA - * or visit www.oracle.com if you need additional information or have any - * questions. - * - */ - -#include "precompiled.hpp" -#include "runtime/arguments.hpp" - -bool Arguments::check_vm_args_consistency_ext() { - return true; -} diff -r 9be4ca335650 -r 76af788b6c16 src/share/vm/runtime/arguments_ext.hpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/share/vm/runtime/arguments_ext.hpp Fri Sep 05 12:36:37 2014 -0700 @@ -0,0 +1,55 @@ +/* + * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + * + */ + +#ifndef SHARE_VM_RUNTIME_ARGUMENTS_EXT_HPP +#define SHARE_VM_RUNTIME_ARGUMENTS_EXT_HPP + +#include "memory/allocation.hpp" +#include "runtime/arguments.hpp" + +class ArgumentsExt: AllStatic { +public: + static inline void select_gc_ergonomically(); + static inline bool check_gc_consistency_user(); + static inline bool check_gc_consistency_ergo(); + static inline bool check_vm_args_consistency(); +}; + +void ArgumentsExt::select_gc_ergonomically() { + Arguments::select_gc_ergonomically(); +} + +bool ArgumentsExt::check_gc_consistency_user() { + return Arguments::check_gc_consistency_user(); +} + +bool ArgumentsExt::check_gc_consistency_ergo() { + return Arguments::check_gc_consistency_ergo(); +} + +bool ArgumentsExt::check_vm_args_consistency() { + return Arguments::check_vm_args_consistency(); +} + +#endif // SHARE_VM_RUNTIME_ARGUMENTS_EXT_HPP