# HG changeset patch # User jcoomes # Date 1409945797 25200 # Node ID 344fb68e970a8b2bd0968eb8c21cfc6ce01d55d2 # Parent 72a43d3841e717bfa5ebfc66e84e6ffb67f8f73d 8057623: add an extension class for argument handling Reviewed-by: brutisso, mgerdin, tschatzl diff -r 72a43d3841e7 -r 344fb68e970a hotspot/src/share/vm/runtime/arguments.cpp --- a/hotspot/src/share/vm/runtime/arguments.cpp Fri Sep 05 09:49:19 2014 +0200 +++ b/hotspot/src/share/vm/runtime/arguments.cpp Fri Sep 05 12:36:37 2014 -0700 @@ -36,6 +36,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 "runtime/os.hpp" @@ -1575,7 +1576,7 @@ void Arguments::select_gc() { if (!gc_selected()) { - select_gc_ergonomically(); + ArgumentsExt::select_gc_ergonomically(); } } @@ -2082,7 +2083,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 @@ -2241,7 +2242,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) { @@ -2498,8 +2499,6 @@ warning("The VM option CICompilerCountPerCPU overrides CICompilerCount."); } - status &= check_vm_args_consistency_ext(); - return status; } @@ -3482,7 +3481,7 @@ } } - if (!check_vm_args_consistency()) { + if (!ArgumentsExt::check_vm_args_consistency()) { return JNI_ERR; } @@ -3838,7 +3837,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 72a43d3841e7 -r 344fb68e970a hotspot/src/share/vm/runtime/arguments.hpp --- a/hotspot/src/share/vm/runtime/arguments.hpp Fri Sep 05 09:49:19 2014 +0200 +++ b/hotspot/src/share/vm/runtime/arguments.hpp Fri Sep 05 12:36:37 2014 -0700 @@ -467,12 +467,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 consistency 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 @@ -615,4 +615,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 72a43d3841e7 -r 344fb68e970a hotspot/src/share/vm/runtime/arguments_ext.cpp --- a/hotspot/src/share/vm/runtime/arguments_ext.cpp Fri Sep 05 09:49:19 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 72a43d3841e7 -r 344fb68e970a hotspot/src/share/vm/runtime/arguments_ext.hpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/hotspot/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