author | gziemski |
Thu, 18 Jun 2015 14:39:38 -0500 | |
changeset 31371 | 311143309e73 |
child 31592 | 43f48e165466 |
permissions | -rw-r--r-- |
31371
311143309e73
8122937: [JEP 245] Validate JVM Command-Line Flag Arguments.
gziemski
parents:
diff
changeset
|
1 |
/* |
311143309e73
8122937: [JEP 245] Validate JVM Command-Line Flag Arguments.
gziemski
parents:
diff
changeset
|
2 |
* Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved. |
311143309e73
8122937: [JEP 245] Validate JVM Command-Line Flag Arguments.
gziemski
parents:
diff
changeset
|
3 |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
311143309e73
8122937: [JEP 245] Validate JVM Command-Line Flag Arguments.
gziemski
parents:
diff
changeset
|
4 |
* |
311143309e73
8122937: [JEP 245] Validate JVM Command-Line Flag Arguments.
gziemski
parents:
diff
changeset
|
5 |
* This code is free software; you can redistribute it and/or modify it |
311143309e73
8122937: [JEP 245] Validate JVM Command-Line Flag Arguments.
gziemski
parents:
diff
changeset
|
6 |
* under the terms of the GNU General Public License version 2 only, as |
311143309e73
8122937: [JEP 245] Validate JVM Command-Line Flag Arguments.
gziemski
parents:
diff
changeset
|
7 |
* published by the Free Software Foundation. |
311143309e73
8122937: [JEP 245] Validate JVM Command-Line Flag Arguments.
gziemski
parents:
diff
changeset
|
8 |
* |
311143309e73
8122937: [JEP 245] Validate JVM Command-Line Flag Arguments.
gziemski
parents:
diff
changeset
|
9 |
* This code is distributed in the hope that it will be useful, but WITHOUT |
311143309e73
8122937: [JEP 245] Validate JVM Command-Line Flag Arguments.
gziemski
parents:
diff
changeset
|
10 |
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
311143309e73
8122937: [JEP 245] Validate JVM Command-Line Flag Arguments.
gziemski
parents:
diff
changeset
|
11 |
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
311143309e73
8122937: [JEP 245] Validate JVM Command-Line Flag Arguments.
gziemski
parents:
diff
changeset
|
12 |
* version 2 for more details (a copy is included in the LICENSE file that |
311143309e73
8122937: [JEP 245] Validate JVM Command-Line Flag Arguments.
gziemski
parents:
diff
changeset
|
13 |
* accompanied this code). |
311143309e73
8122937: [JEP 245] Validate JVM Command-Line Flag Arguments.
gziemski
parents:
diff
changeset
|
14 |
* |
311143309e73
8122937: [JEP 245] Validate JVM Command-Line Flag Arguments.
gziemski
parents:
diff
changeset
|
15 |
* You should have received a copy of the GNU General Public License version |
311143309e73
8122937: [JEP 245] Validate JVM Command-Line Flag Arguments.
gziemski
parents:
diff
changeset
|
16 |
* 2 along with this work; if not, write to the Free Software Foundation, |
311143309e73
8122937: [JEP 245] Validate JVM Command-Line Flag Arguments.
gziemski
parents:
diff
changeset
|
17 |
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. |
311143309e73
8122937: [JEP 245] Validate JVM Command-Line Flag Arguments.
gziemski
parents:
diff
changeset
|
18 |
* |
311143309e73
8122937: [JEP 245] Validate JVM Command-Line Flag Arguments.
gziemski
parents:
diff
changeset
|
19 |
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA |
311143309e73
8122937: [JEP 245] Validate JVM Command-Line Flag Arguments.
gziemski
parents:
diff
changeset
|
20 |
* or visit www.oracle.com if you need additional information or have any |
311143309e73
8122937: [JEP 245] Validate JVM Command-Line Flag Arguments.
gziemski
parents:
diff
changeset
|
21 |
* questions. |
311143309e73
8122937: [JEP 245] Validate JVM Command-Line Flag Arguments.
gziemski
parents:
diff
changeset
|
22 |
* |
311143309e73
8122937: [JEP 245] Validate JVM Command-Line Flag Arguments.
gziemski
parents:
diff
changeset
|
23 |
*/ |
311143309e73
8122937: [JEP 245] Validate JVM Command-Line Flag Arguments.
gziemski
parents:
diff
changeset
|
24 |
|
311143309e73
8122937: [JEP 245] Validate JVM Command-Line Flag Arguments.
gziemski
parents:
diff
changeset
|
25 |
#include "precompiled.hpp" |
311143309e73
8122937: [JEP 245] Validate JVM Command-Line Flag Arguments.
gziemski
parents:
diff
changeset
|
26 |
#include "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/commandLineFlagRangeList.hpp" |
311143309e73
8122937: [JEP 245] Validate JVM Command-Line Flag Arguments.
gziemski
parents:
diff
changeset
|
31 |
#include "runtime/os.hpp" |
311143309e73
8122937: [JEP 245] Validate JVM Command-Line Flag Arguments.
gziemski
parents:
diff
changeset
|
32 |
#include "utilities/defaultStream.hpp" |
311143309e73
8122937: [JEP 245] Validate JVM Command-Line Flag Arguments.
gziemski
parents:
diff
changeset
|
33 |
#include "utilities/macros.hpp" |
311143309e73
8122937: [JEP 245] Validate JVM Command-Line Flag Arguments.
gziemski
parents:
diff
changeset
|
34 |
|
311143309e73
8122937: [JEP 245] Validate JVM Command-Line Flag Arguments.
gziemski
parents:
diff
changeset
|
35 |
class CommandLineFlagRange_int : public CommandLineFlagRange { |
311143309e73
8122937: [JEP 245] Validate JVM Command-Line Flag Arguments.
gziemski
parents:
diff
changeset
|
36 |
int _min; |
311143309e73
8122937: [JEP 245] Validate JVM Command-Line Flag Arguments.
gziemski
parents:
diff
changeset
|
37 |
int _max; |
311143309e73
8122937: [JEP 245] Validate JVM Command-Line Flag Arguments.
gziemski
parents:
diff
changeset
|
38 |
|
311143309e73
8122937: [JEP 245] Validate JVM Command-Line Flag Arguments.
gziemski
parents:
diff
changeset
|
39 |
public: |
311143309e73
8122937: [JEP 245] Validate JVM Command-Line Flag Arguments.
gziemski
parents:
diff
changeset
|
40 |
// the "name" argument must be a string literal |
311143309e73
8122937: [JEP 245] Validate JVM Command-Line Flag Arguments.
gziemski
parents:
diff
changeset
|
41 |
CommandLineFlagRange_int(const char* name, int min, int max) : CommandLineFlagRange(name) { |
311143309e73
8122937: [JEP 245] Validate JVM Command-Line Flag Arguments.
gziemski
parents:
diff
changeset
|
42 |
_min=min, _max=max; |
311143309e73
8122937: [JEP 245] Validate JVM Command-Line Flag Arguments.
gziemski
parents:
diff
changeset
|
43 |
} |
311143309e73
8122937: [JEP 245] Validate JVM Command-Line Flag Arguments.
gziemski
parents:
diff
changeset
|
44 |
|
311143309e73
8122937: [JEP 245] Validate JVM Command-Line Flag Arguments.
gziemski
parents:
diff
changeset
|
45 |
Flag::Error check_int(int value, bool verbose = true) { |
311143309e73
8122937: [JEP 245] Validate JVM Command-Line Flag Arguments.
gziemski
parents:
diff
changeset
|
46 |
if ((value < _min) || (value > _max)) { |
311143309e73
8122937: [JEP 245] Validate JVM Command-Line Flag Arguments.
gziemski
parents:
diff
changeset
|
47 |
if (verbose == true) { |
311143309e73
8122937: [JEP 245] Validate JVM Command-Line Flag Arguments.
gziemski
parents:
diff
changeset
|
48 |
jio_fprintf(defaultStream::error_stream(), |
311143309e73
8122937: [JEP 245] Validate JVM Command-Line Flag Arguments.
gziemski
parents:
diff
changeset
|
49 |
"int %s=%d is outside the allowed range [ %d ... %d ]\n", |
311143309e73
8122937: [JEP 245] Validate JVM Command-Line Flag Arguments.
gziemski
parents:
diff
changeset
|
50 |
name(), value, _min, _max); |
311143309e73
8122937: [JEP 245] Validate JVM Command-Line Flag Arguments.
gziemski
parents:
diff
changeset
|
51 |
} |
311143309e73
8122937: [JEP 245] Validate JVM Command-Line Flag Arguments.
gziemski
parents:
diff
changeset
|
52 |
return Flag::OUT_OF_BOUNDS; |
311143309e73
8122937: [JEP 245] Validate JVM Command-Line Flag Arguments.
gziemski
parents:
diff
changeset
|
53 |
} else { |
311143309e73
8122937: [JEP 245] Validate JVM Command-Line Flag Arguments.
gziemski
parents:
diff
changeset
|
54 |
return Flag::SUCCESS; |
311143309e73
8122937: [JEP 245] Validate JVM Command-Line Flag Arguments.
gziemski
parents:
diff
changeset
|
55 |
} |
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 |
|
311143309e73
8122937: [JEP 245] Validate JVM Command-Line Flag Arguments.
gziemski
parents:
diff
changeset
|
58 |
void print(outputStream* st) { |
311143309e73
8122937: [JEP 245] Validate JVM Command-Line Flag Arguments.
gziemski
parents:
diff
changeset
|
59 |
st->print("[ %-25d ... %25d ]", _min, _max); |
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 |
|
311143309e73
8122937: [JEP 245] Validate JVM Command-Line Flag Arguments.
gziemski
parents:
diff
changeset
|
63 |
class CommandLineFlagRange_intx : public CommandLineFlagRange { |
311143309e73
8122937: [JEP 245] Validate JVM Command-Line Flag Arguments.
gziemski
parents:
diff
changeset
|
64 |
intx _min; |
311143309e73
8122937: [JEP 245] Validate JVM Command-Line Flag Arguments.
gziemski
parents:
diff
changeset
|
65 |
intx _max; |
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 |
311143309e73
8122937: [JEP 245] Validate JVM Command-Line Flag Arguments.
gziemski
parents:
diff
changeset
|
69 |
CommandLineFlagRange_intx(const char* name, intx min, intx max) : CommandLineFlagRange(name) { |
311143309e73
8122937: [JEP 245] Validate JVM Command-Line Flag Arguments.
gziemski
parents:
diff
changeset
|
70 |
_min=min, _max=max; |
311143309e73
8122937: [JEP 245] Validate JVM Command-Line Flag Arguments.
gziemski
parents:
diff
changeset
|
71 |
} |
311143309e73
8122937: [JEP 245] Validate JVM Command-Line Flag Arguments.
gziemski
parents:
diff
changeset
|
72 |
|
311143309e73
8122937: [JEP 245] Validate JVM Command-Line Flag Arguments.
gziemski
parents:
diff
changeset
|
73 |
Flag::Error check_intx(intx value, bool verbose = true) { |
311143309e73
8122937: [JEP 245] Validate JVM Command-Line Flag Arguments.
gziemski
parents:
diff
changeset
|
74 |
if ((value < _min) || (value > _max)) { |
311143309e73
8122937: [JEP 245] Validate JVM Command-Line Flag Arguments.
gziemski
parents:
diff
changeset
|
75 |
if (verbose == true) { |
311143309e73
8122937: [JEP 245] Validate JVM Command-Line Flag Arguments.
gziemski
parents:
diff
changeset
|
76 |
jio_fprintf(defaultStream::error_stream(), |
311143309e73
8122937: [JEP 245] Validate JVM Command-Line Flag Arguments.
gziemski
parents:
diff
changeset
|
77 |
"intx %s=" INTX_FORMAT " is outside the allowed range [ " INTX_FORMAT " ... " INTX_FORMAT " ]\n", |
311143309e73
8122937: [JEP 245] Validate JVM Command-Line Flag Arguments.
gziemski
parents:
diff
changeset
|
78 |
name(), value, _min, _max); |
311143309e73
8122937: [JEP 245] Validate JVM Command-Line Flag Arguments.
gziemski
parents:
diff
changeset
|
79 |
} |
311143309e73
8122937: [JEP 245] Validate JVM Command-Line Flag Arguments.
gziemski
parents:
diff
changeset
|
80 |
return Flag::OUT_OF_BOUNDS; |
311143309e73
8122937: [JEP 245] Validate JVM Command-Line Flag Arguments.
gziemski
parents:
diff
changeset
|
81 |
} else { |
311143309e73
8122937: [JEP 245] Validate JVM Command-Line Flag Arguments.
gziemski
parents:
diff
changeset
|
82 |
return Flag::SUCCESS; |
311143309e73
8122937: [JEP 245] Validate JVM Command-Line Flag Arguments.
gziemski
parents:
diff
changeset
|
83 |
} |
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 |
void print(outputStream* st) { |
311143309e73
8122937: [JEP 245] Validate JVM Command-Line Flag Arguments.
gziemski
parents:
diff
changeset
|
87 |
st->print("[ "INTX_FORMAT_W(-25)" ... "INTX_FORMAT_W(25)" ]", _min, _max); |
311143309e73
8122937: [JEP 245] Validate JVM Command-Line Flag Arguments.
gziemski
parents:
diff
changeset
|
88 |
} |
311143309e73
8122937: [JEP 245] Validate JVM Command-Line Flag Arguments.
gziemski
parents:
diff
changeset
|
89 |
}; |
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 |
class CommandLineFlagRange_uint : public CommandLineFlagRange { |
311143309e73
8122937: [JEP 245] Validate JVM Command-Line Flag Arguments.
gziemski
parents:
diff
changeset
|
92 |
uint _min; |
311143309e73
8122937: [JEP 245] Validate JVM Command-Line Flag Arguments.
gziemski
parents:
diff
changeset
|
93 |
uint _max; |
311143309e73
8122937: [JEP 245] Validate JVM Command-Line Flag Arguments.
gziemski
parents:
diff
changeset
|
94 |
|
311143309e73
8122937: [JEP 245] Validate JVM Command-Line Flag Arguments.
gziemski
parents:
diff
changeset
|
95 |
public: |
311143309e73
8122937: [JEP 245] Validate JVM Command-Line Flag Arguments.
gziemski
parents:
diff
changeset
|
96 |
// the "name" argument must be a string literal |
311143309e73
8122937: [JEP 245] Validate JVM Command-Line Flag Arguments.
gziemski
parents:
diff
changeset
|
97 |
CommandLineFlagRange_uint(const char* name, uint min, uint max) : CommandLineFlagRange(name) { |
311143309e73
8122937: [JEP 245] Validate JVM Command-Line Flag Arguments.
gziemski
parents:
diff
changeset
|
98 |
_min=min, _max=max; |
311143309e73
8122937: [JEP 245] Validate JVM Command-Line Flag Arguments.
gziemski
parents:
diff
changeset
|
99 |
} |
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 |
Flag::Error check_uint(uint value, bool verbose = true) { |
311143309e73
8122937: [JEP 245] Validate JVM Command-Line Flag Arguments.
gziemski
parents:
diff
changeset
|
102 |
if ((value < _min) || (value > _max)) { |
311143309e73
8122937: [JEP 245] Validate JVM Command-Line Flag Arguments.
gziemski
parents:
diff
changeset
|
103 |
if (verbose == true) { |
311143309e73
8122937: [JEP 245] Validate JVM Command-Line Flag Arguments.
gziemski
parents:
diff
changeset
|
104 |
jio_fprintf(defaultStream::error_stream(), |
311143309e73
8122937: [JEP 245] Validate JVM Command-Line Flag Arguments.
gziemski
parents:
diff
changeset
|
105 |
"uintx %s=%u is outside the allowed range [ %u ... %u ]\n", |
311143309e73
8122937: [JEP 245] Validate JVM Command-Line Flag Arguments.
gziemski
parents:
diff
changeset
|
106 |
name(), value, _min, _max); |
311143309e73
8122937: [JEP 245] Validate JVM Command-Line Flag Arguments.
gziemski
parents:
diff
changeset
|
107 |
} |
311143309e73
8122937: [JEP 245] Validate JVM Command-Line Flag Arguments.
gziemski
parents:
diff
changeset
|
108 |
return Flag::OUT_OF_BOUNDS; |
311143309e73
8122937: [JEP 245] Validate JVM Command-Line Flag Arguments.
gziemski
parents:
diff
changeset
|
109 |
} else { |
311143309e73
8122937: [JEP 245] Validate JVM Command-Line Flag Arguments.
gziemski
parents:
diff
changeset
|
110 |
return Flag::SUCCESS; |
311143309e73
8122937: [JEP 245] Validate JVM Command-Line Flag Arguments.
gziemski
parents:
diff
changeset
|
111 |
} |
311143309e73
8122937: [JEP 245] Validate JVM Command-Line Flag Arguments.
gziemski
parents:
diff
changeset
|
112 |
} |
311143309e73
8122937: [JEP 245] Validate JVM Command-Line Flag Arguments.
gziemski
parents:
diff
changeset
|
113 |
|
311143309e73
8122937: [JEP 245] Validate JVM Command-Line Flag Arguments.
gziemski
parents:
diff
changeset
|
114 |
void print(outputStream* st) { |
311143309e73
8122937: [JEP 245] Validate JVM Command-Line Flag Arguments.
gziemski
parents:
diff
changeset
|
115 |
st->print("[ %-25u ... %25u ]", _min, _max); |
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 |
}; |
311143309e73
8122937: [JEP 245] Validate JVM Command-Line Flag Arguments.
gziemski
parents:
diff
changeset
|
118 |
|
311143309e73
8122937: [JEP 245] Validate JVM Command-Line Flag Arguments.
gziemski
parents:
diff
changeset
|
119 |
class CommandLineFlagRange_uintx : public CommandLineFlagRange { |
311143309e73
8122937: [JEP 245] Validate JVM Command-Line Flag Arguments.
gziemski
parents:
diff
changeset
|
120 |
uintx _min; |
311143309e73
8122937: [JEP 245] Validate JVM Command-Line Flag Arguments.
gziemski
parents:
diff
changeset
|
121 |
uintx _max; |
311143309e73
8122937: [JEP 245] Validate JVM Command-Line Flag Arguments.
gziemski
parents:
diff
changeset
|
122 |
|
311143309e73
8122937: [JEP 245] Validate JVM Command-Line Flag Arguments.
gziemski
parents:
diff
changeset
|
123 |
public: |
311143309e73
8122937: [JEP 245] Validate JVM Command-Line Flag Arguments.
gziemski
parents:
diff
changeset
|
124 |
// the "name" argument must be a string literal |
311143309e73
8122937: [JEP 245] Validate JVM Command-Line Flag Arguments.
gziemski
parents:
diff
changeset
|
125 |
CommandLineFlagRange_uintx(const char* name, uintx min, uintx max) : CommandLineFlagRange(name) { |
311143309e73
8122937: [JEP 245] Validate JVM Command-Line Flag Arguments.
gziemski
parents:
diff
changeset
|
126 |
_min=min, _max=max; |
311143309e73
8122937: [JEP 245] Validate JVM Command-Line Flag Arguments.
gziemski
parents:
diff
changeset
|
127 |
} |
311143309e73
8122937: [JEP 245] Validate JVM Command-Line Flag Arguments.
gziemski
parents:
diff
changeset
|
128 |
|
311143309e73
8122937: [JEP 245] Validate JVM Command-Line Flag Arguments.
gziemski
parents:
diff
changeset
|
129 |
Flag::Error check_uintx(uintx value, bool verbose = true) { |
311143309e73
8122937: [JEP 245] Validate JVM Command-Line Flag Arguments.
gziemski
parents:
diff
changeset
|
130 |
if ((value < _min) || (value > _max)) { |
311143309e73
8122937: [JEP 245] Validate JVM Command-Line Flag Arguments.
gziemski
parents:
diff
changeset
|
131 |
if (verbose == true) { |
311143309e73
8122937: [JEP 245] Validate JVM Command-Line Flag Arguments.
gziemski
parents:
diff
changeset
|
132 |
jio_fprintf(defaultStream::error_stream(), |
311143309e73
8122937: [JEP 245] Validate JVM Command-Line Flag Arguments.
gziemski
parents:
diff
changeset
|
133 |
"uintx %s=" UINTX_FORMAT " is outside the allowed range [ " UINTX_FORMAT " ... " UINTX_FORMAT " ]\n", |
311143309e73
8122937: [JEP 245] Validate JVM Command-Line Flag Arguments.
gziemski
parents:
diff
changeset
|
134 |
name(), value, _min, _max); |
311143309e73
8122937: [JEP 245] Validate JVM Command-Line Flag Arguments.
gziemski
parents:
diff
changeset
|
135 |
} |
311143309e73
8122937: [JEP 245] Validate JVM Command-Line Flag Arguments.
gziemski
parents:
diff
changeset
|
136 |
return Flag::OUT_OF_BOUNDS; |
311143309e73
8122937: [JEP 245] Validate JVM Command-Line Flag Arguments.
gziemski
parents:
diff
changeset
|
137 |
} else { |
311143309e73
8122937: [JEP 245] Validate JVM Command-Line Flag Arguments.
gziemski
parents:
diff
changeset
|
138 |
return Flag::SUCCESS; |
311143309e73
8122937: [JEP 245] Validate JVM Command-Line Flag Arguments.
gziemski
parents:
diff
changeset
|
139 |
} |
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 |
void print(outputStream* st) { |
311143309e73
8122937: [JEP 245] Validate JVM Command-Line Flag Arguments.
gziemski
parents:
diff
changeset
|
143 |
st->print("[ "UINTX_FORMAT_W(-25)" ... "UINTX_FORMAT_W(25)" ]", _min, _max); |
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 CommandLineFlagRange_uint64_t : public CommandLineFlagRange { |
311143309e73
8122937: [JEP 245] Validate JVM Command-Line Flag Arguments.
gziemski
parents:
diff
changeset
|
148 |
uint64_t _min; |
311143309e73
8122937: [JEP 245] Validate JVM Command-Line Flag Arguments.
gziemski
parents:
diff
changeset
|
149 |
uint64_t _max; |
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 |
311143309e73
8122937: [JEP 245] Validate JVM Command-Line Flag Arguments.
gziemski
parents:
diff
changeset
|
153 |
CommandLineFlagRange_uint64_t(const char* name, uint64_t min, uint64_t max) : CommandLineFlagRange(name) { |
311143309e73
8122937: [JEP 245] Validate JVM Command-Line Flag Arguments.
gziemski
parents:
diff
changeset
|
154 |
_min=min, _max=max; |
311143309e73
8122937: [JEP 245] Validate JVM Command-Line Flag Arguments.
gziemski
parents:
diff
changeset
|
155 |
} |
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 |
Flag::Error check_uint64_t(uint64_t value, bool verbose = true) { |
311143309e73
8122937: [JEP 245] Validate JVM Command-Line Flag Arguments.
gziemski
parents:
diff
changeset
|
158 |
if ((value < _min) || (value > _max)) { |
311143309e73
8122937: [JEP 245] Validate JVM Command-Line Flag Arguments.
gziemski
parents:
diff
changeset
|
159 |
if (verbose == true) { |
311143309e73
8122937: [JEP 245] Validate JVM Command-Line Flag Arguments.
gziemski
parents:
diff
changeset
|
160 |
jio_fprintf(defaultStream::error_stream(), |
311143309e73
8122937: [JEP 245] Validate JVM Command-Line Flag Arguments.
gziemski
parents:
diff
changeset
|
161 |
"uint64_t %s=" UINT64_FORMAT " is outside the allowed range [ " UINT64_FORMAT " ... " UINT64_FORMAT " ]\n", |
311143309e73
8122937: [JEP 245] Validate JVM Command-Line Flag Arguments.
gziemski
parents:
diff
changeset
|
162 |
name(), value, _min, _max); |
311143309e73
8122937: [JEP 245] Validate JVM Command-Line Flag Arguments.
gziemski
parents:
diff
changeset
|
163 |
} |
311143309e73
8122937: [JEP 245] Validate JVM Command-Line Flag Arguments.
gziemski
parents:
diff
changeset
|
164 |
return Flag::OUT_OF_BOUNDS; |
311143309e73
8122937: [JEP 245] Validate JVM Command-Line Flag Arguments.
gziemski
parents:
diff
changeset
|
165 |
} else { |
311143309e73
8122937: [JEP 245] Validate JVM Command-Line Flag Arguments.
gziemski
parents:
diff
changeset
|
166 |
return Flag::SUCCESS; |
311143309e73
8122937: [JEP 245] Validate JVM Command-Line Flag Arguments.
gziemski
parents:
diff
changeset
|
167 |
} |
311143309e73
8122937: [JEP 245] Validate JVM Command-Line Flag Arguments.
gziemski
parents:
diff
changeset
|
168 |
} |
311143309e73
8122937: [JEP 245] Validate JVM Command-Line Flag Arguments.
gziemski
parents:
diff
changeset
|
169 |
|
311143309e73
8122937: [JEP 245] Validate JVM Command-Line Flag Arguments.
gziemski
parents:
diff
changeset
|
170 |
void print(outputStream* st) { |
311143309e73
8122937: [JEP 245] Validate JVM Command-Line Flag Arguments.
gziemski
parents:
diff
changeset
|
171 |
st->print("[ "UINT64_FORMAT_W(-25)" ... "UINT64_FORMAT_W(25)" ]", _min, _max); |
311143309e73
8122937: [JEP 245] Validate JVM Command-Line Flag Arguments.
gziemski
parents:
diff
changeset
|
172 |
} |
311143309e73
8122937: [JEP 245] Validate JVM Command-Line Flag Arguments.
gziemski
parents:
diff
changeset
|
173 |
}; |
311143309e73
8122937: [JEP 245] Validate JVM Command-Line Flag Arguments.
gziemski
parents:
diff
changeset
|
174 |
|
311143309e73
8122937: [JEP 245] Validate JVM Command-Line Flag Arguments.
gziemski
parents:
diff
changeset
|
175 |
class CommandLineFlagRange_size_t : public CommandLineFlagRange { |
311143309e73
8122937: [JEP 245] Validate JVM Command-Line Flag Arguments.
gziemski
parents:
diff
changeset
|
176 |
size_t _min; |
311143309e73
8122937: [JEP 245] Validate JVM Command-Line Flag Arguments.
gziemski
parents:
diff
changeset
|
177 |
size_t _max; |
311143309e73
8122937: [JEP 245] Validate JVM Command-Line Flag Arguments.
gziemski
parents:
diff
changeset
|
178 |
|
311143309e73
8122937: [JEP 245] Validate JVM Command-Line Flag Arguments.
gziemski
parents:
diff
changeset
|
179 |
public: |
311143309e73
8122937: [JEP 245] Validate JVM Command-Line Flag Arguments.
gziemski
parents:
diff
changeset
|
180 |
// the "name" argument must be a string literal |
311143309e73
8122937: [JEP 245] Validate JVM Command-Line Flag Arguments.
gziemski
parents:
diff
changeset
|
181 |
CommandLineFlagRange_size_t(const char* name, size_t min, size_t max) : CommandLineFlagRange(name) { |
311143309e73
8122937: [JEP 245] Validate JVM Command-Line Flag Arguments.
gziemski
parents:
diff
changeset
|
182 |
_min=min, _max=max; |
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 |
Flag::Error check_size_t(size_t value, bool verbose = true) { |
311143309e73
8122937: [JEP 245] Validate JVM Command-Line Flag Arguments.
gziemski
parents:
diff
changeset
|
186 |
if ((value < _min) || (value > _max)) { |
311143309e73
8122937: [JEP 245] Validate JVM Command-Line Flag Arguments.
gziemski
parents:
diff
changeset
|
187 |
if (verbose == true) { |
311143309e73
8122937: [JEP 245] Validate JVM Command-Line Flag Arguments.
gziemski
parents:
diff
changeset
|
188 |
jio_fprintf(defaultStream::error_stream(), |
311143309e73
8122937: [JEP 245] Validate JVM Command-Line Flag Arguments.
gziemski
parents:
diff
changeset
|
189 |
"size_t %s=" SIZE_FORMAT " is outside the allowed range [ " SIZE_FORMAT " ... " SIZE_FORMAT " ]\n", |
311143309e73
8122937: [JEP 245] Validate JVM Command-Line Flag Arguments.
gziemski
parents:
diff
changeset
|
190 |
name(), value, _min, _max); |
311143309e73
8122937: [JEP 245] Validate JVM Command-Line Flag Arguments.
gziemski
parents:
diff
changeset
|
191 |
} |
311143309e73
8122937: [JEP 245] Validate JVM Command-Line Flag Arguments.
gziemski
parents:
diff
changeset
|
192 |
return Flag::OUT_OF_BOUNDS; |
311143309e73
8122937: [JEP 245] Validate JVM Command-Line Flag Arguments.
gziemski
parents:
diff
changeset
|
193 |
} else { |
311143309e73
8122937: [JEP 245] Validate JVM Command-Line Flag Arguments.
gziemski
parents:
diff
changeset
|
194 |
return Flag::SUCCESS; |
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 |
} |
311143309e73
8122937: [JEP 245] Validate JVM Command-Line Flag Arguments.
gziemski
parents:
diff
changeset
|
197 |
|
311143309e73
8122937: [JEP 245] Validate JVM Command-Line Flag Arguments.
gziemski
parents:
diff
changeset
|
198 |
void print(outputStream* st) { |
311143309e73
8122937: [JEP 245] Validate JVM Command-Line Flag Arguments.
gziemski
parents:
diff
changeset
|
199 |
st->print("[ "SIZE_FORMAT_W(-25)" ... "SIZE_FORMAT_W(25)" ]", _min, _max); |
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 |
|
311143309e73
8122937: [JEP 245] Validate JVM Command-Line Flag Arguments.
gziemski
parents:
diff
changeset
|
203 |
class CommandLineFlagRange_double : public CommandLineFlagRange { |
311143309e73
8122937: [JEP 245] Validate JVM Command-Line Flag Arguments.
gziemski
parents:
diff
changeset
|
204 |
double _min; |
311143309e73
8122937: [JEP 245] Validate JVM Command-Line Flag Arguments.
gziemski
parents:
diff
changeset
|
205 |
double _max; |
311143309e73
8122937: [JEP 245] Validate JVM Command-Line Flag Arguments.
gziemski
parents:
diff
changeset
|
206 |
|
311143309e73
8122937: [JEP 245] Validate JVM Command-Line Flag Arguments.
gziemski
parents:
diff
changeset
|
207 |
public: |
311143309e73
8122937: [JEP 245] Validate JVM Command-Line Flag Arguments.
gziemski
parents:
diff
changeset
|
208 |
// the "name" argument must be a string literal |
311143309e73
8122937: [JEP 245] Validate JVM Command-Line Flag Arguments.
gziemski
parents:
diff
changeset
|
209 |
CommandLineFlagRange_double(const char* name, double min, double max) : CommandLineFlagRange(name) { |
311143309e73
8122937: [JEP 245] Validate JVM Command-Line Flag Arguments.
gziemski
parents:
diff
changeset
|
210 |
_min=min, _max=max; |
311143309e73
8122937: [JEP 245] Validate JVM Command-Line Flag Arguments.
gziemski
parents:
diff
changeset
|
211 |
} |
311143309e73
8122937: [JEP 245] Validate JVM Command-Line Flag Arguments.
gziemski
parents:
diff
changeset
|
212 |
|
311143309e73
8122937: [JEP 245] Validate JVM Command-Line Flag Arguments.
gziemski
parents:
diff
changeset
|
213 |
Flag::Error check_double(double value, bool verbose = true) { |
311143309e73
8122937: [JEP 245] Validate JVM Command-Line Flag Arguments.
gziemski
parents:
diff
changeset
|
214 |
if ((value < _min) || (value > _max)) { |
311143309e73
8122937: [JEP 245] Validate JVM Command-Line Flag Arguments.
gziemski
parents:
diff
changeset
|
215 |
if (verbose == true) { |
311143309e73
8122937: [JEP 245] Validate JVM Command-Line Flag Arguments.
gziemski
parents:
diff
changeset
|
216 |
jio_fprintf(defaultStream::error_stream(), |
311143309e73
8122937: [JEP 245] Validate JVM Command-Line Flag Arguments.
gziemski
parents:
diff
changeset
|
217 |
"double %s=%f is outside the allowed range [ %f ... %f ]\n", |
311143309e73
8122937: [JEP 245] Validate JVM Command-Line Flag Arguments.
gziemski
parents:
diff
changeset
|
218 |
name(), value, _min, _max); |
311143309e73
8122937: [JEP 245] Validate JVM Command-Line Flag Arguments.
gziemski
parents:
diff
changeset
|
219 |
} |
311143309e73
8122937: [JEP 245] Validate JVM Command-Line Flag Arguments.
gziemski
parents:
diff
changeset
|
220 |
return Flag::OUT_OF_BOUNDS; |
311143309e73
8122937: [JEP 245] Validate JVM Command-Line Flag Arguments.
gziemski
parents:
diff
changeset
|
221 |
} else { |
311143309e73
8122937: [JEP 245] Validate JVM Command-Line Flag Arguments.
gziemski
parents:
diff
changeset
|
222 |
return Flag::SUCCESS; |
311143309e73
8122937: [JEP 245] Validate JVM Command-Line Flag Arguments.
gziemski
parents:
diff
changeset
|
223 |
} |
311143309e73
8122937: [JEP 245] Validate JVM Command-Line Flag Arguments.
gziemski
parents:
diff
changeset
|
224 |
} |
311143309e73
8122937: [JEP 245] Validate JVM Command-Line Flag Arguments.
gziemski
parents:
diff
changeset
|
225 |
|
311143309e73
8122937: [JEP 245] Validate JVM Command-Line Flag Arguments.
gziemski
parents:
diff
changeset
|
226 |
void print(outputStream* st) { |
311143309e73
8122937: [JEP 245] Validate JVM Command-Line Flag Arguments.
gziemski
parents:
diff
changeset
|
227 |
st->print("[ %-25.3f ... %25.3f ]", _min, _max); |
311143309e73
8122937: [JEP 245] Validate JVM Command-Line Flag Arguments.
gziemski
parents:
diff
changeset
|
228 |
} |
311143309e73
8122937: [JEP 245] Validate JVM Command-Line Flag Arguments.
gziemski
parents:
diff
changeset
|
229 |
}; |
311143309e73
8122937: [JEP 245] Validate JVM Command-Line Flag Arguments.
gziemski
parents:
diff
changeset
|
230 |
|
311143309e73
8122937: [JEP 245] Validate JVM Command-Line Flag Arguments.
gziemski
parents:
diff
changeset
|
231 |
// No constraint emitting |
311143309e73
8122937: [JEP 245] Validate JVM Command-Line Flag Arguments.
gziemski
parents:
diff
changeset
|
232 |
void emit_range_no(...) { /* NOP */ } |
311143309e73
8122937: [JEP 245] Validate JVM Command-Line Flag Arguments.
gziemski
parents:
diff
changeset
|
233 |
|
311143309e73
8122937: [JEP 245] Validate JVM Command-Line Flag Arguments.
gziemski
parents:
diff
changeset
|
234 |
// No constraint emitting if function argument is NOT provided |
311143309e73
8122937: [JEP 245] Validate JVM Command-Line Flag Arguments.
gziemski
parents:
diff
changeset
|
235 |
void emit_range_bool(const char* /*name*/) { /* NOP */ } |
311143309e73
8122937: [JEP 245] Validate JVM Command-Line Flag Arguments.
gziemski
parents:
diff
changeset
|
236 |
void emit_range_ccstr(const char* /*name*/) { /* NOP */ } |
311143309e73
8122937: [JEP 245] Validate JVM Command-Line Flag Arguments.
gziemski
parents:
diff
changeset
|
237 |
void emit_range_ccstrlist(const char* /*name*/) { /* NOP */ } |
311143309e73
8122937: [JEP 245] Validate JVM Command-Line Flag Arguments.
gziemski
parents:
diff
changeset
|
238 |
void emit_range_int(const char* /*name*/) { /* NOP */ } |
311143309e73
8122937: [JEP 245] Validate JVM Command-Line Flag Arguments.
gziemski
parents:
diff
changeset
|
239 |
void emit_range_intx(const char* /*name*/) { /* NOP */ } |
311143309e73
8122937: [JEP 245] Validate JVM Command-Line Flag Arguments.
gziemski
parents:
diff
changeset
|
240 |
void emit_range_uint(const char* /*name*/) { /* NOP */ } |
311143309e73
8122937: [JEP 245] Validate JVM Command-Line Flag Arguments.
gziemski
parents:
diff
changeset
|
241 |
void emit_range_uintx(const char* /*name*/) { /* NOP */ } |
311143309e73
8122937: [JEP 245] Validate JVM Command-Line Flag Arguments.
gziemski
parents:
diff
changeset
|
242 |
void emit_range_uint64_t(const char* /*name*/) { /* NOP */ } |
311143309e73
8122937: [JEP 245] Validate JVM Command-Line Flag Arguments.
gziemski
parents:
diff
changeset
|
243 |
void emit_range_size_t(const char* /*name*/) { /* NOP */ } |
311143309e73
8122937: [JEP 245] Validate JVM Command-Line Flag Arguments.
gziemski
parents:
diff
changeset
|
244 |
void emit_range_double(const char* /*name*/) { /* NOP */ } |
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 |
// CommandLineFlagRange emitting code functions if range arguments are provided |
311143309e73
8122937: [JEP 245] Validate JVM Command-Line Flag Arguments.
gziemski
parents:
diff
changeset
|
247 |
void emit_range_intx(const char* name, intx min, intx max) { |
311143309e73
8122937: [JEP 245] Validate JVM Command-Line Flag Arguments.
gziemski
parents:
diff
changeset
|
248 |
CommandLineFlagRangeList::add(new CommandLineFlagRange_intx(name, min, max)); |
311143309e73
8122937: [JEP 245] Validate JVM Command-Line Flag Arguments.
gziemski
parents:
diff
changeset
|
249 |
} |
311143309e73
8122937: [JEP 245] Validate JVM Command-Line Flag Arguments.
gziemski
parents:
diff
changeset
|
250 |
void emit_range_uintx(const char* name, uintx min, uintx max) { |
311143309e73
8122937: [JEP 245] Validate JVM Command-Line Flag Arguments.
gziemski
parents:
diff
changeset
|
251 |
CommandLineFlagRangeList::add(new CommandLineFlagRange_uintx(name, min, max)); |
311143309e73
8122937: [JEP 245] Validate JVM Command-Line Flag Arguments.
gziemski
parents:
diff
changeset
|
252 |
} |
311143309e73
8122937: [JEP 245] Validate JVM Command-Line Flag Arguments.
gziemski
parents:
diff
changeset
|
253 |
void emit_range_uint64_t(const char* name, uint64_t min, uint64_t max) { |
311143309e73
8122937: [JEP 245] Validate JVM Command-Line Flag Arguments.
gziemski
parents:
diff
changeset
|
254 |
CommandLineFlagRangeList::add(new CommandLineFlagRange_uint64_t(name, min, max)); |
311143309e73
8122937: [JEP 245] Validate JVM Command-Line Flag Arguments.
gziemski
parents:
diff
changeset
|
255 |
} |
311143309e73
8122937: [JEP 245] Validate JVM Command-Line Flag Arguments.
gziemski
parents:
diff
changeset
|
256 |
void emit_range_size_t(const char* name, size_t min, size_t max) { |
311143309e73
8122937: [JEP 245] Validate JVM Command-Line Flag Arguments.
gziemski
parents:
diff
changeset
|
257 |
CommandLineFlagRangeList::add(new CommandLineFlagRange_size_t(name, min, max)); |
311143309e73
8122937: [JEP 245] Validate JVM Command-Line Flag Arguments.
gziemski
parents:
diff
changeset
|
258 |
} |
311143309e73
8122937: [JEP 245] Validate JVM Command-Line Flag Arguments.
gziemski
parents:
diff
changeset
|
259 |
void emit_range_double(const char* name, double min, double max) { |
311143309e73
8122937: [JEP 245] Validate JVM Command-Line Flag Arguments.
gziemski
parents:
diff
changeset
|
260 |
CommandLineFlagRangeList::add(new CommandLineFlagRange_double(name, min, max)); |
311143309e73
8122937: [JEP 245] Validate JVM Command-Line Flag Arguments.
gziemski
parents:
diff
changeset
|
261 |
} |
311143309e73
8122937: [JEP 245] Validate JVM Command-Line Flag Arguments.
gziemski
parents:
diff
changeset
|
262 |
|
311143309e73
8122937: [JEP 245] Validate JVM Command-Line Flag Arguments.
gziemski
parents:
diff
changeset
|
263 |
// Generate code to call emit_range_xxx function |
311143309e73
8122937: [JEP 245] Validate JVM Command-Line Flag Arguments.
gziemski
parents:
diff
changeset
|
264 |
#define EMIT_RANGE_PRODUCT_FLAG(type, name, value, doc) ); emit_range_##type(#name |
311143309e73
8122937: [JEP 245] Validate JVM Command-Line Flag Arguments.
gziemski
parents:
diff
changeset
|
265 |
#define EMIT_RANGE_COMMERCIAL_FLAG(type, name, value, doc) ); emit_range_##type(#name |
311143309e73
8122937: [JEP 245] Validate JVM Command-Line Flag Arguments.
gziemski
parents:
diff
changeset
|
266 |
#define EMIT_RANGE_DIAGNOSTIC_FLAG(type, name, value, doc) ); emit_range_##type(#name |
311143309e73
8122937: [JEP 245] Validate JVM Command-Line Flag Arguments.
gziemski
parents:
diff
changeset
|
267 |
#define EMIT_RANGE_EXPERIMENTAL_FLAG(type, name, value, doc) ); emit_range_##type(#name |
311143309e73
8122937: [JEP 245] Validate JVM Command-Line Flag Arguments.
gziemski
parents:
diff
changeset
|
268 |
#define EMIT_RANGE_MANAGEABLE_FLAG(type, name, value, doc) ); emit_range_##type(#name |
311143309e73
8122937: [JEP 245] Validate JVM Command-Line Flag Arguments.
gziemski
parents:
diff
changeset
|
269 |
#define EMIT_RANGE_PRODUCT_RW_FLAG(type, name, value, doc) ); emit_range_##type(#name |
311143309e73
8122937: [JEP 245] Validate JVM Command-Line Flag Arguments.
gziemski
parents:
diff
changeset
|
270 |
#define EMIT_RANGE_PD_PRODUCT_FLAG(type, name, doc) ); emit_range_##type(#name |
311143309e73
8122937: [JEP 245] Validate JVM Command-Line Flag Arguments.
gziemski
parents:
diff
changeset
|
271 |
#define EMIT_RANGE_DEVELOPER_FLAG(type, name, value, doc) ); emit_range_##type(#name |
311143309e73
8122937: [JEP 245] Validate JVM Command-Line Flag Arguments.
gziemski
parents:
diff
changeset
|
272 |
#define EMIT_RANGE_PD_DEVELOPER_FLAG(type, name, doc) ); emit_range_##type(#name |
311143309e73
8122937: [JEP 245] Validate JVM Command-Line Flag Arguments.
gziemski
parents:
diff
changeset
|
273 |
#define EMIT_RANGE_NOTPRODUCT_FLAG(type, name, value, doc) ); emit_range_##type(#name |
311143309e73
8122937: [JEP 245] Validate JVM Command-Line Flag Arguments.
gziemski
parents:
diff
changeset
|
274 |
#define EMIT_RANGE_LP64_PRODUCT_FLAG(type, name, value, doc) ); emit_range_##type(#name |
311143309e73
8122937: [JEP 245] Validate JVM Command-Line Flag Arguments.
gziemski
parents:
diff
changeset
|
275 |
|
311143309e73
8122937: [JEP 245] Validate JVM Command-Line Flag Arguments.
gziemski
parents:
diff
changeset
|
276 |
// Generate func argument to pass into emit_range_xxx functions |
311143309e73
8122937: [JEP 245] Validate JVM Command-Line Flag Arguments.
gziemski
parents:
diff
changeset
|
277 |
#define EMIT_RANGE_CHECK(a, b) , a, b |
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 |
#define INITIAL_RANGES_SIZE 128 |
311143309e73
8122937: [JEP 245] Validate JVM Command-Line Flag Arguments.
gziemski
parents:
diff
changeset
|
280 |
GrowableArray<CommandLineFlagRange*>* CommandLineFlagRangeList::_ranges = NULL; |
311143309e73
8122937: [JEP 245] Validate JVM Command-Line Flag Arguments.
gziemski
parents:
diff
changeset
|
281 |
|
311143309e73
8122937: [JEP 245] Validate JVM Command-Line Flag Arguments.
gziemski
parents:
diff
changeset
|
282 |
// Check the ranges of all flags that have them |
311143309e73
8122937: [JEP 245] Validate JVM Command-Line Flag Arguments.
gziemski
parents:
diff
changeset
|
283 |
void CommandLineFlagRangeList::init(void) { |
311143309e73
8122937: [JEP 245] Validate JVM Command-Line Flag Arguments.
gziemski
parents:
diff
changeset
|
284 |
|
311143309e73
8122937: [JEP 245] Validate JVM Command-Line Flag Arguments.
gziemski
parents:
diff
changeset
|
285 |
_ranges = new (ResourceObj::C_HEAP, mtInternal) GrowableArray<CommandLineFlagRange*>(INITIAL_RANGES_SIZE, true); |
311143309e73
8122937: [JEP 245] Validate JVM Command-Line Flag Arguments.
gziemski
parents:
diff
changeset
|
286 |
|
311143309e73
8122937: [JEP 245] Validate JVM Command-Line Flag Arguments.
gziemski
parents:
diff
changeset
|
287 |
emit_range_no(NULL RUNTIME_FLAGS(EMIT_RANGE_DEVELOPER_FLAG, |
311143309e73
8122937: [JEP 245] Validate JVM Command-Line Flag Arguments.
gziemski
parents:
diff
changeset
|
288 |
EMIT_RANGE_PD_DEVELOPER_FLAG, |
311143309e73
8122937: [JEP 245] Validate JVM Command-Line Flag Arguments.
gziemski
parents:
diff
changeset
|
289 |
EMIT_RANGE_PRODUCT_FLAG, |
311143309e73
8122937: [JEP 245] Validate JVM Command-Line Flag Arguments.
gziemski
parents:
diff
changeset
|
290 |
EMIT_RANGE_PD_PRODUCT_FLAG, |
311143309e73
8122937: [JEP 245] Validate JVM Command-Line Flag Arguments.
gziemski
parents:
diff
changeset
|
291 |
EMIT_RANGE_DIAGNOSTIC_FLAG, |
311143309e73
8122937: [JEP 245] Validate JVM Command-Line Flag Arguments.
gziemski
parents:
diff
changeset
|
292 |
EMIT_RANGE_EXPERIMENTAL_FLAG, |
311143309e73
8122937: [JEP 245] Validate JVM Command-Line Flag Arguments.
gziemski
parents:
diff
changeset
|
293 |
EMIT_RANGE_NOTPRODUCT_FLAG, |
311143309e73
8122937: [JEP 245] Validate JVM Command-Line Flag Arguments.
gziemski
parents:
diff
changeset
|
294 |
EMIT_RANGE_MANAGEABLE_FLAG, |
311143309e73
8122937: [JEP 245] Validate JVM Command-Line Flag Arguments.
gziemski
parents:
diff
changeset
|
295 |
EMIT_RANGE_PRODUCT_RW_FLAG, |
311143309e73
8122937: [JEP 245] Validate JVM Command-Line Flag Arguments.
gziemski
parents:
diff
changeset
|
296 |
EMIT_RANGE_LP64_PRODUCT_FLAG, |
311143309e73
8122937: [JEP 245] Validate JVM Command-Line Flag Arguments.
gziemski
parents:
diff
changeset
|
297 |
EMIT_RANGE_CHECK, |
311143309e73
8122937: [JEP 245] Validate JVM Command-Line Flag Arguments.
gziemski
parents:
diff
changeset
|
298 |
IGNORE_CONSTRAINT) ); |
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_RANGES_FOR_GLOBALS_EXT |
311143309e73
8122937: [JEP 245] Validate JVM Command-Line Flag Arguments.
gziemski
parents:
diff
changeset
|
301 |
|
311143309e73
8122937: [JEP 245] Validate JVM Command-Line Flag Arguments.
gziemski
parents:
diff
changeset
|
302 |
emit_range_no(NULL ARCH_FLAGS(EMIT_RANGE_DEVELOPER_FLAG, |
311143309e73
8122937: [JEP 245] Validate JVM Command-Line Flag Arguments.
gziemski
parents:
diff
changeset
|
303 |
EMIT_RANGE_PRODUCT_FLAG, |
311143309e73
8122937: [JEP 245] Validate JVM Command-Line Flag Arguments.
gziemski
parents:
diff
changeset
|
304 |
EMIT_RANGE_DIAGNOSTIC_FLAG, |
311143309e73
8122937: [JEP 245] Validate JVM Command-Line Flag Arguments.
gziemski
parents:
diff
changeset
|
305 |
EMIT_RANGE_EXPERIMENTAL_FLAG, |
311143309e73
8122937: [JEP 245] Validate JVM Command-Line Flag Arguments.
gziemski
parents:
diff
changeset
|
306 |
EMIT_RANGE_NOTPRODUCT_FLAG, |
311143309e73
8122937: [JEP 245] Validate JVM Command-Line Flag Arguments.
gziemski
parents:
diff
changeset
|
307 |
EMIT_RANGE_CHECK, |
311143309e73
8122937: [JEP 245] Validate JVM Command-Line Flag Arguments.
gziemski
parents:
diff
changeset
|
308 |
IGNORE_CONSTRAINT)); |
311143309e73
8122937: [JEP 245] Validate JVM Command-Line Flag Arguments.
gziemski
parents:
diff
changeset
|
309 |
|
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_range_no(NULL C1_FLAGS(EMIT_RANGE_DEVELOPER_FLAG, |
311143309e73
8122937: [JEP 245] Validate JVM Command-Line Flag Arguments.
gziemski
parents:
diff
changeset
|
312 |
EMIT_RANGE_PD_DEVELOPER_FLAG, |
311143309e73
8122937: [JEP 245] Validate JVM Command-Line Flag Arguments.
gziemski
parents:
diff
changeset
|
313 |
EMIT_RANGE_PRODUCT_FLAG, |
311143309e73
8122937: [JEP 245] Validate JVM Command-Line Flag Arguments.
gziemski
parents:
diff
changeset
|
314 |
EMIT_RANGE_PD_PRODUCT_FLAG, |
311143309e73
8122937: [JEP 245] Validate JVM Command-Line Flag Arguments.
gziemski
parents:
diff
changeset
|
315 |
EMIT_RANGE_DIAGNOSTIC_FLAG, |
311143309e73
8122937: [JEP 245] Validate JVM Command-Line Flag Arguments.
gziemski
parents:
diff
changeset
|
316 |
EMIT_RANGE_NOTPRODUCT_FLAG, |
311143309e73
8122937: [JEP 245] Validate JVM Command-Line Flag Arguments.
gziemski
parents:
diff
changeset
|
317 |
EMIT_RANGE_CHECK, |
311143309e73
8122937: [JEP 245] Validate JVM Command-Line Flag Arguments.
gziemski
parents:
diff
changeset
|
318 |
IGNORE_CONSTRAINT)); |
311143309e73
8122937: [JEP 245] Validate JVM Command-Line Flag Arguments.
gziemski
parents:
diff
changeset
|
319 |
#endif // COMPILER1 |
311143309e73
8122937: [JEP 245] Validate JVM Command-Line Flag Arguments.
gziemski
parents:
diff
changeset
|
320 |
|
311143309e73
8122937: [JEP 245] Validate JVM Command-Line Flag Arguments.
gziemski
parents:
diff
changeset
|
321 |
#ifdef COMPILER2 |
311143309e73
8122937: [JEP 245] Validate JVM Command-Line Flag Arguments.
gziemski
parents:
diff
changeset
|
322 |
emit_range_no(NULL C2_FLAGS(EMIT_RANGE_DEVELOPER_FLAG, |
311143309e73
8122937: [JEP 245] Validate JVM Command-Line Flag Arguments.
gziemski
parents:
diff
changeset
|
323 |
EMIT_RANGE_PD_DEVELOPER_FLAG, |
311143309e73
8122937: [JEP 245] Validate JVM Command-Line Flag Arguments.
gziemski
parents:
diff
changeset
|
324 |
EMIT_RANGE_PRODUCT_FLAG, |
311143309e73
8122937: [JEP 245] Validate JVM Command-Line Flag Arguments.
gziemski
parents:
diff
changeset
|
325 |
EMIT_RANGE_PD_PRODUCT_FLAG, |
311143309e73
8122937: [JEP 245] Validate JVM Command-Line Flag Arguments.
gziemski
parents:
diff
changeset
|
326 |
EMIT_RANGE_DIAGNOSTIC_FLAG, |
311143309e73
8122937: [JEP 245] Validate JVM Command-Line Flag Arguments.
gziemski
parents:
diff
changeset
|
327 |
EMIT_RANGE_EXPERIMENTAL_FLAG, |
311143309e73
8122937: [JEP 245] Validate JVM Command-Line Flag Arguments.
gziemski
parents:
diff
changeset
|
328 |
EMIT_RANGE_NOTPRODUCT_FLAG, |
311143309e73
8122937: [JEP 245] Validate JVM Command-Line Flag Arguments.
gziemski
parents:
diff
changeset
|
329 |
EMIT_RANGE_CHECK, |
311143309e73
8122937: [JEP 245] Validate JVM Command-Line Flag Arguments.
gziemski
parents:
diff
changeset
|
330 |
IGNORE_CONSTRAINT)); |
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 |
#if INCLUDE_ALL_GCS |
311143309e73
8122937: [JEP 245] Validate JVM Command-Line Flag Arguments.
gziemski
parents:
diff
changeset
|
334 |
emit_range_no(NULL G1_FLAGS(EMIT_RANGE_DEVELOPER_FLAG, |
311143309e73
8122937: [JEP 245] Validate JVM Command-Line Flag Arguments.
gziemski
parents:
diff
changeset
|
335 |
EMIT_RANGE_PD_DEVELOPER_FLAG, |
311143309e73
8122937: [JEP 245] Validate JVM Command-Line Flag Arguments.
gziemski
parents:
diff
changeset
|
336 |
EMIT_RANGE_PRODUCT_FLAG, |
311143309e73
8122937: [JEP 245] Validate JVM Command-Line Flag Arguments.
gziemski
parents:
diff
changeset
|
337 |
EMIT_RANGE_PD_PRODUCT_FLAG, |
311143309e73
8122937: [JEP 245] Validate JVM Command-Line Flag Arguments.
gziemski
parents:
diff
changeset
|
338 |
EMIT_RANGE_DIAGNOSTIC_FLAG, |
311143309e73
8122937: [JEP 245] Validate JVM Command-Line Flag Arguments.
gziemski
parents:
diff
changeset
|
339 |
EMIT_RANGE_EXPERIMENTAL_FLAG, |
311143309e73
8122937: [JEP 245] Validate JVM Command-Line Flag Arguments.
gziemski
parents:
diff
changeset
|
340 |
EMIT_RANGE_NOTPRODUCT_FLAG, |
311143309e73
8122937: [JEP 245] Validate JVM Command-Line Flag Arguments.
gziemski
parents:
diff
changeset
|
341 |
EMIT_RANGE_MANAGEABLE_FLAG, |
311143309e73
8122937: [JEP 245] Validate JVM Command-Line Flag Arguments.
gziemski
parents:
diff
changeset
|
342 |
EMIT_RANGE_PRODUCT_RW_FLAG, |
311143309e73
8122937: [JEP 245] Validate JVM Command-Line Flag Arguments.
gziemski
parents:
diff
changeset
|
343 |
EMIT_RANGE_CHECK, |
311143309e73
8122937: [JEP 245] Validate JVM Command-Line Flag Arguments.
gziemski
parents:
diff
changeset
|
344 |
IGNORE_CONSTRAINT)); |
311143309e73
8122937: [JEP 245] Validate JVM Command-Line Flag Arguments.
gziemski
parents:
diff
changeset
|
345 |
#endif // INCLUDE_ALL_GCS |
311143309e73
8122937: [JEP 245] Validate JVM Command-Line Flag Arguments.
gziemski
parents:
diff
changeset
|
346 |
} |
311143309e73
8122937: [JEP 245] Validate JVM Command-Line Flag Arguments.
gziemski
parents:
diff
changeset
|
347 |
|
311143309e73
8122937: [JEP 245] Validate JVM Command-Line Flag Arguments.
gziemski
parents:
diff
changeset
|
348 |
CommandLineFlagRange* CommandLineFlagRangeList::find(const char* name) { |
311143309e73
8122937: [JEP 245] Validate JVM Command-Line Flag Arguments.
gziemski
parents:
diff
changeset
|
349 |
CommandLineFlagRange* found = NULL; |
311143309e73
8122937: [JEP 245] Validate JVM Command-Line Flag Arguments.
gziemski
parents:
diff
changeset
|
350 |
for (int i=0; i<length(); i++) { |
311143309e73
8122937: [JEP 245] Validate JVM Command-Line Flag Arguments.
gziemski
parents:
diff
changeset
|
351 |
CommandLineFlagRange* range = at(i); |
311143309e73
8122937: [JEP 245] Validate JVM Command-Line Flag Arguments.
gziemski
parents:
diff
changeset
|
352 |
if (strcmp(range->name(), name) == 0) { |
311143309e73
8122937: [JEP 245] Validate JVM Command-Line Flag Arguments.
gziemski
parents:
diff
changeset
|
353 |
found = range; |
311143309e73
8122937: [JEP 245] Validate JVM Command-Line Flag Arguments.
gziemski
parents:
diff
changeset
|
354 |
break; |
311143309e73
8122937: [JEP 245] Validate JVM Command-Line Flag Arguments.
gziemski
parents:
diff
changeset
|
355 |
} |
311143309e73
8122937: [JEP 245] Validate JVM Command-Line Flag Arguments.
gziemski
parents:
diff
changeset
|
356 |
} |
311143309e73
8122937: [JEP 245] Validate JVM Command-Line Flag Arguments.
gziemski
parents:
diff
changeset
|
357 |
return found; |
311143309e73
8122937: [JEP 245] Validate JVM Command-Line Flag Arguments.
gziemski
parents:
diff
changeset
|
358 |
} |
311143309e73
8122937: [JEP 245] Validate JVM Command-Line Flag Arguments.
gziemski
parents:
diff
changeset
|
359 |
|
311143309e73
8122937: [JEP 245] Validate JVM Command-Line Flag Arguments.
gziemski
parents:
diff
changeset
|
360 |
void CommandLineFlagRangeList::print(const char* name, outputStream* st, bool unspecified) { |
311143309e73
8122937: [JEP 245] Validate JVM Command-Line Flag Arguments.
gziemski
parents:
diff
changeset
|
361 |
CommandLineFlagRange* range = CommandLineFlagRangeList::find(name); |
311143309e73
8122937: [JEP 245] Validate JVM Command-Line Flag Arguments.
gziemski
parents:
diff
changeset
|
362 |
if (range != NULL) { |
311143309e73
8122937: [JEP 245] Validate JVM Command-Line Flag Arguments.
gziemski
parents:
diff
changeset
|
363 |
range->print(st); |
311143309e73
8122937: [JEP 245] Validate JVM Command-Line Flag Arguments.
gziemski
parents:
diff
changeset
|
364 |
} else if (unspecified == true) { |
311143309e73
8122937: [JEP 245] Validate JVM Command-Line Flag Arguments.
gziemski
parents:
diff
changeset
|
365 |
st->print("[ ... ]"); |
311143309e73
8122937: [JEP 245] Validate JVM Command-Line Flag Arguments.
gziemski
parents:
diff
changeset
|
366 |
} |
311143309e73
8122937: [JEP 245] Validate JVM Command-Line Flag Arguments.
gziemski
parents:
diff
changeset
|
367 |
} |