author | gziemski |
Mon, 23 Apr 2018 10:59:39 -0500 | |
changeset 49857 | 31e07291ae29 |
parent 49731 | src/hotspot/share/runtime/commandLineFlagConstraintList.cpp@635838cb8b3a |
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" |
49857
31e07291ae29
8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
49731
diff
changeset
|
28 |
#include "gc/shared/jvmFlagConstraintsGC.hpp" |
31371
311143309e73
8122937: [JEP 245] Validate JVM Command-Line Flag Arguments.
gziemski
parents:
diff
changeset
|
29 |
#include "runtime/arguments.hpp" |
49857
31e07291ae29
8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
49731
diff
changeset
|
30 |
#include "runtime/flags/jvmFlag.hpp" |
31e07291ae29
8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
49731
diff
changeset
|
31 |
#include "runtime/flags/jvmFlagConstraintList.hpp" |
31e07291ae29
8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
49731
diff
changeset
|
32 |
#include "runtime/flags/jvmFlagConstraintsCompiler.hpp" |
31e07291ae29
8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
49731
diff
changeset
|
33 |
#include "runtime/flags/jvmFlagConstraintsRuntime.hpp" |
31371
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" |
46818 | 36 |
#ifdef COMPILER1 |
37 |
#include "c1/c1_globals.hpp" |
|
38 |
#endif |
|
39 |
#ifdef COMPILER2 |
|
40 |
#include "opto/c2_globals.hpp" |
|
41 |
#endif |
|
42 |
||
49857
31e07291ae29
8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
49731
diff
changeset
|
43 |
class JVMFlagConstraint_bool : public JVMFlagConstraint { |
31e07291ae29
8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
49731
diff
changeset
|
44 |
JVMFlagConstraintFunc_bool _constraint; |
46499
22e71ef4a16a
8180614: Skip range and constraint checks on non-existent flags
redestad
parents:
39117
diff
changeset
|
45 |
const bool* _ptr; |
31371
311143309e73
8122937: [JEP 245] Validate JVM Command-Line Flag Arguments.
gziemski
parents:
diff
changeset
|
46 |
|
311143309e73
8122937: [JEP 245] Validate JVM Command-Line Flag Arguments.
gziemski
parents:
diff
changeset
|
47 |
public: |
311143309e73
8122937: [JEP 245] Validate JVM Command-Line Flag Arguments.
gziemski
parents:
diff
changeset
|
48 |
// the "name" argument must be a string literal |
49857
31e07291ae29
8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
49731
diff
changeset
|
49 |
JVMFlagConstraint_bool(const char* name, const bool* ptr, |
31e07291ae29
8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
49731
diff
changeset
|
50 |
JVMFlagConstraintFunc_bool func, |
31e07291ae29
8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
49731
diff
changeset
|
51 |
ConstraintType type) : JVMFlagConstraint(name, type), _constraint(func), _ptr(ptr) {} |
46499
22e71ef4a16a
8180614: Skip range and constraint checks on non-existent flags
redestad
parents:
39117
diff
changeset
|
52 |
|
49857
31e07291ae29
8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
49731
diff
changeset
|
53 |
JVMFlag::Error apply(bool verbose) { |
46499
22e71ef4a16a
8180614: Skip range and constraint checks on non-existent flags
redestad
parents:
39117
diff
changeset
|
54 |
bool value = *_ptr; |
22e71ef4a16a
8180614: Skip range and constraint checks on non-existent flags
redestad
parents:
39117
diff
changeset
|
55 |
return _constraint(value, verbose); |
31371
311143309e73
8122937: [JEP 245] Validate JVM Command-Line Flag Arguments.
gziemski
parents:
diff
changeset
|
56 |
} |
311143309e73
8122937: [JEP 245] Validate JVM Command-Line Flag Arguments.
gziemski
parents:
diff
changeset
|
57 |
|
49857
31e07291ae29
8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
49731
diff
changeset
|
58 |
JVMFlag::Error apply_bool(bool value, bool verbose) { |
32351 | 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 |
}; |
311143309e73
8122937: [JEP 245] Validate JVM Command-Line Flag Arguments.
gziemski
parents:
diff
changeset
|
62 |
|
49857
31e07291ae29
8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
49731
diff
changeset
|
63 |
class JVMFlagConstraint_int : public JVMFlagConstraint { |
31e07291ae29
8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
49731
diff
changeset
|
64 |
JVMFlagConstraintFunc_int _constraint; |
46499
22e71ef4a16a
8180614: Skip range and constraint checks on non-existent flags
redestad
parents:
39117
diff
changeset
|
65 |
const int* _ptr; |
31371
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 |
public: |
311143309e73
8122937: [JEP 245] Validate JVM Command-Line Flag Arguments.
gziemski
parents:
diff
changeset
|
68 |
// the "name" argument must be a string literal |
49857
31e07291ae29
8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
49731
diff
changeset
|
69 |
JVMFlagConstraint_int(const char* name, const int* ptr, |
31e07291ae29
8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
49731
diff
changeset
|
70 |
JVMFlagConstraintFunc_int func, |
31e07291ae29
8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
49731
diff
changeset
|
71 |
ConstraintType type) : JVMFlagConstraint(name, type), _constraint(func), _ptr(ptr) {} |
46499
22e71ef4a16a
8180614: Skip range and constraint checks on non-existent flags
redestad
parents:
39117
diff
changeset
|
72 |
|
49857
31e07291ae29
8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
49731
diff
changeset
|
73 |
JVMFlag::Error apply(bool verbose) { |
46499
22e71ef4a16a
8180614: Skip range and constraint checks on non-existent flags
redestad
parents:
39117
diff
changeset
|
74 |
int value = *_ptr; |
22e71ef4a16a
8180614: Skip range and constraint checks on non-existent flags
redestad
parents:
39117
diff
changeset
|
75 |
return _constraint(value, verbose); |
31371
311143309e73
8122937: [JEP 245] Validate JVM Command-Line Flag Arguments.
gziemski
parents:
diff
changeset
|
76 |
} |
311143309e73
8122937: [JEP 245] Validate JVM Command-Line Flag Arguments.
gziemski
parents:
diff
changeset
|
77 |
|
49857
31e07291ae29
8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
49731
diff
changeset
|
78 |
JVMFlag::Error apply_int(int value, bool verbose) { |
32351 | 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 |
}; |
311143309e73
8122937: [JEP 245] Validate JVM Command-Line Flag Arguments.
gziemski
parents:
diff
changeset
|
82 |
|
49857
31e07291ae29
8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
49731
diff
changeset
|
83 |
class JVMFlagConstraint_intx : public JVMFlagConstraint { |
31e07291ae29
8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
49731
diff
changeset
|
84 |
JVMFlagConstraintFunc_intx _constraint; |
46499
22e71ef4a16a
8180614: Skip range and constraint checks on non-existent flags
redestad
parents:
39117
diff
changeset
|
85 |
const intx* _ptr; |
31371
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 |
public: |
311143309e73
8122937: [JEP 245] Validate JVM Command-Line Flag Arguments.
gziemski
parents:
diff
changeset
|
88 |
// the "name" argument must be a string literal |
49857
31e07291ae29
8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
49731
diff
changeset
|
89 |
JVMFlagConstraint_intx(const char* name, const intx* ptr, |
31e07291ae29
8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
49731
diff
changeset
|
90 |
JVMFlagConstraintFunc_intx func, |
31e07291ae29
8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
49731
diff
changeset
|
91 |
ConstraintType type) : JVMFlagConstraint(name, type), _constraint(func), _ptr(ptr) {} |
46499
22e71ef4a16a
8180614: Skip range and constraint checks on non-existent flags
redestad
parents:
39117
diff
changeset
|
92 |
|
49857
31e07291ae29
8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
49731
diff
changeset
|
93 |
JVMFlag::Error apply(bool verbose) { |
46499
22e71ef4a16a
8180614: Skip range and constraint checks on non-existent flags
redestad
parents:
39117
diff
changeset
|
94 |
intx value = *_ptr; |
22e71ef4a16a
8180614: Skip range and constraint checks on non-existent flags
redestad
parents:
39117
diff
changeset
|
95 |
return _constraint(value, verbose); |
31371
311143309e73
8122937: [JEP 245] Validate JVM Command-Line Flag Arguments.
gziemski
parents:
diff
changeset
|
96 |
} |
311143309e73
8122937: [JEP 245] Validate JVM Command-Line Flag Arguments.
gziemski
parents:
diff
changeset
|
97 |
|
49857
31e07291ae29
8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
49731
diff
changeset
|
98 |
JVMFlag::Error apply_intx(intx value, bool verbose) { |
32351 | 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 |
}; |
311143309e73
8122937: [JEP 245] Validate JVM Command-Line Flag Arguments.
gziemski
parents:
diff
changeset
|
102 |
|
49857
31e07291ae29
8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
49731
diff
changeset
|
103 |
class JVMFlagConstraint_uint : public JVMFlagConstraint { |
31e07291ae29
8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
49731
diff
changeset
|
104 |
JVMFlagConstraintFunc_uint _constraint; |
46499
22e71ef4a16a
8180614: Skip range and constraint checks on non-existent flags
redestad
parents:
39117
diff
changeset
|
105 |
const uint* _ptr; |
31371
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 |
public: |
311143309e73
8122937: [JEP 245] Validate JVM Command-Line Flag Arguments.
gziemski
parents:
diff
changeset
|
108 |
// the "name" argument must be a string literal |
49857
31e07291ae29
8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
49731
diff
changeset
|
109 |
JVMFlagConstraint_uint(const char* name, const uint* ptr, |
31e07291ae29
8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
49731
diff
changeset
|
110 |
JVMFlagConstraintFunc_uint func, |
31e07291ae29
8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
49731
diff
changeset
|
111 |
ConstraintType type) : JVMFlagConstraint(name, type), _constraint(func), _ptr(ptr) {} |
46499
22e71ef4a16a
8180614: Skip range and constraint checks on non-existent flags
redestad
parents:
39117
diff
changeset
|
112 |
|
49857
31e07291ae29
8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
49731
diff
changeset
|
113 |
JVMFlag::Error apply(bool verbose) { |
46499
22e71ef4a16a
8180614: Skip range and constraint checks on non-existent flags
redestad
parents:
39117
diff
changeset
|
114 |
uint value = *_ptr; |
22e71ef4a16a
8180614: Skip range and constraint checks on non-existent flags
redestad
parents:
39117
diff
changeset
|
115 |
return _constraint(value, verbose); |
31371
311143309e73
8122937: [JEP 245] Validate JVM Command-Line Flag Arguments.
gziemski
parents:
diff
changeset
|
116 |
} |
311143309e73
8122937: [JEP 245] Validate JVM Command-Line Flag Arguments.
gziemski
parents:
diff
changeset
|
117 |
|
49857
31e07291ae29
8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
49731
diff
changeset
|
118 |
JVMFlag::Error apply_uint(uint value, bool verbose) { |
32351 | 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 |
}; |
311143309e73
8122937: [JEP 245] Validate JVM Command-Line Flag Arguments.
gziemski
parents:
diff
changeset
|
122 |
|
49857
31e07291ae29
8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
49731
diff
changeset
|
123 |
class JVMFlagConstraint_uintx : public JVMFlagConstraint { |
31e07291ae29
8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
49731
diff
changeset
|
124 |
JVMFlagConstraintFunc_uintx _constraint; |
46499
22e71ef4a16a
8180614: Skip range and constraint checks on non-existent flags
redestad
parents:
39117
diff
changeset
|
125 |
const uintx* _ptr; |
31371
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 |
public: |
311143309e73
8122937: [JEP 245] Validate JVM Command-Line Flag Arguments.
gziemski
parents:
diff
changeset
|
128 |
// the "name" argument must be a string literal |
49857
31e07291ae29
8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
49731
diff
changeset
|
129 |
JVMFlagConstraint_uintx(const char* name, const uintx* ptr, |
31e07291ae29
8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
49731
diff
changeset
|
130 |
JVMFlagConstraintFunc_uintx func, |
31e07291ae29
8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
49731
diff
changeset
|
131 |
ConstraintType type) : JVMFlagConstraint(name, type), _constraint(func), _ptr(ptr) {} |
46499
22e71ef4a16a
8180614: Skip range and constraint checks on non-existent flags
redestad
parents:
39117
diff
changeset
|
132 |
|
49857
31e07291ae29
8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
49731
diff
changeset
|
133 |
JVMFlag::Error apply(bool verbose) { |
46499
22e71ef4a16a
8180614: Skip range and constraint checks on non-existent flags
redestad
parents:
39117
diff
changeset
|
134 |
uintx value = *_ptr; |
22e71ef4a16a
8180614: Skip range and constraint checks on non-existent flags
redestad
parents:
39117
diff
changeset
|
135 |
return _constraint(value, verbose); |
31371
311143309e73
8122937: [JEP 245] Validate JVM Command-Line Flag Arguments.
gziemski
parents:
diff
changeset
|
136 |
} |
311143309e73
8122937: [JEP 245] Validate JVM Command-Line Flag Arguments.
gziemski
parents:
diff
changeset
|
137 |
|
49857
31e07291ae29
8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
49731
diff
changeset
|
138 |
JVMFlag::Error apply_uintx(uintx value, bool verbose) { |
32351 | 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 |
}; |
311143309e73
8122937: [JEP 245] Validate JVM Command-Line Flag Arguments.
gziemski
parents:
diff
changeset
|
142 |
|
49857
31e07291ae29
8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
49731
diff
changeset
|
143 |
class JVMFlagConstraint_uint64_t : public JVMFlagConstraint { |
31e07291ae29
8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
49731
diff
changeset
|
144 |
JVMFlagConstraintFunc_uint64_t _constraint; |
46499
22e71ef4a16a
8180614: Skip range and constraint checks on non-existent flags
redestad
parents:
39117
diff
changeset
|
145 |
const uint64_t* _ptr; |
31371
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 |
public: |
311143309e73
8122937: [JEP 245] Validate JVM Command-Line Flag Arguments.
gziemski
parents:
diff
changeset
|
148 |
// the "name" argument must be a string literal |
49857
31e07291ae29
8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
49731
diff
changeset
|
149 |
JVMFlagConstraint_uint64_t(const char* name, const uint64_t* ptr, |
31e07291ae29
8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
49731
diff
changeset
|
150 |
JVMFlagConstraintFunc_uint64_t func, |
31e07291ae29
8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
49731
diff
changeset
|
151 |
ConstraintType type) : JVMFlagConstraint(name, type), _constraint(func), _ptr(ptr) {} |
46499
22e71ef4a16a
8180614: Skip range and constraint checks on non-existent flags
redestad
parents:
39117
diff
changeset
|
152 |
|
49857
31e07291ae29
8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
49731
diff
changeset
|
153 |
JVMFlag::Error apply(bool verbose) { |
46499
22e71ef4a16a
8180614: Skip range and constraint checks on non-existent flags
redestad
parents:
39117
diff
changeset
|
154 |
uint64_t value = *_ptr; |
22e71ef4a16a
8180614: Skip range and constraint checks on non-existent flags
redestad
parents:
39117
diff
changeset
|
155 |
return _constraint(value, verbose); |
31371
311143309e73
8122937: [JEP 245] Validate JVM Command-Line Flag Arguments.
gziemski
parents:
diff
changeset
|
156 |
} |
311143309e73
8122937: [JEP 245] Validate JVM Command-Line Flag Arguments.
gziemski
parents:
diff
changeset
|
157 |
|
49857
31e07291ae29
8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
49731
diff
changeset
|
158 |
JVMFlag::Error apply_uint64_t(uint64_t value, bool verbose) { |
32351 | 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 |
}; |
311143309e73
8122937: [JEP 245] Validate JVM Command-Line Flag Arguments.
gziemski
parents:
diff
changeset
|
162 |
|
49857
31e07291ae29
8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
49731
diff
changeset
|
163 |
class JVMFlagConstraint_size_t : public JVMFlagConstraint { |
31e07291ae29
8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
49731
diff
changeset
|
164 |
JVMFlagConstraintFunc_size_t _constraint; |
46499
22e71ef4a16a
8180614: Skip range and constraint checks on non-existent flags
redestad
parents:
39117
diff
changeset
|
165 |
const size_t* _ptr; |
31371
311143309e73
8122937: [JEP 245] Validate JVM Command-Line Flag Arguments.
gziemski
parents:
diff
changeset
|
166 |
public: |
311143309e73
8122937: [JEP 245] Validate JVM Command-Line Flag Arguments.
gziemski
parents:
diff
changeset
|
167 |
// the "name" argument must be a string literal |
49857
31e07291ae29
8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
49731
diff
changeset
|
168 |
JVMFlagConstraint_size_t(const char* name, const size_t* ptr, |
31e07291ae29
8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
49731
diff
changeset
|
169 |
JVMFlagConstraintFunc_size_t func, |
31e07291ae29
8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
49731
diff
changeset
|
170 |
ConstraintType type) : JVMFlagConstraint(name, type), _constraint(func), _ptr(ptr) {} |
46499
22e71ef4a16a
8180614: Skip range and constraint checks on non-existent flags
redestad
parents:
39117
diff
changeset
|
171 |
|
49857
31e07291ae29
8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
49731
diff
changeset
|
172 |
JVMFlag::Error apply(bool verbose) { |
46499
22e71ef4a16a
8180614: Skip range and constraint checks on non-existent flags
redestad
parents:
39117
diff
changeset
|
173 |
size_t value = *_ptr; |
22e71ef4a16a
8180614: Skip range and constraint checks on non-existent flags
redestad
parents:
39117
diff
changeset
|
174 |
return _constraint(value, verbose); |
31371
311143309e73
8122937: [JEP 245] Validate JVM Command-Line Flag Arguments.
gziemski
parents:
diff
changeset
|
175 |
} |
311143309e73
8122937: [JEP 245] Validate JVM Command-Line Flag Arguments.
gziemski
parents:
diff
changeset
|
176 |
|
49857
31e07291ae29
8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
49731
diff
changeset
|
177 |
JVMFlag::Error apply_size_t(size_t value, bool verbose) { |
32351 | 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 |
}; |
311143309e73
8122937: [JEP 245] Validate JVM Command-Line Flag Arguments.
gziemski
parents:
diff
changeset
|
181 |
|
49857
31e07291ae29
8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
49731
diff
changeset
|
182 |
class JVMFlagConstraint_double : public JVMFlagConstraint { |
31e07291ae29
8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
49731
diff
changeset
|
183 |
JVMFlagConstraintFunc_double _constraint; |
46499
22e71ef4a16a
8180614: Skip range and constraint checks on non-existent flags
redestad
parents:
39117
diff
changeset
|
184 |
const double* _ptr; |
31371
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 |
public: |
311143309e73
8122937: [JEP 245] Validate JVM Command-Line Flag Arguments.
gziemski
parents:
diff
changeset
|
187 |
// the "name" argument must be a string literal |
49857
31e07291ae29
8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
49731
diff
changeset
|
188 |
JVMFlagConstraint_double(const char* name, const double* ptr, |
31e07291ae29
8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
49731
diff
changeset
|
189 |
JVMFlagConstraintFunc_double func, |
31e07291ae29
8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
49731
diff
changeset
|
190 |
ConstraintType type) : JVMFlagConstraint(name, type), _constraint(func), _ptr(ptr) {} |
46499
22e71ef4a16a
8180614: Skip range and constraint checks on non-existent flags
redestad
parents:
39117
diff
changeset
|
191 |
|
49857
31e07291ae29
8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
49731
diff
changeset
|
192 |
JVMFlag::Error apply(bool verbose) { |
46499
22e71ef4a16a
8180614: Skip range and constraint checks on non-existent flags
redestad
parents:
39117
diff
changeset
|
193 |
double value = *_ptr; |
22e71ef4a16a
8180614: Skip range and constraint checks on non-existent flags
redestad
parents:
39117
diff
changeset
|
194 |
return _constraint(value, verbose); |
31371
311143309e73
8122937: [JEP 245] Validate JVM Command-Line Flag Arguments.
gziemski
parents:
diff
changeset
|
195 |
} |
311143309e73
8122937: [JEP 245] Validate JVM Command-Line Flag Arguments.
gziemski
parents:
diff
changeset
|
196 |
|
49857
31e07291ae29
8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
49731
diff
changeset
|
197 |
JVMFlag::Error apply_double(double value, bool verbose) { |
32351 | 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 |
}; |
311143309e73
8122937: [JEP 245] Validate JVM Command-Line Flag Arguments.
gziemski
parents:
diff
changeset
|
201 |
|
311143309e73
8122937: [JEP 245] Validate JVM Command-Line Flag Arguments.
gziemski
parents:
diff
changeset
|
202 |
// No constraint emitting |
46499
22e71ef4a16a
8180614: Skip range and constraint checks on non-existent flags
redestad
parents:
39117
diff
changeset
|
203 |
void emit_constraint_no(...) { /* NOP */ } |
31371
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 |
// 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
|
206 |
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
|
207 |
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
|
208 |
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
|
209 |
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
|
210 |
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
|
211 |
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
|
212 |
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
|
213 |
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
|
214 |
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
|
215 |
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
|
216 |
|
49857
31e07291ae29
8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
49731
diff
changeset
|
217 |
// JVMFlagConstraint emitting code functions if function argument is provided |
31e07291ae29
8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
49731
diff
changeset
|
218 |
void emit_constraint_bool(const char* name, const bool* ptr, JVMFlagConstraintFunc_bool func, JVMFlagConstraint::ConstraintType type) { |
31e07291ae29
8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
49731
diff
changeset
|
219 |
JVMFlagConstraintList::add(new JVMFlagConstraint_bool(name, ptr, func, type)); |
31371
311143309e73
8122937: [JEP 245] Validate JVM Command-Line Flag Arguments.
gziemski
parents:
diff
changeset
|
220 |
} |
49857
31e07291ae29
8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
49731
diff
changeset
|
221 |
void emit_constraint_int(const char* name, const int* ptr, JVMFlagConstraintFunc_int func, JVMFlagConstraint::ConstraintType type) { |
31e07291ae29
8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
49731
diff
changeset
|
222 |
JVMFlagConstraintList::add(new JVMFlagConstraint_int(name, ptr, func, type)); |
31371
311143309e73
8122937: [JEP 245] Validate JVM Command-Line Flag Arguments.
gziemski
parents:
diff
changeset
|
223 |
} |
49857
31e07291ae29
8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
49731
diff
changeset
|
224 |
void emit_constraint_intx(const char* name, const intx* ptr, JVMFlagConstraintFunc_intx func, JVMFlagConstraint::ConstraintType type) { |
31e07291ae29
8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
49731
diff
changeset
|
225 |
JVMFlagConstraintList::add(new JVMFlagConstraint_intx(name, ptr, func, type)); |
31371
311143309e73
8122937: [JEP 245] Validate JVM Command-Line Flag Arguments.
gziemski
parents:
diff
changeset
|
226 |
} |
49857
31e07291ae29
8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
49731
diff
changeset
|
227 |
void emit_constraint_uint(const char* name, const uint* ptr, JVMFlagConstraintFunc_uint func, JVMFlagConstraint::ConstraintType type) { |
31e07291ae29
8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
49731
diff
changeset
|
228 |
JVMFlagConstraintList::add(new JVMFlagConstraint_uint(name, ptr, func, type)); |
31371
311143309e73
8122937: [JEP 245] Validate JVM Command-Line Flag Arguments.
gziemski
parents:
diff
changeset
|
229 |
} |
49857
31e07291ae29
8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
49731
diff
changeset
|
230 |
void emit_constraint_uintx(const char* name, const uintx* ptr, JVMFlagConstraintFunc_uintx func, JVMFlagConstraint::ConstraintType type) { |
31e07291ae29
8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
49731
diff
changeset
|
231 |
JVMFlagConstraintList::add(new JVMFlagConstraint_uintx(name, ptr, func, type)); |
31371
311143309e73
8122937: [JEP 245] Validate JVM Command-Line Flag Arguments.
gziemski
parents:
diff
changeset
|
232 |
} |
49857
31e07291ae29
8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
49731
diff
changeset
|
233 |
void emit_constraint_uint64_t(const char* name, const uint64_t* ptr, JVMFlagConstraintFunc_uint64_t func, JVMFlagConstraint::ConstraintType type) { |
31e07291ae29
8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
49731
diff
changeset
|
234 |
JVMFlagConstraintList::add(new JVMFlagConstraint_uint64_t(name, ptr, func, type)); |
31371
311143309e73
8122937: [JEP 245] Validate JVM Command-Line Flag Arguments.
gziemski
parents:
diff
changeset
|
235 |
} |
49857
31e07291ae29
8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
49731
diff
changeset
|
236 |
void emit_constraint_size_t(const char* name, const size_t* ptr, JVMFlagConstraintFunc_size_t func, JVMFlagConstraint::ConstraintType type) { |
31e07291ae29
8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
49731
diff
changeset
|
237 |
JVMFlagConstraintList::add(new JVMFlagConstraint_size_t(name, ptr, func, type)); |
31371
311143309e73
8122937: [JEP 245] Validate JVM Command-Line Flag Arguments.
gziemski
parents:
diff
changeset
|
238 |
} |
49857
31e07291ae29
8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
49731
diff
changeset
|
239 |
void emit_constraint_double(const char* name, const double* ptr, JVMFlagConstraintFunc_double func, JVMFlagConstraint::ConstraintType type) { |
31e07291ae29
8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
49731
diff
changeset
|
240 |
JVMFlagConstraintList::add(new JVMFlagConstraint_double(name, ptr, func, type)); |
31371
311143309e73
8122937: [JEP 245] Validate JVM Command-Line Flag Arguments.
gziemski
parents:
diff
changeset
|
241 |
} |
311143309e73
8122937: [JEP 245] Validate JVM Command-Line Flag Arguments.
gziemski
parents:
diff
changeset
|
242 |
|
311143309e73
8122937: [JEP 245] Validate JVM Command-Line Flag Arguments.
gziemski
parents:
diff
changeset
|
243 |
// 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
|
244 |
#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
|
245 |
#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
|
246 |
#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
|
247 |
#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
|
248 |
#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
|
249 |
#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
|
250 |
#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
|
251 |
#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
|
252 |
#ifndef PRODUCT |
22e71ef4a16a
8180614: Skip range and constraint checks on non-existent flags
redestad
parents:
39117
diff
changeset
|
253 |
#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
|
254 |
#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
|
255 |
#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
|
256 |
#else |
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_no(#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_no(#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_no(#name,&name |
22e71ef4a16a
8180614: Skip range and constraint checks on non-existent flags
redestad
parents:
39117
diff
changeset
|
260 |
#endif |
22e71ef4a16a
8180614: Skip range and constraint checks on non-existent flags
redestad
parents:
39117
diff
changeset
|
261 |
#ifdef _LP64 |
22e71ef4a16a
8180614: Skip range and constraint checks on non-existent flags
redestad
parents:
39117
diff
changeset
|
262 |
#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
|
263 |
#else |
22e71ef4a16a
8180614: Skip range and constraint checks on non-existent flags
redestad
parents:
39117
diff
changeset
|
264 |
#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
|
265 |
#endif |
31371
311143309e73
8122937: [JEP 245] Validate JVM Command-Line Flag Arguments.
gziemski
parents:
diff
changeset
|
266 |
|
311143309e73
8122937: [JEP 245] Validate JVM Command-Line Flag Arguments.
gziemski
parents:
diff
changeset
|
267 |
// Generate func argument to pass into emit_constraint_xxx functions |
49857
31e07291ae29
8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
49731
diff
changeset
|
268 |
#define EMIT_CONSTRAINT_CHECK(func, type) , func, JVMFlagConstraint::type |
31371
311143309e73
8122937: [JEP 245] Validate JVM Command-Line Flag Arguments.
gziemski
parents:
diff
changeset
|
269 |
|
311143309e73
8122937: [JEP 245] Validate JVM Command-Line Flag Arguments.
gziemski
parents:
diff
changeset
|
270 |
// the "name" argument must be a string literal |
34661
9a1d11d88ea0
8142341: GC: current flags need ranges to be implemented
sangheki
parents:
34242
diff
changeset
|
271 |
#define INITIAL_CONSTRAINTS_SIZE 72 |
49857
31e07291ae29
8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
49731
diff
changeset
|
272 |
GrowableArray<JVMFlagConstraint*>* JVMFlagConstraintList::_constraints = NULL; |
31e07291ae29
8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
49731
diff
changeset
|
273 |
JVMFlagConstraint::ConstraintType JVMFlagConstraintList::_validating_type = JVMFlagConstraint::AtParse; |
31371
311143309e73
8122937: [JEP 245] Validate JVM Command-Line Flag Arguments.
gziemski
parents:
diff
changeset
|
274 |
|
311143309e73
8122937: [JEP 245] Validate JVM Command-Line Flag Arguments.
gziemski
parents:
diff
changeset
|
275 |
// Check the ranges of all flags that have them or print them out and exit if requested |
49857
31e07291ae29
8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
49731
diff
changeset
|
276 |
void JVMFlagConstraintList::init(void) { |
31e07291ae29
8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
49731
diff
changeset
|
277 |
_constraints = new (ResourceObj::C_HEAP, mtArguments) GrowableArray<JVMFlagConstraint*>(INITIAL_CONSTRAINTS_SIZE, true); |
31371
311143309e73
8122937: [JEP 245] Validate JVM Command-Line Flag Arguments.
gziemski
parents:
diff
changeset
|
278 |
|
49715
947560700a09
8201136: Move GC flags from globals.hpp to GC specific files
stefank
parents:
47216
diff
changeset
|
279 |
emit_constraint_no(NULL VM_FLAGS(EMIT_CONSTRAINT_DEVELOPER_FLAG, |
947560700a09
8201136: Move GC flags from globals.hpp to GC specific files
stefank
parents:
47216
diff
changeset
|
280 |
EMIT_CONSTRAINT_PD_DEVELOPER_FLAG, |
947560700a09
8201136: Move GC flags from globals.hpp to GC specific files
stefank
parents:
47216
diff
changeset
|
281 |
EMIT_CONSTRAINT_PRODUCT_FLAG, |
947560700a09
8201136: Move GC flags from globals.hpp to GC specific files
stefank
parents:
47216
diff
changeset
|
282 |
EMIT_CONSTRAINT_PD_PRODUCT_FLAG, |
947560700a09
8201136: Move GC flags from globals.hpp to GC specific files
stefank
parents:
47216
diff
changeset
|
283 |
EMIT_CONSTRAINT_DIAGNOSTIC_FLAG, |
947560700a09
8201136: Move GC flags from globals.hpp to GC specific files
stefank
parents:
47216
diff
changeset
|
284 |
EMIT_CONSTRAINT_PD_DIAGNOSTIC_FLAG, |
947560700a09
8201136: Move GC flags from globals.hpp to GC specific files
stefank
parents:
47216
diff
changeset
|
285 |
EMIT_CONSTRAINT_EXPERIMENTAL_FLAG, |
947560700a09
8201136: Move GC flags from globals.hpp to GC specific files
stefank
parents:
47216
diff
changeset
|
286 |
EMIT_CONSTRAINT_NOTPRODUCT_FLAG, |
947560700a09
8201136: Move GC flags from globals.hpp to GC specific files
stefank
parents:
47216
diff
changeset
|
287 |
EMIT_CONSTRAINT_MANAGEABLE_FLAG, |
947560700a09
8201136: Move GC flags from globals.hpp to GC specific files
stefank
parents:
47216
diff
changeset
|
288 |
EMIT_CONSTRAINT_PRODUCT_RW_FLAG, |
947560700a09
8201136: Move GC flags from globals.hpp to GC specific files
stefank
parents:
47216
diff
changeset
|
289 |
EMIT_CONSTRAINT_LP64_PRODUCT_FLAG, |
947560700a09
8201136: Move GC flags from globals.hpp to GC specific files
stefank
parents:
47216
diff
changeset
|
290 |
IGNORE_RANGE, |
947560700a09
8201136: Move GC flags from globals.hpp to GC specific files
stefank
parents:
47216
diff
changeset
|
291 |
EMIT_CONSTRAINT_CHECK, |
947560700a09
8201136: Move GC flags from globals.hpp to GC specific files
stefank
parents:
47216
diff
changeset
|
292 |
IGNORE_WRITEABLE)); |
31371
311143309e73
8122937: [JEP 245] Validate JVM Command-Line Flag Arguments.
gziemski
parents:
diff
changeset
|
293 |
|
311143309e73
8122937: [JEP 245] Validate JVM Command-Line Flag Arguments.
gziemski
parents:
diff
changeset
|
294 |
EMIT_CONSTRAINTS_FOR_GLOBALS_EXT |
311143309e73
8122937: [JEP 245] Validate JVM Command-Line Flag Arguments.
gziemski
parents:
diff
changeset
|
295 |
|
311143309e73
8122937: [JEP 245] Validate JVM Command-Line Flag Arguments.
gziemski
parents:
diff
changeset
|
296 |
emit_constraint_no(NULL ARCH_FLAGS(EMIT_CONSTRAINT_DEVELOPER_FLAG, |
311143309e73
8122937: [JEP 245] Validate JVM Command-Line Flag Arguments.
gziemski
parents:
diff
changeset
|
297 |
EMIT_CONSTRAINT_PRODUCT_FLAG, |
311143309e73
8122937: [JEP 245] Validate JVM Command-Line Flag Arguments.
gziemski
parents:
diff
changeset
|
298 |
EMIT_CONSTRAINT_DIAGNOSTIC_FLAG, |
311143309e73
8122937: [JEP 245] Validate JVM Command-Line Flag Arguments.
gziemski
parents:
diff
changeset
|
299 |
EMIT_CONSTRAINT_EXPERIMENTAL_FLAG, |
311143309e73
8122937: [JEP 245] Validate JVM Command-Line Flag Arguments.
gziemski
parents:
diff
changeset
|
300 |
EMIT_CONSTRAINT_NOTPRODUCT_FLAG, |
311143309e73
8122937: [JEP 245] Validate JVM Command-Line Flag Arguments.
gziemski
parents:
diff
changeset
|
301 |
IGNORE_RANGE, |
38273
2634194d7555
8073500: Prevent certain commercial flags from being changed at runtime
gziemski
parents:
37491
diff
changeset
|
302 |
EMIT_CONSTRAINT_CHECK, |
2634194d7555
8073500: Prevent certain commercial flags from being changed at runtime
gziemski
parents:
37491
diff
changeset
|
303 |
IGNORE_WRITEABLE)); |
31371
311143309e73
8122937: [JEP 245] Validate JVM Command-Line Flag Arguments.
gziemski
parents:
diff
changeset
|
304 |
|
33160
c59f1676d27e
8136421: JEP 243: Java-Level JVM Compiler Interface
twisti
parents:
32613
diff
changeset
|
305 |
|
31371
311143309e73
8122937: [JEP 245] Validate JVM Command-Line Flag Arguments.
gziemski
parents:
diff
changeset
|
306 |
#ifdef COMPILER1 |
311143309e73
8122937: [JEP 245] Validate JVM Command-Line Flag Arguments.
gziemski
parents:
diff
changeset
|
307 |
emit_constraint_no(NULL C1_FLAGS(EMIT_CONSTRAINT_DEVELOPER_FLAG, |
311143309e73
8122937: [JEP 245] Validate JVM Command-Line Flag Arguments.
gziemski
parents:
diff
changeset
|
308 |
EMIT_CONSTRAINT_PD_DEVELOPER_FLAG, |
311143309e73
8122937: [JEP 245] Validate JVM Command-Line Flag Arguments.
gziemski
parents:
diff
changeset
|
309 |
EMIT_CONSTRAINT_PRODUCT_FLAG, |
311143309e73
8122937: [JEP 245] Validate JVM Command-Line Flag Arguments.
gziemski
parents:
diff
changeset
|
310 |
EMIT_CONSTRAINT_PD_PRODUCT_FLAG, |
311143309e73
8122937: [JEP 245] Validate JVM Command-Line Flag Arguments.
gziemski
parents:
diff
changeset
|
311 |
EMIT_CONSTRAINT_DIAGNOSTIC_FLAG, |
39117 | 312 |
EMIT_CONSTRAINT_PD_DIAGNOSTIC_FLAG, |
31371
311143309e73
8122937: [JEP 245] Validate JVM Command-Line Flag Arguments.
gziemski
parents:
diff
changeset
|
313 |
EMIT_CONSTRAINT_NOTPRODUCT_FLAG, |
311143309e73
8122937: [JEP 245] Validate JVM Command-Line Flag Arguments.
gziemski
parents:
diff
changeset
|
314 |
IGNORE_RANGE, |
38273
2634194d7555
8073500: Prevent certain commercial flags from being changed at runtime
gziemski
parents:
37491
diff
changeset
|
315 |
EMIT_CONSTRAINT_CHECK, |
2634194d7555
8073500: Prevent certain commercial flags from being changed at runtime
gziemski
parents:
37491
diff
changeset
|
316 |
IGNORE_WRITEABLE)); |
31371
311143309e73
8122937: [JEP 245] Validate JVM Command-Line Flag Arguments.
gziemski
parents:
diff
changeset
|
317 |
#endif // COMPILER1 |
311143309e73
8122937: [JEP 245] Validate JVM Command-Line Flag Arguments.
gziemski
parents:
diff
changeset
|
318 |
|
311143309e73
8122937: [JEP 245] Validate JVM Command-Line Flag Arguments.
gziemski
parents:
diff
changeset
|
319 |
#ifdef COMPILER2 |
311143309e73
8122937: [JEP 245] Validate JVM Command-Line Flag Arguments.
gziemski
parents:
diff
changeset
|
320 |
emit_constraint_no(NULL C2_FLAGS(EMIT_CONSTRAINT_DEVELOPER_FLAG, |
311143309e73
8122937: [JEP 245] Validate JVM Command-Line Flag Arguments.
gziemski
parents:
diff
changeset
|
321 |
EMIT_CONSTRAINT_PD_DEVELOPER_FLAG, |
311143309e73
8122937: [JEP 245] Validate JVM Command-Line Flag Arguments.
gziemski
parents:
diff
changeset
|
322 |
EMIT_CONSTRAINT_PRODUCT_FLAG, |
311143309e73
8122937: [JEP 245] Validate JVM Command-Line Flag Arguments.
gziemski
parents:
diff
changeset
|
323 |
EMIT_CONSTRAINT_PD_PRODUCT_FLAG, |
311143309e73
8122937: [JEP 245] Validate JVM Command-Line Flag Arguments.
gziemski
parents:
diff
changeset
|
324 |
EMIT_CONSTRAINT_DIAGNOSTIC_FLAG, |
39117 | 325 |
EMIT_CONSTRAINT_PD_DIAGNOSTIC_FLAG, |
31371
311143309e73
8122937: [JEP 245] Validate JVM Command-Line Flag Arguments.
gziemski
parents:
diff
changeset
|
326 |
EMIT_CONSTRAINT_EXPERIMENTAL_FLAG, |
311143309e73
8122937: [JEP 245] Validate JVM Command-Line Flag Arguments.
gziemski
parents:
diff
changeset
|
327 |
EMIT_CONSTRAINT_NOTPRODUCT_FLAG, |
311143309e73
8122937: [JEP 245] Validate JVM Command-Line Flag Arguments.
gziemski
parents:
diff
changeset
|
328 |
IGNORE_RANGE, |
38273
2634194d7555
8073500: Prevent certain commercial flags from being changed at runtime
gziemski
parents:
37491
diff
changeset
|
329 |
EMIT_CONSTRAINT_CHECK, |
2634194d7555
8073500: Prevent certain commercial flags from being changed at runtime
gziemski
parents:
37491
diff
changeset
|
330 |
IGNORE_WRITEABLE)); |
31371
311143309e73
8122937: [JEP 245] Validate JVM Command-Line Flag Arguments.
gziemski
parents:
diff
changeset
|
331 |
#endif // COMPILER2 |
311143309e73
8122937: [JEP 245] Validate JVM Command-Line Flag Arguments.
gziemski
parents:
diff
changeset
|
332 |
} |
311143309e73
8122937: [JEP 245] Validate JVM Command-Line Flag Arguments.
gziemski
parents:
diff
changeset
|
333 |
|
49857
31e07291ae29
8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
49731
diff
changeset
|
334 |
JVMFlagConstraint* JVMFlagConstraintList::find(const char* name) { |
31e07291ae29
8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
49731
diff
changeset
|
335 |
JVMFlagConstraint* found = NULL; |
31371
311143309e73
8122937: [JEP 245] Validate JVM Command-Line Flag Arguments.
gziemski
parents:
diff
changeset
|
336 |
for (int i=0; i<length(); i++) { |
49857
31e07291ae29
8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
49731
diff
changeset
|
337 |
JVMFlagConstraint* 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
|
338 |
if (strcmp(constraint->name(), name) == 0) { |
31371
311143309e73
8122937: [JEP 245] Validate JVM Command-Line Flag Arguments.
gziemski
parents:
diff
changeset
|
339 |
found = constraint; |
311143309e73
8122937: [JEP 245] Validate JVM Command-Line Flag Arguments.
gziemski
parents:
diff
changeset
|
340 |
break; |
311143309e73
8122937: [JEP 245] Validate JVM Command-Line Flag Arguments.
gziemski
parents:
diff
changeset
|
341 |
} |
311143309e73
8122937: [JEP 245] Validate JVM Command-Line Flag Arguments.
gziemski
parents:
diff
changeset
|
342 |
} |
311143309e73
8122937: [JEP 245] Validate JVM Command-Line Flag Arguments.
gziemski
parents:
diff
changeset
|
343 |
return found; |
311143309e73
8122937: [JEP 245] Validate JVM Command-Line Flag Arguments.
gziemski
parents:
diff
changeset
|
344 |
} |
31995
aa4049b4184a
8130459: Add additional validation after heap creation
sangheki
parents:
31371
diff
changeset
|
345 |
|
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
|
346 |
// Find constraints by name and return only if found constraint's type is equal or lower than current validating type. |
49857
31e07291ae29
8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
49731
diff
changeset
|
347 |
JVMFlagConstraint* JVMFlagConstraintList::find_if_needs_check(const char* name) { |
31e07291ae29
8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
49731
diff
changeset
|
348 |
JVMFlagConstraint* found = NULL; |
31e07291ae29
8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
49731
diff
changeset
|
349 |
JVMFlagConstraint* constraint = find(name); |
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
|
350 |
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
|
351 |
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
|
352 |
} |
aaf76eb8cfd4
8142510: -XX:+PrintFlagsRanges should print default range value for those flags that have constraint and an implicit range.
gziemski
parents:
36313
diff
changeset
|
353 |
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
|
354 |
} |
aaf76eb8cfd4
8142510: -XX:+PrintFlagsRanges should print default range value for those flags that have constraint and an implicit range.
gziemski
parents:
36313
diff
changeset
|
355 |
|
31995
aa4049b4184a
8130459: Add additional validation after heap creation
sangheki
parents:
31371
diff
changeset
|
356 |
// Check constraints for specific constraint type. |
49857
31e07291ae29
8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
49731
diff
changeset
|
357 |
bool JVMFlagConstraintList::check_constraints(JVMFlagConstraint::ConstraintType type) { |
33144
c56850e328fc
8134995: [REDO] GC: implement ranges (optionally constraints) for those flags that have them missing
sangheki
parents:
32613
diff
changeset
|
358 |
guarantee(type > _validating_type, "Constraint check is out of order."); |
31995
aa4049b4184a
8130459: Add additional validation after heap creation
sangheki
parents:
31371
diff
changeset
|
359 |
_validating_type = type; |
aa4049b4184a
8130459: Add additional validation after heap creation
sangheki
parents:
31371
diff
changeset
|
360 |
|
aa4049b4184a
8130459: Add additional validation after heap creation
sangheki
parents:
31371
diff
changeset
|
361 |
bool status = true; |
aa4049b4184a
8130459: Add additional validation after heap creation
sangheki
parents:
31371
diff
changeset
|
362 |
for (int i=0; i<length(); i++) { |
49857
31e07291ae29
8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
49731
diff
changeset
|
363 |
JVMFlagConstraint* constraint = at(i); |
31995
aa4049b4184a
8130459: Add additional validation after heap creation
sangheki
parents:
31371
diff
changeset
|
364 |
if (type != constraint->type()) continue; |
49857
31e07291ae29
8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
49731
diff
changeset
|
365 |
if (constraint->apply(true) != JVMFlag::SUCCESS) status = false; |
31995
aa4049b4184a
8130459: Add additional validation after heap creation
sangheki
parents:
31371
diff
changeset
|
366 |
} |
aa4049b4184a
8130459: Add additional validation after heap creation
sangheki
parents:
31371
diff
changeset
|
367 |
return status; |
aa4049b4184a
8130459: Add additional validation after heap creation
sangheki
parents:
31371
diff
changeset
|
368 |
} |