author | roland |
Tue, 04 Aug 2015 13:41:09 +0200 | |
changeset 32087 | dcbcf15229a9 |
parent 32083 | 1796911eb140 |
parent 31996 | 6c23ab90cbaa |
child 32351 | 1da9b960b3d4 |
permissions | -rw-r--r-- |
31371
311143309e73
8122937: [JEP 245] Validate JVM Command-Line Flag Arguments.
gziemski
parents:
diff
changeset
|
1 |
/* |
311143309e73
8122937: [JEP 245] Validate JVM Command-Line Flag Arguments.
gziemski
parents:
diff
changeset
|
2 |
* Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved. |
311143309e73
8122937: [JEP 245] Validate JVM Command-Line Flag Arguments.
gziemski
parents:
diff
changeset
|
3 |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
311143309e73
8122937: [JEP 245] Validate JVM Command-Line Flag Arguments.
gziemski
parents:
diff
changeset
|
4 |
* |
311143309e73
8122937: [JEP 245] Validate JVM Command-Line Flag Arguments.
gziemski
parents:
diff
changeset
|
5 |
* This code is free software; you can redistribute it and/or modify it |
311143309e73
8122937: [JEP 245] Validate JVM Command-Line Flag Arguments.
gziemski
parents:
diff
changeset
|
6 |
* under the terms of the GNU General Public License version 2 only, as |
311143309e73
8122937: [JEP 245] Validate JVM Command-Line Flag Arguments.
gziemski
parents:
diff
changeset
|
7 |
* published by the Free Software Foundation. |
311143309e73
8122937: [JEP 245] Validate JVM Command-Line Flag Arguments.
gziemski
parents:
diff
changeset
|
8 |
* |
311143309e73
8122937: [JEP 245] Validate JVM Command-Line Flag Arguments.
gziemski
parents:
diff
changeset
|
9 |
* This code is distributed in the hope that it will be useful, but WITHOUT |
311143309e73
8122937: [JEP 245] Validate JVM Command-Line Flag Arguments.
gziemski
parents:
diff
changeset
|
10 |
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
311143309e73
8122937: [JEP 245] Validate JVM Command-Line Flag Arguments.
gziemski
parents:
diff
changeset
|
11 |
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
311143309e73
8122937: [JEP 245] Validate JVM Command-Line Flag Arguments.
gziemski
parents:
diff
changeset
|
12 |
* version 2 for more details (a copy is included in the LICENSE file that |
311143309e73
8122937: [JEP 245] Validate JVM Command-Line Flag Arguments.
gziemski
parents:
diff
changeset
|
13 |
* accompanied this code). |
311143309e73
8122937: [JEP 245] Validate JVM Command-Line Flag Arguments.
gziemski
parents:
diff
changeset
|
14 |
* |
311143309e73
8122937: [JEP 245] Validate JVM Command-Line Flag Arguments.
gziemski
parents:
diff
changeset
|
15 |
* You should have received a copy of the GNU General Public License version |
311143309e73
8122937: [JEP 245] Validate JVM Command-Line Flag Arguments.
gziemski
parents:
diff
changeset
|
16 |
* 2 along with this work; if not, write to the Free Software Foundation, |
311143309e73
8122937: [JEP 245] Validate JVM Command-Line Flag Arguments.
gziemski
parents:
diff
changeset
|
17 |
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. |
311143309e73
8122937: [JEP 245] Validate JVM Command-Line Flag Arguments.
gziemski
parents:
diff
changeset
|
18 |
* |
311143309e73
8122937: [JEP 245] Validate JVM Command-Line Flag Arguments.
gziemski
parents:
diff
changeset
|
19 |
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA |
311143309e73
8122937: [JEP 245] Validate JVM Command-Line Flag Arguments.
gziemski
parents:
diff
changeset
|
20 |
* or visit www.oracle.com if you need additional information or have any |
311143309e73
8122937: [JEP 245] Validate JVM Command-Line Flag Arguments.
gziemski
parents:
diff
changeset
|
21 |
* questions. |
311143309e73
8122937: [JEP 245] Validate JVM Command-Line Flag Arguments.
gziemski
parents:
diff
changeset
|
22 |
* |
311143309e73
8122937: [JEP 245] Validate JVM Command-Line Flag Arguments.
gziemski
parents:
diff
changeset
|
23 |
*/ |
311143309e73
8122937: [JEP 245] Validate JVM Command-Line Flag Arguments.
gziemski
parents:
diff
changeset
|
24 |
|
311143309e73
8122937: [JEP 245] Validate JVM Command-Line Flag Arguments.
gziemski
parents:
diff
changeset
|
25 |
#include "precompiled.hpp" |
311143309e73
8122937: [JEP 245] Validate JVM Command-Line Flag Arguments.
gziemski
parents:
diff
changeset
|
26 |
#include "runtime/arguments.hpp" |
311143309e73
8122937: [JEP 245] Validate JVM Command-Line Flag Arguments.
gziemski
parents:
diff
changeset
|
27 |
#include "runtime/commandLineFlagConstraintsCompiler.hpp" |
311143309e73
8122937: [JEP 245] Validate JVM Command-Line Flag Arguments.
gziemski
parents:
diff
changeset
|
28 |
#include "runtime/globals.hpp" |
311143309e73
8122937: [JEP 245] Validate JVM Command-Line Flag Arguments.
gziemski
parents:
diff
changeset
|
29 |
#include "utilities/defaultStream.hpp" |
311143309e73
8122937: [JEP 245] Validate JVM Command-Line Flag Arguments.
gziemski
parents:
diff
changeset
|
30 |
|
311143309e73
8122937: [JEP 245] Validate JVM Command-Line Flag Arguments.
gziemski
parents:
diff
changeset
|
31 |
Flag::Error AliasLevelConstraintFunc(bool verbose, intx* value) { |
31995
aa4049b4184a
8130459: Add additional validation after heap creation
sangheki
parents:
31371
diff
changeset
|
32 |
if ((*value <= 1) && (Arguments::mode() == Arguments::_comp)) { |
aa4049b4184a
8130459: Add additional validation after heap creation
sangheki
parents:
31371
diff
changeset
|
33 |
if (verbose == true) { |
aa4049b4184a
8130459: Add additional validation after heap creation
sangheki
parents:
31371
diff
changeset
|
34 |
jio_fprintf(defaultStream::error_stream(), |
aa4049b4184a
8130459: Add additional validation after heap creation
sangheki
parents:
31371
diff
changeset
|
35 |
"AliasLevel (" INTX_FORMAT ") is not compatible " |
aa4049b4184a
8130459: Add additional validation after heap creation
sangheki
parents:
31371
diff
changeset
|
36 |
"with -Xcomp \n", |
aa4049b4184a
8130459: Add additional validation after heap creation
sangheki
parents:
31371
diff
changeset
|
37 |
*value); |
31371
311143309e73
8122937: [JEP 245] Validate JVM Command-Line Flag Arguments.
gziemski
parents:
diff
changeset
|
38 |
} |
31995
aa4049b4184a
8130459: Add additional validation after heap creation
sangheki
parents:
31371
diff
changeset
|
39 |
return Flag::VIOLATES_CONSTRAINT; |
aa4049b4184a
8130459: Add additional validation after heap creation
sangheki
parents:
31371
diff
changeset
|
40 |
} else { |
aa4049b4184a
8130459: Add additional validation after heap creation
sangheki
parents:
31371
diff
changeset
|
41 |
return Flag::SUCCESS; |
31371
311143309e73
8122937: [JEP 245] Validate JVM Command-Line Flag Arguments.
gziemski
parents:
diff
changeset
|
42 |
} |
311143309e73
8122937: [JEP 245] Validate JVM Command-Line Flag Arguments.
gziemski
parents:
diff
changeset
|
43 |
} |
31959
34180370555e
8130858: CICompilerCount=1 when tiered is off is not allowed any more
roland
parents:
31371
diff
changeset
|
44 |
|
34180370555e
8130858: CICompilerCount=1 when tiered is off is not allowed any more
roland
parents:
31371
diff
changeset
|
45 |
/** |
34180370555e
8130858: CICompilerCount=1 when tiered is off is not allowed any more
roland
parents:
31371
diff
changeset
|
46 |
* Validate the minimum number of compiler threads needed to run the |
34180370555e
8130858: CICompilerCount=1 when tiered is off is not allowed any more
roland
parents:
31371
diff
changeset
|
47 |
* JVM. The following configurations are possible. |
34180370555e
8130858: CICompilerCount=1 when tiered is off is not allowed any more
roland
parents:
31371
diff
changeset
|
48 |
* |
34180370555e
8130858: CICompilerCount=1 when tiered is off is not allowed any more
roland
parents:
31371
diff
changeset
|
49 |
* 1) The JVM is build using an interpreter only. As a result, the minimum number of |
34180370555e
8130858: CICompilerCount=1 when tiered is off is not allowed any more
roland
parents:
31371
diff
changeset
|
50 |
* compiler threads is 0. |
34180370555e
8130858: CICompilerCount=1 when tiered is off is not allowed any more
roland
parents:
31371
diff
changeset
|
51 |
* 2) The JVM is build using the compiler(s) and tiered compilation is disabled. As |
34180370555e
8130858: CICompilerCount=1 when tiered is off is not allowed any more
roland
parents:
31371
diff
changeset
|
52 |
* a result, either C1 or C2 is used, so the minimum number of compiler threads is 1. |
34180370555e
8130858: CICompilerCount=1 when tiered is off is not allowed any more
roland
parents:
31371
diff
changeset
|
53 |
* 3) The JVM is build using the compiler(s) and tiered compilation is enabled. However, |
34180370555e
8130858: CICompilerCount=1 when tiered is off is not allowed any more
roland
parents:
31371
diff
changeset
|
54 |
* the option "TieredStopAtLevel < CompLevel_full_optimization". As a result, only |
34180370555e
8130858: CICompilerCount=1 when tiered is off is not allowed any more
roland
parents:
31371
diff
changeset
|
55 |
* C1 can be used, so the minimum number of compiler threads is 1. |
34180370555e
8130858: CICompilerCount=1 when tiered is off is not allowed any more
roland
parents:
31371
diff
changeset
|
56 |
* 4) The JVM is build using the compilers and tiered compilation is enabled. The option |
34180370555e
8130858: CICompilerCount=1 when tiered is off is not allowed any more
roland
parents:
31371
diff
changeset
|
57 |
* 'TieredStopAtLevel = CompLevel_full_optimization' (the default value). As a result, |
34180370555e
8130858: CICompilerCount=1 when tiered is off is not allowed any more
roland
parents:
31371
diff
changeset
|
58 |
* the minimum number of compiler threads is 2. |
34180370555e
8130858: CICompilerCount=1 when tiered is off is not allowed any more
roland
parents:
31371
diff
changeset
|
59 |
*/ |
34180370555e
8130858: CICompilerCount=1 when tiered is off is not allowed any more
roland
parents:
31371
diff
changeset
|
60 |
Flag::Error CICompilerCountConstraintFunc(bool verbose, intx* value) { |
34180370555e
8130858: CICompilerCount=1 when tiered is off is not allowed any more
roland
parents:
31371
diff
changeset
|
61 |
int min_number_of_compiler_threads = 0; |
34180370555e
8130858: CICompilerCount=1 when tiered is off is not allowed any more
roland
parents:
31371
diff
changeset
|
62 |
#if !defined(COMPILER1) && !defined(COMPILER2) && !defined(SHARK) |
34180370555e
8130858: CICompilerCount=1 when tiered is off is not allowed any more
roland
parents:
31371
diff
changeset
|
63 |
// case 1 |
34180370555e
8130858: CICompilerCount=1 when tiered is off is not allowed any more
roland
parents:
31371
diff
changeset
|
64 |
#else |
34180370555e
8130858: CICompilerCount=1 when tiered is off is not allowed any more
roland
parents:
31371
diff
changeset
|
65 |
if (!TieredCompilation || (TieredStopAtLevel < CompLevel_full_optimization)) { |
34180370555e
8130858: CICompilerCount=1 when tiered is off is not allowed any more
roland
parents:
31371
diff
changeset
|
66 |
min_number_of_compiler_threads = 1; // case 2 or case 3 |
34180370555e
8130858: CICompilerCount=1 when tiered is off is not allowed any more
roland
parents:
31371
diff
changeset
|
67 |
} else { |
34180370555e
8130858: CICompilerCount=1 when tiered is off is not allowed any more
roland
parents:
31371
diff
changeset
|
68 |
min_number_of_compiler_threads = 2; // case 4 (tiered) |
34180370555e
8130858: CICompilerCount=1 when tiered is off is not allowed any more
roland
parents:
31371
diff
changeset
|
69 |
} |
34180370555e
8130858: CICompilerCount=1 when tiered is off is not allowed any more
roland
parents:
31371
diff
changeset
|
70 |
#endif |
34180370555e
8130858: CICompilerCount=1 when tiered is off is not allowed any more
roland
parents:
31371
diff
changeset
|
71 |
|
34180370555e
8130858: CICompilerCount=1 when tiered is off is not allowed any more
roland
parents:
31371
diff
changeset
|
72 |
// The default CICompilerCount's value is CI_COMPILER_COUNT. |
32083
1796911eb140
8132525: java -client -XX:+TieredCompilation -XX:CICompilerCount=1 -version asserts since 8130858
roland
parents:
31959
diff
changeset
|
73 |
// With a client VM, -XX:+TieredCompilation causes TieredCompilation |
1796911eb140
8132525: java -client -XX:+TieredCompilation -XX:CICompilerCount=1 -version asserts since 8130858
roland
parents:
31959
diff
changeset
|
74 |
// to be true here (the option is validated later) and |
1796911eb140
8132525: java -client -XX:+TieredCompilation -XX:CICompilerCount=1 -version asserts since 8130858
roland
parents:
31959
diff
changeset
|
75 |
// min_number_of_compiler_threads to exceed CI_COMPILER_COUNT. |
1796911eb140
8132525: java -client -XX:+TieredCompilation -XX:CICompilerCount=1 -version asserts since 8130858
roland
parents:
31959
diff
changeset
|
76 |
min_number_of_compiler_threads = MIN2(min_number_of_compiler_threads, CI_COMPILER_COUNT); |
31959
34180370555e
8130858: CICompilerCount=1 when tiered is off is not allowed any more
roland
parents:
31371
diff
changeset
|
77 |
|
34180370555e
8130858: CICompilerCount=1 when tiered is off is not allowed any more
roland
parents:
31371
diff
changeset
|
78 |
if (*value < (intx)min_number_of_compiler_threads) { |
34180370555e
8130858: CICompilerCount=1 when tiered is off is not allowed any more
roland
parents:
31371
diff
changeset
|
79 |
if (verbose == true) { |
34180370555e
8130858: CICompilerCount=1 when tiered is off is not allowed any more
roland
parents:
31371
diff
changeset
|
80 |
jio_fprintf(defaultStream::error_stream(), |
34180370555e
8130858: CICompilerCount=1 when tiered is off is not allowed any more
roland
parents:
31371
diff
changeset
|
81 |
"CICompilerCount=" INTX_FORMAT " must be at least %d \n", |
34180370555e
8130858: CICompilerCount=1 when tiered is off is not allowed any more
roland
parents:
31371
diff
changeset
|
82 |
*value, min_number_of_compiler_threads); |
34180370555e
8130858: CICompilerCount=1 when tiered is off is not allowed any more
roland
parents:
31371
diff
changeset
|
83 |
} |
34180370555e
8130858: CICompilerCount=1 when tiered is off is not allowed any more
roland
parents:
31371
diff
changeset
|
84 |
return Flag::VIOLATES_CONSTRAINT; |
34180370555e
8130858: CICompilerCount=1 when tiered is off is not allowed any more
roland
parents:
31371
diff
changeset
|
85 |
} else { |
34180370555e
8130858: CICompilerCount=1 when tiered is off is not allowed any more
roland
parents:
31371
diff
changeset
|
86 |
return Flag::SUCCESS; |
34180370555e
8130858: CICompilerCount=1 when tiered is off is not allowed any more
roland
parents:
31371
diff
changeset
|
87 |
} |
34180370555e
8130858: CICompilerCount=1 when tiered is off is not allowed any more
roland
parents:
31371
diff
changeset
|
88 |
} |