author | erikj |
Tue, 12 Sep 2017 19:03:39 +0200 | |
changeset 47216 | 71c04702a3d5 |
parent 46818 | hotspot/src/share/vm/runtime/commandLineFlagConstraintList.cpp@d0475215ae39 |
child 49715 | 947560700a09 |
child 55767 | 8e22715afabc |
permissions | -rw-r--r-- |
31371
311143309e73
8122937: [JEP 245] Validate JVM Command-Line Flag Arguments.
gziemski
parents:
diff
changeset
|
1 |
/* |
46818 | 2 |
* Copyright (c) 2015, 2017, Oracle and/or its affiliates. All rights reserved. |
31371
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 "classfile/stringTable.hpp" |
311143309e73
8122937: [JEP 245] Validate JVM Command-Line Flag Arguments.
gziemski
parents:
diff
changeset
|
27 |
#include "classfile/symbolTable.hpp" |
311143309e73
8122937: [JEP 245] Validate JVM Command-Line Flag Arguments.
gziemski
parents:
diff
changeset
|
28 |
#include "gc/shared/referenceProcessor.hpp" |
311143309e73
8122937: [JEP 245] Validate JVM Command-Line Flag Arguments.
gziemski
parents:
diff
changeset
|
29 |
#include "runtime/arguments.hpp" |
311143309e73
8122937: [JEP 245] Validate JVM Command-Line Flag Arguments.
gziemski
parents:
diff
changeset
|
30 |
#include "runtime/commandLineFlagConstraintList.hpp" |
311143309e73
8122937: [JEP 245] Validate JVM Command-Line Flag Arguments.
gziemski
parents:
diff
changeset
|
31 |
#include "runtime/commandLineFlagConstraintsCompiler.hpp" |
311143309e73
8122937: [JEP 245] Validate JVM Command-Line Flag Arguments.
gziemski
parents:
diff
changeset
|
32 |
#include "runtime/commandLineFlagConstraintsGC.hpp" |
311143309e73
8122937: [JEP 245] Validate JVM Command-Line Flag Arguments.
gziemski
parents:
diff
changeset
|
33 |
#include "runtime/commandLineFlagConstraintsRuntime.hpp" |
311143309e73
8122937: [JEP 245] Validate JVM Command-Line Flag Arguments.
gziemski
parents:
diff
changeset
|
34 |
#include "runtime/os.hpp" |
311143309e73
8122937: [JEP 245] Validate JVM Command-Line Flag Arguments.
gziemski
parents:
diff
changeset
|
35 |
#include "utilities/macros.hpp" |
46564
0ec329b23bbf
8182696: Remove gcTrace.hpp include from referenceProcessor.hpp
stefank
parents:
46499
diff
changeset
|
36 |
#if INCLUDE_ALL_GCS |
0ec329b23bbf
8182696: Remove gcTrace.hpp include from referenceProcessor.hpp
stefank
parents:
46499
diff
changeset
|
37 |
#include "gc/g1/g1_globals.hpp" |
0ec329b23bbf
8182696: Remove gcTrace.hpp include from referenceProcessor.hpp
stefank
parents:
46499
diff
changeset
|
38 |
#endif |
46818 | 39 |
#ifdef COMPILER1 |
40 |
#include "c1/c1_globals.hpp" |
|
41 |
#endif |
|
42 |
#ifdef COMPILER2 |
|
43 |
#include "opto/c2_globals.hpp" |
|
44 |
#endif |
|
45 |
||
46564
0ec329b23bbf
8182696: Remove gcTrace.hpp include from referenceProcessor.hpp
stefank
parents:
46499
diff
changeset
|
46 |
|
31371
311143309e73
8122937: [JEP 245] Validate JVM Command-Line Flag Arguments.
gziemski
parents:
diff
changeset
|
47 |
class CommandLineFlagConstraint_bool : public CommandLineFlagConstraint { |
311143309e73
8122937: [JEP 245] Validate JVM Command-Line Flag Arguments.
gziemski
parents:
diff
changeset
|
48 |
CommandLineFlagConstraintFunc_bool _constraint; |
46499
22e71ef4a16a
8180614: Skip range and constraint checks on non-existent flags
redestad
parents:
39117
diff
changeset
|
49 |
const bool* _ptr; |
31371
311143309e73
8122937: [JEP 245] Validate JVM Command-Line Flag Arguments.
gziemski
parents:
diff
changeset
|
50 |
|
311143309e73
8122937: [JEP 245] Validate JVM Command-Line Flag Arguments.
gziemski
parents:
diff
changeset
|
51 |
public: |
311143309e73
8122937: [JEP 245] Validate JVM Command-Line Flag Arguments.
gziemski
parents:
diff
changeset
|
52 |
// the "name" argument must be a string literal |
46499
22e71ef4a16a
8180614: Skip range and constraint checks on non-existent flags
redestad
parents:
39117
diff
changeset
|
53 |
CommandLineFlagConstraint_bool(const char* name, const bool* ptr, |
31995
aa4049b4184a
8130459: Add additional validation after heap creation
sangheki
parents:
31371
diff
changeset
|
54 |
CommandLineFlagConstraintFunc_bool func, |
46499
22e71ef4a16a
8180614: Skip range and constraint checks on non-existent flags
redestad
parents:
39117
diff
changeset
|
55 |
ConstraintType type) : CommandLineFlagConstraint(name, type), _constraint(func), _ptr(ptr) {} |
22e71ef4a16a
8180614: Skip range and constraint checks on non-existent flags
redestad
parents:
39117
diff
changeset
|
56 |
|
22e71ef4a16a
8180614: Skip range and constraint checks on non-existent flags
redestad
parents:
39117
diff
changeset
|
57 |
Flag::Error apply(bool verbose) { |
22e71ef4a16a
8180614: Skip range and constraint checks on non-existent flags
redestad
parents:
39117
diff
changeset
|
58 |
bool value = *_ptr; |
22e71ef4a16a
8180614: Skip range and constraint checks on non-existent flags
redestad
parents:
39117
diff
changeset
|
59 |
return _constraint(value, verbose); |
31371
311143309e73
8122937: [JEP 245] Validate JVM Command-Line Flag Arguments.
gziemski
parents:
diff
changeset
|
60 |
} |
311143309e73
8122937: [JEP 245] Validate JVM Command-Line Flag Arguments.
gziemski
parents:
diff
changeset
|
61 |
|
32351 | 62 |
Flag::Error apply_bool(bool value, bool verbose) { |
63 |
return _constraint(value, verbose); |
|
31371
311143309e73
8122937: [JEP 245] Validate JVM Command-Line Flag Arguments.
gziemski
parents:
diff
changeset
|
64 |
} |
311143309e73
8122937: [JEP 245] Validate JVM Command-Line Flag Arguments.
gziemski
parents:
diff
changeset
|
65 |
}; |
311143309e73
8122937: [JEP 245] Validate JVM Command-Line Flag Arguments.
gziemski
parents:
diff
changeset
|
66 |
|
311143309e73
8122937: [JEP 245] Validate JVM Command-Line Flag Arguments.
gziemski
parents:
diff
changeset
|
67 |
class CommandLineFlagConstraint_int : public CommandLineFlagConstraint { |
311143309e73
8122937: [JEP 245] Validate JVM Command-Line Flag Arguments.
gziemski
parents:
diff
changeset
|
68 |
CommandLineFlagConstraintFunc_int _constraint; |
46499
22e71ef4a16a
8180614: Skip range and constraint checks on non-existent flags
redestad
parents:
39117
diff
changeset
|
69 |
const int* _ptr; |
31371
311143309e73
8122937: [JEP 245] Validate JVM Command-Line Flag Arguments.
gziemski
parents:
diff
changeset
|
70 |
|
311143309e73
8122937: [JEP 245] Validate JVM Command-Line Flag Arguments.
gziemski
parents:
diff
changeset
|
71 |
public: |
311143309e73
8122937: [JEP 245] Validate JVM Command-Line Flag Arguments.
gziemski
parents:
diff
changeset
|
72 |
// the "name" argument must be a string literal |
46499
22e71ef4a16a
8180614: Skip range and constraint checks on non-existent flags
redestad
parents:
39117
diff
changeset
|
73 |
CommandLineFlagConstraint_int(const char* name, const int* ptr, |
31995
aa4049b4184a
8130459: Add additional validation after heap creation
sangheki
parents:
31371
diff
changeset
|
74 |
CommandLineFlagConstraintFunc_int func, |
46499
22e71ef4a16a
8180614: Skip range and constraint checks on non-existent flags
redestad
parents:
39117
diff
changeset
|
75 |
ConstraintType type) : CommandLineFlagConstraint(name, type), _constraint(func), _ptr(ptr) {} |
22e71ef4a16a
8180614: Skip range and constraint checks on non-existent flags
redestad
parents:
39117
diff
changeset
|
76 |
|
22e71ef4a16a
8180614: Skip range and constraint checks on non-existent flags
redestad
parents:
39117
diff
changeset
|
77 |
Flag::Error apply(bool verbose) { |
22e71ef4a16a
8180614: Skip range and constraint checks on non-existent flags
redestad
parents:
39117
diff
changeset
|
78 |
int value = *_ptr; |
22e71ef4a16a
8180614: Skip range and constraint checks on non-existent flags
redestad
parents:
39117
diff
changeset
|
79 |
return _constraint(value, verbose); |
31371
311143309e73
8122937: [JEP 245] Validate JVM Command-Line Flag Arguments.
gziemski
parents:
diff
changeset
|
80 |
} |
311143309e73
8122937: [JEP 245] Validate JVM Command-Line Flag Arguments.
gziemski
parents:
diff
changeset
|
81 |
|
32351 | 82 |
Flag::Error apply_int(int value, bool verbose) { |
83 |
return _constraint(value, verbose); |
|
31371
311143309e73
8122937: [JEP 245] Validate JVM Command-Line Flag Arguments.
gziemski
parents:
diff
changeset
|
84 |
} |
311143309e73
8122937: [JEP 245] Validate JVM Command-Line Flag Arguments.
gziemski
parents:
diff
changeset
|
85 |
}; |
311143309e73
8122937: [JEP 245] Validate JVM Command-Line Flag Arguments.
gziemski
parents:
diff
changeset
|
86 |
|
311143309e73
8122937: [JEP 245] Validate JVM Command-Line Flag Arguments.
gziemski
parents:
diff
changeset
|
87 |
class CommandLineFlagConstraint_intx : public CommandLineFlagConstraint { |
311143309e73
8122937: [JEP 245] Validate JVM Command-Line Flag Arguments.
gziemski
parents:
diff
changeset
|
88 |
CommandLineFlagConstraintFunc_intx _constraint; |
46499
22e71ef4a16a
8180614: Skip range and constraint checks on non-existent flags
redestad
parents:
39117
diff
changeset
|
89 |
const intx* _ptr; |
31371
311143309e73
8122937: [JEP 245] Validate JVM Command-Line Flag Arguments.
gziemski
parents:
diff
changeset
|
90 |
|
311143309e73
8122937: [JEP 245] Validate JVM Command-Line Flag Arguments.
gziemski
parents:
diff
changeset
|
91 |
public: |
311143309e73
8122937: [JEP 245] Validate JVM Command-Line Flag Arguments.
gziemski
parents:
diff
changeset
|
92 |
// the "name" argument must be a string literal |
46499
22e71ef4a16a
8180614: Skip range and constraint checks on non-existent flags
redestad
parents:
39117
diff
changeset
|
93 |
CommandLineFlagConstraint_intx(const char* name, const intx* ptr, |
31995
aa4049b4184a
8130459: Add additional validation after heap creation
sangheki
parents:
31371
diff
changeset
|
94 |
CommandLineFlagConstraintFunc_intx func, |
46499
22e71ef4a16a
8180614: Skip range and constraint checks on non-existent flags
redestad
parents:
39117
diff
changeset
|
95 |
ConstraintType type) : CommandLineFlagConstraint(name, type), _constraint(func), _ptr(ptr) {} |
22e71ef4a16a
8180614: Skip range and constraint checks on non-existent flags
redestad
parents:
39117
diff
changeset
|
96 |
|
22e71ef4a16a
8180614: Skip range and constraint checks on non-existent flags
redestad
parents:
39117
diff
changeset
|
97 |
Flag::Error apply(bool verbose) { |
22e71ef4a16a
8180614: Skip range and constraint checks on non-existent flags
redestad
parents:
39117
diff
changeset
|
98 |
intx value = *_ptr; |
22e71ef4a16a
8180614: Skip range and constraint checks on non-existent flags
redestad
parents:
39117
diff
changeset
|
99 |
return _constraint(value, verbose); |
31371
311143309e73
8122937: [JEP 245] Validate JVM Command-Line Flag Arguments.
gziemski
parents:
diff
changeset
|
100 |
} |
311143309e73
8122937: [JEP 245] Validate JVM Command-Line Flag Arguments.
gziemski
parents:
diff
changeset
|
101 |
|
32351 | 102 |
Flag::Error apply_intx(intx value, bool verbose) { |
103 |
return _constraint(value, verbose); |
|
31371
311143309e73
8122937: [JEP 245] Validate JVM Command-Line Flag Arguments.
gziemski
parents:
diff
changeset
|
104 |
} |
311143309e73
8122937: [JEP 245] Validate JVM Command-Line Flag Arguments.
gziemski
parents:
diff
changeset
|
105 |
}; |
311143309e73
8122937: [JEP 245] Validate JVM Command-Line Flag Arguments.
gziemski
parents:
diff
changeset
|
106 |
|
311143309e73
8122937: [JEP 245] Validate JVM Command-Line Flag Arguments.
gziemski
parents:
diff
changeset
|
107 |
class CommandLineFlagConstraint_uint : public CommandLineFlagConstraint { |
311143309e73
8122937: [JEP 245] Validate JVM Command-Line Flag Arguments.
gziemski
parents:
diff
changeset
|
108 |
CommandLineFlagConstraintFunc_uint _constraint; |
46499
22e71ef4a16a
8180614: Skip range and constraint checks on non-existent flags
redestad
parents:
39117
diff
changeset
|
109 |
const uint* _ptr; |
31371
311143309e73
8122937: [JEP 245] Validate JVM Command-Line Flag Arguments.
gziemski
parents:
diff
changeset
|
110 |
|
311143309e73
8122937: [JEP 245] Validate JVM Command-Line Flag Arguments.
gziemski
parents:
diff
changeset
|
111 |
public: |
311143309e73
8122937: [JEP 245] Validate JVM Command-Line Flag Arguments.
gziemski
parents:
diff
changeset
|
112 |
// the "name" argument must be a string literal |
46499
22e71ef4a16a
8180614: Skip range and constraint checks on non-existent flags
redestad
parents:
39117
diff
changeset
|
113 |
CommandLineFlagConstraint_uint(const char* name, const uint* ptr, |
31995
aa4049b4184a
8130459: Add additional validation after heap creation
sangheki
parents:
31371
diff
changeset
|
114 |
CommandLineFlagConstraintFunc_uint func, |
46499
22e71ef4a16a
8180614: Skip range and constraint checks on non-existent flags
redestad
parents:
39117
diff
changeset
|
115 |
ConstraintType type) : CommandLineFlagConstraint(name, type), _constraint(func), _ptr(ptr) {} |
22e71ef4a16a
8180614: Skip range and constraint checks on non-existent flags
redestad
parents:
39117
diff
changeset
|
116 |
|
22e71ef4a16a
8180614: Skip range and constraint checks on non-existent flags
redestad
parents:
39117
diff
changeset
|
117 |
Flag::Error apply(bool verbose) { |
22e71ef4a16a
8180614: Skip range and constraint checks on non-existent flags
redestad
parents:
39117
diff
changeset
|
118 |
uint value = *_ptr; |
22e71ef4a16a
8180614: Skip range and constraint checks on non-existent flags
redestad
parents:
39117
diff
changeset
|
119 |
return _constraint(value, verbose); |
31371
311143309e73
8122937: [JEP 245] Validate JVM Command-Line Flag Arguments.
gziemski
parents:
diff
changeset
|
120 |
} |
311143309e73
8122937: [JEP 245] Validate JVM Command-Line Flag Arguments.
gziemski
parents:
diff
changeset
|
121 |
|
32351 | 122 |
Flag::Error apply_uint(uint value, bool verbose) { |
123 |
return _constraint(value, verbose); |
|
31371
311143309e73
8122937: [JEP 245] Validate JVM Command-Line Flag Arguments.
gziemski
parents:
diff
changeset
|
124 |
} |
311143309e73
8122937: [JEP 245] Validate JVM Command-Line Flag Arguments.
gziemski
parents:
diff
changeset
|
125 |
}; |
311143309e73
8122937: [JEP 245] Validate JVM Command-Line Flag Arguments.
gziemski
parents:
diff
changeset
|
126 |
|
311143309e73
8122937: [JEP 245] Validate JVM Command-Line Flag Arguments.
gziemski
parents:
diff
changeset
|
127 |
class CommandLineFlagConstraint_uintx : public CommandLineFlagConstraint { |
311143309e73
8122937: [JEP 245] Validate JVM Command-Line Flag Arguments.
gziemski
parents:
diff
changeset
|
128 |
CommandLineFlagConstraintFunc_uintx _constraint; |
46499
22e71ef4a16a
8180614: Skip range and constraint checks on non-existent flags
redestad
parents:
39117
diff
changeset
|
129 |
const uintx* _ptr; |
31371
311143309e73
8122937: [JEP 245] Validate JVM Command-Line Flag Arguments.
gziemski
parents:
diff
changeset
|
130 |
|
311143309e73
8122937: [JEP 245] Validate JVM Command-Line Flag Arguments.
gziemski
parents:
diff
changeset
|
131 |
public: |
311143309e73
8122937: [JEP 245] Validate JVM Command-Line Flag Arguments.
gziemski
parents:
diff
changeset
|
132 |
// the "name" argument must be a string literal |
46499
22e71ef4a16a
8180614: Skip range and constraint checks on non-existent flags
redestad
parents:
39117
diff
changeset
|
133 |
CommandLineFlagConstraint_uintx(const char* name, const uintx* ptr, |
31995
aa4049b4184a
8130459: Add additional validation after heap creation
sangheki
parents:
31371
diff
changeset
|
134 |
CommandLineFlagConstraintFunc_uintx func, |
46499
22e71ef4a16a
8180614: Skip range and constraint checks on non-existent flags
redestad
parents:
39117
diff
changeset
|
135 |
ConstraintType type) : CommandLineFlagConstraint(name, type), _constraint(func), _ptr(ptr) {} |
22e71ef4a16a
8180614: Skip range and constraint checks on non-existent flags
redestad
parents:
39117
diff
changeset
|
136 |
|
22e71ef4a16a
8180614: Skip range and constraint checks on non-existent flags
redestad
parents:
39117
diff
changeset
|
137 |
Flag::Error apply(bool verbose) { |
22e71ef4a16a
8180614: Skip range and constraint checks on non-existent flags
redestad
parents:
39117
diff
changeset
|
138 |
uintx value = *_ptr; |
22e71ef4a16a
8180614: Skip range and constraint checks on non-existent flags
redestad
parents:
39117
diff
changeset
|
139 |
return _constraint(value, verbose); |
31371
311143309e73
8122937: [JEP 245] Validate JVM Command-Line Flag Arguments.
gziemski
parents:
diff
changeset
|
140 |
} |
311143309e73
8122937: [JEP 245] Validate JVM Command-Line Flag Arguments.
gziemski
parents:
diff
changeset
|
141 |
|
32351 | 142 |
Flag::Error apply_uintx(uintx value, bool verbose) { |
143 |
return _constraint(value, verbose); |
|
31371
311143309e73
8122937: [JEP 245] Validate JVM Command-Line Flag Arguments.
gziemski
parents:
diff
changeset
|
144 |
} |
311143309e73
8122937: [JEP 245] Validate JVM Command-Line Flag Arguments.
gziemski
parents:
diff
changeset
|
145 |
}; |
311143309e73
8122937: [JEP 245] Validate JVM Command-Line Flag Arguments.
gziemski
parents:
diff
changeset
|
146 |
|
311143309e73
8122937: [JEP 245] Validate JVM Command-Line Flag Arguments.
gziemski
parents:
diff
changeset
|
147 |
class CommandLineFlagConstraint_uint64_t : public CommandLineFlagConstraint { |
311143309e73
8122937: [JEP 245] Validate JVM Command-Line Flag Arguments.
gziemski
parents:
diff
changeset
|
148 |
CommandLineFlagConstraintFunc_uint64_t _constraint; |
46499
22e71ef4a16a
8180614: Skip range and constraint checks on non-existent flags
redestad
parents:
39117
diff
changeset
|
149 |
const uint64_t* _ptr; |
31371
311143309e73
8122937: [JEP 245] Validate JVM Command-Line Flag Arguments.
gziemski
parents:
diff
changeset
|
150 |
|
311143309e73
8122937: [JEP 245] Validate JVM Command-Line Flag Arguments.
gziemski
parents:
diff
changeset
|
151 |
public: |
311143309e73
8122937: [JEP 245] Validate JVM Command-Line Flag Arguments.
gziemski
parents:
diff
changeset
|
152 |
// the "name" argument must be a string literal |
46499
22e71ef4a16a
8180614: Skip range and constraint checks on non-existent flags
redestad
parents:
39117
diff
changeset
|
153 |
CommandLineFlagConstraint_uint64_t(const char* name, const uint64_t* ptr, |
31995
aa4049b4184a
8130459: Add additional validation after heap creation
sangheki
parents:
31371
diff
changeset
|
154 |
CommandLineFlagConstraintFunc_uint64_t func, |
46499
22e71ef4a16a
8180614: Skip range and constraint checks on non-existent flags
redestad
parents:
39117
diff
changeset
|
155 |
ConstraintType type) : CommandLineFlagConstraint(name, type), _constraint(func), _ptr(ptr) {} |
22e71ef4a16a
8180614: Skip range and constraint checks on non-existent flags
redestad
parents:
39117
diff
changeset
|
156 |
|
22e71ef4a16a
8180614: Skip range and constraint checks on non-existent flags
redestad
parents:
39117
diff
changeset
|
157 |
Flag::Error apply(bool verbose) { |
22e71ef4a16a
8180614: Skip range and constraint checks on non-existent flags
redestad
parents:
39117
diff
changeset
|
158 |
uint64_t value = *_ptr; |
22e71ef4a16a
8180614: Skip range and constraint checks on non-existent flags
redestad
parents:
39117
diff
changeset
|
159 |
return _constraint(value, verbose); |
31371
311143309e73
8122937: [JEP 245] Validate JVM Command-Line Flag Arguments.
gziemski
parents:
diff
changeset
|
160 |
} |
311143309e73
8122937: [JEP 245] Validate JVM Command-Line Flag Arguments.
gziemski
parents:
diff
changeset
|
161 |
|
32351 | 162 |
Flag::Error apply_uint64_t(uint64_t value, bool verbose) { |
163 |
return _constraint(value, verbose); |
|
31371
311143309e73
8122937: [JEP 245] Validate JVM Command-Line Flag Arguments.
gziemski
parents:
diff
changeset
|
164 |
} |
311143309e73
8122937: [JEP 245] Validate JVM Command-Line Flag Arguments.
gziemski
parents:
diff
changeset
|
165 |
}; |
311143309e73
8122937: [JEP 245] Validate JVM Command-Line Flag Arguments.
gziemski
parents:
diff
changeset
|
166 |
|
311143309e73
8122937: [JEP 245] Validate JVM Command-Line Flag Arguments.
gziemski
parents:
diff
changeset
|
167 |
class CommandLineFlagConstraint_size_t : public CommandLineFlagConstraint { |
311143309e73
8122937: [JEP 245] Validate JVM Command-Line Flag Arguments.
gziemski
parents:
diff
changeset
|
168 |
CommandLineFlagConstraintFunc_size_t _constraint; |
46499
22e71ef4a16a
8180614: Skip range and constraint checks on non-existent flags
redestad
parents:
39117
diff
changeset
|
169 |
const size_t* _ptr; |
31371
311143309e73
8122937: [JEP 245] Validate JVM Command-Line Flag Arguments.
gziemski
parents:
diff
changeset
|
170 |
public: |
311143309e73
8122937: [JEP 245] Validate JVM Command-Line Flag Arguments.
gziemski
parents:
diff
changeset
|
171 |
// the "name" argument must be a string literal |
46499
22e71ef4a16a
8180614: Skip range and constraint checks on non-existent flags
redestad
parents:
39117
diff
changeset
|
172 |
CommandLineFlagConstraint_size_t(const char* name, const size_t* ptr, |
31995
aa4049b4184a
8130459: Add additional validation after heap creation
sangheki
parents:
31371
diff
changeset
|
173 |
CommandLineFlagConstraintFunc_size_t func, |
46499
22e71ef4a16a
8180614: Skip range and constraint checks on non-existent flags
redestad
parents:
39117
diff
changeset
|
174 |
ConstraintType type) : CommandLineFlagConstraint(name, type), _constraint(func), _ptr(ptr) {} |
22e71ef4a16a
8180614: Skip range and constraint checks on non-existent flags
redestad
parents:
39117
diff
changeset
|
175 |
|
22e71ef4a16a
8180614: Skip range and constraint checks on non-existent flags
redestad
parents:
39117
diff
changeset
|
176 |
Flag::Error apply(bool verbose) { |
22e71ef4a16a
8180614: Skip range and constraint checks on non-existent flags
redestad
parents:
39117
diff
changeset
|
177 |
size_t value = *_ptr; |
22e71ef4a16a
8180614: Skip range and constraint checks on non-existent flags
redestad
parents:
39117
diff
changeset
|
178 |
return _constraint(value, verbose); |
31371
311143309e73
8122937: [JEP 245] Validate JVM Command-Line Flag Arguments.
gziemski
parents:
diff
changeset
|
179 |
} |
311143309e73
8122937: [JEP 245] Validate JVM Command-Line Flag Arguments.
gziemski
parents:
diff
changeset
|
180 |
|
32351 | 181 |
Flag::Error apply_size_t(size_t value, bool verbose) { |
182 |
return _constraint(value, verbose); |
|
31371
311143309e73
8122937: [JEP 245] Validate JVM Command-Line Flag Arguments.
gziemski
parents:
diff
changeset
|
183 |
} |
311143309e73
8122937: [JEP 245] Validate JVM Command-Line Flag Arguments.
gziemski
parents:
diff
changeset
|
184 |
}; |
311143309e73
8122937: [JEP 245] Validate JVM Command-Line Flag Arguments.
gziemski
parents:
diff
changeset
|
185 |
|
311143309e73
8122937: [JEP 245] Validate JVM Command-Line Flag Arguments.
gziemski
parents:
diff
changeset
|
186 |
class CommandLineFlagConstraint_double : public CommandLineFlagConstraint { |
311143309e73
8122937: [JEP 245] Validate JVM Command-Line Flag Arguments.
gziemski
parents:
diff
changeset
|
187 |
CommandLineFlagConstraintFunc_double _constraint; |
46499
22e71ef4a16a
8180614: Skip range and constraint checks on non-existent flags
redestad
parents:
39117
diff
changeset
|
188 |
const double* _ptr; |
31371
311143309e73
8122937: [JEP 245] Validate JVM Command-Line Flag Arguments.
gziemski
parents:
diff
changeset
|
189 |
|
311143309e73
8122937: [JEP 245] Validate JVM Command-Line Flag Arguments.
gziemski
parents:
diff
changeset
|
190 |
public: |
311143309e73
8122937: [JEP 245] Validate JVM Command-Line Flag Arguments.
gziemski
parents:
diff
changeset
|
191 |
// the "name" argument must be a string literal |
46499
22e71ef4a16a
8180614: Skip range and constraint checks on non-existent flags
redestad
parents:
39117
diff
changeset
|
192 |
CommandLineFlagConstraint_double(const char* name, const double* ptr, |
31995
aa4049b4184a
8130459: Add additional validation after heap creation
sangheki
parents:
31371
diff
changeset
|
193 |
CommandLineFlagConstraintFunc_double func, |
46499
22e71ef4a16a
8180614: Skip range and constraint checks on non-existent flags
redestad
parents:
39117
diff
changeset
|
194 |
ConstraintType type) : CommandLineFlagConstraint(name, type), _constraint(func), _ptr(ptr) {} |
22e71ef4a16a
8180614: Skip range and constraint checks on non-existent flags
redestad
parents:
39117
diff
changeset
|
195 |
|
22e71ef4a16a
8180614: Skip range and constraint checks on non-existent flags
redestad
parents:
39117
diff
changeset
|
196 |
Flag::Error apply(bool verbose) { |
22e71ef4a16a
8180614: Skip range and constraint checks on non-existent flags
redestad
parents:
39117
diff
changeset
|
197 |
double value = *_ptr; |
22e71ef4a16a
8180614: Skip range and constraint checks on non-existent flags
redestad
parents:
39117
diff
changeset
|
198 |
return _constraint(value, verbose); |
31371
311143309e73
8122937: [JEP 245] Validate JVM Command-Line Flag Arguments.
gziemski
parents:
diff
changeset
|
199 |
} |
311143309e73
8122937: [JEP 245] Validate JVM Command-Line Flag Arguments.
gziemski
parents:
diff
changeset
|
200 |
|
32351 | 201 |
Flag::Error apply_double(double value, bool verbose) { |
202 |
return _constraint(value, verbose); |
|
31371
311143309e73
8122937: [JEP 245] Validate JVM Command-Line Flag Arguments.
gziemski
parents:
diff
changeset
|
203 |
} |
311143309e73
8122937: [JEP 245] Validate JVM Command-Line Flag Arguments.
gziemski
parents:
diff
changeset
|
204 |
}; |
311143309e73
8122937: [JEP 245] Validate JVM Command-Line Flag Arguments.
gziemski
parents:
diff
changeset
|
205 |
|
311143309e73
8122937: [JEP 245] Validate JVM Command-Line Flag Arguments.
gziemski
parents:
diff
changeset
|
206 |
// No constraint emitting |
46499
22e71ef4a16a
8180614: Skip range and constraint checks on non-existent flags
redestad
parents:
39117
diff
changeset
|
207 |
void emit_constraint_no(...) { /* NOP */ } |
31371
311143309e73
8122937: [JEP 245] Validate JVM Command-Line Flag Arguments.
gziemski
parents:
diff
changeset
|
208 |
|
311143309e73
8122937: [JEP 245] Validate JVM Command-Line Flag Arguments.
gziemski
parents:
diff
changeset
|
209 |
// No constraint emitting if function argument is NOT provided |
46499
22e71ef4a16a
8180614: Skip range and constraint checks on non-existent flags
redestad
parents:
39117
diff
changeset
|
210 |
void emit_constraint_bool(const char* /*name*/, const bool* /*value*/) { /* NOP */ } |
22e71ef4a16a
8180614: Skip range and constraint checks on non-existent flags
redestad
parents:
39117
diff
changeset
|
211 |
void emit_constraint_ccstr(const char* /*name*/, const ccstr* /*value*/) { /* NOP */ } |
22e71ef4a16a
8180614: Skip range and constraint checks on non-existent flags
redestad
parents:
39117
diff
changeset
|
212 |
void emit_constraint_ccstrlist(const char* /*name*/, const ccstrlist* /*value*/) { /* NOP */ } |
22e71ef4a16a
8180614: Skip range and constraint checks on non-existent flags
redestad
parents:
39117
diff
changeset
|
213 |
void emit_constraint_int(const char* /*name*/, const int* /*value*/) { /* NOP */ } |
22e71ef4a16a
8180614: Skip range and constraint checks on non-existent flags
redestad
parents:
39117
diff
changeset
|
214 |
void emit_constraint_intx(const char* /*name*/, const intx* /*value*/) { /* NOP */ } |
22e71ef4a16a
8180614: Skip range and constraint checks on non-existent flags
redestad
parents:
39117
diff
changeset
|
215 |
void emit_constraint_uint(const char* /*name*/, const uint* /*value*/) { /* NOP */ } |
22e71ef4a16a
8180614: Skip range and constraint checks on non-existent flags
redestad
parents:
39117
diff
changeset
|
216 |
void emit_constraint_uintx(const char* /*name*/, const uintx* /*value*/) { /* NOP */ } |
22e71ef4a16a
8180614: Skip range and constraint checks on non-existent flags
redestad
parents:
39117
diff
changeset
|
217 |
void emit_constraint_uint64_t(const char* /*name*/, const uint64_t* /*value*/) { /* NOP */ } |
22e71ef4a16a
8180614: Skip range and constraint checks on non-existent flags
redestad
parents:
39117
diff
changeset
|
218 |
void emit_constraint_size_t(const char* /*name*/, const size_t* /*value*/) { /* NOP */ } |
22e71ef4a16a
8180614: Skip range and constraint checks on non-existent flags
redestad
parents:
39117
diff
changeset
|
219 |
void emit_constraint_double(const char* /*name*/, const double* /*value*/) { /* NOP */ } |
31371
311143309e73
8122937: [JEP 245] Validate JVM Command-Line Flag Arguments.
gziemski
parents:
diff
changeset
|
220 |
|
311143309e73
8122937: [JEP 245] Validate JVM Command-Line Flag Arguments.
gziemski
parents:
diff
changeset
|
221 |
// CommandLineFlagConstraint emitting code functions if function argument is provided |
46499
22e71ef4a16a
8180614: Skip range and constraint checks on non-existent flags
redestad
parents:
39117
diff
changeset
|
222 |
void emit_constraint_bool(const char* name, const bool* ptr, CommandLineFlagConstraintFunc_bool func, CommandLineFlagConstraint::ConstraintType type) { |
22e71ef4a16a
8180614: Skip range and constraint checks on non-existent flags
redestad
parents:
39117
diff
changeset
|
223 |
CommandLineFlagConstraintList::add(new CommandLineFlagConstraint_bool(name, ptr, func, type)); |
31371
311143309e73
8122937: [JEP 245] Validate JVM Command-Line Flag Arguments.
gziemski
parents:
diff
changeset
|
224 |
} |
46499
22e71ef4a16a
8180614: Skip range and constraint checks on non-existent flags
redestad
parents:
39117
diff
changeset
|
225 |
void emit_constraint_int(const char* name, const int* ptr, CommandLineFlagConstraintFunc_int func, CommandLineFlagConstraint::ConstraintType type) { |
22e71ef4a16a
8180614: Skip range and constraint checks on non-existent flags
redestad
parents:
39117
diff
changeset
|
226 |
CommandLineFlagConstraintList::add(new CommandLineFlagConstraint_int(name, ptr, func, type)); |
31371
311143309e73
8122937: [JEP 245] Validate JVM Command-Line Flag Arguments.
gziemski
parents:
diff
changeset
|
227 |
} |
46499
22e71ef4a16a
8180614: Skip range and constraint checks on non-existent flags
redestad
parents:
39117
diff
changeset
|
228 |
void emit_constraint_intx(const char* name, const intx* ptr, CommandLineFlagConstraintFunc_intx func, CommandLineFlagConstraint::ConstraintType type) { |
22e71ef4a16a
8180614: Skip range and constraint checks on non-existent flags
redestad
parents:
39117
diff
changeset
|
229 |
CommandLineFlagConstraintList::add(new CommandLineFlagConstraint_intx(name, ptr, func, type)); |
31371
311143309e73
8122937: [JEP 245] Validate JVM Command-Line Flag Arguments.
gziemski
parents:
diff
changeset
|
230 |
} |
46499
22e71ef4a16a
8180614: Skip range and constraint checks on non-existent flags
redestad
parents:
39117
diff
changeset
|
231 |
void emit_constraint_uint(const char* name, const uint* ptr, CommandLineFlagConstraintFunc_uint func, CommandLineFlagConstraint::ConstraintType type) { |
22e71ef4a16a
8180614: Skip range and constraint checks on non-existent flags
redestad
parents:
39117
diff
changeset
|
232 |
CommandLineFlagConstraintList::add(new CommandLineFlagConstraint_uint(name, ptr, func, type)); |
31371
311143309e73
8122937: [JEP 245] Validate JVM Command-Line Flag Arguments.
gziemski
parents:
diff
changeset
|
233 |
} |
46499
22e71ef4a16a
8180614: Skip range and constraint checks on non-existent flags
redestad
parents:
39117
diff
changeset
|
234 |
void emit_constraint_uintx(const char* name, const uintx* ptr, CommandLineFlagConstraintFunc_uintx func, CommandLineFlagConstraint::ConstraintType type) { |
22e71ef4a16a
8180614: Skip range and constraint checks on non-existent flags
redestad
parents:
39117
diff
changeset
|
235 |
CommandLineFlagConstraintList::add(new CommandLineFlagConstraint_uintx(name, ptr, func, type)); |
31371
311143309e73
8122937: [JEP 245] Validate JVM Command-Line Flag Arguments.
gziemski
parents:
diff
changeset
|
236 |
} |
46499
22e71ef4a16a
8180614: Skip range and constraint checks on non-existent flags
redestad
parents:
39117
diff
changeset
|
237 |
void emit_constraint_uint64_t(const char* name, const uint64_t* ptr, CommandLineFlagConstraintFunc_uint64_t func, CommandLineFlagConstraint::ConstraintType type) { |
22e71ef4a16a
8180614: Skip range and constraint checks on non-existent flags
redestad
parents:
39117
diff
changeset
|
238 |
CommandLineFlagConstraintList::add(new CommandLineFlagConstraint_uint64_t(name, ptr, func, type)); |
31371
311143309e73
8122937: [JEP 245] Validate JVM Command-Line Flag Arguments.
gziemski
parents:
diff
changeset
|
239 |
} |
46499
22e71ef4a16a
8180614: Skip range and constraint checks on non-existent flags
redestad
parents:
39117
diff
changeset
|
240 |
void emit_constraint_size_t(const char* name, const size_t* ptr, CommandLineFlagConstraintFunc_size_t func, CommandLineFlagConstraint::ConstraintType type) { |
22e71ef4a16a
8180614: Skip range and constraint checks on non-existent flags
redestad
parents:
39117
diff
changeset
|
241 |
CommandLineFlagConstraintList::add(new CommandLineFlagConstraint_size_t(name, ptr, func, type)); |
31371
311143309e73
8122937: [JEP 245] Validate JVM Command-Line Flag Arguments.
gziemski
parents:
diff
changeset
|
242 |
} |
46499
22e71ef4a16a
8180614: Skip range and constraint checks on non-existent flags
redestad
parents:
39117
diff
changeset
|
243 |
void emit_constraint_double(const char* name, const double* ptr, CommandLineFlagConstraintFunc_double func, CommandLineFlagConstraint::ConstraintType type) { |
22e71ef4a16a
8180614: Skip range and constraint checks on non-existent flags
redestad
parents:
39117
diff
changeset
|
244 |
CommandLineFlagConstraintList::add(new CommandLineFlagConstraint_double(name, ptr, func, type)); |
31371
311143309e73
8122937: [JEP 245] Validate JVM Command-Line Flag Arguments.
gziemski
parents:
diff
changeset
|
245 |
} |
311143309e73
8122937: [JEP 245] Validate JVM Command-Line Flag Arguments.
gziemski
parents:
diff
changeset
|
246 |
|
311143309e73
8122937: [JEP 245] Validate JVM Command-Line Flag Arguments.
gziemski
parents:
diff
changeset
|
247 |
// Generate code to call emit_constraint_xxx function |
46499
22e71ef4a16a
8180614: Skip range and constraint checks on non-existent flags
redestad
parents:
39117
diff
changeset
|
248 |
#define EMIT_CONSTRAINT_PRODUCT_FLAG(type, name, value, doc) ); emit_constraint_##type(#name,&name |
22e71ef4a16a
8180614: Skip range and constraint checks on non-existent flags
redestad
parents:
39117
diff
changeset
|
249 |
#define EMIT_CONSTRAINT_COMMERCIAL_FLAG(type, name, value, doc) ); emit_constraint_##type(#name,&name |
22e71ef4a16a
8180614: Skip range and constraint checks on non-existent flags
redestad
parents:
39117
diff
changeset
|
250 |
#define EMIT_CONSTRAINT_DIAGNOSTIC_FLAG(type, name, value, doc) ); emit_constraint_##type(#name,&name |
22e71ef4a16a
8180614: Skip range and constraint checks on non-existent flags
redestad
parents:
39117
diff
changeset
|
251 |
#define EMIT_CONSTRAINT_EXPERIMENTAL_FLAG(type, name, value, doc) ); emit_constraint_##type(#name,&name |
22e71ef4a16a
8180614: Skip range and constraint checks on non-existent flags
redestad
parents:
39117
diff
changeset
|
252 |
#define EMIT_CONSTRAINT_MANAGEABLE_FLAG(type, name, value, doc) ); emit_constraint_##type(#name,&name |
22e71ef4a16a
8180614: Skip range and constraint checks on non-existent flags
redestad
parents:
39117
diff
changeset
|
253 |
#define EMIT_CONSTRAINT_PRODUCT_RW_FLAG(type, name, value, doc) ); emit_constraint_##type(#name,&name |
22e71ef4a16a
8180614: Skip range and constraint checks on non-existent flags
redestad
parents:
39117
diff
changeset
|
254 |
#define EMIT_CONSTRAINT_PD_PRODUCT_FLAG(type, name, doc) ); emit_constraint_##type(#name,&name |
22e71ef4a16a
8180614: Skip range and constraint checks on non-existent flags
redestad
parents:
39117
diff
changeset
|
255 |
#define EMIT_CONSTRAINT_PD_DIAGNOSTIC_FLAG(type, name, doc) ); emit_constraint_##type(#name,&name |
22e71ef4a16a
8180614: Skip range and constraint checks on non-existent flags
redestad
parents:
39117
diff
changeset
|
256 |
#ifndef PRODUCT |
22e71ef4a16a
8180614: Skip range and constraint checks on non-existent flags
redestad
parents:
39117
diff
changeset
|
257 |
#define EMIT_CONSTRAINT_DEVELOPER_FLAG(type, name, value, doc) ); emit_constraint_##type(#name,&name |
22e71ef4a16a
8180614: Skip range and constraint checks on non-existent flags
redestad
parents:
39117
diff
changeset
|
258 |
#define EMIT_CONSTRAINT_PD_DEVELOPER_FLAG(type, name, doc) ); emit_constraint_##type(#name,&name |
22e71ef4a16a
8180614: Skip range and constraint checks on non-existent flags
redestad
parents:
39117
diff
changeset
|
259 |
#define EMIT_CONSTRAINT_NOTPRODUCT_FLAG(type, name, value, doc) ); emit_constraint_##type(#name,&name |
22e71ef4a16a
8180614: Skip range and constraint checks on non-existent flags
redestad
parents:
39117
diff
changeset
|
260 |
#else |
22e71ef4a16a
8180614: Skip range and constraint checks on non-existent flags
redestad
parents:
39117
diff
changeset
|
261 |
#define EMIT_CONSTRAINT_DEVELOPER_FLAG(type, name, value, doc) ); emit_constraint_no(#name,&name |
22e71ef4a16a
8180614: Skip range and constraint checks on non-existent flags
redestad
parents:
39117
diff
changeset
|
262 |
#define EMIT_CONSTRAINT_PD_DEVELOPER_FLAG(type, name, doc) ); emit_constraint_no(#name,&name |
22e71ef4a16a
8180614: Skip range and constraint checks on non-existent flags
redestad
parents:
39117
diff
changeset
|
263 |
#define EMIT_CONSTRAINT_NOTPRODUCT_FLAG(type, name, value, doc) ); emit_constraint_no(#name,&name |
22e71ef4a16a
8180614: Skip range and constraint checks on non-existent flags
redestad
parents:
39117
diff
changeset
|
264 |
#endif |
22e71ef4a16a
8180614: Skip range and constraint checks on non-existent flags
redestad
parents:
39117
diff
changeset
|
265 |
#ifdef _LP64 |
22e71ef4a16a
8180614: Skip range and constraint checks on non-existent flags
redestad
parents:
39117
diff
changeset
|
266 |
#define EMIT_CONSTRAINT_LP64_PRODUCT_FLAG(type, name, value, doc) ); emit_constraint_##type(#name,&name |
22e71ef4a16a
8180614: Skip range and constraint checks on non-existent flags
redestad
parents:
39117
diff
changeset
|
267 |
#else |
22e71ef4a16a
8180614: Skip range and constraint checks on non-existent flags
redestad
parents:
39117
diff
changeset
|
268 |
#define EMIT_CONSTRAINT_LP64_PRODUCT_FLAG(type, name, value, doc) ); emit_constraint_no(#name,&name |
22e71ef4a16a
8180614: Skip range and constraint checks on non-existent flags
redestad
parents:
39117
diff
changeset
|
269 |
#endif |
31371
311143309e73
8122937: [JEP 245] Validate JVM Command-Line Flag Arguments.
gziemski
parents:
diff
changeset
|
270 |
|
311143309e73
8122937: [JEP 245] Validate JVM Command-Line Flag Arguments.
gziemski
parents:
diff
changeset
|
271 |
// Generate func argument to pass into emit_constraint_xxx functions |
38273
2634194d7555
8073500: Prevent certain commercial flags from being changed at runtime
gziemski
parents:
37491
diff
changeset
|
272 |
#define EMIT_CONSTRAINT_CHECK(func, type) , func, CommandLineFlagConstraint::type |
31371
311143309e73
8122937: [JEP 245] Validate JVM Command-Line Flag Arguments.
gziemski
parents:
diff
changeset
|
273 |
|
311143309e73
8122937: [JEP 245] Validate JVM Command-Line Flag Arguments.
gziemski
parents:
diff
changeset
|
274 |
// the "name" argument must be a string literal |
34661
9a1d11d88ea0
8142341: GC: current flags need ranges to be implemented
sangheki
parents:
34242
diff
changeset
|
275 |
#define INITIAL_CONSTRAINTS_SIZE 72 |
31371
311143309e73
8122937: [JEP 245] Validate JVM Command-Line Flag Arguments.
gziemski
parents:
diff
changeset
|
276 |
GrowableArray<CommandLineFlagConstraint*>* CommandLineFlagConstraintList::_constraints = NULL; |
31995
aa4049b4184a
8130459: Add additional validation after heap creation
sangheki
parents:
31371
diff
changeset
|
277 |
CommandLineFlagConstraint::ConstraintType CommandLineFlagConstraintList::_validating_type = CommandLineFlagConstraint::AtParse; |
31371
311143309e73
8122937: [JEP 245] Validate JVM Command-Line Flag Arguments.
gziemski
parents:
diff
changeset
|
278 |
|
311143309e73
8122937: [JEP 245] Validate JVM Command-Line Flag Arguments.
gziemski
parents:
diff
changeset
|
279 |
// Check the ranges of all flags that have them or print them out and exit if requested |
311143309e73
8122937: [JEP 245] Validate JVM Command-Line Flag Arguments.
gziemski
parents:
diff
changeset
|
280 |
void CommandLineFlagConstraintList::init(void) { |
37491
edf4cc53f5a3
8153039: Command line processing should use mtCommand or mtArguments rather than mtInternal for NMT
gziemski
parents:
37208
diff
changeset
|
281 |
_constraints = new (ResourceObj::C_HEAP, mtArguments) GrowableArray<CommandLineFlagConstraint*>(INITIAL_CONSTRAINTS_SIZE, true); |
31371
311143309e73
8122937: [JEP 245] Validate JVM Command-Line Flag Arguments.
gziemski
parents:
diff
changeset
|
282 |
|
311143309e73
8122937: [JEP 245] Validate JVM Command-Line Flag Arguments.
gziemski
parents:
diff
changeset
|
283 |
emit_constraint_no(NULL RUNTIME_FLAGS(EMIT_CONSTRAINT_DEVELOPER_FLAG, |
311143309e73
8122937: [JEP 245] Validate JVM Command-Line Flag Arguments.
gziemski
parents:
diff
changeset
|
284 |
EMIT_CONSTRAINT_PD_DEVELOPER_FLAG, |
311143309e73
8122937: [JEP 245] Validate JVM Command-Line Flag Arguments.
gziemski
parents:
diff
changeset
|
285 |
EMIT_CONSTRAINT_PRODUCT_FLAG, |
311143309e73
8122937: [JEP 245] Validate JVM Command-Line Flag Arguments.
gziemski
parents:
diff
changeset
|
286 |
EMIT_CONSTRAINT_PD_PRODUCT_FLAG, |
311143309e73
8122937: [JEP 245] Validate JVM Command-Line Flag Arguments.
gziemski
parents:
diff
changeset
|
287 |
EMIT_CONSTRAINT_DIAGNOSTIC_FLAG, |
39117 | 288 |
EMIT_CONSTRAINT_PD_DIAGNOSTIC_FLAG, |
31371
311143309e73
8122937: [JEP 245] Validate JVM Command-Line Flag Arguments.
gziemski
parents:
diff
changeset
|
289 |
EMIT_CONSTRAINT_EXPERIMENTAL_FLAG, |
311143309e73
8122937: [JEP 245] Validate JVM Command-Line Flag Arguments.
gziemski
parents:
diff
changeset
|
290 |
EMIT_CONSTRAINT_NOTPRODUCT_FLAG, |
311143309e73
8122937: [JEP 245] Validate JVM Command-Line Flag Arguments.
gziemski
parents:
diff
changeset
|
291 |
EMIT_CONSTRAINT_MANAGEABLE_FLAG, |
311143309e73
8122937: [JEP 245] Validate JVM Command-Line Flag Arguments.
gziemski
parents:
diff
changeset
|
292 |
EMIT_CONSTRAINT_PRODUCT_RW_FLAG, |
311143309e73
8122937: [JEP 245] Validate JVM Command-Line Flag Arguments.
gziemski
parents:
diff
changeset
|
293 |
EMIT_CONSTRAINT_LP64_PRODUCT_FLAG, |
311143309e73
8122937: [JEP 245] Validate JVM Command-Line Flag Arguments.
gziemski
parents:
diff
changeset
|
294 |
IGNORE_RANGE, |
38273
2634194d7555
8073500: Prevent certain commercial flags from being changed at runtime
gziemski
parents:
37491
diff
changeset
|
295 |
EMIT_CONSTRAINT_CHECK, |
2634194d7555
8073500: Prevent certain commercial flags from being changed at runtime
gziemski
parents:
37491
diff
changeset
|
296 |
IGNORE_WRITEABLE)); |
31371
311143309e73
8122937: [JEP 245] Validate JVM Command-Line Flag Arguments.
gziemski
parents:
diff
changeset
|
297 |
|
311143309e73
8122937: [JEP 245] Validate JVM Command-Line Flag Arguments.
gziemski
parents:
diff
changeset
|
298 |
EMIT_CONSTRAINTS_FOR_GLOBALS_EXT |
311143309e73
8122937: [JEP 245] Validate JVM Command-Line Flag Arguments.
gziemski
parents:
diff
changeset
|
299 |
|
311143309e73
8122937: [JEP 245] Validate JVM Command-Line Flag Arguments.
gziemski
parents:
diff
changeset
|
300 |
emit_constraint_no(NULL ARCH_FLAGS(EMIT_CONSTRAINT_DEVELOPER_FLAG, |
311143309e73
8122937: [JEP 245] Validate JVM Command-Line Flag Arguments.
gziemski
parents:
diff
changeset
|
301 |
EMIT_CONSTRAINT_PRODUCT_FLAG, |
311143309e73
8122937: [JEP 245] Validate JVM Command-Line Flag Arguments.
gziemski
parents:
diff
changeset
|
302 |
EMIT_CONSTRAINT_DIAGNOSTIC_FLAG, |
311143309e73
8122937: [JEP 245] Validate JVM Command-Line Flag Arguments.
gziemski
parents:
diff
changeset
|
303 |
EMIT_CONSTRAINT_EXPERIMENTAL_FLAG, |
311143309e73
8122937: [JEP 245] Validate JVM Command-Line Flag Arguments.
gziemski
parents:
diff
changeset
|
304 |
EMIT_CONSTRAINT_NOTPRODUCT_FLAG, |
311143309e73
8122937: [JEP 245] Validate JVM Command-Line Flag Arguments.
gziemski
parents:
diff
changeset
|
305 |
IGNORE_RANGE, |
38273
2634194d7555
8073500: Prevent certain commercial flags from being changed at runtime
gziemski
parents:
37491
diff
changeset
|
306 |
EMIT_CONSTRAINT_CHECK, |
2634194d7555
8073500: Prevent certain commercial flags from being changed at runtime
gziemski
parents:
37491
diff
changeset
|
307 |
IGNORE_WRITEABLE)); |
31371
311143309e73
8122937: [JEP 245] Validate JVM Command-Line Flag Arguments.
gziemski
parents:
diff
changeset
|
308 |
|
33160
c59f1676d27e
8136421: JEP 243: Java-Level JVM Compiler Interface
twisti
parents:
32613
diff
changeset
|
309 |
|
31371
311143309e73
8122937: [JEP 245] Validate JVM Command-Line Flag Arguments.
gziemski
parents:
diff
changeset
|
310 |
#ifdef COMPILER1 |
311143309e73
8122937: [JEP 245] Validate JVM Command-Line Flag Arguments.
gziemski
parents:
diff
changeset
|
311 |
emit_constraint_no(NULL C1_FLAGS(EMIT_CONSTRAINT_DEVELOPER_FLAG, |
311143309e73
8122937: [JEP 245] Validate JVM Command-Line Flag Arguments.
gziemski
parents:
diff
changeset
|
312 |
EMIT_CONSTRAINT_PD_DEVELOPER_FLAG, |
311143309e73
8122937: [JEP 245] Validate JVM Command-Line Flag Arguments.
gziemski
parents:
diff
changeset
|
313 |
EMIT_CONSTRAINT_PRODUCT_FLAG, |
311143309e73
8122937: [JEP 245] Validate JVM Command-Line Flag Arguments.
gziemski
parents:
diff
changeset
|
314 |
EMIT_CONSTRAINT_PD_PRODUCT_FLAG, |
311143309e73
8122937: [JEP 245] Validate JVM Command-Line Flag Arguments.
gziemski
parents:
diff
changeset
|
315 |
EMIT_CONSTRAINT_DIAGNOSTIC_FLAG, |
39117 | 316 |
EMIT_CONSTRAINT_PD_DIAGNOSTIC_FLAG, |
31371
311143309e73
8122937: [JEP 245] Validate JVM Command-Line Flag Arguments.
gziemski
parents:
diff
changeset
|
317 |
EMIT_CONSTRAINT_NOTPRODUCT_FLAG, |
311143309e73
8122937: [JEP 245] Validate JVM Command-Line Flag Arguments.
gziemski
parents:
diff
changeset
|
318 |
IGNORE_RANGE, |
38273
2634194d7555
8073500: Prevent certain commercial flags from being changed at runtime
gziemski
parents:
37491
diff
changeset
|
319 |
EMIT_CONSTRAINT_CHECK, |
2634194d7555
8073500: Prevent certain commercial flags from being changed at runtime
gziemski
parents:
37491
diff
changeset
|
320 |
IGNORE_WRITEABLE)); |
31371
311143309e73
8122937: [JEP 245] Validate JVM Command-Line Flag Arguments.
gziemski
parents:
diff
changeset
|
321 |
#endif // COMPILER1 |
311143309e73
8122937: [JEP 245] Validate JVM Command-Line Flag Arguments.
gziemski
parents:
diff
changeset
|
322 |
|
311143309e73
8122937: [JEP 245] Validate JVM Command-Line Flag Arguments.
gziemski
parents:
diff
changeset
|
323 |
#ifdef COMPILER2 |
311143309e73
8122937: [JEP 245] Validate JVM Command-Line Flag Arguments.
gziemski
parents:
diff
changeset
|
324 |
emit_constraint_no(NULL C2_FLAGS(EMIT_CONSTRAINT_DEVELOPER_FLAG, |
311143309e73
8122937: [JEP 245] Validate JVM Command-Line Flag Arguments.
gziemski
parents:
diff
changeset
|
325 |
EMIT_CONSTRAINT_PD_DEVELOPER_FLAG, |
311143309e73
8122937: [JEP 245] Validate JVM Command-Line Flag Arguments.
gziemski
parents:
diff
changeset
|
326 |
EMIT_CONSTRAINT_PRODUCT_FLAG, |
311143309e73
8122937: [JEP 245] Validate JVM Command-Line Flag Arguments.
gziemski
parents:
diff
changeset
|
327 |
EMIT_CONSTRAINT_PD_PRODUCT_FLAG, |
311143309e73
8122937: [JEP 245] Validate JVM Command-Line Flag Arguments.
gziemski
parents:
diff
changeset
|
328 |
EMIT_CONSTRAINT_DIAGNOSTIC_FLAG, |
39117 | 329 |
EMIT_CONSTRAINT_PD_DIAGNOSTIC_FLAG, |
31371
311143309e73
8122937: [JEP 245] Validate JVM Command-Line Flag Arguments.
gziemski
parents:
diff
changeset
|
330 |
EMIT_CONSTRAINT_EXPERIMENTAL_FLAG, |
311143309e73
8122937: [JEP 245] Validate JVM Command-Line Flag Arguments.
gziemski
parents:
diff
changeset
|
331 |
EMIT_CONSTRAINT_NOTPRODUCT_FLAG, |
311143309e73
8122937: [JEP 245] Validate JVM Command-Line Flag Arguments.
gziemski
parents:
diff
changeset
|
332 |
IGNORE_RANGE, |
38273
2634194d7555
8073500: Prevent certain commercial flags from being changed at runtime
gziemski
parents:
37491
diff
changeset
|
333 |
EMIT_CONSTRAINT_CHECK, |
2634194d7555
8073500: Prevent certain commercial flags from being changed at runtime
gziemski
parents:
37491
diff
changeset
|
334 |
IGNORE_WRITEABLE)); |
31371
311143309e73
8122937: [JEP 245] Validate JVM Command-Line Flag Arguments.
gziemski
parents:
diff
changeset
|
335 |
#endif // COMPILER2 |
311143309e73
8122937: [JEP 245] Validate JVM Command-Line Flag Arguments.
gziemski
parents:
diff
changeset
|
336 |
|
33144
c56850e328fc
8134995: [REDO] GC: implement ranges (optionally constraints) for those flags that have them missing
sangheki
parents:
32613
diff
changeset
|
337 |
#if INCLUDE_ALL_GCS |
31371
311143309e73
8122937: [JEP 245] Validate JVM Command-Line Flag Arguments.
gziemski
parents:
diff
changeset
|
338 |
emit_constraint_no(NULL G1_FLAGS(EMIT_CONSTRAINT_DEVELOPER_FLAG, |
311143309e73
8122937: [JEP 245] Validate JVM Command-Line Flag Arguments.
gziemski
parents:
diff
changeset
|
339 |
EMIT_CONSTRAINT_PD_DEVELOPER_FLAG, |
311143309e73
8122937: [JEP 245] Validate JVM Command-Line Flag Arguments.
gziemski
parents:
diff
changeset
|
340 |
EMIT_CONSTRAINT_PRODUCT_FLAG, |
311143309e73
8122937: [JEP 245] Validate JVM Command-Line Flag Arguments.
gziemski
parents:
diff
changeset
|
341 |
EMIT_CONSTRAINT_PD_PRODUCT_FLAG, |
311143309e73
8122937: [JEP 245] Validate JVM Command-Line Flag Arguments.
gziemski
parents:
diff
changeset
|
342 |
EMIT_CONSTRAINT_DIAGNOSTIC_FLAG, |
39117 | 343 |
EMIT_CONSTRAINT_PD_DIAGNOSTIC_FLAG, |
31371
311143309e73
8122937: [JEP 245] Validate JVM Command-Line Flag Arguments.
gziemski
parents:
diff
changeset
|
344 |
EMIT_CONSTRAINT_EXPERIMENTAL_FLAG, |
311143309e73
8122937: [JEP 245] Validate JVM Command-Line Flag Arguments.
gziemski
parents:
diff
changeset
|
345 |
EMIT_CONSTRAINT_NOTPRODUCT_FLAG, |
311143309e73
8122937: [JEP 245] Validate JVM Command-Line Flag Arguments.
gziemski
parents:
diff
changeset
|
346 |
EMIT_CONSTRAINT_MANAGEABLE_FLAG, |
311143309e73
8122937: [JEP 245] Validate JVM Command-Line Flag Arguments.
gziemski
parents:
diff
changeset
|
347 |
EMIT_CONSTRAINT_PRODUCT_RW_FLAG, |
311143309e73
8122937: [JEP 245] Validate JVM Command-Line Flag Arguments.
gziemski
parents:
diff
changeset
|
348 |
IGNORE_RANGE, |
38273
2634194d7555
8073500: Prevent certain commercial flags from being changed at runtime
gziemski
parents:
37491
diff
changeset
|
349 |
EMIT_CONSTRAINT_CHECK, |
2634194d7555
8073500: Prevent certain commercial flags from being changed at runtime
gziemski
parents:
37491
diff
changeset
|
350 |
IGNORE_WRITEABLE)); |
31371
311143309e73
8122937: [JEP 245] Validate JVM Command-Line Flag Arguments.
gziemski
parents:
diff
changeset
|
351 |
#endif // INCLUDE_ALL_GCS |
311143309e73
8122937: [JEP 245] Validate JVM Command-Line Flag Arguments.
gziemski
parents:
diff
changeset
|
352 |
} |
311143309e73
8122937: [JEP 245] Validate JVM Command-Line Flag Arguments.
gziemski
parents:
diff
changeset
|
353 |
|
37208
aaf76eb8cfd4
8142510: -XX:+PrintFlagsRanges should print default range value for those flags that have constraint and an implicit range.
gziemski
parents:
36313
diff
changeset
|
354 |
CommandLineFlagConstraint* CommandLineFlagConstraintList::find(const char* name) { |
31371
311143309e73
8122937: [JEP 245] Validate JVM Command-Line Flag Arguments.
gziemski
parents:
diff
changeset
|
355 |
CommandLineFlagConstraint* found = NULL; |
311143309e73
8122937: [JEP 245] Validate JVM Command-Line Flag Arguments.
gziemski
parents:
diff
changeset
|
356 |
for (int i=0; i<length(); i++) { |
311143309e73
8122937: [JEP 245] Validate JVM Command-Line Flag Arguments.
gziemski
parents:
diff
changeset
|
357 |
CommandLineFlagConstraint* constraint = at(i); |
37208
aaf76eb8cfd4
8142510: -XX:+PrintFlagsRanges should print default range value for those flags that have constraint and an implicit range.
gziemski
parents:
36313
diff
changeset
|
358 |
if (strcmp(constraint->name(), name) == 0) { |
31371
311143309e73
8122937: [JEP 245] Validate JVM Command-Line Flag Arguments.
gziemski
parents:
diff
changeset
|
359 |
found = constraint; |
311143309e73
8122937: [JEP 245] Validate JVM Command-Line Flag Arguments.
gziemski
parents:
diff
changeset
|
360 |
break; |
311143309e73
8122937: [JEP 245] Validate JVM Command-Line Flag Arguments.
gziemski
parents:
diff
changeset
|
361 |
} |
311143309e73
8122937: [JEP 245] Validate JVM Command-Line Flag Arguments.
gziemski
parents:
diff
changeset
|
362 |
} |
311143309e73
8122937: [JEP 245] Validate JVM Command-Line Flag Arguments.
gziemski
parents:
diff
changeset
|
363 |
return found; |
311143309e73
8122937: [JEP 245] Validate JVM Command-Line Flag Arguments.
gziemski
parents:
diff
changeset
|
364 |
} |
31995
aa4049b4184a
8130459: Add additional validation after heap creation
sangheki
parents:
31371
diff
changeset
|
365 |
|
37208
aaf76eb8cfd4
8142510: -XX:+PrintFlagsRanges should print default range value for those flags that have constraint and an implicit range.
gziemski
parents:
36313
diff
changeset
|
366 |
// Find constraints by name and return only if found constraint's type is equal or lower than current validating type. |
aaf76eb8cfd4
8142510: -XX:+PrintFlagsRanges should print default range value for those flags that have constraint and an implicit range.
gziemski
parents:
36313
diff
changeset
|
367 |
CommandLineFlagConstraint* CommandLineFlagConstraintList::find_if_needs_check(const char* name) { |
aaf76eb8cfd4
8142510: -XX:+PrintFlagsRanges should print default range value for those flags that have constraint and an implicit range.
gziemski
parents:
36313
diff
changeset
|
368 |
CommandLineFlagConstraint* found = NULL; |
aaf76eb8cfd4
8142510: -XX:+PrintFlagsRanges should print default range value for those flags that have constraint and an implicit range.
gziemski
parents:
36313
diff
changeset
|
369 |
CommandLineFlagConstraint* constraint = find(name); |
aaf76eb8cfd4
8142510: -XX:+PrintFlagsRanges should print default range value for those flags that have constraint and an implicit range.
gziemski
parents:
36313
diff
changeset
|
370 |
if (constraint && (constraint->type() <= _validating_type)) { |
aaf76eb8cfd4
8142510: -XX:+PrintFlagsRanges should print default range value for those flags that have constraint and an implicit range.
gziemski
parents:
36313
diff
changeset
|
371 |
found = constraint; |
aaf76eb8cfd4
8142510: -XX:+PrintFlagsRanges should print default range value for those flags that have constraint and an implicit range.
gziemski
parents:
36313
diff
changeset
|
372 |
} |
aaf76eb8cfd4
8142510: -XX:+PrintFlagsRanges should print default range value for those flags that have constraint and an implicit range.
gziemski
parents:
36313
diff
changeset
|
373 |
return found; |
aaf76eb8cfd4
8142510: -XX:+PrintFlagsRanges should print default range value for those flags that have constraint and an implicit range.
gziemski
parents:
36313
diff
changeset
|
374 |
} |
aaf76eb8cfd4
8142510: -XX:+PrintFlagsRanges should print default range value for those flags that have constraint and an implicit range.
gziemski
parents:
36313
diff
changeset
|
375 |
|
31995
aa4049b4184a
8130459: Add additional validation after heap creation
sangheki
parents:
31371
diff
changeset
|
376 |
// Check constraints for specific constraint type. |
aa4049b4184a
8130459: Add additional validation after heap creation
sangheki
parents:
31371
diff
changeset
|
377 |
bool CommandLineFlagConstraintList::check_constraints(CommandLineFlagConstraint::ConstraintType type) { |
33144
c56850e328fc
8134995: [REDO] GC: implement ranges (optionally constraints) for those flags that have them missing
sangheki
parents:
32613
diff
changeset
|
378 |
guarantee(type > _validating_type, "Constraint check is out of order."); |
31995
aa4049b4184a
8130459: Add additional validation after heap creation
sangheki
parents:
31371
diff
changeset
|
379 |
_validating_type = type; |
aa4049b4184a
8130459: Add additional validation after heap creation
sangheki
parents:
31371
diff
changeset
|
380 |
|
aa4049b4184a
8130459: Add additional validation after heap creation
sangheki
parents:
31371
diff
changeset
|
381 |
bool status = true; |
aa4049b4184a
8130459: Add additional validation after heap creation
sangheki
parents:
31371
diff
changeset
|
382 |
for (int i=0; i<length(); i++) { |
aa4049b4184a
8130459: Add additional validation after heap creation
sangheki
parents:
31371
diff
changeset
|
383 |
CommandLineFlagConstraint* constraint = at(i); |
aa4049b4184a
8130459: Add additional validation after heap creation
sangheki
parents:
31371
diff
changeset
|
384 |
if (type != constraint->type()) continue; |
46499
22e71ef4a16a
8180614: Skip range and constraint checks on non-existent flags
redestad
parents:
39117
diff
changeset
|
385 |
if (constraint->apply(true) != Flag::SUCCESS) status = false; |
31995
aa4049b4184a
8130459: Add additional validation after heap creation
sangheki
parents:
31371
diff
changeset
|
386 |
} |
aa4049b4184a
8130459: Add additional validation after heap creation
sangheki
parents:
31371
diff
changeset
|
387 |
return status; |
aa4049b4184a
8130459: Add additional validation after heap creation
sangheki
parents:
31371
diff
changeset
|
388 |
} |