Path: blob/master/src/hotspot/share/gc/parallel/jvmFlagConstraintsParallel.cpp
41149 views
/*1* Copyright (c) 2015, 2021, Oracle and/or its affiliates. All rights reserved.2* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.3*4* This code is free software; you can redistribute it and/or modify it5* under the terms of the GNU General Public License version 2 only, as6* published by the Free Software Foundation.7*8* This code is distributed in the hope that it will be useful, but WITHOUT9* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or10* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License11* version 2 for more details (a copy is included in the LICENSE file that12* accompanied this code).13*14* You should have received a copy of the GNU General Public License version15* 2 along with this work; if not, write to the Free Software Foundation,16* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.17*18* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA19* or visit www.oracle.com if you need additional information or have any20* questions.21*22*/2324#include "precompiled.hpp"25#include "gc/parallel/jvmFlagConstraintsParallel.hpp"26#include "gc/shared/gc_globals.hpp"27#include "runtime/globals.hpp"28#include "utilities/globalDefinitions.hpp"2930JVMFlag::Error ParallelGCThreadsConstraintFuncParallel(uint value, bool verbose) {31// Parallel GC passes ParallelGCThreads when creating GrowableArray as 'int' type parameter.32// So can't exceed with "max_jint"3334if (UseParallelGC && (value > (uint)max_jint)) {35JVMFlag::printError(verbose,36"ParallelGCThreads (" UINT32_FORMAT ") must be "37"less than or equal to " UINT32_FORMAT " for Parallel GC\n",38value, max_jint);39return JVMFlag::VIOLATES_CONSTRAINT;40}41return JVMFlag::SUCCESS;42}4344JVMFlag::Error InitialTenuringThresholdConstraintFuncParallel(uintx value, bool verbose) {45// InitialTenuringThreshold is only used for ParallelGC.46if (UseParallelGC && (value > MaxTenuringThreshold)) {47JVMFlag::printError(verbose,48"InitialTenuringThreshold (" UINTX_FORMAT ") must be "49"less than or equal to MaxTenuringThreshold (" UINTX_FORMAT ")\n",50value, MaxTenuringThreshold);51return JVMFlag::VIOLATES_CONSTRAINT;52}53return JVMFlag::SUCCESS;54}5556JVMFlag::Error MaxTenuringThresholdConstraintFuncParallel(uintx value, bool verbose) {57// As only ParallelGC uses InitialTenuringThreshold,58// we don't need to compare InitialTenuringThreshold with MaxTenuringThreshold.59if (UseParallelGC && (value < InitialTenuringThreshold)) {60JVMFlag::printError(verbose,61"MaxTenuringThreshold (" UINTX_FORMAT ") must be "62"greater than or equal to InitialTenuringThreshold (" UINTX_FORMAT ")\n",63value, InitialTenuringThreshold);64return JVMFlag::VIOLATES_CONSTRAINT;65}6667return JVMFlag::SUCCESS;68}697071