src/hotspot/share/gc/parallel/jvmFlagConstraintsParallel.cpp
author stefank
Mon, 15 Apr 2019 11:47:46 +0200
changeset 54678 93f09ca4a7f8
parent 50289 0195ee80e530
permissions -rw-r--r--
8198505: Remove CollectorPolicy and its subclasses Reviewed-by: pliden, shade
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
49731
635838cb8b3a 8201168: Move GC command line constraint functions to GC specific files
stefank
parents:
diff changeset
     1
/*
635838cb8b3a 8201168: Move GC command line constraint functions to GC specific files
stefank
parents:
diff changeset
     2
 * Copyright (c) 2015, 2018, Oracle and/or its affiliates. All rights reserved.
635838cb8b3a 8201168: Move GC command line constraint functions to GC specific files
stefank
parents:
diff changeset
     3
 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
635838cb8b3a 8201168: Move GC command line constraint functions to GC specific files
stefank
parents:
diff changeset
     4
 *
635838cb8b3a 8201168: Move GC command line constraint functions to GC specific files
stefank
parents:
diff changeset
     5
 * This code is free software; you can redistribute it and/or modify it
635838cb8b3a 8201168: Move GC command line constraint functions to GC specific files
stefank
parents:
diff changeset
     6
 * under the terms of the GNU General Public License version 2 only, as
635838cb8b3a 8201168: Move GC command line constraint functions to GC specific files
stefank
parents:
diff changeset
     7
 * published by the Free Software Foundation.
635838cb8b3a 8201168: Move GC command line constraint functions to GC specific files
stefank
parents:
diff changeset
     8
 *
635838cb8b3a 8201168: Move GC command line constraint functions to GC specific files
stefank
parents:
diff changeset
     9
 * This code is distributed in the hope that it will be useful, but WITHOUT
635838cb8b3a 8201168: Move GC command line constraint functions to GC specific files
stefank
parents:
diff changeset
    10
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
635838cb8b3a 8201168: Move GC command line constraint functions to GC specific files
stefank
parents:
diff changeset
    11
 * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
635838cb8b3a 8201168: Move GC command line constraint functions to GC specific files
stefank
parents:
diff changeset
    12
 * version 2 for more details (a copy is included in the LICENSE file that
635838cb8b3a 8201168: Move GC command line constraint functions to GC specific files
stefank
parents:
diff changeset
    13
 * accompanied this code).
635838cb8b3a 8201168: Move GC command line constraint functions to GC specific files
stefank
parents:
diff changeset
    14
 *
635838cb8b3a 8201168: Move GC command line constraint functions to GC specific files
stefank
parents:
diff changeset
    15
 * You should have received a copy of the GNU General Public License version
635838cb8b3a 8201168: Move GC command line constraint functions to GC specific files
stefank
parents:
diff changeset
    16
 * 2 along with this work; if not, write to the Free Software Foundation,
635838cb8b3a 8201168: Move GC command line constraint functions to GC specific files
stefank
parents:
diff changeset
    17
 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
635838cb8b3a 8201168: Move GC command line constraint functions to GC specific files
stefank
parents:
diff changeset
    18
 *
635838cb8b3a 8201168: Move GC command line constraint functions to GC specific files
stefank
parents:
diff changeset
    19
 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
635838cb8b3a 8201168: Move GC command line constraint functions to GC specific files
stefank
parents:
diff changeset
    20
 * or visit www.oracle.com if you need additional information or have any
635838cb8b3a 8201168: Move GC command line constraint functions to GC specific files
stefank
parents:
diff changeset
    21
 * questions.
635838cb8b3a 8201168: Move GC command line constraint functions to GC specific files
stefank
parents:
diff changeset
    22
 *
635838cb8b3a 8201168: Move GC command line constraint functions to GC specific files
stefank
parents:
diff changeset
    23
 */
635838cb8b3a 8201168: Move GC command line constraint functions to GC specific files
stefank
parents:
diff changeset
    24
635838cb8b3a 8201168: Move GC command line constraint functions to GC specific files
stefank
parents:
diff changeset
    25
#include "precompiled.hpp"
50289
0195ee80e530 8133564: Runtime - 2nd followup to Validate JVM Command-Line Flag Arguments
gziemski
parents: 49857
diff changeset
    26
#include "gc/parallel/jvmFlagConstraintsParallel.hpp"
49731
635838cb8b3a 8201168: Move GC command line constraint functions to GC specific files
stefank
parents:
diff changeset
    27
#include "runtime/globals.hpp"
635838cb8b3a 8201168: Move GC command line constraint functions to GC specific files
stefank
parents:
diff changeset
    28
#include "utilities/globalDefinitions.hpp"
635838cb8b3a 8201168: Move GC command line constraint functions to GC specific files
stefank
parents:
diff changeset
    29
49857
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents: 49731
diff changeset
    30
JVMFlag::Error ParallelGCThreadsConstraintFuncParallel(uint value, bool verbose) {
49731
635838cb8b3a 8201168: Move GC command line constraint functions to GC specific files
stefank
parents:
diff changeset
    31
  // Parallel GC passes ParallelGCThreads when creating GrowableArray as 'int' type parameter.
635838cb8b3a 8201168: Move GC command line constraint functions to GC specific files
stefank
parents:
diff changeset
    32
  // So can't exceed with "max_jint"
635838cb8b3a 8201168: Move GC command line constraint functions to GC specific files
stefank
parents:
diff changeset
    33
635838cb8b3a 8201168: Move GC command line constraint functions to GC specific files
stefank
parents:
diff changeset
    34
  if (UseParallelGC && (value > (uint)max_jint)) {
50289
0195ee80e530 8133564: Runtime - 2nd followup to Validate JVM Command-Line Flag Arguments
gziemski
parents: 49857
diff changeset
    35
    JVMFlag::printError(verbose,
0195ee80e530 8133564: Runtime - 2nd followup to Validate JVM Command-Line Flag Arguments
gziemski
parents: 49857
diff changeset
    36
                        "ParallelGCThreads (" UINT32_FORMAT ") must be "
0195ee80e530 8133564: Runtime - 2nd followup to Validate JVM Command-Line Flag Arguments
gziemski
parents: 49857
diff changeset
    37
                        "less than or equal to " UINT32_FORMAT " for Parallel GC\n",
0195ee80e530 8133564: Runtime - 2nd followup to Validate JVM Command-Line Flag Arguments
gziemski
parents: 49857
diff changeset
    38
                        value, max_jint);
49857
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents: 49731
diff changeset
    39
    return JVMFlag::VIOLATES_CONSTRAINT;
49731
635838cb8b3a 8201168: Move GC command line constraint functions to GC specific files
stefank
parents:
diff changeset
    40
  }
49857
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents: 49731
diff changeset
    41
  return JVMFlag::SUCCESS;
49731
635838cb8b3a 8201168: Move GC command line constraint functions to GC specific files
stefank
parents:
diff changeset
    42
}
635838cb8b3a 8201168: Move GC command line constraint functions to GC specific files
stefank
parents:
diff changeset
    43
49857
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents: 49731
diff changeset
    44
JVMFlag::Error InitialTenuringThresholdConstraintFuncParallel(uintx value, bool verbose) {
49731
635838cb8b3a 8201168: Move GC command line constraint functions to GC specific files
stefank
parents:
diff changeset
    45
  // InitialTenuringThreshold is only used for ParallelGC.
635838cb8b3a 8201168: Move GC command line constraint functions to GC specific files
stefank
parents:
diff changeset
    46
  if (UseParallelGC && (value > MaxTenuringThreshold)) {
50289
0195ee80e530 8133564: Runtime - 2nd followup to Validate JVM Command-Line Flag Arguments
gziemski
parents: 49857
diff changeset
    47
      JVMFlag::printError(verbose,
0195ee80e530 8133564: Runtime - 2nd followup to Validate JVM Command-Line Flag Arguments
gziemski
parents: 49857
diff changeset
    48
                          "InitialTenuringThreshold (" UINTX_FORMAT ") must be "
0195ee80e530 8133564: Runtime - 2nd followup to Validate JVM Command-Line Flag Arguments
gziemski
parents: 49857
diff changeset
    49
                          "less than or equal to MaxTenuringThreshold (" UINTX_FORMAT ")\n",
0195ee80e530 8133564: Runtime - 2nd followup to Validate JVM Command-Line Flag Arguments
gziemski
parents: 49857
diff changeset
    50
                          value, MaxTenuringThreshold);
49857
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents: 49731
diff changeset
    51
      return JVMFlag::VIOLATES_CONSTRAINT;
49731
635838cb8b3a 8201168: Move GC command line constraint functions to GC specific files
stefank
parents:
diff changeset
    52
  }
49857
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents: 49731
diff changeset
    53
  return JVMFlag::SUCCESS;
49731
635838cb8b3a 8201168: Move GC command line constraint functions to GC specific files
stefank
parents:
diff changeset
    54
}
635838cb8b3a 8201168: Move GC command line constraint functions to GC specific files
stefank
parents:
diff changeset
    55
49857
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents: 49731
diff changeset
    56
JVMFlag::Error MaxTenuringThresholdConstraintFuncParallel(uintx value, bool verbose) {
49731
635838cb8b3a 8201168: Move GC command line constraint functions to GC specific files
stefank
parents:
diff changeset
    57
  // As only ParallelGC uses InitialTenuringThreshold,
635838cb8b3a 8201168: Move GC command line constraint functions to GC specific files
stefank
parents:
diff changeset
    58
  // we don't need to compare InitialTenuringThreshold with MaxTenuringThreshold.
635838cb8b3a 8201168: Move GC command line constraint functions to GC specific files
stefank
parents:
diff changeset
    59
  if (UseParallelGC && (value < InitialTenuringThreshold)) {
50289
0195ee80e530 8133564: Runtime - 2nd followup to Validate JVM Command-Line Flag Arguments
gziemski
parents: 49857
diff changeset
    60
    JVMFlag::printError(verbose,
0195ee80e530 8133564: Runtime - 2nd followup to Validate JVM Command-Line Flag Arguments
gziemski
parents: 49857
diff changeset
    61
                        "MaxTenuringThreshold (" UINTX_FORMAT ") must be "
0195ee80e530 8133564: Runtime - 2nd followup to Validate JVM Command-Line Flag Arguments
gziemski
parents: 49857
diff changeset
    62
                        "greater than or equal to InitialTenuringThreshold (" UINTX_FORMAT ")\n",
0195ee80e530 8133564: Runtime - 2nd followup to Validate JVM Command-Line Flag Arguments
gziemski
parents: 49857
diff changeset
    63
                        value, InitialTenuringThreshold);
49857
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents: 49731
diff changeset
    64
    return JVMFlag::VIOLATES_CONSTRAINT;
49731
635838cb8b3a 8201168: Move GC command line constraint functions to GC specific files
stefank
parents:
diff changeset
    65
  }
635838cb8b3a 8201168: Move GC command line constraint functions to GC specific files
stefank
parents:
diff changeset
    66
49857
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents: 49731
diff changeset
    67
  return JVMFlag::SUCCESS;
49731
635838cb8b3a 8201168: Move GC command line constraint functions to GC specific files
stefank
parents:
diff changeset
    68
}