author | gziemski |
Wed, 30 Mar 2016 14:44:27 -0500 | |
changeset 37208 | aaf76eb8cfd4 |
parent 36189 | 2fbe2434b914 |
child 37466 | 287c4ebd11b0 |
permissions | -rw-r--r-- |
1 | 1 |
/* |
36189
2fbe2434b914
8146187: Print develop and nonproduct flags by -XX:+PrintFlags* options in debug build
ddmitriev
parents:
34185
diff
changeset
|
2 |
* Copyright (c) 1997, 2016, Oracle and/or its affiliates. All rights reserved. |
1 | 3 |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
4 |
* |
|
5 |
* This code is free software; you can redistribute it and/or modify it |
|
6 |
* under the terms of the GNU General Public License version 2 only, as |
|
7 |
* published by the Free Software Foundation. |
|
8 |
* |
|
9 |
* This code is distributed in the hope that it will be useful, but WITHOUT |
|
10 |
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
|
11 |
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
|
12 |
* version 2 for more details (a copy is included in the LICENSE file that |
|
13 |
* accompanied this code). |
|
14 |
* |
|
15 |
* You should have received a copy of the GNU General Public License version |
|
16 |
* 2 along with this work; if not, write to the Free Software Foundation, |
|
17 |
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. |
|
18 |
* |
|
5547
f4b087cbb361
6941466: Oracle rebranding changes for Hotspot repositories
trims
parents:
4579
diff
changeset
|
19 |
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA |
f4b087cbb361
6941466: Oracle rebranding changes for Hotspot repositories
trims
parents:
4579
diff
changeset
|
20 |
* or visit www.oracle.com if you need additional information or have any |
f4b087cbb361
6941466: Oracle rebranding changes for Hotspot repositories
trims
parents:
4579
diff
changeset
|
21 |
* questions. |
1 | 22 |
* |
23 |
*/ |
|
24 |
||
7397 | 25 |
#include "precompiled.hpp" |
26 |
#include "memory/allocation.inline.hpp" |
|
27 |
#include "oops/oop.inline.hpp" |
|
28 |
#include "runtime/arguments.hpp" |
|
29 |
#include "runtime/globals.hpp" |
|
30 |
#include "runtime/globals_extension.hpp" |
|
31371
311143309e73
8122937: [JEP 245] Validate JVM Command-Line Flag Arguments.
gziemski
parents:
31236
diff
changeset
|
31 |
#include "runtime/commandLineFlagConstraintList.hpp" |
311143309e73
8122937: [JEP 245] Validate JVM Command-Line Flag Arguments.
gziemski
parents:
31236
diff
changeset
|
32 |
#include "runtime/commandLineFlagRangeList.hpp" |
27471 | 33 |
#include "runtime/os.hpp" |
31371
311143309e73
8122937: [JEP 245] Validate JVM Command-Line Flag Arguments.
gziemski
parents:
31236
diff
changeset
|
34 |
#include "runtime/sharedRuntime.hpp" |
27684
e0391b2bf625
8064581: Move INCLUDE_ALL_GCS include section to the end of the include list
stefank
parents:
27417
diff
changeset
|
35 |
#include "trace/tracing.hpp" |
30764 | 36 |
#include "utilities/macros.hpp" |
7397 | 37 |
#include "utilities/ostream.hpp" |
38 |
#include "utilities/top.hpp" |
|
15482
470d0b0c09f1
8005915: Unify SERIALGC and INCLUDE_ALTERNATE_GCS
jprovino
parents:
13521
diff
changeset
|
39 |
#if INCLUDE_ALL_GCS |
30764 | 40 |
#include "gc/g1/g1_globals.hpp" |
15482
470d0b0c09f1
8005915: Unify SERIALGC and INCLUDE_ALTERNATE_GCS
jprovino
parents:
13521
diff
changeset
|
41 |
#endif // INCLUDE_ALL_GCS |
7397 | 42 |
#ifdef COMPILER1 |
43 |
#include "c1/c1_globals.hpp" |
|
44 |
#endif |
|
33160
c59f1676d27e
8136421: JEP 243: Java-Level JVM Compiler Interface
twisti
parents:
32374
diff
changeset
|
45 |
#if INCLUDE_JVMCI |
c59f1676d27e
8136421: JEP 243: Java-Level JVM Compiler Interface
twisti
parents:
32374
diff
changeset
|
46 |
#include "jvmci/jvmci_globals.hpp" |
c59f1676d27e
8136421: JEP 243: Java-Level JVM Compiler Interface
twisti
parents:
32374
diff
changeset
|
47 |
#endif |
7397 | 48 |
#ifdef COMPILER2 |
49 |
#include "opto/c2_globals.hpp" |
|
50 |
#endif |
|
51 |
#ifdef SHARK |
|
52 |
#include "shark/shark_globals.hpp" |
|
53 |
#endif |
|
1 | 54 |
|
31371
311143309e73
8122937: [JEP 245] Validate JVM Command-Line Flag Arguments.
gziemski
parents:
31236
diff
changeset
|
55 |
RUNTIME_FLAGS(MATERIALIZE_DEVELOPER_FLAG, \ |
311143309e73
8122937: [JEP 245] Validate JVM Command-Line Flag Arguments.
gziemski
parents:
31236
diff
changeset
|
56 |
MATERIALIZE_PD_DEVELOPER_FLAG, \ |
311143309e73
8122937: [JEP 245] Validate JVM Command-Line Flag Arguments.
gziemski
parents:
31236
diff
changeset
|
57 |
MATERIALIZE_PRODUCT_FLAG, \ |
311143309e73
8122937: [JEP 245] Validate JVM Command-Line Flag Arguments.
gziemski
parents:
31236
diff
changeset
|
58 |
MATERIALIZE_PD_PRODUCT_FLAG, \ |
311143309e73
8122937: [JEP 245] Validate JVM Command-Line Flag Arguments.
gziemski
parents:
31236
diff
changeset
|
59 |
MATERIALIZE_DIAGNOSTIC_FLAG, \ |
311143309e73
8122937: [JEP 245] Validate JVM Command-Line Flag Arguments.
gziemski
parents:
31236
diff
changeset
|
60 |
MATERIALIZE_EXPERIMENTAL_FLAG, \ |
11167
3931428f62ae
7116730: Revert 7116481: Commercial features in Hotspot must be gated by a switch
phh
parents:
11166
diff
changeset
|
61 |
MATERIALIZE_NOTPRODUCT_FLAG, \ |
31371
311143309e73
8122937: [JEP 245] Validate JVM Command-Line Flag Arguments.
gziemski
parents:
31236
diff
changeset
|
62 |
MATERIALIZE_MANAGEABLE_FLAG, \ |
311143309e73
8122937: [JEP 245] Validate JVM Command-Line Flag Arguments.
gziemski
parents:
31236
diff
changeset
|
63 |
MATERIALIZE_PRODUCT_RW_FLAG, \ |
311143309e73
8122937: [JEP 245] Validate JVM Command-Line Flag Arguments.
gziemski
parents:
31236
diff
changeset
|
64 |
MATERIALIZE_LP64_PRODUCT_FLAG, \ |
311143309e73
8122937: [JEP 245] Validate JVM Command-Line Flag Arguments.
gziemski
parents:
31236
diff
changeset
|
65 |
IGNORE_RANGE, \ |
311143309e73
8122937: [JEP 245] Validate JVM Command-Line Flag Arguments.
gziemski
parents:
31236
diff
changeset
|
66 |
IGNORE_CONSTRAINT) |
1 | 67 |
|
31371
311143309e73
8122937: [JEP 245] Validate JVM Command-Line Flag Arguments.
gziemski
parents:
31236
diff
changeset
|
68 |
RUNTIME_OS_FLAGS(MATERIALIZE_DEVELOPER_FLAG, \ |
311143309e73
8122937: [JEP 245] Validate JVM Command-Line Flag Arguments.
gziemski
parents:
31236
diff
changeset
|
69 |
MATERIALIZE_PD_DEVELOPER_FLAG, \ |
311143309e73
8122937: [JEP 245] Validate JVM Command-Line Flag Arguments.
gziemski
parents:
31236
diff
changeset
|
70 |
MATERIALIZE_PRODUCT_FLAG, \ |
311143309e73
8122937: [JEP 245] Validate JVM Command-Line Flag Arguments.
gziemski
parents:
31236
diff
changeset
|
71 |
MATERIALIZE_PD_PRODUCT_FLAG, \ |
311143309e73
8122937: [JEP 245] Validate JVM Command-Line Flag Arguments.
gziemski
parents:
31236
diff
changeset
|
72 |
MATERIALIZE_DIAGNOSTIC_FLAG, \ |
311143309e73
8122937: [JEP 245] Validate JVM Command-Line Flag Arguments.
gziemski
parents:
31236
diff
changeset
|
73 |
MATERIALIZE_NOTPRODUCT_FLAG, \ |
311143309e73
8122937: [JEP 245] Validate JVM Command-Line Flag Arguments.
gziemski
parents:
31236
diff
changeset
|
74 |
IGNORE_RANGE, \ |
311143309e73
8122937: [JEP 245] Validate JVM Command-Line Flag Arguments.
gziemski
parents:
31236
diff
changeset
|
75 |
IGNORE_CONSTRAINT) |
1 | 76 |
|
31371
311143309e73
8122937: [JEP 245] Validate JVM Command-Line Flag Arguments.
gziemski
parents:
31236
diff
changeset
|
77 |
ARCH_FLAGS(MATERIALIZE_DEVELOPER_FLAG, \ |
311143309e73
8122937: [JEP 245] Validate JVM Command-Line Flag Arguments.
gziemski
parents:
31236
diff
changeset
|
78 |
MATERIALIZE_PRODUCT_FLAG, \ |
311143309e73
8122937: [JEP 245] Validate JVM Command-Line Flag Arguments.
gziemski
parents:
31236
diff
changeset
|
79 |
MATERIALIZE_DIAGNOSTIC_FLAG, \ |
311143309e73
8122937: [JEP 245] Validate JVM Command-Line Flag Arguments.
gziemski
parents:
31236
diff
changeset
|
80 |
MATERIALIZE_EXPERIMENTAL_FLAG, \ |
311143309e73
8122937: [JEP 245] Validate JVM Command-Line Flag Arguments.
gziemski
parents:
31236
diff
changeset
|
81 |
MATERIALIZE_NOTPRODUCT_FLAG, \ |
311143309e73
8122937: [JEP 245] Validate JVM Command-Line Flag Arguments.
gziemski
parents:
31236
diff
changeset
|
82 |
IGNORE_RANGE, \ |
311143309e73
8122937: [JEP 245] Validate JVM Command-Line Flag Arguments.
gziemski
parents:
31236
diff
changeset
|
83 |
IGNORE_CONSTRAINT) |
13521
97a23be06f4e
6677625: Move platform specific flags from globals.hpp to globals_<arch>.hpp
twisti
parents:
13195
diff
changeset
|
84 |
|
11183
a81bb5c041d3
7117389: Add a framework for vendor-specific command line switch extensions to Hotspot
phh
parents:
11167
diff
changeset
|
85 |
MATERIALIZE_FLAGS_EXT |
a81bb5c041d3
7117389: Add a framework for vendor-specific command line switch extensions to Hotspot
phh
parents:
11167
diff
changeset
|
86 |
|
37208
aaf76eb8cfd4
8142510: -XX:+PrintFlagsRanges should print default range value for those flags that have constraint and an implicit range.
gziemski
parents:
36189
diff
changeset
|
87 |
#define DEFAULT_RANGE_STR_CHUNK_SIZE 64 |
aaf76eb8cfd4
8142510: -XX:+PrintFlagsRanges should print default range value for those flags that have constraint and an implicit range.
gziemski
parents:
36189
diff
changeset
|
88 |
static char* create_range_str(const char *fmt, ...) { |
aaf76eb8cfd4
8142510: -XX:+PrintFlagsRanges should print default range value for those flags that have constraint and an implicit range.
gziemski
parents:
36189
diff
changeset
|
89 |
static size_t string_length = DEFAULT_RANGE_STR_CHUNK_SIZE; |
aaf76eb8cfd4
8142510: -XX:+PrintFlagsRanges should print default range value for those flags that have constraint and an implicit range.
gziemski
parents:
36189
diff
changeset
|
90 |
static char* range_string = NEW_C_HEAP_ARRAY(char, string_length, mtLogging); |
aaf76eb8cfd4
8142510: -XX:+PrintFlagsRanges should print default range value for those flags that have constraint and an implicit range.
gziemski
parents:
36189
diff
changeset
|
91 |
|
aaf76eb8cfd4
8142510: -XX:+PrintFlagsRanges should print default range value for those flags that have constraint and an implicit range.
gziemski
parents:
36189
diff
changeset
|
92 |
int size_needed = 0; |
aaf76eb8cfd4
8142510: -XX:+PrintFlagsRanges should print default range value for those flags that have constraint and an implicit range.
gziemski
parents:
36189
diff
changeset
|
93 |
do { |
aaf76eb8cfd4
8142510: -XX:+PrintFlagsRanges should print default range value for those flags that have constraint and an implicit range.
gziemski
parents:
36189
diff
changeset
|
94 |
va_list args; |
aaf76eb8cfd4
8142510: -XX:+PrintFlagsRanges should print default range value for those flags that have constraint and an implicit range.
gziemski
parents:
36189
diff
changeset
|
95 |
va_start(args, fmt); |
aaf76eb8cfd4
8142510: -XX:+PrintFlagsRanges should print default range value for those flags that have constraint and an implicit range.
gziemski
parents:
36189
diff
changeset
|
96 |
size_needed = jio_vsnprintf(range_string, string_length, fmt, args); |
aaf76eb8cfd4
8142510: -XX:+PrintFlagsRanges should print default range value for those flags that have constraint and an implicit range.
gziemski
parents:
36189
diff
changeset
|
97 |
va_end(args); |
aaf76eb8cfd4
8142510: -XX:+PrintFlagsRanges should print default range value for those flags that have constraint and an implicit range.
gziemski
parents:
36189
diff
changeset
|
98 |
|
aaf76eb8cfd4
8142510: -XX:+PrintFlagsRanges should print default range value for those flags that have constraint and an implicit range.
gziemski
parents:
36189
diff
changeset
|
99 |
if (size_needed < 0) { |
aaf76eb8cfd4
8142510: -XX:+PrintFlagsRanges should print default range value for those flags that have constraint and an implicit range.
gziemski
parents:
36189
diff
changeset
|
100 |
string_length += DEFAULT_RANGE_STR_CHUNK_SIZE; |
aaf76eb8cfd4
8142510: -XX:+PrintFlagsRanges should print default range value for those flags that have constraint and an implicit range.
gziemski
parents:
36189
diff
changeset
|
101 |
range_string = REALLOC_C_HEAP_ARRAY(char, range_string, string_length, mtLogging); |
aaf76eb8cfd4
8142510: -XX:+PrintFlagsRanges should print default range value for those flags that have constraint and an implicit range.
gziemski
parents:
36189
diff
changeset
|
102 |
guarantee(range_string != NULL, "create_range_str string should not be NULL"); |
aaf76eb8cfd4
8142510: -XX:+PrintFlagsRanges should print default range value for those flags that have constraint and an implicit range.
gziemski
parents:
36189
diff
changeset
|
103 |
} |
aaf76eb8cfd4
8142510: -XX:+PrintFlagsRanges should print default range value for those flags that have constraint and an implicit range.
gziemski
parents:
36189
diff
changeset
|
104 |
} while (size_needed < 0); |
aaf76eb8cfd4
8142510: -XX:+PrintFlagsRanges should print default range value for those flags that have constraint and an implicit range.
gziemski
parents:
36189
diff
changeset
|
105 |
|
aaf76eb8cfd4
8142510: -XX:+PrintFlagsRanges should print default range value for those flags that have constraint and an implicit range.
gziemski
parents:
36189
diff
changeset
|
106 |
return range_string; |
aaf76eb8cfd4
8142510: -XX:+PrintFlagsRanges should print default range value for those flags that have constraint and an implicit range.
gziemski
parents:
36189
diff
changeset
|
107 |
} |
aaf76eb8cfd4
8142510: -XX:+PrintFlagsRanges should print default range value for those flags that have constraint and an implicit range.
gziemski
parents:
36189
diff
changeset
|
108 |
|
aaf76eb8cfd4
8142510: -XX:+PrintFlagsRanges should print default range value for those flags that have constraint and an implicit range.
gziemski
parents:
36189
diff
changeset
|
109 |
const char* Flag::get_int_default_range_str() { |
aaf76eb8cfd4
8142510: -XX:+PrintFlagsRanges should print default range value for those flags that have constraint and an implicit range.
gziemski
parents:
36189
diff
changeset
|
110 |
return create_range_str("[ " INT32_FORMAT_W(-25) " ... " INT32_FORMAT_W(25) " ]", INT_MIN, INT_MAX); |
aaf76eb8cfd4
8142510: -XX:+PrintFlagsRanges should print default range value for those flags that have constraint and an implicit range.
gziemski
parents:
36189
diff
changeset
|
111 |
} |
aaf76eb8cfd4
8142510: -XX:+PrintFlagsRanges should print default range value for those flags that have constraint and an implicit range.
gziemski
parents:
36189
diff
changeset
|
112 |
|
aaf76eb8cfd4
8142510: -XX:+PrintFlagsRanges should print default range value for those flags that have constraint and an implicit range.
gziemski
parents:
36189
diff
changeset
|
113 |
const char* Flag::get_uint_default_range_str() { |
aaf76eb8cfd4
8142510: -XX:+PrintFlagsRanges should print default range value for those flags that have constraint and an implicit range.
gziemski
parents:
36189
diff
changeset
|
114 |
return create_range_str("[ " UINT32_FORMAT_W(-25) " ... " UINT32_FORMAT_W(25) " ]", 0, UINT_MAX); |
aaf76eb8cfd4
8142510: -XX:+PrintFlagsRanges should print default range value for those flags that have constraint and an implicit range.
gziemski
parents:
36189
diff
changeset
|
115 |
} |
aaf76eb8cfd4
8142510: -XX:+PrintFlagsRanges should print default range value for those flags that have constraint and an implicit range.
gziemski
parents:
36189
diff
changeset
|
116 |
|
aaf76eb8cfd4
8142510: -XX:+PrintFlagsRanges should print default range value for those flags that have constraint and an implicit range.
gziemski
parents:
36189
diff
changeset
|
117 |
const char* Flag::get_intx_default_range_str() { |
aaf76eb8cfd4
8142510: -XX:+PrintFlagsRanges should print default range value for those flags that have constraint and an implicit range.
gziemski
parents:
36189
diff
changeset
|
118 |
return create_range_str("[ " INTX_FORMAT_W(-25) " ... " INTX_FORMAT_W(25) " ]", min_intx, max_intx); |
aaf76eb8cfd4
8142510: -XX:+PrintFlagsRanges should print default range value for those flags that have constraint and an implicit range.
gziemski
parents:
36189
diff
changeset
|
119 |
} |
aaf76eb8cfd4
8142510: -XX:+PrintFlagsRanges should print default range value for those flags that have constraint and an implicit range.
gziemski
parents:
36189
diff
changeset
|
120 |
|
aaf76eb8cfd4
8142510: -XX:+PrintFlagsRanges should print default range value for those flags that have constraint and an implicit range.
gziemski
parents:
36189
diff
changeset
|
121 |
const char* Flag::get_uintx_default_range_str() { |
aaf76eb8cfd4
8142510: -XX:+PrintFlagsRanges should print default range value for those flags that have constraint and an implicit range.
gziemski
parents:
36189
diff
changeset
|
122 |
return create_range_str("[ " UINTX_FORMAT_W(-25) " ... " UINTX_FORMAT_W(25) " ]", 0, max_uintx); |
aaf76eb8cfd4
8142510: -XX:+PrintFlagsRanges should print default range value for those flags that have constraint and an implicit range.
gziemski
parents:
36189
diff
changeset
|
123 |
} |
aaf76eb8cfd4
8142510: -XX:+PrintFlagsRanges should print default range value for those flags that have constraint and an implicit range.
gziemski
parents:
36189
diff
changeset
|
124 |
|
aaf76eb8cfd4
8142510: -XX:+PrintFlagsRanges should print default range value for those flags that have constraint and an implicit range.
gziemski
parents:
36189
diff
changeset
|
125 |
const char* Flag::get_uint64_t_default_range_str() { |
aaf76eb8cfd4
8142510: -XX:+PrintFlagsRanges should print default range value for those flags that have constraint and an implicit range.
gziemski
parents:
36189
diff
changeset
|
126 |
return create_range_str("[ " UINT64_FORMAT_W(-25) " ... " UINT64_FORMAT_W(25) " ]", 0, uint64_t(max_juint)); |
aaf76eb8cfd4
8142510: -XX:+PrintFlagsRanges should print default range value for those flags that have constraint and an implicit range.
gziemski
parents:
36189
diff
changeset
|
127 |
} |
aaf76eb8cfd4
8142510: -XX:+PrintFlagsRanges should print default range value for those flags that have constraint and an implicit range.
gziemski
parents:
36189
diff
changeset
|
128 |
|
aaf76eb8cfd4
8142510: -XX:+PrintFlagsRanges should print default range value for those flags that have constraint and an implicit range.
gziemski
parents:
36189
diff
changeset
|
129 |
const char* Flag::get_size_t_default_range_str() { |
aaf76eb8cfd4
8142510: -XX:+PrintFlagsRanges should print default range value for those flags that have constraint and an implicit range.
gziemski
parents:
36189
diff
changeset
|
130 |
return create_range_str("[ " SIZE_FORMAT_W(-25) " ... " SIZE_FORMAT_W(25) " ]", 0, SIZE_MAX); |
aaf76eb8cfd4
8142510: -XX:+PrintFlagsRanges should print default range value for those flags that have constraint and an implicit range.
gziemski
parents:
36189
diff
changeset
|
131 |
} |
aaf76eb8cfd4
8142510: -XX:+PrintFlagsRanges should print default range value for those flags that have constraint and an implicit range.
gziemski
parents:
36189
diff
changeset
|
132 |
|
aaf76eb8cfd4
8142510: -XX:+PrintFlagsRanges should print default range value for those flags that have constraint and an implicit range.
gziemski
parents:
36189
diff
changeset
|
133 |
const char* Flag::get_double_default_range_str() { |
aaf76eb8cfd4
8142510: -XX:+PrintFlagsRanges should print default range value for those flags that have constraint and an implicit range.
gziemski
parents:
36189
diff
changeset
|
134 |
return create_range_str("[ %-25.3f ... %25.3f ]", DBL_MIN, DBL_MAX); |
aaf76eb8cfd4
8142510: -XX:+PrintFlagsRanges should print default range value for those flags that have constraint and an implicit range.
gziemski
parents:
36189
diff
changeset
|
135 |
} |
aaf76eb8cfd4
8142510: -XX:+PrintFlagsRanges should print default range value for those flags that have constraint and an implicit range.
gziemski
parents:
36189
diff
changeset
|
136 |
|
22518
e23c5545e376
8027314: Java should recognize Diagnostic options if -XX:+UnlockDiagnosticVMOptions is not specified and print an informative message
ccheung
parents:
22194
diff
changeset
|
137 |
static bool is_product_build() { |
e23c5545e376
8027314: Java should recognize Diagnostic options if -XX:+UnlockDiagnosticVMOptions is not specified and print an informative message
ccheung
parents:
22194
diff
changeset
|
138 |
#ifdef PRODUCT |
e23c5545e376
8027314: Java should recognize Diagnostic options if -XX:+UnlockDiagnosticVMOptions is not specified and print an informative message
ccheung
parents:
22194
diff
changeset
|
139 |
return true; |
e23c5545e376
8027314: Java should recognize Diagnostic options if -XX:+UnlockDiagnosticVMOptions is not specified and print an informative message
ccheung
parents:
22194
diff
changeset
|
140 |
#else |
e23c5545e376
8027314: Java should recognize Diagnostic options if -XX:+UnlockDiagnosticVMOptions is not specified and print an informative message
ccheung
parents:
22194
diff
changeset
|
141 |
return false; |
e23c5545e376
8027314: Java should recognize Diagnostic options if -XX:+UnlockDiagnosticVMOptions is not specified and print an informative message
ccheung
parents:
22194
diff
changeset
|
142 |
#endif |
e23c5545e376
8027314: Java should recognize Diagnostic options if -XX:+UnlockDiagnosticVMOptions is not specified and print an informative message
ccheung
parents:
22194
diff
changeset
|
143 |
} |
e23c5545e376
8027314: Java should recognize Diagnostic options if -XX:+UnlockDiagnosticVMOptions is not specified and print an informative message
ccheung
parents:
22194
diff
changeset
|
144 |
|
20288
e2d549f40de9
8024545: make develop and notproduct flag values available in product builds
twisti
parents:
19710
diff
changeset
|
145 |
void Flag::check_writable() { |
e2d549f40de9
8024545: make develop and notproduct flag values available in product builds
twisti
parents:
19710
diff
changeset
|
146 |
if (is_constant_in_binary()) { |
33105
294e48b4f704
8080775: Better argument formatting for assert() and friends
david
parents:
32374
diff
changeset
|
147 |
fatal("flag is constant: %s", _name); |
20288
e2d549f40de9
8024545: make develop and notproduct flag values available in product builds
twisti
parents:
19710
diff
changeset
|
148 |
} |
e2d549f40de9
8024545: make develop and notproduct flag values available in product builds
twisti
parents:
19710
diff
changeset
|
149 |
} |
e2d549f40de9
8024545: make develop and notproduct flag values available in product builds
twisti
parents:
19710
diff
changeset
|
150 |
|
e2d549f40de9
8024545: make develop and notproduct flag values available in product builds
twisti
parents:
19710
diff
changeset
|
151 |
bool Flag::is_bool() const { |
e2d549f40de9
8024545: make develop and notproduct flag values available in product builds
twisti
parents:
19710
diff
changeset
|
152 |
return strcmp(_type, "bool") == 0; |
e2d549f40de9
8024545: make develop and notproduct flag values available in product builds
twisti
parents:
19710
diff
changeset
|
153 |
} |
e2d549f40de9
8024545: make develop and notproduct flag values available in product builds
twisti
parents:
19710
diff
changeset
|
154 |
|
e2d549f40de9
8024545: make develop and notproduct flag values available in product builds
twisti
parents:
19710
diff
changeset
|
155 |
bool Flag::get_bool() const { |
e2d549f40de9
8024545: make develop and notproduct flag values available in product builds
twisti
parents:
19710
diff
changeset
|
156 |
return *((bool*) _addr); |
e2d549f40de9
8024545: make develop and notproduct flag values available in product builds
twisti
parents:
19710
diff
changeset
|
157 |
} |
e2d549f40de9
8024545: make develop and notproduct flag values available in product builds
twisti
parents:
19710
diff
changeset
|
158 |
|
e2d549f40de9
8024545: make develop and notproduct flag values available in product builds
twisti
parents:
19710
diff
changeset
|
159 |
void Flag::set_bool(bool value) { |
e2d549f40de9
8024545: make develop and notproduct flag values available in product builds
twisti
parents:
19710
diff
changeset
|
160 |
check_writable(); |
e2d549f40de9
8024545: make develop and notproduct flag values available in product builds
twisti
parents:
19710
diff
changeset
|
161 |
*((bool*) _addr) = value; |
e2d549f40de9
8024545: make develop and notproduct flag values available in product builds
twisti
parents:
19710
diff
changeset
|
162 |
} |
e2d549f40de9
8024545: make develop and notproduct flag values available in product builds
twisti
parents:
19710
diff
changeset
|
163 |
|
31236 | 164 |
bool Flag::is_int() const { |
165 |
return strcmp(_type, "int") == 0; |
|
166 |
} |
|
167 |
||
168 |
int Flag::get_int() const { |
|
169 |
return *((int*) _addr); |
|
170 |
} |
|
171 |
||
172 |
void Flag::set_int(int value) { |
|
173 |
check_writable(); |
|
174 |
*((int*) _addr) = value; |
|
175 |
} |
|
176 |
||
177 |
bool Flag::is_uint() const { |
|
178 |
return strcmp(_type, "uint") == 0; |
|
179 |
} |
|
180 |
||
181 |
uint Flag::get_uint() const { |
|
182 |
return *((uint*) _addr); |
|
183 |
} |
|
184 |
||
185 |
void Flag::set_uint(uint value) { |
|
186 |
check_writable(); |
|
187 |
*((uint*) _addr) = value; |
|
188 |
} |
|
189 |
||
20288
e2d549f40de9
8024545: make develop and notproduct flag values available in product builds
twisti
parents:
19710
diff
changeset
|
190 |
bool Flag::is_intx() const { |
e2d549f40de9
8024545: make develop and notproduct flag values available in product builds
twisti
parents:
19710
diff
changeset
|
191 |
return strcmp(_type, "intx") == 0; |
e2d549f40de9
8024545: make develop and notproduct flag values available in product builds
twisti
parents:
19710
diff
changeset
|
192 |
} |
e2d549f40de9
8024545: make develop and notproduct flag values available in product builds
twisti
parents:
19710
diff
changeset
|
193 |
|
e2d549f40de9
8024545: make develop and notproduct flag values available in product builds
twisti
parents:
19710
diff
changeset
|
194 |
intx Flag::get_intx() const { |
e2d549f40de9
8024545: make develop and notproduct flag values available in product builds
twisti
parents:
19710
diff
changeset
|
195 |
return *((intx*) _addr); |
e2d549f40de9
8024545: make develop and notproduct flag values available in product builds
twisti
parents:
19710
diff
changeset
|
196 |
} |
e2d549f40de9
8024545: make develop and notproduct flag values available in product builds
twisti
parents:
19710
diff
changeset
|
197 |
|
e2d549f40de9
8024545: make develop and notproduct flag values available in product builds
twisti
parents:
19710
diff
changeset
|
198 |
void Flag::set_intx(intx value) { |
e2d549f40de9
8024545: make develop and notproduct flag values available in product builds
twisti
parents:
19710
diff
changeset
|
199 |
check_writable(); |
e2d549f40de9
8024545: make develop and notproduct flag values available in product builds
twisti
parents:
19710
diff
changeset
|
200 |
*((intx*) _addr) = value; |
e2d549f40de9
8024545: make develop and notproduct flag values available in product builds
twisti
parents:
19710
diff
changeset
|
201 |
} |
e2d549f40de9
8024545: make develop and notproduct flag values available in product builds
twisti
parents:
19710
diff
changeset
|
202 |
|
e2d549f40de9
8024545: make develop and notproduct flag values available in product builds
twisti
parents:
19710
diff
changeset
|
203 |
bool Flag::is_uintx() const { |
e2d549f40de9
8024545: make develop and notproduct flag values available in product builds
twisti
parents:
19710
diff
changeset
|
204 |
return strcmp(_type, "uintx") == 0; |
e2d549f40de9
8024545: make develop and notproduct flag values available in product builds
twisti
parents:
19710
diff
changeset
|
205 |
} |
e2d549f40de9
8024545: make develop and notproduct flag values available in product builds
twisti
parents:
19710
diff
changeset
|
206 |
|
e2d549f40de9
8024545: make develop and notproduct flag values available in product builds
twisti
parents:
19710
diff
changeset
|
207 |
uintx Flag::get_uintx() const { |
e2d549f40de9
8024545: make develop and notproduct flag values available in product builds
twisti
parents:
19710
diff
changeset
|
208 |
return *((uintx*) _addr); |
e2d549f40de9
8024545: make develop and notproduct flag values available in product builds
twisti
parents:
19710
diff
changeset
|
209 |
} |
e2d549f40de9
8024545: make develop and notproduct flag values available in product builds
twisti
parents:
19710
diff
changeset
|
210 |
|
e2d549f40de9
8024545: make develop and notproduct flag values available in product builds
twisti
parents:
19710
diff
changeset
|
211 |
void Flag::set_uintx(uintx value) { |
e2d549f40de9
8024545: make develop and notproduct flag values available in product builds
twisti
parents:
19710
diff
changeset
|
212 |
check_writable(); |
e2d549f40de9
8024545: make develop and notproduct flag values available in product builds
twisti
parents:
19710
diff
changeset
|
213 |
*((uintx*) _addr) = value; |
e2d549f40de9
8024545: make develop and notproduct flag values available in product builds
twisti
parents:
19710
diff
changeset
|
214 |
} |
e2d549f40de9
8024545: make develop and notproduct flag values available in product builds
twisti
parents:
19710
diff
changeset
|
215 |
|
e2d549f40de9
8024545: make develop and notproduct flag values available in product builds
twisti
parents:
19710
diff
changeset
|
216 |
bool Flag::is_uint64_t() const { |
e2d549f40de9
8024545: make develop and notproduct flag values available in product builds
twisti
parents:
19710
diff
changeset
|
217 |
return strcmp(_type, "uint64_t") == 0; |
e2d549f40de9
8024545: make develop and notproduct flag values available in product builds
twisti
parents:
19710
diff
changeset
|
218 |
} |
e2d549f40de9
8024545: make develop and notproduct flag values available in product builds
twisti
parents:
19710
diff
changeset
|
219 |
|
e2d549f40de9
8024545: make develop and notproduct flag values available in product builds
twisti
parents:
19710
diff
changeset
|
220 |
uint64_t Flag::get_uint64_t() const { |
e2d549f40de9
8024545: make develop and notproduct flag values available in product builds
twisti
parents:
19710
diff
changeset
|
221 |
return *((uint64_t*) _addr); |
e2d549f40de9
8024545: make develop and notproduct flag values available in product builds
twisti
parents:
19710
diff
changeset
|
222 |
} |
e2d549f40de9
8024545: make develop and notproduct flag values available in product builds
twisti
parents:
19710
diff
changeset
|
223 |
|
e2d549f40de9
8024545: make develop and notproduct flag values available in product builds
twisti
parents:
19710
diff
changeset
|
224 |
void Flag::set_uint64_t(uint64_t value) { |
e2d549f40de9
8024545: make develop and notproduct flag values available in product builds
twisti
parents:
19710
diff
changeset
|
225 |
check_writable(); |
e2d549f40de9
8024545: make develop and notproduct flag values available in product builds
twisti
parents:
19710
diff
changeset
|
226 |
*((uint64_t*) _addr) = value; |
e2d549f40de9
8024545: make develop and notproduct flag values available in product builds
twisti
parents:
19710
diff
changeset
|
227 |
} |
e2d549f40de9
8024545: make develop and notproduct flag values available in product builds
twisti
parents:
19710
diff
changeset
|
228 |
|
25959 | 229 |
bool Flag::is_size_t() const { |
230 |
return strcmp(_type, "size_t") == 0; |
|
231 |
} |
|
232 |
||
233 |
size_t Flag::get_size_t() const { |
|
234 |
return *((size_t*) _addr); |
|
235 |
} |
|
236 |
||
237 |
void Flag::set_size_t(size_t value) { |
|
238 |
check_writable(); |
|
239 |
*((size_t*) _addr) = value; |
|
240 |
} |
|
241 |
||
20288
e2d549f40de9
8024545: make develop and notproduct flag values available in product builds
twisti
parents:
19710
diff
changeset
|
242 |
bool Flag::is_double() const { |
e2d549f40de9
8024545: make develop and notproduct flag values available in product builds
twisti
parents:
19710
diff
changeset
|
243 |
return strcmp(_type, "double") == 0; |
e2d549f40de9
8024545: make develop and notproduct flag values available in product builds
twisti
parents:
19710
diff
changeset
|
244 |
} |
e2d549f40de9
8024545: make develop and notproduct flag values available in product builds
twisti
parents:
19710
diff
changeset
|
245 |
|
e2d549f40de9
8024545: make develop and notproduct flag values available in product builds
twisti
parents:
19710
diff
changeset
|
246 |
double Flag::get_double() const { |
e2d549f40de9
8024545: make develop and notproduct flag values available in product builds
twisti
parents:
19710
diff
changeset
|
247 |
return *((double*) _addr); |
e2d549f40de9
8024545: make develop and notproduct flag values available in product builds
twisti
parents:
19710
diff
changeset
|
248 |
} |
e2d549f40de9
8024545: make develop and notproduct flag values available in product builds
twisti
parents:
19710
diff
changeset
|
249 |
|
e2d549f40de9
8024545: make develop and notproduct flag values available in product builds
twisti
parents:
19710
diff
changeset
|
250 |
void Flag::set_double(double value) { |
e2d549f40de9
8024545: make develop and notproduct flag values available in product builds
twisti
parents:
19710
diff
changeset
|
251 |
check_writable(); |
e2d549f40de9
8024545: make develop and notproduct flag values available in product builds
twisti
parents:
19710
diff
changeset
|
252 |
*((double*) _addr) = value; |
e2d549f40de9
8024545: make develop and notproduct flag values available in product builds
twisti
parents:
19710
diff
changeset
|
253 |
} |
e2d549f40de9
8024545: make develop and notproduct flag values available in product builds
twisti
parents:
19710
diff
changeset
|
254 |
|
e2d549f40de9
8024545: make develop and notproduct flag values available in product builds
twisti
parents:
19710
diff
changeset
|
255 |
bool Flag::is_ccstr() const { |
e2d549f40de9
8024545: make develop and notproduct flag values available in product builds
twisti
parents:
19710
diff
changeset
|
256 |
return strcmp(_type, "ccstr") == 0 || strcmp(_type, "ccstrlist") == 0; |
e2d549f40de9
8024545: make develop and notproduct flag values available in product builds
twisti
parents:
19710
diff
changeset
|
257 |
} |
e2d549f40de9
8024545: make develop and notproduct flag values available in product builds
twisti
parents:
19710
diff
changeset
|
258 |
|
e2d549f40de9
8024545: make develop and notproduct flag values available in product builds
twisti
parents:
19710
diff
changeset
|
259 |
bool Flag::ccstr_accumulates() const { |
e2d549f40de9
8024545: make develop and notproduct flag values available in product builds
twisti
parents:
19710
diff
changeset
|
260 |
return strcmp(_type, "ccstrlist") == 0; |
e2d549f40de9
8024545: make develop and notproduct flag values available in product builds
twisti
parents:
19710
diff
changeset
|
261 |
} |
e2d549f40de9
8024545: make develop and notproduct flag values available in product builds
twisti
parents:
19710
diff
changeset
|
262 |
|
e2d549f40de9
8024545: make develop and notproduct flag values available in product builds
twisti
parents:
19710
diff
changeset
|
263 |
ccstr Flag::get_ccstr() const { |
e2d549f40de9
8024545: make develop and notproduct flag values available in product builds
twisti
parents:
19710
diff
changeset
|
264 |
return *((ccstr*) _addr); |
e2d549f40de9
8024545: make develop and notproduct flag values available in product builds
twisti
parents:
19710
diff
changeset
|
265 |
} |
e2d549f40de9
8024545: make develop and notproduct flag values available in product builds
twisti
parents:
19710
diff
changeset
|
266 |
|
e2d549f40de9
8024545: make develop and notproduct flag values available in product builds
twisti
parents:
19710
diff
changeset
|
267 |
void Flag::set_ccstr(ccstr value) { |
e2d549f40de9
8024545: make develop and notproduct flag values available in product builds
twisti
parents:
19710
diff
changeset
|
268 |
check_writable(); |
e2d549f40de9
8024545: make develop and notproduct flag values available in product builds
twisti
parents:
19710
diff
changeset
|
269 |
*((ccstr*) _addr) = value; |
e2d549f40de9
8024545: make develop and notproduct flag values available in product builds
twisti
parents:
19710
diff
changeset
|
270 |
} |
e2d549f40de9
8024545: make develop and notproduct flag values available in product builds
twisti
parents:
19710
diff
changeset
|
271 |
|
e2d549f40de9
8024545: make develop and notproduct flag values available in product builds
twisti
parents:
19710
diff
changeset
|
272 |
|
e2d549f40de9
8024545: make develop and notproduct flag values available in product builds
twisti
parents:
19710
diff
changeset
|
273 |
Flag::Flags Flag::get_origin() { |
e2d549f40de9
8024545: make develop and notproduct flag values available in product builds
twisti
parents:
19710
diff
changeset
|
274 |
return Flags(_flags & VALUE_ORIGIN_MASK); |
e2d549f40de9
8024545: make develop and notproduct flag values available in product builds
twisti
parents:
19710
diff
changeset
|
275 |
} |
e2d549f40de9
8024545: make develop and notproduct flag values available in product builds
twisti
parents:
19710
diff
changeset
|
276 |
|
e2d549f40de9
8024545: make develop and notproduct flag values available in product builds
twisti
parents:
19710
diff
changeset
|
277 |
void Flag::set_origin(Flags origin) { |
e2d549f40de9
8024545: make develop and notproduct flag values available in product builds
twisti
parents:
19710
diff
changeset
|
278 |
assert((origin & VALUE_ORIGIN_MASK) == origin, "sanity"); |
e2d549f40de9
8024545: make develop and notproduct flag values available in product builds
twisti
parents:
19710
diff
changeset
|
279 |
_flags = Flags((_flags & ~VALUE_ORIGIN_MASK) | origin); |
e2d549f40de9
8024545: make develop and notproduct flag values available in product builds
twisti
parents:
19710
diff
changeset
|
280 |
} |
e2d549f40de9
8024545: make develop and notproduct flag values available in product builds
twisti
parents:
19710
diff
changeset
|
281 |
|
e2d549f40de9
8024545: make develop and notproduct flag values available in product builds
twisti
parents:
19710
diff
changeset
|
282 |
bool Flag::is_default() { |
e2d549f40de9
8024545: make develop and notproduct flag values available in product builds
twisti
parents:
19710
diff
changeset
|
283 |
return (get_origin() == DEFAULT); |
e2d549f40de9
8024545: make develop and notproduct flag values available in product builds
twisti
parents:
19710
diff
changeset
|
284 |
} |
e2d549f40de9
8024545: make develop and notproduct flag values available in product builds
twisti
parents:
19710
diff
changeset
|
285 |
|
e2d549f40de9
8024545: make develop and notproduct flag values available in product builds
twisti
parents:
19710
diff
changeset
|
286 |
bool Flag::is_ergonomic() { |
e2d549f40de9
8024545: make develop and notproduct flag values available in product builds
twisti
parents:
19710
diff
changeset
|
287 |
return (get_origin() == ERGONOMIC); |
e2d549f40de9
8024545: make develop and notproduct flag values available in product builds
twisti
parents:
19710
diff
changeset
|
288 |
} |
e2d549f40de9
8024545: make develop and notproduct flag values available in product builds
twisti
parents:
19710
diff
changeset
|
289 |
|
e2d549f40de9
8024545: make develop and notproduct flag values available in product builds
twisti
parents:
19710
diff
changeset
|
290 |
bool Flag::is_command_line() { |
e2d549f40de9
8024545: make develop and notproduct flag values available in product builds
twisti
parents:
19710
diff
changeset
|
291 |
return (get_origin() == COMMAND_LINE); |
e2d549f40de9
8024545: make develop and notproduct flag values available in product builds
twisti
parents:
19710
diff
changeset
|
292 |
} |
e2d549f40de9
8024545: make develop and notproduct flag values available in product builds
twisti
parents:
19710
diff
changeset
|
293 |
|
e2d549f40de9
8024545: make develop and notproduct flag values available in product builds
twisti
parents:
19710
diff
changeset
|
294 |
bool Flag::is_product() const { |
e2d549f40de9
8024545: make develop and notproduct flag values available in product builds
twisti
parents:
19710
diff
changeset
|
295 |
return (_flags & KIND_PRODUCT) != 0; |
e2d549f40de9
8024545: make develop and notproduct flag values available in product builds
twisti
parents:
19710
diff
changeset
|
296 |
} |
e2d549f40de9
8024545: make develop and notproduct flag values available in product builds
twisti
parents:
19710
diff
changeset
|
297 |
|
e2d549f40de9
8024545: make develop and notproduct flag values available in product builds
twisti
parents:
19710
diff
changeset
|
298 |
bool Flag::is_manageable() const { |
e2d549f40de9
8024545: make develop and notproduct flag values available in product builds
twisti
parents:
19710
diff
changeset
|
299 |
return (_flags & KIND_MANAGEABLE) != 0; |
e2d549f40de9
8024545: make develop and notproduct flag values available in product builds
twisti
parents:
19710
diff
changeset
|
300 |
} |
e2d549f40de9
8024545: make develop and notproduct flag values available in product builds
twisti
parents:
19710
diff
changeset
|
301 |
|
e2d549f40de9
8024545: make develop and notproduct flag values available in product builds
twisti
parents:
19710
diff
changeset
|
302 |
bool Flag::is_diagnostic() const { |
e2d549f40de9
8024545: make develop and notproduct flag values available in product builds
twisti
parents:
19710
diff
changeset
|
303 |
return (_flags & KIND_DIAGNOSTIC) != 0; |
e2d549f40de9
8024545: make develop and notproduct flag values available in product builds
twisti
parents:
19710
diff
changeset
|
304 |
} |
e2d549f40de9
8024545: make develop and notproduct flag values available in product builds
twisti
parents:
19710
diff
changeset
|
305 |
|
e2d549f40de9
8024545: make develop and notproduct flag values available in product builds
twisti
parents:
19710
diff
changeset
|
306 |
bool Flag::is_experimental() const { |
e2d549f40de9
8024545: make develop and notproduct flag values available in product builds
twisti
parents:
19710
diff
changeset
|
307 |
return (_flags & KIND_EXPERIMENTAL) != 0; |
e2d549f40de9
8024545: make develop and notproduct flag values available in product builds
twisti
parents:
19710
diff
changeset
|
308 |
} |
e2d549f40de9
8024545: make develop and notproduct flag values available in product builds
twisti
parents:
19710
diff
changeset
|
309 |
|
e2d549f40de9
8024545: make develop and notproduct flag values available in product builds
twisti
parents:
19710
diff
changeset
|
310 |
bool Flag::is_notproduct() const { |
e2d549f40de9
8024545: make develop and notproduct flag values available in product builds
twisti
parents:
19710
diff
changeset
|
311 |
return (_flags & KIND_NOT_PRODUCT) != 0; |
e2d549f40de9
8024545: make develop and notproduct flag values available in product builds
twisti
parents:
19710
diff
changeset
|
312 |
} |
e2d549f40de9
8024545: make develop and notproduct flag values available in product builds
twisti
parents:
19710
diff
changeset
|
313 |
|
e2d549f40de9
8024545: make develop and notproduct flag values available in product builds
twisti
parents:
19710
diff
changeset
|
314 |
bool Flag::is_develop() const { |
e2d549f40de9
8024545: make develop and notproduct flag values available in product builds
twisti
parents:
19710
diff
changeset
|
315 |
return (_flags & KIND_DEVELOP) != 0; |
e2d549f40de9
8024545: make develop and notproduct flag values available in product builds
twisti
parents:
19710
diff
changeset
|
316 |
} |
e2d549f40de9
8024545: make develop and notproduct flag values available in product builds
twisti
parents:
19710
diff
changeset
|
317 |
|
e2d549f40de9
8024545: make develop and notproduct flag values available in product builds
twisti
parents:
19710
diff
changeset
|
318 |
bool Flag::is_read_write() const { |
e2d549f40de9
8024545: make develop and notproduct flag values available in product builds
twisti
parents:
19710
diff
changeset
|
319 |
return (_flags & KIND_READ_WRITE) != 0; |
e2d549f40de9
8024545: make develop and notproduct flag values available in product builds
twisti
parents:
19710
diff
changeset
|
320 |
} |
e2d549f40de9
8024545: make develop and notproduct flag values available in product builds
twisti
parents:
19710
diff
changeset
|
321 |
|
e2d549f40de9
8024545: make develop and notproduct flag values available in product builds
twisti
parents:
19710
diff
changeset
|
322 |
bool Flag::is_commercial() const { |
e2d549f40de9
8024545: make develop and notproduct flag values available in product builds
twisti
parents:
19710
diff
changeset
|
323 |
return (_flags & KIND_COMMERCIAL) != 0; |
e2d549f40de9
8024545: make develop and notproduct flag values available in product builds
twisti
parents:
19710
diff
changeset
|
324 |
} |
e2d549f40de9
8024545: make develop and notproduct flag values available in product builds
twisti
parents:
19710
diff
changeset
|
325 |
|
e2d549f40de9
8024545: make develop and notproduct flag values available in product builds
twisti
parents:
19710
diff
changeset
|
326 |
/** |
e2d549f40de9
8024545: make develop and notproduct flag values available in product builds
twisti
parents:
19710
diff
changeset
|
327 |
* Returns if this flag is a constant in the binary. Right now this is |
e2d549f40de9
8024545: make develop and notproduct flag values available in product builds
twisti
parents:
19710
diff
changeset
|
328 |
* true for notproduct and develop flags in product builds. |
e2d549f40de9
8024545: make develop and notproduct flag values available in product builds
twisti
parents:
19710
diff
changeset
|
329 |
*/ |
e2d549f40de9
8024545: make develop and notproduct flag values available in product builds
twisti
parents:
19710
diff
changeset
|
330 |
bool Flag::is_constant_in_binary() const { |
e2d549f40de9
8024545: make develop and notproduct flag values available in product builds
twisti
parents:
19710
diff
changeset
|
331 |
#ifdef PRODUCT |
e2d549f40de9
8024545: make develop and notproduct flag values available in product builds
twisti
parents:
19710
diff
changeset
|
332 |
return is_notproduct() || is_develop(); |
e2d549f40de9
8024545: make develop and notproduct flag values available in product builds
twisti
parents:
19710
diff
changeset
|
333 |
#else |
e2d549f40de9
8024545: make develop and notproduct flag values available in product builds
twisti
parents:
19710
diff
changeset
|
334 |
return false; |
e2d549f40de9
8024545: make develop and notproduct flag values available in product builds
twisti
parents:
19710
diff
changeset
|
335 |
#endif |
e2d549f40de9
8024545: make develop and notproduct flag values available in product builds
twisti
parents:
19710
diff
changeset
|
336 |
} |
e2d549f40de9
8024545: make develop and notproduct flag values available in product builds
twisti
parents:
19710
diff
changeset
|
337 |
|
1 | 338 |
bool Flag::is_unlocker() const { |
20288
e2d549f40de9
8024545: make develop and notproduct flag values available in product builds
twisti
parents:
19710
diff
changeset
|
339 |
return strcmp(_name, "UnlockDiagnosticVMOptions") == 0 || |
e2d549f40de9
8024545: make develop and notproduct flag values available in product builds
twisti
parents:
19710
diff
changeset
|
340 |
strcmp(_name, "UnlockExperimentalVMOptions") == 0 || |
11183
a81bb5c041d3
7117389: Add a framework for vendor-specific command line switch extensions to Hotspot
phh
parents:
11167
diff
changeset
|
341 |
is_unlocker_ext(); |
1 | 342 |
} |
343 |
||
344 |
bool Flag::is_unlocked() const { |
|
20288
e2d549f40de9
8024545: make develop and notproduct flag values available in product builds
twisti
parents:
19710
diff
changeset
|
345 |
if (is_diagnostic()) { |
1 | 346 |
return UnlockDiagnosticVMOptions; |
20288
e2d549f40de9
8024545: make develop and notproduct flag values available in product builds
twisti
parents:
19710
diff
changeset
|
347 |
} |
e2d549f40de9
8024545: make develop and notproduct flag values available in product builds
twisti
parents:
19710
diff
changeset
|
348 |
if (is_experimental()) { |
1382
fa3de4068282
6618726: Introduce -XX:+UnlockExperimentalVMOptions flag
ysr
parents:
1374
diff
changeset
|
349 |
return UnlockExperimentalVMOptions; |
1 | 350 |
} |
20288
e2d549f40de9
8024545: make develop and notproduct flag values available in product builds
twisti
parents:
19710
diff
changeset
|
351 |
return is_unlocked_ext(); |
1 | 352 |
} |
353 |
||
27166
4ce0d93a8287
8047934: Adding new API for unlocking diagnostic argument.
jiangli
parents:
25959
diff
changeset
|
354 |
void Flag::unlock_diagnostic() { |
4ce0d93a8287
8047934: Adding new API for unlocking diagnostic argument.
jiangli
parents:
25959
diff
changeset
|
355 |
assert(is_diagnostic(), "sanity"); |
4ce0d93a8287
8047934: Adding new API for unlocking diagnostic argument.
jiangli
parents:
25959
diff
changeset
|
356 |
_flags = Flags(_flags & ~KIND_DIAGNOSTIC); |
4ce0d93a8287
8047934: Adding new API for unlocking diagnostic argument.
jiangli
parents:
25959
diff
changeset
|
357 |
} |
4ce0d93a8287
8047934: Adding new API for unlocking diagnostic argument.
jiangli
parents:
25959
diff
changeset
|
358 |
|
33592
ceda4a796f5d
8129855: "-XX:+IgnoreUnrecognizedVMOptions" hides out of range VM options.
gziemski
parents:
33198
diff
changeset
|
359 |
// Get custom message for this locked flag, or NULL if |
ceda4a796f5d
8129855: "-XX:+IgnoreUnrecognizedVMOptions" hides out of range VM options.
gziemski
parents:
33198
diff
changeset
|
360 |
// none is available. Returns message type produced. |
ceda4a796f5d
8129855: "-XX:+IgnoreUnrecognizedVMOptions" hides out of range VM options.
gziemski
parents:
33198
diff
changeset
|
361 |
Flag::MsgType Flag::get_locked_message(char* buf, int buflen) const { |
22518
e23c5545e376
8027314: Java should recognize Diagnostic options if -XX:+UnlockDiagnosticVMOptions is not specified and print an informative message
ccheung
parents:
22194
diff
changeset
|
362 |
buf[0] = '\0'; |
e23c5545e376
8027314: Java should recognize Diagnostic options if -XX:+UnlockDiagnosticVMOptions is not specified and print an informative message
ccheung
parents:
22194
diff
changeset
|
363 |
if (is_diagnostic() && !is_unlocked()) { |
32374
4fd9c17bc240
8133537: clarify position of unlock options in error messages
dcubed
parents:
32351
diff
changeset
|
364 |
jio_snprintf(buf, buflen, |
4fd9c17bc240
8133537: clarify position of unlock options in error messages
dcubed
parents:
32351
diff
changeset
|
365 |
"Error: VM option '%s' is diagnostic and must be enabled via -XX:+UnlockDiagnosticVMOptions.\n" |
4fd9c17bc240
8133537: clarify position of unlock options in error messages
dcubed
parents:
32351
diff
changeset
|
366 |
"Error: The unlock option must precede '%s'.\n", |
4fd9c17bc240
8133537: clarify position of unlock options in error messages
dcubed
parents:
32351
diff
changeset
|
367 |
_name, _name); |
33592
ceda4a796f5d
8129855: "-XX:+IgnoreUnrecognizedVMOptions" hides out of range VM options.
gziemski
parents:
33198
diff
changeset
|
368 |
return Flag::DIAGNOSTIC_FLAG_BUT_LOCKED; |
22518
e23c5545e376
8027314: Java should recognize Diagnostic options if -XX:+UnlockDiagnosticVMOptions is not specified and print an informative message
ccheung
parents:
22194
diff
changeset
|
369 |
} |
e23c5545e376
8027314: Java should recognize Diagnostic options if -XX:+UnlockDiagnosticVMOptions is not specified and print an informative message
ccheung
parents:
22194
diff
changeset
|
370 |
if (is_experimental() && !is_unlocked()) { |
32374
4fd9c17bc240
8133537: clarify position of unlock options in error messages
dcubed
parents:
32351
diff
changeset
|
371 |
jio_snprintf(buf, buflen, |
4fd9c17bc240
8133537: clarify position of unlock options in error messages
dcubed
parents:
32351
diff
changeset
|
372 |
"Error: VM option '%s' is experimental and must be enabled via -XX:+UnlockExperimentalVMOptions.\n" |
4fd9c17bc240
8133537: clarify position of unlock options in error messages
dcubed
parents:
32351
diff
changeset
|
373 |
"Error: The unlock option must precede '%s'.\n", |
4fd9c17bc240
8133537: clarify position of unlock options in error messages
dcubed
parents:
32351
diff
changeset
|
374 |
_name, _name); |
33592
ceda4a796f5d
8129855: "-XX:+IgnoreUnrecognizedVMOptions" hides out of range VM options.
gziemski
parents:
33198
diff
changeset
|
375 |
return Flag::EXPERIMENTAL_FLAG_BUT_LOCKED; |
22518
e23c5545e376
8027314: Java should recognize Diagnostic options if -XX:+UnlockDiagnosticVMOptions is not specified and print an informative message
ccheung
parents:
22194
diff
changeset
|
376 |
} |
e23c5545e376
8027314: Java should recognize Diagnostic options if -XX:+UnlockDiagnosticVMOptions is not specified and print an informative message
ccheung
parents:
22194
diff
changeset
|
377 |
if (is_develop() && is_product_build()) { |
e23c5545e376
8027314: Java should recognize Diagnostic options if -XX:+UnlockDiagnosticVMOptions is not specified and print an informative message
ccheung
parents:
22194
diff
changeset
|
378 |
jio_snprintf(buf, buflen, "Error: VM option '%s' is develop and is available only in debug version of VM.\n", |
e23c5545e376
8027314: Java should recognize Diagnostic options if -XX:+UnlockDiagnosticVMOptions is not specified and print an informative message
ccheung
parents:
22194
diff
changeset
|
379 |
_name); |
33592
ceda4a796f5d
8129855: "-XX:+IgnoreUnrecognizedVMOptions" hides out of range VM options.
gziemski
parents:
33198
diff
changeset
|
380 |
return Flag::DEVELOPER_FLAG_BUT_PRODUCT_BUILD; |
22518
e23c5545e376
8027314: Java should recognize Diagnostic options if -XX:+UnlockDiagnosticVMOptions is not specified and print an informative message
ccheung
parents:
22194
diff
changeset
|
381 |
} |
e23c5545e376
8027314: Java should recognize Diagnostic options if -XX:+UnlockDiagnosticVMOptions is not specified and print an informative message
ccheung
parents:
22194
diff
changeset
|
382 |
if (is_notproduct() && is_product_build()) { |
e23c5545e376
8027314: Java should recognize Diagnostic options if -XX:+UnlockDiagnosticVMOptions is not specified and print an informative message
ccheung
parents:
22194
diff
changeset
|
383 |
jio_snprintf(buf, buflen, "Error: VM option '%s' is notproduct and is available only in debug version of VM.\n", |
e23c5545e376
8027314: Java should recognize Diagnostic options if -XX:+UnlockDiagnosticVMOptions is not specified and print an informative message
ccheung
parents:
22194
diff
changeset
|
384 |
_name); |
33592
ceda4a796f5d
8129855: "-XX:+IgnoreUnrecognizedVMOptions" hides out of range VM options.
gziemski
parents:
33198
diff
changeset
|
385 |
return Flag::NOTPRODUCT_FLAG_BUT_PRODUCT_BUILD; |
22518
e23c5545e376
8027314: Java should recognize Diagnostic options if -XX:+UnlockDiagnosticVMOptions is not specified and print an informative message
ccheung
parents:
22194
diff
changeset
|
386 |
} |
12157
439a7166bf0f
7144328: Improper commandlines for -XX:+-UnlockCommercialFeatures require proper warning/error messages
jmelvin
parents:
11441
diff
changeset
|
387 |
get_locked_message_ext(buf, buflen); |
33592
ceda4a796f5d
8129855: "-XX:+IgnoreUnrecognizedVMOptions" hides out of range VM options.
gziemski
parents:
33198
diff
changeset
|
388 |
return Flag::NONE; |
12157
439a7166bf0f
7144328: Improper commandlines for -XX:+-UnlockCommercialFeatures require proper warning/error messages
jmelvin
parents:
11441
diff
changeset
|
389 |
} |
439a7166bf0f
7144328: Improper commandlines for -XX:+-UnlockCommercialFeatures require proper warning/error messages
jmelvin
parents:
11441
diff
changeset
|
390 |
|
1 | 391 |
bool Flag::is_writeable() const { |
20288
e2d549f40de9
8024545: make develop and notproduct flag values available in product builds
twisti
parents:
19710
diff
changeset
|
392 |
return is_manageable() || (is_product() && is_read_write()) || is_writeable_ext(); |
1 | 393 |
} |
394 |
||
11254
e2dd3c32a7cb
7122880: Extend vendor-specific command interface to include manageable switches
phh
parents:
11183
diff
changeset
|
395 |
// All flags except "manageable" are assumed to be internal flags. |
1 | 396 |
// Long term, we need to define a mechanism to specify which flags |
397 |
// are external/stable and change this function accordingly. |
|
398 |
bool Flag::is_external() const { |
|
20288
e2d549f40de9
8024545: make develop and notproduct flag values available in product builds
twisti
parents:
19710
diff
changeset
|
399 |
return is_manageable() || is_external_ext(); |
1 | 400 |
} |
401 |
||
31371
311143309e73
8122937: [JEP 245] Validate JVM Command-Line Flag Arguments.
gziemski
parents:
31236
diff
changeset
|
402 |
void Flag::print_on(outputStream* st, bool withComments, bool printRanges) { |
20288
e2d549f40de9
8024545: make develop and notproduct flag values available in product builds
twisti
parents:
19710
diff
changeset
|
403 |
// Don't print notproduct and develop flags in a product build. |
e2d549f40de9
8024545: make develop and notproduct flag values available in product builds
twisti
parents:
19710
diff
changeset
|
404 |
if (is_constant_in_binary()) { |
e2d549f40de9
8024545: make develop and notproduct flag values available in product builds
twisti
parents:
19710
diff
changeset
|
405 |
return; |
e2d549f40de9
8024545: make develop and notproduct flag values available in product builds
twisti
parents:
19710
diff
changeset
|
406 |
} |
e2d549f40de9
8024545: make develop and notproduct flag values available in product builds
twisti
parents:
19710
diff
changeset
|
407 |
|
31371
311143309e73
8122937: [JEP 245] Validate JVM Command-Line Flag Arguments.
gziemski
parents:
31236
diff
changeset
|
408 |
if (!printRanges) { |
311143309e73
8122937: [JEP 245] Validate JVM Command-Line Flag Arguments.
gziemski
parents:
31236
diff
changeset
|
409 |
|
311143309e73
8122937: [JEP 245] Validate JVM Command-Line Flag Arguments.
gziemski
parents:
31236
diff
changeset
|
410 |
st->print("%9s %-40s %c= ", _type, _name, (!is_default() ? ':' : ' ')); |
6438
ace4f8100e90
6979444: add command line option to print command line flags descriptions
ikrylov
parents:
6187
diff
changeset
|
411 |
|
31371
311143309e73
8122937: [JEP 245] Validate JVM Command-Line Flag Arguments.
gziemski
parents:
31236
diff
changeset
|
412 |
if (is_bool()) { |
311143309e73
8122937: [JEP 245] Validate JVM Command-Line Flag Arguments.
gziemski
parents:
31236
diff
changeset
|
413 |
st->print("%-16s", get_bool() ? "true" : "false"); |
311143309e73
8122937: [JEP 245] Validate JVM Command-Line Flag Arguments.
gziemski
parents:
31236
diff
changeset
|
414 |
} else if (is_int()) { |
311143309e73
8122937: [JEP 245] Validate JVM Command-Line Flag Arguments.
gziemski
parents:
31236
diff
changeset
|
415 |
st->print("%-16d", get_int()); |
311143309e73
8122937: [JEP 245] Validate JVM Command-Line Flag Arguments.
gziemski
parents:
31236
diff
changeset
|
416 |
} else if (is_uint()) { |
311143309e73
8122937: [JEP 245] Validate JVM Command-Line Flag Arguments.
gziemski
parents:
31236
diff
changeset
|
417 |
st->print("%-16u", get_uint()); |
311143309e73
8122937: [JEP 245] Validate JVM Command-Line Flag Arguments.
gziemski
parents:
31236
diff
changeset
|
418 |
} else if (is_intx()) { |
33148
68fa8b6c4340
8042893: compiler: PRAGMA_FORMAT_MUTE_WARNINGS_FOR_GCC needs to be removed from source files
david
parents:
33105
diff
changeset
|
419 |
st->print(INTX_FORMAT_W(-16), get_intx()); |
31371
311143309e73
8122937: [JEP 245] Validate JVM Command-Line Flag Arguments.
gziemski
parents:
31236
diff
changeset
|
420 |
} else if (is_uintx()) { |
33148
68fa8b6c4340
8042893: compiler: PRAGMA_FORMAT_MUTE_WARNINGS_FOR_GCC needs to be removed from source files
david
parents:
33105
diff
changeset
|
421 |
st->print(UINTX_FORMAT_W(-16), get_uintx()); |
31371
311143309e73
8122937: [JEP 245] Validate JVM Command-Line Flag Arguments.
gziemski
parents:
31236
diff
changeset
|
422 |
} else if (is_uint64_t()) { |
33148
68fa8b6c4340
8042893: compiler: PRAGMA_FORMAT_MUTE_WARNINGS_FOR_GCC needs to be removed from source files
david
parents:
33105
diff
changeset
|
423 |
st->print(UINT64_FORMAT_W(-16), get_uint64_t()); |
31371
311143309e73
8122937: [JEP 245] Validate JVM Command-Line Flag Arguments.
gziemski
parents:
31236
diff
changeset
|
424 |
} else if (is_size_t()) { |
311143309e73
8122937: [JEP 245] Validate JVM Command-Line Flag Arguments.
gziemski
parents:
31236
diff
changeset
|
425 |
st->print(SIZE_FORMAT_W(-16), get_size_t()); |
311143309e73
8122937: [JEP 245] Validate JVM Command-Line Flag Arguments.
gziemski
parents:
31236
diff
changeset
|
426 |
} else if (is_double()) { |
311143309e73
8122937: [JEP 245] Validate JVM Command-Line Flag Arguments.
gziemski
parents:
31236
diff
changeset
|
427 |
st->print("%-16f", get_double()); |
311143309e73
8122937: [JEP 245] Validate JVM Command-Line Flag Arguments.
gziemski
parents:
31236
diff
changeset
|
428 |
} else if (is_ccstr()) { |
311143309e73
8122937: [JEP 245] Validate JVM Command-Line Flag Arguments.
gziemski
parents:
31236
diff
changeset
|
429 |
const char* cp = get_ccstr(); |
311143309e73
8122937: [JEP 245] Validate JVM Command-Line Flag Arguments.
gziemski
parents:
31236
diff
changeset
|
430 |
if (cp != NULL) { |
311143309e73
8122937: [JEP 245] Validate JVM Command-Line Flag Arguments.
gziemski
parents:
31236
diff
changeset
|
431 |
const char* eol; |
311143309e73
8122937: [JEP 245] Validate JVM Command-Line Flag Arguments.
gziemski
parents:
31236
diff
changeset
|
432 |
while ((eol = strchr(cp, '\n')) != NULL) { |
311143309e73
8122937: [JEP 245] Validate JVM Command-Line Flag Arguments.
gziemski
parents:
31236
diff
changeset
|
433 |
size_t llen = pointer_delta(eol, cp, sizeof(char)); |
33604
ad1cd9269bd4
8139116: Fixes for warning "format not a string literal"
goetz
parents:
33592
diff
changeset
|
434 |
st->print("%.*s", (int)llen, cp); |
31371
311143309e73
8122937: [JEP 245] Validate JVM Command-Line Flag Arguments.
gziemski
parents:
31236
diff
changeset
|
435 |
st->cr(); |
311143309e73
8122937: [JEP 245] Validate JVM Command-Line Flag Arguments.
gziemski
parents:
31236
diff
changeset
|
436 |
cp = eol+1; |
311143309e73
8122937: [JEP 245] Validate JVM Command-Line Flag Arguments.
gziemski
parents:
31236
diff
changeset
|
437 |
st->print("%5s %-35s += ", "", _name); |
311143309e73
8122937: [JEP 245] Validate JVM Command-Line Flag Arguments.
gziemski
parents:
31236
diff
changeset
|
438 |
} |
311143309e73
8122937: [JEP 245] Validate JVM Command-Line Flag Arguments.
gziemski
parents:
31236
diff
changeset
|
439 |
st->print("%-16s", cp); |
311143309e73
8122937: [JEP 245] Validate JVM Command-Line Flag Arguments.
gziemski
parents:
31236
diff
changeset
|
440 |
} |
311143309e73
8122937: [JEP 245] Validate JVM Command-Line Flag Arguments.
gziemski
parents:
31236
diff
changeset
|
441 |
else st->print("%-16s", ""); |
311143309e73
8122937: [JEP 245] Validate JVM Command-Line Flag Arguments.
gziemski
parents:
31236
diff
changeset
|
442 |
} |
311143309e73
8122937: [JEP 245] Validate JVM Command-Line Flag Arguments.
gziemski
parents:
31236
diff
changeset
|
443 |
|
311143309e73
8122937: [JEP 245] Validate JVM Command-Line Flag Arguments.
gziemski
parents:
31236
diff
changeset
|
444 |
st->print("%-20s", " "); |
311143309e73
8122937: [JEP 245] Validate JVM Command-Line Flag Arguments.
gziemski
parents:
31236
diff
changeset
|
445 |
print_kind(st); |
311143309e73
8122937: [JEP 245] Validate JVM Command-Line Flag Arguments.
gziemski
parents:
31236
diff
changeset
|
446 |
|
311143309e73
8122937: [JEP 245] Validate JVM Command-Line Flag Arguments.
gziemski
parents:
31236
diff
changeset
|
447 |
#ifndef PRODUCT |
311143309e73
8122937: [JEP 245] Validate JVM Command-Line Flag Arguments.
gziemski
parents:
31236
diff
changeset
|
448 |
if (withComments) { |
311143309e73
8122937: [JEP 245] Validate JVM Command-Line Flag Arguments.
gziemski
parents:
31236
diff
changeset
|
449 |
st->print("%s", _doc); |
311143309e73
8122937: [JEP 245] Validate JVM Command-Line Flag Arguments.
gziemski
parents:
31236
diff
changeset
|
450 |
} |
311143309e73
8122937: [JEP 245] Validate JVM Command-Line Flag Arguments.
gziemski
parents:
31236
diff
changeset
|
451 |
#endif |
311143309e73
8122937: [JEP 245] Validate JVM Command-Line Flag Arguments.
gziemski
parents:
31236
diff
changeset
|
452 |
|
311143309e73
8122937: [JEP 245] Validate JVM Command-Line Flag Arguments.
gziemski
parents:
31236
diff
changeset
|
453 |
st->cr(); |
311143309e73
8122937: [JEP 245] Validate JVM Command-Line Flag Arguments.
gziemski
parents:
31236
diff
changeset
|
454 |
|
311143309e73
8122937: [JEP 245] Validate JVM Command-Line Flag Arguments.
gziemski
parents:
31236
diff
changeset
|
455 |
} else if (!is_bool() && !is_ccstr()) { |
36189
2fbe2434b914
8146187: Print develop and nonproduct flags by -XX:+PrintFlags* options in debug build
ddmitriev
parents:
34185
diff
changeset
|
456 |
st->print("%9s %-50s ", _type, _name); |
31371
311143309e73
8122937: [JEP 245] Validate JVM Command-Line Flag Arguments.
gziemski
parents:
31236
diff
changeset
|
457 |
|
37208
aaf76eb8cfd4
8142510: -XX:+PrintFlagsRanges should print default range value for those flags that have constraint and an implicit range.
gziemski
parents:
36189
diff
changeset
|
458 |
RangeStrFunc func = NULL; |
aaf76eb8cfd4
8142510: -XX:+PrintFlagsRanges should print default range value for those flags that have constraint and an implicit range.
gziemski
parents:
36189
diff
changeset
|
459 |
if (is_int()) { |
aaf76eb8cfd4
8142510: -XX:+PrintFlagsRanges should print default range value for those flags that have constraint and an implicit range.
gziemski
parents:
36189
diff
changeset
|
460 |
func = Flag::get_int_default_range_str; |
aaf76eb8cfd4
8142510: -XX:+PrintFlagsRanges should print default range value for those flags that have constraint and an implicit range.
gziemski
parents:
36189
diff
changeset
|
461 |
} else if (is_uint()) { |
aaf76eb8cfd4
8142510: -XX:+PrintFlagsRanges should print default range value for those flags that have constraint and an implicit range.
gziemski
parents:
36189
diff
changeset
|
462 |
func = Flag::get_uint_default_range_str; |
aaf76eb8cfd4
8142510: -XX:+PrintFlagsRanges should print default range value for those flags that have constraint and an implicit range.
gziemski
parents:
36189
diff
changeset
|
463 |
} else if (is_intx()) { |
aaf76eb8cfd4
8142510: -XX:+PrintFlagsRanges should print default range value for those flags that have constraint and an implicit range.
gziemski
parents:
36189
diff
changeset
|
464 |
func = Flag::get_intx_default_range_str; |
aaf76eb8cfd4
8142510: -XX:+PrintFlagsRanges should print default range value for those flags that have constraint and an implicit range.
gziemski
parents:
36189
diff
changeset
|
465 |
} else if (is_uintx()) { |
aaf76eb8cfd4
8142510: -XX:+PrintFlagsRanges should print default range value for those flags that have constraint and an implicit range.
gziemski
parents:
36189
diff
changeset
|
466 |
func = Flag::get_uintx_default_range_str; |
aaf76eb8cfd4
8142510: -XX:+PrintFlagsRanges should print default range value for those flags that have constraint and an implicit range.
gziemski
parents:
36189
diff
changeset
|
467 |
} else if (is_uint64_t()) { |
aaf76eb8cfd4
8142510: -XX:+PrintFlagsRanges should print default range value for those flags that have constraint and an implicit range.
gziemski
parents:
36189
diff
changeset
|
468 |
func = Flag::get_uint64_t_default_range_str; |
aaf76eb8cfd4
8142510: -XX:+PrintFlagsRanges should print default range value for those flags that have constraint and an implicit range.
gziemski
parents:
36189
diff
changeset
|
469 |
} else if (is_size_t()) { |
aaf76eb8cfd4
8142510: -XX:+PrintFlagsRanges should print default range value for those flags that have constraint and an implicit range.
gziemski
parents:
36189
diff
changeset
|
470 |
func = Flag::get_size_t_default_range_str; |
aaf76eb8cfd4
8142510: -XX:+PrintFlagsRanges should print default range value for those flags that have constraint and an implicit range.
gziemski
parents:
36189
diff
changeset
|
471 |
} else if (is_double()) { |
aaf76eb8cfd4
8142510: -XX:+PrintFlagsRanges should print default range value for those flags that have constraint and an implicit range.
gziemski
parents:
36189
diff
changeset
|
472 |
func = Flag::get_double_default_range_str; |
aaf76eb8cfd4
8142510: -XX:+PrintFlagsRanges should print default range value for those flags that have constraint and an implicit range.
gziemski
parents:
36189
diff
changeset
|
473 |
} else { |
aaf76eb8cfd4
8142510: -XX:+PrintFlagsRanges should print default range value for those flags that have constraint and an implicit range.
gziemski
parents:
36189
diff
changeset
|
474 |
ShouldNotReachHere(); |
aaf76eb8cfd4
8142510: -XX:+PrintFlagsRanges should print default range value for those flags that have constraint and an implicit range.
gziemski
parents:
36189
diff
changeset
|
475 |
} |
aaf76eb8cfd4
8142510: -XX:+PrintFlagsRanges should print default range value for those flags that have constraint and an implicit range.
gziemski
parents:
36189
diff
changeset
|
476 |
CommandLineFlagRangeList::print(st, _name, func); |
31371
311143309e73
8122937: [JEP 245] Validate JVM Command-Line Flag Arguments.
gziemski
parents:
31236
diff
changeset
|
477 |
|
36189
2fbe2434b914
8146187: Print develop and nonproduct flags by -XX:+PrintFlags* options in debug build
ddmitriev
parents:
34185
diff
changeset
|
478 |
st->print(" %-20s", " "); |
2fbe2434b914
8146187: Print develop and nonproduct flags by -XX:+PrintFlags* options in debug build
ddmitriev
parents:
34185
diff
changeset
|
479 |
print_kind(st); |
31371
311143309e73
8122937: [JEP 245] Validate JVM Command-Line Flag Arguments.
gziemski
parents:
31236
diff
changeset
|
480 |
|
311143309e73
8122937: [JEP 245] Validate JVM Command-Line Flag Arguments.
gziemski
parents:
31236
diff
changeset
|
481 |
#ifndef PRODUCT |
36189
2fbe2434b914
8146187: Print develop and nonproduct flags by -XX:+PrintFlags* options in debug build
ddmitriev
parents:
34185
diff
changeset
|
482 |
if (withComments) { |
2fbe2434b914
8146187: Print develop and nonproduct flags by -XX:+PrintFlags* options in debug build
ddmitriev
parents:
34185
diff
changeset
|
483 |
st->print("%s", _doc); |
2fbe2434b914
8146187: Print develop and nonproduct flags by -XX:+PrintFlags* options in debug build
ddmitriev
parents:
34185
diff
changeset
|
484 |
} |
31371
311143309e73
8122937: [JEP 245] Validate JVM Command-Line Flag Arguments.
gziemski
parents:
31236
diff
changeset
|
485 |
#endif |
311143309e73
8122937: [JEP 245] Validate JVM Command-Line Flag Arguments.
gziemski
parents:
31236
diff
changeset
|
486 |
|
36189
2fbe2434b914
8146187: Print develop and nonproduct flags by -XX:+PrintFlags* options in debug build
ddmitriev
parents:
34185
diff
changeset
|
487 |
st->cr(); |
20288
e2d549f40de9
8024545: make develop and notproduct flag values available in product builds
twisti
parents:
19710
diff
changeset
|
488 |
} |
1 | 489 |
} |
490 |
||
20288
e2d549f40de9
8024545: make develop and notproduct flag values available in product builds
twisti
parents:
19710
diff
changeset
|
491 |
void Flag::print_kind(outputStream* st) { |
e2d549f40de9
8024545: make develop and notproduct flag values available in product builds
twisti
parents:
19710
diff
changeset
|
492 |
struct Data { |
e2d549f40de9
8024545: make develop and notproduct flag values available in product builds
twisti
parents:
19710
diff
changeset
|
493 |
int flag; |
e2d549f40de9
8024545: make develop and notproduct flag values available in product builds
twisti
parents:
19710
diff
changeset
|
494 |
const char* name; |
e2d549f40de9
8024545: make develop and notproduct flag values available in product builds
twisti
parents:
19710
diff
changeset
|
495 |
}; |
e2d549f40de9
8024545: make develop and notproduct flag values available in product builds
twisti
parents:
19710
diff
changeset
|
496 |
|
e2d549f40de9
8024545: make develop and notproduct flag values available in product builds
twisti
parents:
19710
diff
changeset
|
497 |
Data data[] = { |
33160
c59f1676d27e
8136421: JEP 243: Java-Level JVM Compiler Interface
twisti
parents:
32374
diff
changeset
|
498 |
{ KIND_JVMCI, "JVMCI" }, |
20288
e2d549f40de9
8024545: make develop and notproduct flag values available in product builds
twisti
parents:
19710
diff
changeset
|
499 |
{ KIND_C1, "C1" }, |
e2d549f40de9
8024545: make develop and notproduct flag values available in product builds
twisti
parents:
19710
diff
changeset
|
500 |
{ KIND_C2, "C2" }, |
e2d549f40de9
8024545: make develop and notproduct flag values available in product builds
twisti
parents:
19710
diff
changeset
|
501 |
{ KIND_ARCH, "ARCH" }, |
e2d549f40de9
8024545: make develop and notproduct flag values available in product builds
twisti
parents:
19710
diff
changeset
|
502 |
{ KIND_SHARK, "SHARK" }, |
e2d549f40de9
8024545: make develop and notproduct flag values available in product builds
twisti
parents:
19710
diff
changeset
|
503 |
{ KIND_PLATFORM_DEPENDENT, "pd" }, |
e2d549f40de9
8024545: make develop and notproduct flag values available in product builds
twisti
parents:
19710
diff
changeset
|
504 |
{ KIND_PRODUCT, "product" }, |
e2d549f40de9
8024545: make develop and notproduct flag values available in product builds
twisti
parents:
19710
diff
changeset
|
505 |
{ KIND_MANAGEABLE, "manageable" }, |
e2d549f40de9
8024545: make develop and notproduct flag values available in product builds
twisti
parents:
19710
diff
changeset
|
506 |
{ KIND_DIAGNOSTIC, "diagnostic" }, |
21736
ef8da7738ad4
8028341: PSR:FUNC: SCOPE PARAMETER MISSING FROM THE -XX:+PRINTFLAGSFINAL
sgabdura
parents:
20288
diff
changeset
|
507 |
{ KIND_EXPERIMENTAL, "experimental" }, |
ef8da7738ad4
8028341: PSR:FUNC: SCOPE PARAMETER MISSING FROM THE -XX:+PRINTFLAGSFINAL
sgabdura
parents:
20288
diff
changeset
|
508 |
{ KIND_COMMERCIAL, "commercial" }, |
20288
e2d549f40de9
8024545: make develop and notproduct flag values available in product builds
twisti
parents:
19710
diff
changeset
|
509 |
{ KIND_NOT_PRODUCT, "notproduct" }, |
e2d549f40de9
8024545: make develop and notproduct flag values available in product builds
twisti
parents:
19710
diff
changeset
|
510 |
{ KIND_DEVELOP, "develop" }, |
e2d549f40de9
8024545: make develop and notproduct flag values available in product builds
twisti
parents:
19710
diff
changeset
|
511 |
{ KIND_LP64_PRODUCT, "lp64_product" }, |
e2d549f40de9
8024545: make develop and notproduct flag values available in product builds
twisti
parents:
19710
diff
changeset
|
512 |
{ KIND_READ_WRITE, "rw" }, |
e2d549f40de9
8024545: make develop and notproduct flag values available in product builds
twisti
parents:
19710
diff
changeset
|
513 |
{ -1, "" } |
e2d549f40de9
8024545: make develop and notproduct flag values available in product builds
twisti
parents:
19710
diff
changeset
|
514 |
}; |
e2d549f40de9
8024545: make develop and notproduct flag values available in product builds
twisti
parents:
19710
diff
changeset
|
515 |
|
e2d549f40de9
8024545: make develop and notproduct flag values available in product builds
twisti
parents:
19710
diff
changeset
|
516 |
if ((_flags & KIND_MASK) != 0) { |
e2d549f40de9
8024545: make develop and notproduct flag values available in product builds
twisti
parents:
19710
diff
changeset
|
517 |
st->print("{"); |
e2d549f40de9
8024545: make develop and notproduct flag values available in product builds
twisti
parents:
19710
diff
changeset
|
518 |
bool is_first = true; |
e2d549f40de9
8024545: make develop and notproduct flag values available in product builds
twisti
parents:
19710
diff
changeset
|
519 |
|
e2d549f40de9
8024545: make develop and notproduct flag values available in product builds
twisti
parents:
19710
diff
changeset
|
520 |
for (int i = 0; data[i].flag != -1; i++) { |
e2d549f40de9
8024545: make develop and notproduct flag values available in product builds
twisti
parents:
19710
diff
changeset
|
521 |
Data d = data[i]; |
e2d549f40de9
8024545: make develop and notproduct flag values available in product builds
twisti
parents:
19710
diff
changeset
|
522 |
if ((_flags & d.flag) != 0) { |
e2d549f40de9
8024545: make develop and notproduct flag values available in product builds
twisti
parents:
19710
diff
changeset
|
523 |
if (is_first) { |
e2d549f40de9
8024545: make develop and notproduct flag values available in product builds
twisti
parents:
19710
diff
changeset
|
524 |
is_first = false; |
e2d549f40de9
8024545: make develop and notproduct flag values available in product builds
twisti
parents:
19710
diff
changeset
|
525 |
} else { |
e2d549f40de9
8024545: make develop and notproduct flag values available in product builds
twisti
parents:
19710
diff
changeset
|
526 |
st->print(" "); |
e2d549f40de9
8024545: make develop and notproduct flag values available in product builds
twisti
parents:
19710
diff
changeset
|
527 |
} |
24424
2658d7834c6e
8037816: Fix for 8036122 breaks build with Xcode5/clang
drchase
parents:
22527
diff
changeset
|
528 |
st->print("%s", d.name); |
20288
e2d549f40de9
8024545: make develop and notproduct flag values available in product builds
twisti
parents:
19710
diff
changeset
|
529 |
} |
e2d549f40de9
8024545: make develop and notproduct flag values available in product builds
twisti
parents:
19710
diff
changeset
|
530 |
} |
e2d549f40de9
8024545: make develop and notproduct flag values available in product builds
twisti
parents:
19710
diff
changeset
|
531 |
|
e2d549f40de9
8024545: make develop and notproduct flag values available in product builds
twisti
parents:
19710
diff
changeset
|
532 |
st->print("}"); |
e2d549f40de9
8024545: make develop and notproduct flag values available in product builds
twisti
parents:
19710
diff
changeset
|
533 |
} |
e2d549f40de9
8024545: make develop and notproduct flag values available in product builds
twisti
parents:
19710
diff
changeset
|
534 |
} |
e2d549f40de9
8024545: make develop and notproduct flag values available in product builds
twisti
parents:
19710
diff
changeset
|
535 |
|
1 | 536 |
void Flag::print_as_flag(outputStream* st) { |
537 |
if (is_bool()) { |
|
20288
e2d549f40de9
8024545: make develop and notproduct flag values available in product builds
twisti
parents:
19710
diff
changeset
|
538 |
st->print("-XX:%s%s", get_bool() ? "+" : "-", _name); |
31236 | 539 |
} else if (is_int()) { |
540 |
st->print("-XX:%s=%d", _name, get_int()); |
|
541 |
} else if (is_uint()) { |
|
542 |
st->print("-XX:%s=%u", _name, get_uint()); |
|
1 | 543 |
} else if (is_intx()) { |
20288
e2d549f40de9
8024545: make develop and notproduct flag values available in product builds
twisti
parents:
19710
diff
changeset
|
544 |
st->print("-XX:%s=" INTX_FORMAT, _name, get_intx()); |
1 | 545 |
} else if (is_uintx()) { |
20288
e2d549f40de9
8024545: make develop and notproduct flag values available in product builds
twisti
parents:
19710
diff
changeset
|
546 |
st->print("-XX:%s=" UINTX_FORMAT, _name, get_uintx()); |
4437
d1abc17afffb
6898160: Need serviceability support for new vm argument type 'uint64_t'
phh
parents:
4434
diff
changeset
|
547 |
} else if (is_uint64_t()) { |
20288
e2d549f40de9
8024545: make develop and notproduct flag values available in product builds
twisti
parents:
19710
diff
changeset
|
548 |
st->print("-XX:%s=" UINT64_FORMAT, _name, get_uint64_t()); |
25959 | 549 |
} else if (is_size_t()) { |
550 |
st->print("-XX:%s=" SIZE_FORMAT, _name, get_size_t()); |
|
12598
1256ef9b648a
7167069: 6 VM flags crash the VM when queried via jinfo
brutisso
parents:
12157
diff
changeset
|
551 |
} else if (is_double()) { |
20288
e2d549f40de9
8024545: make develop and notproduct flag values available in product builds
twisti
parents:
19710
diff
changeset
|
552 |
st->print("-XX:%s=%f", _name, get_double()); |
1 | 553 |
} else if (is_ccstr()) { |
20288
e2d549f40de9
8024545: make develop and notproduct flag values available in product builds
twisti
parents:
19710
diff
changeset
|
554 |
st->print("-XX:%s=", _name); |
350 | 555 |
const char* cp = get_ccstr(); |
556 |
if (cp != NULL) { |
|
557 |
// Need to turn embedded '\n's back into separate arguments |
|
558 |
// Not so efficient to print one character at a time, |
|
559 |
// but the choice is to do the transformation to a buffer |
|
560 |
// and print that. And this need not be efficient. |
|
561 |
for (; *cp != '\0'; cp += 1) { |
|
562 |
switch (*cp) { |
|
563 |
default: |
|
564 |
st->print("%c", *cp); |
|
565 |
break; |
|
566 |
case '\n': |
|
20288
e2d549f40de9
8024545: make develop and notproduct flag values available in product builds
twisti
parents:
19710
diff
changeset
|
567 |
st->print(" -XX:%s=", _name); |
350 | 568 |
break; |
569 |
} |
|
1 | 570 |
} |
571 |
} |
|
572 |
} else { |
|
573 |
ShouldNotReachHere(); |
|
574 |
} |
|
575 |
} |
|
576 |
||
32351 | 577 |
const char* Flag::flag_error_str(Flag::Error error) { |
578 |
switch (error) { |
|
579 |
case Flag::MISSING_NAME: return "MISSING_NAME"; |
|
580 |
case Flag::MISSING_VALUE: return "MISSING_VALUE"; |
|
581 |
case Flag::NON_WRITABLE: return "NON_WRITABLE"; |
|
582 |
case Flag::OUT_OF_BOUNDS: return "OUT_OF_BOUNDS"; |
|
583 |
case Flag::VIOLATES_CONSTRAINT: return "VIOLATES_CONSTRAINT"; |
|
584 |
case Flag::INVALID_FLAG: return "INVALID_FLAG"; |
|
585 |
case Flag::ERR_OTHER: return "ERR_OTHER"; |
|
586 |
case Flag::SUCCESS: return "SUCCESS"; |
|
587 |
default: ShouldNotReachHere(); return "NULL"; |
|
588 |
} |
|
589 |
} |
|
590 |
||
1 | 591 |
// 4991491 do not "optimize out" the was_set false values: omitting them |
592 |
// tickles a Microsoft compiler bug causing flagTable to be malformed |
|
593 |
||
34174
4db2fb26dc49
8140424: don't prefix developer and notproduct flag variables with CONST_ in product builds
twisti
parents:
33198
diff
changeset
|
594 |
#define RUNTIME_PRODUCT_FLAG_STRUCT( type, name, value, doc) { #type, XSTR(name), &name, NOT_PRODUCT_ARG(doc) Flag::Flags(Flag::DEFAULT | Flag::KIND_PRODUCT) }, |
4db2fb26dc49
8140424: don't prefix developer and notproduct flag variables with CONST_ in product builds
twisti
parents:
33198
diff
changeset
|
595 |
#define RUNTIME_PD_PRODUCT_FLAG_STRUCT( type, name, doc) { #type, XSTR(name), &name, NOT_PRODUCT_ARG(doc) Flag::Flags(Flag::DEFAULT | Flag::KIND_PRODUCT | Flag::KIND_PLATFORM_DEPENDENT) }, |
4db2fb26dc49
8140424: don't prefix developer and notproduct flag variables with CONST_ in product builds
twisti
parents:
33198
diff
changeset
|
596 |
#define RUNTIME_DIAGNOSTIC_FLAG_STRUCT( type, name, value, doc) { #type, XSTR(name), &name, NOT_PRODUCT_ARG(doc) Flag::Flags(Flag::DEFAULT | Flag::KIND_DIAGNOSTIC) }, |
4db2fb26dc49
8140424: don't prefix developer and notproduct flag variables with CONST_ in product builds
twisti
parents:
33198
diff
changeset
|
597 |
#define RUNTIME_EXPERIMENTAL_FLAG_STRUCT(type, name, value, doc) { #type, XSTR(name), &name, NOT_PRODUCT_ARG(doc) Flag::Flags(Flag::DEFAULT | Flag::KIND_EXPERIMENTAL) }, |
4db2fb26dc49
8140424: don't prefix developer and notproduct flag variables with CONST_ in product builds
twisti
parents:
33198
diff
changeset
|
598 |
#define RUNTIME_MANAGEABLE_FLAG_STRUCT( type, name, value, doc) { #type, XSTR(name), &name, NOT_PRODUCT_ARG(doc) Flag::Flags(Flag::DEFAULT | Flag::KIND_MANAGEABLE) }, |
4db2fb26dc49
8140424: don't prefix developer and notproduct flag variables with CONST_ in product builds
twisti
parents:
33198
diff
changeset
|
599 |
#define RUNTIME_PRODUCT_RW_FLAG_STRUCT( type, name, value, doc) { #type, XSTR(name), &name, NOT_PRODUCT_ARG(doc) Flag::Flags(Flag::DEFAULT | Flag::KIND_PRODUCT | Flag::KIND_READ_WRITE) }, |
4db2fb26dc49
8140424: don't prefix developer and notproduct flag variables with CONST_ in product builds
twisti
parents:
33198
diff
changeset
|
600 |
#define RUNTIME_DEVELOP_FLAG_STRUCT( type, name, value, doc) { #type, XSTR(name), (void*) &name, NOT_PRODUCT_ARG(doc) Flag::Flags(Flag::DEFAULT | Flag::KIND_DEVELOP) }, |
4db2fb26dc49
8140424: don't prefix developer and notproduct flag variables with CONST_ in product builds
twisti
parents:
33198
diff
changeset
|
601 |
#define RUNTIME_PD_DEVELOP_FLAG_STRUCT( type, name, doc) { #type, XSTR(name), (void*) &name, NOT_PRODUCT_ARG(doc) Flag::Flags(Flag::DEFAULT | Flag::KIND_DEVELOP | Flag::KIND_PLATFORM_DEPENDENT) }, |
4db2fb26dc49
8140424: don't prefix developer and notproduct flag variables with CONST_ in product builds
twisti
parents:
33198
diff
changeset
|
602 |
#define RUNTIME_NOTPRODUCT_FLAG_STRUCT( type, name, value, doc) { #type, XSTR(name), (void*) &name, NOT_PRODUCT_ARG(doc) Flag::Flags(Flag::DEFAULT | Flag::KIND_NOT_PRODUCT) }, |
1 | 603 |
|
34174
4db2fb26dc49
8140424: don't prefix developer and notproduct flag variables with CONST_ in product builds
twisti
parents:
33198
diff
changeset
|
604 |
#define JVMCI_PRODUCT_FLAG_STRUCT( type, name, value, doc) { #type, XSTR(name), &name, NOT_PRODUCT_ARG(doc) Flag::Flags(Flag::DEFAULT | Flag::KIND_JVMCI | Flag::KIND_PRODUCT) }, |
4db2fb26dc49
8140424: don't prefix developer and notproduct flag variables with CONST_ in product builds
twisti
parents:
33198
diff
changeset
|
605 |
#define JVMCI_PD_PRODUCT_FLAG_STRUCT( type, name, doc) { #type, XSTR(name), &name, NOT_PRODUCT_ARG(doc) Flag::Flags(Flag::DEFAULT | Flag::KIND_JVMCI | Flag::KIND_PRODUCT | Flag::KIND_PLATFORM_DEPENDENT) }, |
4db2fb26dc49
8140424: don't prefix developer and notproduct flag variables with CONST_ in product builds
twisti
parents:
33198
diff
changeset
|
606 |
#define JVMCI_DIAGNOSTIC_FLAG_STRUCT( type, name, value, doc) { #type, XSTR(name), &name, NOT_PRODUCT_ARG(doc) Flag::Flags(Flag::DEFAULT | Flag::KIND_JVMCI | Flag::KIND_DIAGNOSTIC) }, |
4db2fb26dc49
8140424: don't prefix developer and notproduct flag variables with CONST_ in product builds
twisti
parents:
33198
diff
changeset
|
607 |
#define JVMCI_EXPERIMENTAL_FLAG_STRUCT( type, name, value, doc) { #type, XSTR(name), &name, NOT_PRODUCT_ARG(doc) Flag::Flags(Flag::DEFAULT | Flag::KIND_JVMCI | Flag::KIND_EXPERIMENTAL) }, |
4db2fb26dc49
8140424: don't prefix developer and notproduct flag variables with CONST_ in product builds
twisti
parents:
33198
diff
changeset
|
608 |
#define JVMCI_DEVELOP_FLAG_STRUCT( type, name, value, doc) { #type, XSTR(name), (void*) &name, NOT_PRODUCT_ARG(doc) Flag::Flags(Flag::DEFAULT | Flag::KIND_JVMCI | Flag::KIND_DEVELOP) }, |
4db2fb26dc49
8140424: don't prefix developer and notproduct flag variables with CONST_ in product builds
twisti
parents:
33198
diff
changeset
|
609 |
#define JVMCI_PD_DEVELOP_FLAG_STRUCT( type, name, doc) { #type, XSTR(name), (void*) &name, NOT_PRODUCT_ARG(doc) Flag::Flags(Flag::DEFAULT | Flag::KIND_JVMCI | Flag::KIND_DEVELOP | Flag::KIND_PLATFORM_DEPENDENT) }, |
4db2fb26dc49
8140424: don't prefix developer and notproduct flag variables with CONST_ in product builds
twisti
parents:
33198
diff
changeset
|
610 |
#define JVMCI_NOTPRODUCT_FLAG_STRUCT( type, name, value, doc) { #type, XSTR(name), (void*) &name, NOT_PRODUCT_ARG(doc) Flag::Flags(Flag::DEFAULT | Flag::KIND_JVMCI | Flag::KIND_NOT_PRODUCT) }, |
33160
c59f1676d27e
8136421: JEP 243: Java-Level JVM Compiler Interface
twisti
parents:
32374
diff
changeset
|
611 |
|
360
21d113ecbf6a
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
350
diff
changeset
|
612 |
#ifdef _LP64 |
34174
4db2fb26dc49
8140424: don't prefix developer and notproduct flag variables with CONST_ in product builds
twisti
parents:
33198
diff
changeset
|
613 |
#define RUNTIME_LP64_PRODUCT_FLAG_STRUCT(type, name, value, doc) { #type, XSTR(name), &name, NOT_PRODUCT_ARG(doc) Flag::Flags(Flag::DEFAULT | Flag::KIND_LP64_PRODUCT) }, |
360
21d113ecbf6a
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
350
diff
changeset
|
614 |
#else |
20288
e2d549f40de9
8024545: make develop and notproduct flag values available in product builds
twisti
parents:
19710
diff
changeset
|
615 |
#define RUNTIME_LP64_PRODUCT_FLAG_STRUCT(type, name, value, doc) /* flag is constant */ |
360
21d113ecbf6a
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
350
diff
changeset
|
616 |
#endif // _LP64 |
21d113ecbf6a
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
350
diff
changeset
|
617 |
|
34174
4db2fb26dc49
8140424: don't prefix developer and notproduct flag variables with CONST_ in product builds
twisti
parents:
33198
diff
changeset
|
618 |
#define C1_PRODUCT_FLAG_STRUCT( type, name, value, doc) { #type, XSTR(name), &name, NOT_PRODUCT_ARG(doc) Flag::Flags(Flag::DEFAULT | Flag::KIND_C1 | Flag::KIND_PRODUCT) }, |
4db2fb26dc49
8140424: don't prefix developer and notproduct flag variables with CONST_ in product builds
twisti
parents:
33198
diff
changeset
|
619 |
#define C1_PD_PRODUCT_FLAG_STRUCT( type, name, doc) { #type, XSTR(name), &name, NOT_PRODUCT_ARG(doc) Flag::Flags(Flag::DEFAULT | Flag::KIND_C1 | Flag::KIND_PRODUCT | Flag::KIND_PLATFORM_DEPENDENT) }, |
4db2fb26dc49
8140424: don't prefix developer and notproduct flag variables with CONST_ in product builds
twisti
parents:
33198
diff
changeset
|
620 |
#define C1_DIAGNOSTIC_FLAG_STRUCT( type, name, value, doc) { #type, XSTR(name), &name, NOT_PRODUCT_ARG(doc) Flag::Flags(Flag::DEFAULT | Flag::KIND_C1 | Flag::KIND_DIAGNOSTIC) }, |
4db2fb26dc49
8140424: don't prefix developer and notproduct flag variables with CONST_ in product builds
twisti
parents:
33198
diff
changeset
|
621 |
#define C1_DEVELOP_FLAG_STRUCT( type, name, value, doc) { #type, XSTR(name), (void*) &name, NOT_PRODUCT_ARG(doc) Flag::Flags(Flag::DEFAULT | Flag::KIND_C1 | Flag::KIND_DEVELOP) }, |
4db2fb26dc49
8140424: don't prefix developer and notproduct flag variables with CONST_ in product builds
twisti
parents:
33198
diff
changeset
|
622 |
#define C1_PD_DEVELOP_FLAG_STRUCT( type, name, doc) { #type, XSTR(name), (void*) &name, NOT_PRODUCT_ARG(doc) Flag::Flags(Flag::DEFAULT | Flag::KIND_C1 | Flag::KIND_DEVELOP | Flag::KIND_PLATFORM_DEPENDENT) }, |
4db2fb26dc49
8140424: don't prefix developer and notproduct flag variables with CONST_ in product builds
twisti
parents:
33198
diff
changeset
|
623 |
#define C1_NOTPRODUCT_FLAG_STRUCT( type, name, value, doc) { #type, XSTR(name), (void*) &name, NOT_PRODUCT_ARG(doc) Flag::Flags(Flag::DEFAULT | Flag::KIND_C1 | Flag::KIND_NOT_PRODUCT) }, |
1 | 624 |
|
34174
4db2fb26dc49
8140424: don't prefix developer and notproduct flag variables with CONST_ in product builds
twisti
parents:
33198
diff
changeset
|
625 |
#define C2_PRODUCT_FLAG_STRUCT( type, name, value, doc) { #type, XSTR(name), &name, NOT_PRODUCT_ARG(doc) Flag::Flags(Flag::DEFAULT | Flag::KIND_C2 | Flag::KIND_PRODUCT) }, |
4db2fb26dc49
8140424: don't prefix developer and notproduct flag variables with CONST_ in product builds
twisti
parents:
33198
diff
changeset
|
626 |
#define C2_PD_PRODUCT_FLAG_STRUCT( type, name, doc) { #type, XSTR(name), &name, NOT_PRODUCT_ARG(doc) Flag::Flags(Flag::DEFAULT | Flag::KIND_C2 | Flag::KIND_PRODUCT | Flag::KIND_PLATFORM_DEPENDENT) }, |
4db2fb26dc49
8140424: don't prefix developer and notproduct flag variables with CONST_ in product builds
twisti
parents:
33198
diff
changeset
|
627 |
#define C2_DIAGNOSTIC_FLAG_STRUCT( type, name, value, doc) { #type, XSTR(name), &name, NOT_PRODUCT_ARG(doc) Flag::Flags(Flag::DEFAULT | Flag::KIND_C2 | Flag::KIND_DIAGNOSTIC) }, |
4db2fb26dc49
8140424: don't prefix developer and notproduct flag variables with CONST_ in product builds
twisti
parents:
33198
diff
changeset
|
628 |
#define C2_EXPERIMENTAL_FLAG_STRUCT( type, name, value, doc) { #type, XSTR(name), &name, NOT_PRODUCT_ARG(doc) Flag::Flags(Flag::DEFAULT | Flag::KIND_C2 | Flag::KIND_EXPERIMENTAL) }, |
4db2fb26dc49
8140424: don't prefix developer and notproduct flag variables with CONST_ in product builds
twisti
parents:
33198
diff
changeset
|
629 |
#define C2_DEVELOP_FLAG_STRUCT( type, name, value, doc) { #type, XSTR(name), (void*) &name, NOT_PRODUCT_ARG(doc) Flag::Flags(Flag::DEFAULT | Flag::KIND_C2 | Flag::KIND_DEVELOP) }, |
4db2fb26dc49
8140424: don't prefix developer and notproduct flag variables with CONST_ in product builds
twisti
parents:
33198
diff
changeset
|
630 |
#define C2_PD_DEVELOP_FLAG_STRUCT( type, name, doc) { #type, XSTR(name), (void*) &name, NOT_PRODUCT_ARG(doc) Flag::Flags(Flag::DEFAULT | Flag::KIND_C2 | Flag::KIND_DEVELOP | Flag::KIND_PLATFORM_DEPENDENT) }, |
4db2fb26dc49
8140424: don't prefix developer and notproduct flag variables with CONST_ in product builds
twisti
parents:
33198
diff
changeset
|
631 |
#define C2_NOTPRODUCT_FLAG_STRUCT( type, name, value, doc) { #type, XSTR(name), (void*) &name, NOT_PRODUCT_ARG(doc) Flag::Flags(Flag::DEFAULT | Flag::KIND_C2 | Flag::KIND_NOT_PRODUCT) }, |
1 | 632 |
|
34174
4db2fb26dc49
8140424: don't prefix developer and notproduct flag variables with CONST_ in product builds
twisti
parents:
33198
diff
changeset
|
633 |
#define ARCH_PRODUCT_FLAG_STRUCT( type, name, value, doc) { #type, XSTR(name), &name, NOT_PRODUCT_ARG(doc) Flag::Flags(Flag::DEFAULT | Flag::KIND_ARCH | Flag::KIND_PRODUCT) }, |
4db2fb26dc49
8140424: don't prefix developer and notproduct flag variables with CONST_ in product builds
twisti
parents:
33198
diff
changeset
|
634 |
#define ARCH_DIAGNOSTIC_FLAG_STRUCT( type, name, value, doc) { #type, XSTR(name), &name, NOT_PRODUCT_ARG(doc) Flag::Flags(Flag::DEFAULT | Flag::KIND_ARCH | Flag::KIND_DIAGNOSTIC) }, |
4db2fb26dc49
8140424: don't prefix developer and notproduct flag variables with CONST_ in product builds
twisti
parents:
33198
diff
changeset
|
635 |
#define ARCH_EXPERIMENTAL_FLAG_STRUCT( type, name, value, doc) { #type, XSTR(name), &name, NOT_PRODUCT_ARG(doc) Flag::Flags(Flag::DEFAULT | Flag::KIND_ARCH | Flag::KIND_EXPERIMENTAL) }, |
4db2fb26dc49
8140424: don't prefix developer and notproduct flag variables with CONST_ in product builds
twisti
parents:
33198
diff
changeset
|
636 |
#define ARCH_DEVELOP_FLAG_STRUCT( type, name, value, doc) { #type, XSTR(name), (void*) &name, NOT_PRODUCT_ARG(doc) Flag::Flags(Flag::DEFAULT | Flag::KIND_ARCH | Flag::KIND_DEVELOP) }, |
4db2fb26dc49
8140424: don't prefix developer and notproduct flag variables with CONST_ in product builds
twisti
parents:
33198
diff
changeset
|
637 |
#define ARCH_NOTPRODUCT_FLAG_STRUCT( type, name, value, doc) { #type, XSTR(name), (void*) &name, NOT_PRODUCT_ARG(doc) Flag::Flags(Flag::DEFAULT | Flag::KIND_ARCH | Flag::KIND_NOT_PRODUCT) }, |
13521
97a23be06f4e
6677625: Move platform specific flags from globals.hpp to globals_<arch>.hpp
twisti
parents:
13195
diff
changeset
|
638 |
|
34174
4db2fb26dc49
8140424: don't prefix developer and notproduct flag variables with CONST_ in product builds
twisti
parents:
33198
diff
changeset
|
639 |
#define SHARK_PRODUCT_FLAG_STRUCT( type, name, value, doc) { #type, XSTR(name), &name, NOT_PRODUCT_ARG(doc) Flag::Flags(Flag::DEFAULT | Flag::KIND_SHARK | Flag::KIND_PRODUCT) }, |
4db2fb26dc49
8140424: don't prefix developer and notproduct flag variables with CONST_ in product builds
twisti
parents:
33198
diff
changeset
|
640 |
#define SHARK_PD_PRODUCT_FLAG_STRUCT( type, name, doc) { #type, XSTR(name), &name, NOT_PRODUCT_ARG(doc) Flag::Flags(Flag::DEFAULT | Flag::KIND_SHARK | Flag::KIND_PRODUCT | Flag::KIND_PLATFORM_DEPENDENT) }, |
4db2fb26dc49
8140424: don't prefix developer and notproduct flag variables with CONST_ in product builds
twisti
parents:
33198
diff
changeset
|
641 |
#define SHARK_DIAGNOSTIC_FLAG_STRUCT( type, name, value, doc) { #type, XSTR(name), &name, NOT_PRODUCT_ARG(doc) Flag::Flags(Flag::DEFAULT | Flag::KIND_SHARK | Flag::KIND_DIAGNOSTIC) }, |
4db2fb26dc49
8140424: don't prefix developer and notproduct flag variables with CONST_ in product builds
twisti
parents:
33198
diff
changeset
|
642 |
#define SHARK_DEVELOP_FLAG_STRUCT( type, name, value, doc) { #type, XSTR(name), (void*) &name, NOT_PRODUCT_ARG(doc) Flag::Flags(Flag::DEFAULT | Flag::KIND_SHARK | Flag::KIND_DEVELOP) }, |
4db2fb26dc49
8140424: don't prefix developer and notproduct flag variables with CONST_ in product builds
twisti
parents:
33198
diff
changeset
|
643 |
#define SHARK_PD_DEVELOP_FLAG_STRUCT( type, name, doc) { #type, XSTR(name), (void*) &name, NOT_PRODUCT_ARG(doc) Flag::Flags(Flag::DEFAULT | Flag::KIND_SHARK | Flag::KIND_DEVELOP | Flag::KIND_PLATFORM_DEPENDENT) }, |
4db2fb26dc49
8140424: don't prefix developer and notproduct flag variables with CONST_ in product builds
twisti
parents:
33198
diff
changeset
|
644 |
#define SHARK_NOTPRODUCT_FLAG_STRUCT( type, name, value, doc) { #type, XSTR(name), (void*) &name, NOT_PRODUCT_ARG(doc) Flag::Flags(Flag::DEFAULT | Flag::KIND_SHARK | Flag::KIND_NOT_PRODUCT) }, |
1 | 645 |
|
646 |
static Flag flagTable[] = { |
|
31371
311143309e73
8122937: [JEP 245] Validate JVM Command-Line Flag Arguments.
gziemski
parents:
31236
diff
changeset
|
647 |
RUNTIME_FLAGS(RUNTIME_DEVELOP_FLAG_STRUCT, \ |
311143309e73
8122937: [JEP 245] Validate JVM Command-Line Flag Arguments.
gziemski
parents:
31236
diff
changeset
|
648 |
RUNTIME_PD_DEVELOP_FLAG_STRUCT, \ |
311143309e73
8122937: [JEP 245] Validate JVM Command-Line Flag Arguments.
gziemski
parents:
31236
diff
changeset
|
649 |
RUNTIME_PRODUCT_FLAG_STRUCT, \ |
311143309e73
8122937: [JEP 245] Validate JVM Command-Line Flag Arguments.
gziemski
parents:
31236
diff
changeset
|
650 |
RUNTIME_PD_PRODUCT_FLAG_STRUCT, \ |
311143309e73
8122937: [JEP 245] Validate JVM Command-Line Flag Arguments.
gziemski
parents:
31236
diff
changeset
|
651 |
RUNTIME_DIAGNOSTIC_FLAG_STRUCT, \ |
311143309e73
8122937: [JEP 245] Validate JVM Command-Line Flag Arguments.
gziemski
parents:
31236
diff
changeset
|
652 |
RUNTIME_EXPERIMENTAL_FLAG_STRUCT, \ |
311143309e73
8122937: [JEP 245] Validate JVM Command-Line Flag Arguments.
gziemski
parents:
31236
diff
changeset
|
653 |
RUNTIME_NOTPRODUCT_FLAG_STRUCT, \ |
311143309e73
8122937: [JEP 245] Validate JVM Command-Line Flag Arguments.
gziemski
parents:
31236
diff
changeset
|
654 |
RUNTIME_MANAGEABLE_FLAG_STRUCT, \ |
311143309e73
8122937: [JEP 245] Validate JVM Command-Line Flag Arguments.
gziemski
parents:
31236
diff
changeset
|
655 |
RUNTIME_PRODUCT_RW_FLAG_STRUCT, \ |
311143309e73
8122937: [JEP 245] Validate JVM Command-Line Flag Arguments.
gziemski
parents:
31236
diff
changeset
|
656 |
RUNTIME_LP64_PRODUCT_FLAG_STRUCT, \ |
311143309e73
8122937: [JEP 245] Validate JVM Command-Line Flag Arguments.
gziemski
parents:
31236
diff
changeset
|
657 |
IGNORE_RANGE, \ |
311143309e73
8122937: [JEP 245] Validate JVM Command-Line Flag Arguments.
gziemski
parents:
31236
diff
changeset
|
658 |
IGNORE_CONSTRAINT) |
311143309e73
8122937: [JEP 245] Validate JVM Command-Line Flag Arguments.
gziemski
parents:
31236
diff
changeset
|
659 |
RUNTIME_OS_FLAGS(RUNTIME_DEVELOP_FLAG_STRUCT, \ |
311143309e73
8122937: [JEP 245] Validate JVM Command-Line Flag Arguments.
gziemski
parents:
31236
diff
changeset
|
660 |
RUNTIME_PD_DEVELOP_FLAG_STRUCT, \ |
311143309e73
8122937: [JEP 245] Validate JVM Command-Line Flag Arguments.
gziemski
parents:
31236
diff
changeset
|
661 |
RUNTIME_PRODUCT_FLAG_STRUCT, \ |
311143309e73
8122937: [JEP 245] Validate JVM Command-Line Flag Arguments.
gziemski
parents:
31236
diff
changeset
|
662 |
RUNTIME_PD_PRODUCT_FLAG_STRUCT, \ |
311143309e73
8122937: [JEP 245] Validate JVM Command-Line Flag Arguments.
gziemski
parents:
31236
diff
changeset
|
663 |
RUNTIME_DIAGNOSTIC_FLAG_STRUCT, \ |
311143309e73
8122937: [JEP 245] Validate JVM Command-Line Flag Arguments.
gziemski
parents:
31236
diff
changeset
|
664 |
RUNTIME_NOTPRODUCT_FLAG_STRUCT, \ |
311143309e73
8122937: [JEP 245] Validate JVM Command-Line Flag Arguments.
gziemski
parents:
31236
diff
changeset
|
665 |
IGNORE_RANGE, \ |
311143309e73
8122937: [JEP 245] Validate JVM Command-Line Flag Arguments.
gziemski
parents:
31236
diff
changeset
|
666 |
IGNORE_CONSTRAINT) |
15482
470d0b0c09f1
8005915: Unify SERIALGC and INCLUDE_ALTERNATE_GCS
jprovino
parents:
13521
diff
changeset
|
667 |
#if INCLUDE_ALL_GCS |
31371
311143309e73
8122937: [JEP 245] Validate JVM Command-Line Flag Arguments.
gziemski
parents:
31236
diff
changeset
|
668 |
G1_FLAGS(RUNTIME_DEVELOP_FLAG_STRUCT, \ |
311143309e73
8122937: [JEP 245] Validate JVM Command-Line Flag Arguments.
gziemski
parents:
31236
diff
changeset
|
669 |
RUNTIME_PD_DEVELOP_FLAG_STRUCT, \ |
311143309e73
8122937: [JEP 245] Validate JVM Command-Line Flag Arguments.
gziemski
parents:
31236
diff
changeset
|
670 |
RUNTIME_PRODUCT_FLAG_STRUCT, \ |
311143309e73
8122937: [JEP 245] Validate JVM Command-Line Flag Arguments.
gziemski
parents:
31236
diff
changeset
|
671 |
RUNTIME_PD_PRODUCT_FLAG_STRUCT, \ |
311143309e73
8122937: [JEP 245] Validate JVM Command-Line Flag Arguments.
gziemski
parents:
31236
diff
changeset
|
672 |
RUNTIME_DIAGNOSTIC_FLAG_STRUCT, \ |
311143309e73
8122937: [JEP 245] Validate JVM Command-Line Flag Arguments.
gziemski
parents:
31236
diff
changeset
|
673 |
RUNTIME_EXPERIMENTAL_FLAG_STRUCT, \ |
311143309e73
8122937: [JEP 245] Validate JVM Command-Line Flag Arguments.
gziemski
parents:
31236
diff
changeset
|
674 |
RUNTIME_NOTPRODUCT_FLAG_STRUCT, \ |
311143309e73
8122937: [JEP 245] Validate JVM Command-Line Flag Arguments.
gziemski
parents:
31236
diff
changeset
|
675 |
RUNTIME_MANAGEABLE_FLAG_STRUCT, \ |
311143309e73
8122937: [JEP 245] Validate JVM Command-Line Flag Arguments.
gziemski
parents:
31236
diff
changeset
|
676 |
RUNTIME_PRODUCT_RW_FLAG_STRUCT, \ |
311143309e73
8122937: [JEP 245] Validate JVM Command-Line Flag Arguments.
gziemski
parents:
31236
diff
changeset
|
677 |
IGNORE_RANGE, \ |
311143309e73
8122937: [JEP 245] Validate JVM Command-Line Flag Arguments.
gziemski
parents:
31236
diff
changeset
|
678 |
IGNORE_CONSTRAINT) |
15482
470d0b0c09f1
8005915: Unify SERIALGC and INCLUDE_ALTERNATE_GCS
jprovino
parents:
13521
diff
changeset
|
679 |
#endif // INCLUDE_ALL_GCS |
33160
c59f1676d27e
8136421: JEP 243: Java-Level JVM Compiler Interface
twisti
parents:
32374
diff
changeset
|
680 |
#if INCLUDE_JVMCI |
c59f1676d27e
8136421: JEP 243: Java-Level JVM Compiler Interface
twisti
parents:
32374
diff
changeset
|
681 |
JVMCI_FLAGS(JVMCI_DEVELOP_FLAG_STRUCT, \ |
c59f1676d27e
8136421: JEP 243: Java-Level JVM Compiler Interface
twisti
parents:
32374
diff
changeset
|
682 |
JVMCI_PD_DEVELOP_FLAG_STRUCT, \ |
c59f1676d27e
8136421: JEP 243: Java-Level JVM Compiler Interface
twisti
parents:
32374
diff
changeset
|
683 |
JVMCI_PRODUCT_FLAG_STRUCT, \ |
c59f1676d27e
8136421: JEP 243: Java-Level JVM Compiler Interface
twisti
parents:
32374
diff
changeset
|
684 |
JVMCI_PD_PRODUCT_FLAG_STRUCT, \ |
c59f1676d27e
8136421: JEP 243: Java-Level JVM Compiler Interface
twisti
parents:
32374
diff
changeset
|
685 |
JVMCI_DIAGNOSTIC_FLAG_STRUCT, \ |
c59f1676d27e
8136421: JEP 243: Java-Level JVM Compiler Interface
twisti
parents:
32374
diff
changeset
|
686 |
JVMCI_EXPERIMENTAL_FLAG_STRUCT, \ |
c59f1676d27e
8136421: JEP 243: Java-Level JVM Compiler Interface
twisti
parents:
32374
diff
changeset
|
687 |
JVMCI_NOTPRODUCT_FLAG_STRUCT, \ |
c59f1676d27e
8136421: JEP 243: Java-Level JVM Compiler Interface
twisti
parents:
32374
diff
changeset
|
688 |
IGNORE_RANGE, \ |
c59f1676d27e
8136421: JEP 243: Java-Level JVM Compiler Interface
twisti
parents:
32374
diff
changeset
|
689 |
IGNORE_CONSTRAINT) |
c59f1676d27e
8136421: JEP 243: Java-Level JVM Compiler Interface
twisti
parents:
32374
diff
changeset
|
690 |
#endif // INCLUDE_JVMCI |
1 | 691 |
#ifdef COMPILER1 |
31371
311143309e73
8122937: [JEP 245] Validate JVM Command-Line Flag Arguments.
gziemski
parents:
31236
diff
changeset
|
692 |
C1_FLAGS(C1_DEVELOP_FLAG_STRUCT, \ |
311143309e73
8122937: [JEP 245] Validate JVM Command-Line Flag Arguments.
gziemski
parents:
31236
diff
changeset
|
693 |
C1_PD_DEVELOP_FLAG_STRUCT, \ |
311143309e73
8122937: [JEP 245] Validate JVM Command-Line Flag Arguments.
gziemski
parents:
31236
diff
changeset
|
694 |
C1_PRODUCT_FLAG_STRUCT, \ |
311143309e73
8122937: [JEP 245] Validate JVM Command-Line Flag Arguments.
gziemski
parents:
31236
diff
changeset
|
695 |
C1_PD_PRODUCT_FLAG_STRUCT, \ |
311143309e73
8122937: [JEP 245] Validate JVM Command-Line Flag Arguments.
gziemski
parents:
31236
diff
changeset
|
696 |
C1_DIAGNOSTIC_FLAG_STRUCT, \ |
311143309e73
8122937: [JEP 245] Validate JVM Command-Line Flag Arguments.
gziemski
parents:
31236
diff
changeset
|
697 |
C1_NOTPRODUCT_FLAG_STRUCT, \ |
311143309e73
8122937: [JEP 245] Validate JVM Command-Line Flag Arguments.
gziemski
parents:
31236
diff
changeset
|
698 |
IGNORE_RANGE, \ |
311143309e73
8122937: [JEP 245] Validate JVM Command-Line Flag Arguments.
gziemski
parents:
31236
diff
changeset
|
699 |
IGNORE_CONSTRAINT) |
311143309e73
8122937: [JEP 245] Validate JVM Command-Line Flag Arguments.
gziemski
parents:
31236
diff
changeset
|
700 |
#endif // COMPILER1 |
1 | 701 |
#ifdef COMPILER2 |
31371
311143309e73
8122937: [JEP 245] Validate JVM Command-Line Flag Arguments.
gziemski
parents:
31236
diff
changeset
|
702 |
C2_FLAGS(C2_DEVELOP_FLAG_STRUCT, \ |
311143309e73
8122937: [JEP 245] Validate JVM Command-Line Flag Arguments.
gziemski
parents:
31236
diff
changeset
|
703 |
C2_PD_DEVELOP_FLAG_STRUCT, \ |
311143309e73
8122937: [JEP 245] Validate JVM Command-Line Flag Arguments.
gziemski
parents:
31236
diff
changeset
|
704 |
C2_PRODUCT_FLAG_STRUCT, \ |
311143309e73
8122937: [JEP 245] Validate JVM Command-Line Flag Arguments.
gziemski
parents:
31236
diff
changeset
|
705 |
C2_PD_PRODUCT_FLAG_STRUCT, \ |
311143309e73
8122937: [JEP 245] Validate JVM Command-Line Flag Arguments.
gziemski
parents:
31236
diff
changeset
|
706 |
C2_DIAGNOSTIC_FLAG_STRUCT, \ |
311143309e73
8122937: [JEP 245] Validate JVM Command-Line Flag Arguments.
gziemski
parents:
31236
diff
changeset
|
707 |
C2_EXPERIMENTAL_FLAG_STRUCT, \ |
311143309e73
8122937: [JEP 245] Validate JVM Command-Line Flag Arguments.
gziemski
parents:
31236
diff
changeset
|
708 |
C2_NOTPRODUCT_FLAG_STRUCT, \ |
311143309e73
8122937: [JEP 245] Validate JVM Command-Line Flag Arguments.
gziemski
parents:
31236
diff
changeset
|
709 |
IGNORE_RANGE, \ |
311143309e73
8122937: [JEP 245] Validate JVM Command-Line Flag Arguments.
gziemski
parents:
31236
diff
changeset
|
710 |
IGNORE_CONSTRAINT) |
311143309e73
8122937: [JEP 245] Validate JVM Command-Line Flag Arguments.
gziemski
parents:
31236
diff
changeset
|
711 |
#endif // COMPILER2 |
6187 | 712 |
#ifdef SHARK |
31371
311143309e73
8122937: [JEP 245] Validate JVM Command-Line Flag Arguments.
gziemski
parents:
31236
diff
changeset
|
713 |
SHARK_FLAGS(SHARK_DEVELOP_FLAG_STRUCT, \ |
311143309e73
8122937: [JEP 245] Validate JVM Command-Line Flag Arguments.
gziemski
parents:
31236
diff
changeset
|
714 |
SHARK_PD_DEVELOP_FLAG_STRUCT, \ |
311143309e73
8122937: [JEP 245] Validate JVM Command-Line Flag Arguments.
gziemski
parents:
31236
diff
changeset
|
715 |
SHARK_PRODUCT_FLAG_STRUCT, \ |
311143309e73
8122937: [JEP 245] Validate JVM Command-Line Flag Arguments.
gziemski
parents:
31236
diff
changeset
|
716 |
SHARK_PD_PRODUCT_FLAG_STRUCT, \ |
311143309e73
8122937: [JEP 245] Validate JVM Command-Line Flag Arguments.
gziemski
parents:
31236
diff
changeset
|
717 |
SHARK_DIAGNOSTIC_FLAG_STRUCT, \ |
311143309e73
8122937: [JEP 245] Validate JVM Command-Line Flag Arguments.
gziemski
parents:
31236
diff
changeset
|
718 |
SHARK_NOTPRODUCT_FLAG_STRUCT) |
311143309e73
8122937: [JEP 245] Validate JVM Command-Line Flag Arguments.
gziemski
parents:
31236
diff
changeset
|
719 |
#endif // SHARK |
311143309e73
8122937: [JEP 245] Validate JVM Command-Line Flag Arguments.
gziemski
parents:
31236
diff
changeset
|
720 |
ARCH_FLAGS(ARCH_DEVELOP_FLAG_STRUCT, \ |
311143309e73
8122937: [JEP 245] Validate JVM Command-Line Flag Arguments.
gziemski
parents:
31236
diff
changeset
|
721 |
ARCH_PRODUCT_FLAG_STRUCT, \ |
311143309e73
8122937: [JEP 245] Validate JVM Command-Line Flag Arguments.
gziemski
parents:
31236
diff
changeset
|
722 |
ARCH_DIAGNOSTIC_FLAG_STRUCT, \ |
311143309e73
8122937: [JEP 245] Validate JVM Command-Line Flag Arguments.
gziemski
parents:
31236
diff
changeset
|
723 |
ARCH_EXPERIMENTAL_FLAG_STRUCT, \ |
311143309e73
8122937: [JEP 245] Validate JVM Command-Line Flag Arguments.
gziemski
parents:
31236
diff
changeset
|
724 |
ARCH_NOTPRODUCT_FLAG_STRUCT, \ |
311143309e73
8122937: [JEP 245] Validate JVM Command-Line Flag Arguments.
gziemski
parents:
31236
diff
changeset
|
725 |
IGNORE_RANGE, \ |
311143309e73
8122937: [JEP 245] Validate JVM Command-Line Flag Arguments.
gziemski
parents:
31236
diff
changeset
|
726 |
IGNORE_CONSTRAINT) |
11183
a81bb5c041d3
7117389: Add a framework for vendor-specific command line switch extensions to Hotspot
phh
parents:
11167
diff
changeset
|
727 |
FLAGTABLE_EXT |
1 | 728 |
{0, NULL, NULL} |
729 |
}; |
|
730 |
||
731 |
Flag* Flag::flags = flagTable; |
|
732 |
size_t Flag::numFlags = (sizeof(flagTable) / sizeof(Flag)); |
|
733 |
||
18497 | 734 |
inline bool str_equal(const char* s, const char* q, size_t len) { |
1 | 735 |
// s is null terminated, q is not! |
736 |
if (strlen(s) != (unsigned int) len) return false; |
|
737 |
return strncmp(s, q, len) == 0; |
|
738 |
} |
|
739 |
||
12157
439a7166bf0f
7144328: Improper commandlines for -XX:+-UnlockCommercialFeatures require proper warning/error messages
jmelvin
parents:
11441
diff
changeset
|
740 |
// Search the flag table for a named flag |
22518
e23c5545e376
8027314: Java should recognize Diagnostic options if -XX:+UnlockDiagnosticVMOptions is not specified and print an informative message
ccheung
parents:
22194
diff
changeset
|
741 |
Flag* Flag::find_flag(const char* name, size_t length, bool allow_locked, bool return_flag) { |
20288
e2d549f40de9
8024545: make develop and notproduct flag values available in product builds
twisti
parents:
19710
diff
changeset
|
742 |
for (Flag* current = &flagTable[0]; current->_name != NULL; current++) { |
e2d549f40de9
8024545: make develop and notproduct flag values available in product builds
twisti
parents:
19710
diff
changeset
|
743 |
if (str_equal(current->_name, name, length)) { |
e2d549f40de9
8024545: make develop and notproduct flag values available in product builds
twisti
parents:
19710
diff
changeset
|
744 |
// Found a matching entry. |
e2d549f40de9
8024545: make develop and notproduct flag values available in product builds
twisti
parents:
19710
diff
changeset
|
745 |
// Don't report notproduct and develop flags in product builds. |
e2d549f40de9
8024545: make develop and notproduct flag values available in product builds
twisti
parents:
19710
diff
changeset
|
746 |
if (current->is_constant_in_binary()) { |
31371
311143309e73
8122937: [JEP 245] Validate JVM Command-Line Flag Arguments.
gziemski
parents:
31236
diff
changeset
|
747 |
return (return_flag ? current : NULL); |
20288
e2d549f40de9
8024545: make develop and notproduct flag values available in product builds
twisti
parents:
19710
diff
changeset
|
748 |
} |
e2d549f40de9
8024545: make develop and notproduct flag values available in product builds
twisti
parents:
19710
diff
changeset
|
749 |
// Report locked flags only if allowed. |
1 | 750 |
if (!(current->is_unlocked() || current->is_unlocker())) { |
12157
439a7166bf0f
7144328: Improper commandlines for -XX:+-UnlockCommercialFeatures require proper warning/error messages
jmelvin
parents:
11441
diff
changeset
|
751 |
if (!allow_locked) { |
439a7166bf0f
7144328: Improper commandlines for -XX:+-UnlockCommercialFeatures require proper warning/error messages
jmelvin
parents:
11441
diff
changeset
|
752 |
// disable use of locked flags, e.g. diagnostic, experimental, |
439a7166bf0f
7144328: Improper commandlines for -XX:+-UnlockCommercialFeatures require proper warning/error messages
jmelvin
parents:
11441
diff
changeset
|
753 |
// commercial... until they are explicitly unlocked |
439a7166bf0f
7144328: Improper commandlines for -XX:+-UnlockCommercialFeatures require proper warning/error messages
jmelvin
parents:
11441
diff
changeset
|
754 |
return NULL; |
439a7166bf0f
7144328: Improper commandlines for -XX:+-UnlockCommercialFeatures require proper warning/error messages
jmelvin
parents:
11441
diff
changeset
|
755 |
} |
1 | 756 |
} |
757 |
return current; |
|
758 |
} |
|
759 |
} |
|
12157
439a7166bf0f
7144328: Improper commandlines for -XX:+-UnlockCommercialFeatures require proper warning/error messages
jmelvin
parents:
11441
diff
changeset
|
760 |
// Flag name is not in the flag table |
1 | 761 |
return NULL; |
762 |
} |
|
763 |
||
18497 | 764 |
// Compute string similarity based on Dice's coefficient |
765 |
static float str_similar(const char* str1, const char* str2, size_t len2) { |
|
766 |
int len1 = (int) strlen(str1); |
|
767 |
int total = len1 + (int) len2; |
|
768 |
||
769 |
int hit = 0; |
|
770 |
||
771 |
for (int i = 0; i < len1 -1; ++i) { |
|
772 |
for (int j = 0; j < (int) len2 -1; ++j) { |
|
773 |
if ((str1[i] == str2[j]) && (str1[i+1] == str2[j+1])) { |
|
774 |
++hit; |
|
775 |
break; |
|
776 |
} |
|
777 |
} |
|
778 |
} |
|
779 |
||
780 |
return 2.0f * (float) hit / (float) total; |
|
781 |
} |
|
782 |
||
783 |
Flag* Flag::fuzzy_match(const char* name, size_t length, bool allow_locked) { |
|
784 |
float VMOptionsFuzzyMatchSimilarity = 0.7f; |
|
785 |
Flag* match = NULL; |
|
786 |
float score; |
|
787 |
float max_score = -1; |
|
788 |
||
20288
e2d549f40de9
8024545: make develop and notproduct flag values available in product builds
twisti
parents:
19710
diff
changeset
|
789 |
for (Flag* current = &flagTable[0]; current->_name != NULL; current++) { |
e2d549f40de9
8024545: make develop and notproduct flag values available in product builds
twisti
parents:
19710
diff
changeset
|
790 |
score = str_similar(current->_name, name, length); |
18497 | 791 |
if (score > max_score) { |
792 |
max_score = score; |
|
793 |
match = current; |
|
794 |
} |
|
795 |
} |
|
796 |
||
797 |
if (!(match->is_unlocked() || match->is_unlocker())) { |
|
798 |
if (!allow_locked) { |
|
799 |
return NULL; |
|
800 |
} |
|
801 |
} |
|
802 |
||
803 |
if (max_score < VMOptionsFuzzyMatchSimilarity) { |
|
804 |
return NULL; |
|
805 |
} |
|
806 |
||
807 |
return match; |
|
808 |
} |
|
809 |
||
1 | 810 |
// Returns the address of the index'th element |
811 |
static Flag* address_of_flag(CommandLineFlagWithType flag) { |
|
812 |
assert((size_t)flag < Flag::numFlags, "bad command line flag index"); |
|
813 |
return &Flag::flags[flag]; |
|
814 |
} |
|
815 |
||
816 |
bool CommandLineFlagsEx::is_default(CommandLineFlag flag) { |
|
817 |
assert((size_t)flag < Flag::numFlags, "bad command line flag index"); |
|
818 |
Flag* f = &Flag::flags[flag]; |
|
20288
e2d549f40de9
8024545: make develop and notproduct flag values available in product builds
twisti
parents:
19710
diff
changeset
|
819 |
return f->is_default(); |
1 | 820 |
} |
821 |
||
186
32e6c95f8d9b
6557851: CMS: ergonomics defaults are not set with FLAG_SET_ERGO
jmasa
parents:
1
diff
changeset
|
822 |
bool CommandLineFlagsEx::is_ergo(CommandLineFlag flag) { |
32e6c95f8d9b
6557851: CMS: ergonomics defaults are not set with FLAG_SET_ERGO
jmasa
parents:
1
diff
changeset
|
823 |
assert((size_t)flag < Flag::numFlags, "bad command line flag index"); |
32e6c95f8d9b
6557851: CMS: ergonomics defaults are not set with FLAG_SET_ERGO
jmasa
parents:
1
diff
changeset
|
824 |
Flag* f = &Flag::flags[flag]; |
20288
e2d549f40de9
8024545: make develop and notproduct flag values available in product builds
twisti
parents:
19710
diff
changeset
|
825 |
return f->is_ergonomic(); |
186
32e6c95f8d9b
6557851: CMS: ergonomics defaults are not set with FLAG_SET_ERGO
jmasa
parents:
1
diff
changeset
|
826 |
} |
32e6c95f8d9b
6557851: CMS: ergonomics defaults are not set with FLAG_SET_ERGO
jmasa
parents:
1
diff
changeset
|
827 |
|
32e6c95f8d9b
6557851: CMS: ergonomics defaults are not set with FLAG_SET_ERGO
jmasa
parents:
1
diff
changeset
|
828 |
bool CommandLineFlagsEx::is_cmdline(CommandLineFlag flag) { |
32e6c95f8d9b
6557851: CMS: ergonomics defaults are not set with FLAG_SET_ERGO
jmasa
parents:
1
diff
changeset
|
829 |
assert((size_t)flag < Flag::numFlags, "bad command line flag index"); |
32e6c95f8d9b
6557851: CMS: ergonomics defaults are not set with FLAG_SET_ERGO
jmasa
parents:
1
diff
changeset
|
830 |
Flag* f = &Flag::flags[flag]; |
20288
e2d549f40de9
8024545: make develop and notproduct flag values available in product builds
twisti
parents:
19710
diff
changeset
|
831 |
return f->is_command_line(); |
186
32e6c95f8d9b
6557851: CMS: ergonomics defaults are not set with FLAG_SET_ERGO
jmasa
parents:
1
diff
changeset
|
832 |
} |
32e6c95f8d9b
6557851: CMS: ergonomics defaults are not set with FLAG_SET_ERGO
jmasa
parents:
1
diff
changeset
|
833 |
|
1 | 834 |
bool CommandLineFlags::wasSetOnCmdline(const char* name, bool* value) { |
835 |
Flag* result = Flag::find_flag((char*)name, strlen(name)); |
|
836 |
if (result == NULL) return false; |
|
20288
e2d549f40de9
8024545: make develop and notproduct flag values available in product builds
twisti
parents:
19710
diff
changeset
|
837 |
*value = result->is_command_line(); |
1 | 838 |
return true; |
839 |
} |
|
840 |
||
22527 | 841 |
template<class E, class T> |
31371
311143309e73
8122937: [JEP 245] Validate JVM Command-Line Flag Arguments.
gziemski
parents:
31236
diff
changeset
|
842 |
static void trace_flag_changed(const char* name, const T old_value, const T new_value, const Flag::Flags origin) { |
22527 | 843 |
E e; |
844 |
e.set_name(name); |
|
845 |
e.set_old_value(old_value); |
|
846 |
e.set_new_value(new_value); |
|
847 |
e.set_origin(origin); |
|
848 |
e.commit(); |
|
849 |
} |
|
850 |
||
33775
3ae47fa978ea
8139765: set_numeric_flag can call Flag::find_flag to determine the flag type
ddmitriev
parents:
33604
diff
changeset
|
851 |
static Flag::Error apply_constraint_and_check_range_bool(const char* name, bool new_value, bool verbose) { |
31371
311143309e73
8122937: [JEP 245] Validate JVM Command-Line Flag Arguments.
gziemski
parents:
31236
diff
changeset
|
852 |
Flag::Error status = Flag::SUCCESS; |
31995
aa4049b4184a
8130459: Add additional validation after heap creation
sangheki
parents:
31592
diff
changeset
|
853 |
CommandLineFlagConstraint* constraint = CommandLineFlagConstraintList::find_if_needs_check(name); |
31371
311143309e73
8122937: [JEP 245] Validate JVM Command-Line Flag Arguments.
gziemski
parents:
31236
diff
changeset
|
854 |
if (constraint != NULL) { |
311143309e73
8122937: [JEP 245] Validate JVM Command-Line Flag Arguments.
gziemski
parents:
31236
diff
changeset
|
855 |
status = constraint->apply_bool(new_value, verbose); |
311143309e73
8122937: [JEP 245] Validate JVM Command-Line Flag Arguments.
gziemski
parents:
31236
diff
changeset
|
856 |
} |
311143309e73
8122937: [JEP 245] Validate JVM Command-Line Flag Arguments.
gziemski
parents:
31236
diff
changeset
|
857 |
return status; |
311143309e73
8122937: [JEP 245] Validate JVM Command-Line Flag Arguments.
gziemski
parents:
31236
diff
changeset
|
858 |
} |
311143309e73
8122937: [JEP 245] Validate JVM Command-Line Flag Arguments.
gziemski
parents:
31236
diff
changeset
|
859 |
|
311143309e73
8122937: [JEP 245] Validate JVM Command-Line Flag Arguments.
gziemski
parents:
31236
diff
changeset
|
860 |
Flag::Error CommandLineFlags::boolAt(const char* name, size_t len, bool* value, bool allow_locked, bool return_flag) { |
311143309e73
8122937: [JEP 245] Validate JVM Command-Line Flag Arguments.
gziemski
parents:
31236
diff
changeset
|
861 |
Flag* result = Flag::find_flag(name, len, allow_locked, return_flag); |
311143309e73
8122937: [JEP 245] Validate JVM Command-Line Flag Arguments.
gziemski
parents:
31236
diff
changeset
|
862 |
if (result == NULL) return Flag::INVALID_FLAG; |
311143309e73
8122937: [JEP 245] Validate JVM Command-Line Flag Arguments.
gziemski
parents:
31236
diff
changeset
|
863 |
if (!result->is_bool()) return Flag::WRONG_FORMAT; |
311143309e73
8122937: [JEP 245] Validate JVM Command-Line Flag Arguments.
gziemski
parents:
31236
diff
changeset
|
864 |
*value = result->get_bool(); |
311143309e73
8122937: [JEP 245] Validate JVM Command-Line Flag Arguments.
gziemski
parents:
31236
diff
changeset
|
865 |
return Flag::SUCCESS; |
311143309e73
8122937: [JEP 245] Validate JVM Command-Line Flag Arguments.
gziemski
parents:
31236
diff
changeset
|
866 |
} |
311143309e73
8122937: [JEP 245] Validate JVM Command-Line Flag Arguments.
gziemski
parents:
31236
diff
changeset
|
867 |
|
33775
3ae47fa978ea
8139765: set_numeric_flag can call Flag::find_flag to determine the flag type
ddmitriev
parents:
33604
diff
changeset
|
868 |
Flag::Error CommandLineFlags::boolAtPut(Flag* flag, bool* value, Flag::Flags origin) { |
3ae47fa978ea
8139765: set_numeric_flag can call Flag::find_flag to determine the flag type
ddmitriev
parents:
33604
diff
changeset
|
869 |
const char* name; |
3ae47fa978ea
8139765: set_numeric_flag can call Flag::find_flag to determine the flag type
ddmitriev
parents:
33604
diff
changeset
|
870 |
if (flag == NULL) return Flag::INVALID_FLAG; |
3ae47fa978ea
8139765: set_numeric_flag can call Flag::find_flag to determine the flag type
ddmitriev
parents:
33604
diff
changeset
|
871 |
if (!flag->is_bool()) return Flag::WRONG_FORMAT; |
3ae47fa978ea
8139765: set_numeric_flag can call Flag::find_flag to determine the flag type
ddmitriev
parents:
33604
diff
changeset
|
872 |
name = flag->_name; |
32351 | 873 |
Flag::Error check = apply_constraint_and_check_range_bool(name, *value, !CommandLineFlagConstraintList::validated_after_ergo()); |
31371
311143309e73
8122937: [JEP 245] Validate JVM Command-Line Flag Arguments.
gziemski
parents:
31236
diff
changeset
|
874 |
if (check != Flag::SUCCESS) return check; |
33775
3ae47fa978ea
8139765: set_numeric_flag can call Flag::find_flag to determine the flag type
ddmitriev
parents:
33604
diff
changeset
|
875 |
bool old_value = flag->get_bool(); |
22527 | 876 |
trace_flag_changed<EventBooleanFlagChanged, bool>(name, old_value, *value, origin); |
33775
3ae47fa978ea
8139765: set_numeric_flag can call Flag::find_flag to determine the flag type
ddmitriev
parents:
33604
diff
changeset
|
877 |
flag->set_bool(*value); |
1 | 878 |
*value = old_value; |
33775
3ae47fa978ea
8139765: set_numeric_flag can call Flag::find_flag to determine the flag type
ddmitriev
parents:
33604
diff
changeset
|
879 |
flag->set_origin(origin); |
31371
311143309e73
8122937: [JEP 245] Validate JVM Command-Line Flag Arguments.
gziemski
parents:
31236
diff
changeset
|
880 |
return Flag::SUCCESS; |
1 | 881 |
} |
882 |
||
33775
3ae47fa978ea
8139765: set_numeric_flag can call Flag::find_flag to determine the flag type
ddmitriev
parents:
33604
diff
changeset
|
883 |
Flag::Error CommandLineFlags::boolAtPut(const char* name, size_t len, bool* value, Flag::Flags origin) { |
3ae47fa978ea
8139765: set_numeric_flag can call Flag::find_flag to determine the flag type
ddmitriev
parents:
33604
diff
changeset
|
884 |
Flag* result = Flag::find_flag(name, len); |
3ae47fa978ea
8139765: set_numeric_flag can call Flag::find_flag to determine the flag type
ddmitriev
parents:
33604
diff
changeset
|
885 |
return boolAtPut(result, value, origin); |
3ae47fa978ea
8139765: set_numeric_flag can call Flag::find_flag to determine the flag type
ddmitriev
parents:
33604
diff
changeset
|
886 |
} |
3ae47fa978ea
8139765: set_numeric_flag can call Flag::find_flag to determine the flag type
ddmitriev
parents:
33604
diff
changeset
|
887 |
|
31371
311143309e73
8122937: [JEP 245] Validate JVM Command-Line Flag Arguments.
gziemski
parents:
31236
diff
changeset
|
888 |
Flag::Error CommandLineFlagsEx::boolAtPut(CommandLineFlagWithType flag, bool value, Flag::Flags origin) { |
1 | 889 |
Flag* faddr = address_of_flag(flag); |
890 |
guarantee(faddr != NULL && faddr->is_bool(), "wrong flag type"); |
|
33775
3ae47fa978ea
8139765: set_numeric_flag can call Flag::find_flag to determine the flag type
ddmitriev
parents:
33604
diff
changeset
|
891 |
return CommandLineFlags::boolAtPut(faddr, &value, origin); |
1 | 892 |
} |
893 |
||
33775
3ae47fa978ea
8139765: set_numeric_flag can call Flag::find_flag to determine the flag type
ddmitriev
parents:
33604
diff
changeset
|
894 |
static Flag::Error apply_constraint_and_check_range_int(const char* name, int new_value, bool verbose) { |
32351 | 895 |
Flag::Error status = Flag::SUCCESS; |
31371
311143309e73
8122937: [JEP 245] Validate JVM Command-Line Flag Arguments.
gziemski
parents:
31236
diff
changeset
|
896 |
CommandLineFlagRange* range = CommandLineFlagRangeList::find(name); |
311143309e73
8122937: [JEP 245] Validate JVM Command-Line Flag Arguments.
gziemski
parents:
31236
diff
changeset
|
897 |
if (range != NULL) { |
32351 | 898 |
status = range->check_int(new_value, verbose); |
31371
311143309e73
8122937: [JEP 245] Validate JVM Command-Line Flag Arguments.
gziemski
parents:
31236
diff
changeset
|
899 |
} |
32351 | 900 |
if (status == Flag::SUCCESS) { |
901 |
CommandLineFlagConstraint* constraint = CommandLineFlagConstraintList::find_if_needs_check(name); |
|
902 |
if (constraint != NULL) { |
|
903 |
status = constraint->apply_int(new_value, verbose); |
|
904 |
} |
|
31371
311143309e73
8122937: [JEP 245] Validate JVM Command-Line Flag Arguments.
gziemski
parents:
31236
diff
changeset
|
905 |
} |
32351 | 906 |
return status; |
31236 | 907 |
} |
908 |
||
31371
311143309e73
8122937: [JEP 245] Validate JVM Command-Line Flag Arguments.
gziemski
parents:
31236
diff
changeset
|
909 |
Flag::Error CommandLineFlags::intAt(const char* name, size_t len, int* value, bool allow_locked, bool return_flag) { |
311143309e73
8122937: [JEP 245] Validate JVM Command-Line Flag Arguments.
gziemski
parents:
31236
diff
changeset
|
910 |
Flag* result = Flag::find_flag(name, len, allow_locked, return_flag); |
311143309e73
8122937: [JEP 245] Validate JVM Command-Line Flag Arguments.
gziemski
parents:
31236
diff
changeset
|
911 |
if (result == NULL) return Flag::INVALID_FLAG; |
311143309e73
8122937: [JEP 245] Validate JVM Command-Line Flag Arguments.
gziemski
parents:
31236
diff
changeset
|
912 |
if (!result->is_int()) return Flag::WRONG_FORMAT; |
311143309e73
8122937: [JEP 245] Validate JVM Command-Line Flag Arguments.
gziemski
parents:
31236
diff
changeset
|
913 |
*value = result->get_int(); |
311143309e73
8122937: [JEP 245] Validate JVM Command-Line Flag Arguments.
gziemski
parents:
31236
diff
changeset
|
914 |
return Flag::SUCCESS; |
311143309e73
8122937: [JEP 245] Validate JVM Command-Line Flag Arguments.
gziemski
parents:
31236
diff
changeset
|
915 |
} |
311143309e73
8122937: [JEP 245] Validate JVM Command-Line Flag Arguments.
gziemski
parents:
31236
diff
changeset
|
916 |
|
33775
3ae47fa978ea
8139765: set_numeric_flag can call Flag::find_flag to determine the flag type
ddmitriev
parents:
33604
diff
changeset
|
917 |
Flag::Error CommandLineFlags::intAtPut(Flag* flag, int* value, Flag::Flags origin) { |
3ae47fa978ea
8139765: set_numeric_flag can call Flag::find_flag to determine the flag type
ddmitriev
parents:
33604
diff
changeset
|
918 |
const char* name; |
3ae47fa978ea
8139765: set_numeric_flag can call Flag::find_flag to determine the flag type
ddmitriev
parents:
33604
diff
changeset
|
919 |
if (flag == NULL) return Flag::INVALID_FLAG; |
3ae47fa978ea
8139765: set_numeric_flag can call Flag::find_flag to determine the flag type
ddmitriev
parents:
33604
diff
changeset
|
920 |
if (!flag->is_int()) return Flag::WRONG_FORMAT; |
3ae47fa978ea
8139765: set_numeric_flag can call Flag::find_flag to determine the flag type
ddmitriev
parents:
33604
diff
changeset
|
921 |
name = flag->_name; |
32351 | 922 |
Flag::Error check = apply_constraint_and_check_range_int(name, *value, !CommandLineFlagConstraintList::validated_after_ergo()); |
31371
311143309e73
8122937: [JEP 245] Validate JVM Command-Line Flag Arguments.
gziemski
parents:
31236
diff
changeset
|
923 |
if (check != Flag::SUCCESS) return check; |
33775
3ae47fa978ea
8139765: set_numeric_flag can call Flag::find_flag to determine the flag type
ddmitriev
parents:
33604
diff
changeset
|
924 |
int old_value = flag->get_int(); |
31236 | 925 |
trace_flag_changed<EventIntFlagChanged, s4>(name, old_value, *value, origin); |
33775
3ae47fa978ea
8139765: set_numeric_flag can call Flag::find_flag to determine the flag type
ddmitriev
parents:
33604
diff
changeset
|
926 |
flag->set_int(*value); |
31236 | 927 |
*value = old_value; |
33775
3ae47fa978ea
8139765: set_numeric_flag can call Flag::find_flag to determine the flag type
ddmitriev
parents:
33604
diff
changeset
|
928 |
flag->set_origin(origin); |
31371
311143309e73
8122937: [JEP 245] Validate JVM Command-Line Flag Arguments.
gziemski
parents:
31236
diff
changeset
|
929 |
return Flag::SUCCESS; |
31236 | 930 |
} |
931 |
||
33775
3ae47fa978ea
8139765: set_numeric_flag can call Flag::find_flag to determine the flag type
ddmitriev
parents:
33604
diff
changeset
|
932 |
Flag::Error CommandLineFlags::intAtPut(const char* name, size_t len, int* value, Flag::Flags origin) { |
3ae47fa978ea
8139765: set_numeric_flag can call Flag::find_flag to determine the flag type
ddmitriev
parents:
33604
diff
changeset
|
933 |
Flag* result = Flag::find_flag(name, len); |
3ae47fa978ea
8139765: set_numeric_flag can call Flag::find_flag to determine the flag type
ddmitriev
parents:
33604
diff
changeset
|
934 |
return intAtPut(result, value, origin); |
3ae47fa978ea
8139765: set_numeric_flag can call Flag::find_flag to determine the flag type
ddmitriev
parents:
33604
diff
changeset
|
935 |
} |
3ae47fa978ea
8139765: set_numeric_flag can call Flag::find_flag to determine the flag type
ddmitriev
parents:
33604
diff
changeset
|
936 |
|
31371
311143309e73
8122937: [JEP 245] Validate JVM Command-Line Flag Arguments.
gziemski
parents:
31236
diff
changeset
|
937 |
Flag::Error CommandLineFlagsEx::intAtPut(CommandLineFlagWithType flag, int value, Flag::Flags origin) { |
31236 | 938 |
Flag* faddr = address_of_flag(flag); |
939 |
guarantee(faddr != NULL && faddr->is_int(), "wrong flag type"); |
|
33775
3ae47fa978ea
8139765: set_numeric_flag can call Flag::find_flag to determine the flag type
ddmitriev
parents:
33604
diff
changeset
|
940 |
return CommandLineFlags::intAtPut(faddr, &value, origin); |
31236 | 941 |
} |
942 |
||
33775
3ae47fa978ea
8139765: set_numeric_flag can call Flag::find_flag to determine the flag type
ddmitriev
parents:
33604
diff
changeset
|
943 |
static Flag::Error apply_constraint_and_check_range_uint(const char* name, uint new_value, bool verbose) { |
32351 | 944 |
Flag::Error status = Flag::SUCCESS; |
31371
311143309e73
8122937: [JEP 245] Validate JVM Command-Line Flag Arguments.
gziemski
parents:
31236
diff
changeset
|
945 |
CommandLineFlagRange* range = CommandLineFlagRangeList::find(name); |
311143309e73
8122937: [JEP 245] Validate JVM Command-Line Flag Arguments.
gziemski
parents:
31236
diff
changeset
|
946 |
if (range != NULL) { |
32351 | 947 |
status = range->check_uint(new_value, verbose); |
31371
311143309e73
8122937: [JEP 245] Validate JVM Command-Line Flag Arguments.
gziemski
parents:
31236
diff
changeset
|
948 |
} |
32351 | 949 |
if (status == Flag::SUCCESS) { |
950 |
CommandLineFlagConstraint* constraint = CommandLineFlagConstraintList::find_if_needs_check(name); |
|
951 |
if (constraint != NULL) { |
|
952 |
status = constraint->apply_uint(new_value, verbose); |
|
953 |
} |
|
31371
311143309e73
8122937: [JEP 245] Validate JVM Command-Line Flag Arguments.
gziemski
parents:
31236
diff
changeset
|
954 |
} |
32351 | 955 |
return status; |
31236 | 956 |
} |
957 |
||
31371
311143309e73
8122937: [JEP 245] Validate JVM Command-Line Flag Arguments.
gziemski
parents:
31236
diff
changeset
|
958 |
Flag::Error CommandLineFlags::uintAt(const char* name, size_t len, uint* value, bool allow_locked, bool return_flag) { |
311143309e73
8122937: [JEP 245] Validate JVM Command-Line Flag Arguments.
gziemski
parents:
31236
diff
changeset
|
959 |
Flag* result = Flag::find_flag(name, len, allow_locked, return_flag); |
311143309e73
8122937: [JEP 245] Validate JVM Command-Line Flag Arguments.
gziemski
parents:
31236
diff
changeset
|
960 |
if (result == NULL) return Flag::INVALID_FLAG; |
311143309e73
8122937: [JEP 245] Validate JVM Command-Line Flag Arguments.
gziemski
parents:
31236
diff
changeset
|
961 |
if (!result->is_uint()) return Flag::WRONG_FORMAT; |
311143309e73
8122937: [JEP 245] Validate JVM Command-Line Flag Arguments.
gziemski
parents:
31236
diff
changeset
|
962 |
*value = result->get_uint(); |
311143309e73
8122937: [JEP 245] Validate JVM Command-Line Flag Arguments.
gziemski
parents:
31236
diff
changeset
|
963 |
return Flag::SUCCESS; |
311143309e73
8122937: [JEP 245] Validate JVM Command-Line Flag Arguments.
gziemski
parents:
31236
diff
changeset
|
964 |
} |
311143309e73
8122937: [JEP 245] Validate JVM Command-Line Flag Arguments.
gziemski
parents:
31236
diff
changeset
|
965 |
|
33775
3ae47fa978ea
8139765: set_numeric_flag can call Flag::find_flag to determine the flag type
ddmitriev
parents:
33604
diff
changeset
|
966 |
Flag::Error CommandLineFlags::uintAtPut(Flag* flag, uint* value, Flag::Flags origin) { |
3ae47fa978ea
8139765: set_numeric_flag can call Flag::find_flag to determine the flag type
ddmitriev
parents:
33604
diff
changeset
|
967 |
const char* name; |
3ae47fa978ea
8139765: set_numeric_flag can call Flag::find_flag to determine the flag type
ddmitriev
parents:
33604
diff
changeset
|
968 |
if (flag == NULL) return Flag::INVALID_FLAG; |
3ae47fa978ea
8139765: set_numeric_flag can call Flag::find_flag to determine the flag type
ddmitriev
parents:
33604
diff
changeset
|
969 |
if (!flag->is_uint()) return Flag::WRONG_FORMAT; |
3ae47fa978ea
8139765: set_numeric_flag can call Flag::find_flag to determine the flag type
ddmitriev
parents:
33604
diff
changeset
|
970 |
name = flag->_name; |
32351 | 971 |
Flag::Error check = apply_constraint_and_check_range_uint(name, *value, !CommandLineFlagConstraintList::validated_after_ergo()); |
31371
311143309e73
8122937: [JEP 245] Validate JVM Command-Line Flag Arguments.
gziemski
parents:
31236
diff
changeset
|
972 |
if (check != Flag::SUCCESS) return check; |
33775
3ae47fa978ea
8139765: set_numeric_flag can call Flag::find_flag to determine the flag type
ddmitriev
parents:
33604
diff
changeset
|
973 |
uint old_value = flag->get_uint(); |
31236 | 974 |
trace_flag_changed<EventUnsignedIntFlagChanged, u4>(name, old_value, *value, origin); |
33775
3ae47fa978ea
8139765: set_numeric_flag can call Flag::find_flag to determine the flag type
ddmitriev
parents:
33604
diff
changeset
|
975 |
flag->set_uint(*value); |
31236 | 976 |
*value = old_value; |
33775
3ae47fa978ea
8139765: set_numeric_flag can call Flag::find_flag to determine the flag type
ddmitriev
parents:
33604
diff
changeset
|
977 |
flag->set_origin(origin); |
31371
311143309e73
8122937: [JEP 245] Validate JVM Command-Line Flag Arguments.
gziemski
parents:
31236
diff
changeset
|
978 |
return Flag::SUCCESS; |
31236 | 979 |
} |
980 |
||
33775
3ae47fa978ea
8139765: set_numeric_flag can call Flag::find_flag to determine the flag type
ddmitriev
parents:
33604
diff
changeset
|
981 |
Flag::Error CommandLineFlags::uintAtPut(const char* name, size_t len, uint* value, Flag::Flags origin) { |
3ae47fa978ea
8139765: set_numeric_flag can call Flag::find_flag to determine the flag type
ddmitriev
parents:
33604
diff
changeset
|
982 |
Flag* result = Flag::find_flag(name, len); |
3ae47fa978ea
8139765: set_numeric_flag can call Flag::find_flag to determine the flag type
ddmitriev
parents:
33604
diff
changeset
|
983 |
return uintAtPut(result, value, origin); |
3ae47fa978ea
8139765: set_numeric_flag can call Flag::find_flag to determine the flag type
ddmitriev
parents:
33604
diff
changeset
|
984 |
} |
3ae47fa978ea
8139765: set_numeric_flag can call Flag::find_flag to determine the flag type
ddmitriev
parents:
33604
diff
changeset
|
985 |
|
31371
311143309e73
8122937: [JEP 245] Validate JVM Command-Line Flag Arguments.
gziemski
parents:
31236
diff
changeset
|
986 |
Flag::Error CommandLineFlagsEx::uintAtPut(CommandLineFlagWithType flag, uint value, Flag::Flags origin) { |
31236 | 987 |
Flag* faddr = address_of_flag(flag); |
988 |
guarantee(faddr != NULL && faddr->is_uint(), "wrong flag type"); |
|
33775
3ae47fa978ea
8139765: set_numeric_flag can call Flag::find_flag to determine the flag type
ddmitriev
parents:
33604
diff
changeset
|
989 |
return CommandLineFlags::uintAtPut(faddr, &value, origin); |
31371
311143309e73
8122937: [JEP 245] Validate JVM Command-Line Flag Arguments.
gziemski
parents:
31236
diff
changeset
|
990 |
} |
311143309e73
8122937: [JEP 245] Validate JVM Command-Line Flag Arguments.
gziemski
parents:
31236
diff
changeset
|
991 |
|
311143309e73
8122937: [JEP 245] Validate JVM Command-Line Flag Arguments.
gziemski
parents:
31236
diff
changeset
|
992 |
Flag::Error CommandLineFlags::intxAt(const char* name, size_t len, intx* value, bool allow_locked, bool return_flag) { |
311143309e73
8122937: [JEP 245] Validate JVM Command-Line Flag Arguments.
gziemski
parents:
31236
diff
changeset
|
993 |
Flag* result = Flag::find_flag(name, len, allow_locked, return_flag); |
311143309e73
8122937: [JEP 245] Validate JVM Command-Line Flag Arguments.
gziemski
parents:
31236
diff
changeset
|
994 |
if (result == NULL) return Flag::INVALID_FLAG; |
311143309e73
8122937: [JEP 245] Validate JVM Command-Line Flag Arguments.
gziemski
parents:
31236
diff
changeset
|
995 |
if (!result->is_intx()) return Flag::WRONG_FORMAT; |
311143309e73
8122937: [JEP 245] Validate JVM Command-Line Flag Arguments.
gziemski
parents:
31236
diff
changeset
|
996 |
*value = result->get_intx(); |
311143309e73
8122937: [JEP 245] Validate JVM Command-Line Flag Arguments.
gziemski
parents:
31236
diff
changeset
|
997 |
return Flag::SUCCESS; |
31236 | 998 |
} |
999 |
||
33775
3ae47fa978ea
8139765: set_numeric_flag can call Flag::find_flag to determine the flag type
ddmitriev
parents:
33604
diff
changeset
|
1000 |
static Flag::Error apply_constraint_and_check_range_intx(const char* name, intx new_value, bool verbose) { |
32351 | 1001 |
Flag::Error status = Flag::SUCCESS; |
31371
311143309e73
8122937: [JEP 245] Validate JVM Command-Line Flag Arguments.
gziemski
parents:
31236
diff
changeset
|
1002 |
CommandLineFlagRange* range = CommandLineFlagRangeList::find(name); |
311143309e73
8122937: [JEP 245] Validate JVM Command-Line Flag Arguments.
gziemski
parents:
31236
diff
changeset
|
1003 |
if (range != NULL) { |
32351 | 1004 |
status = range->check_intx(new_value, verbose); |
31371
311143309e73
8122937: [JEP 245] Validate JVM Command-Line Flag Arguments.
gziemski
parents:
31236
diff
changeset
|
1005 |
} |
32351 | 1006 |
if (status == Flag::SUCCESS) { |
1007 |
CommandLineFlagConstraint* constraint = CommandLineFlagConstraintList::find_if_needs_check(name); |
|
1008 |
if (constraint != NULL) { |
|
1009 |
status = constraint->apply_intx(new_value, verbose); |
|
1010 |
} |
|
31371
311143309e73
8122937: [JEP 245] Validate JVM Command-Line Flag Arguments.
gziemski
parents:
31236
diff
changeset
|
1011 |
} |
32351 | 1012 |
return status; |
1 | 1013 |
} |
1014 |
||
33775
3ae47fa978ea
8139765: set_numeric_flag can call Flag::find_flag to determine the flag type
ddmitriev
parents:
33604
diff
changeset
|
1015 |
Flag::Error CommandLineFlags::intxAtPut(Flag* flag, intx* value, Flag::Flags origin) { |
3ae47fa978ea
8139765: set_numeric_flag can call Flag::find_flag to determine the flag type
ddmitriev
parents:
33604
diff
changeset
|
1016 |
const char* name; |
3ae47fa978ea
8139765: set_numeric_flag can call Flag::find_flag to determine the flag type
ddmitriev
parents:
33604
diff
changeset
|
1017 |
if (flag == NULL) return Flag::INVALID_FLAG; |
3ae47fa978ea
8139765: set_numeric_flag can call Flag::find_flag to determine the flag type
ddmitriev
parents:
33604
diff
changeset
|
1018 |
if (!flag->is_intx()) return Flag::WRONG_FORMAT; |
3ae47fa978ea
8139765: set_numeric_flag can call Flag::find_flag to determine the flag type
ddmitriev
parents:
33604
diff
changeset
|
1019 |
name = flag->_name; |
32351 | 1020 |
Flag::Error check = apply_constraint_and_check_range_intx(name, *value, !CommandLineFlagConstraintList::validated_after_ergo()); |
31371
311143309e73
8122937: [JEP 245] Validate JVM Command-Line Flag Arguments.
gziemski
parents:
31236
diff
changeset
|
1021 |
if (check != Flag::SUCCESS) return check; |
33775
3ae47fa978ea
8139765: set_numeric_flag can call Flag::find_flag to determine the flag type
ddmitriev
parents:
33604
diff
changeset
|
1022 |
intx old_value = flag->get_intx(); |
31371
311143309e73
8122937: [JEP 245] Validate JVM Command-Line Flag Arguments.
gziemski
parents:
31236
diff
changeset
|
1023 |
trace_flag_changed<EventLongFlagChanged, intx>(name, old_value, *value, origin); |
33775
3ae47fa978ea
8139765: set_numeric_flag can call Flag::find_flag to determine the flag type
ddmitriev
parents:
33604
diff
changeset
|
1024 |
flag->set_intx(*value); |
1 | 1025 |
*value = old_value; |
33775
3ae47fa978ea
8139765: set_numeric_flag can call Flag::find_flag to determine the flag type
ddmitriev
parents:
33604
diff
changeset
|
1026 |
flag->set_origin(origin); |
31371
311143309e73
8122937: [JEP 245] Validate JVM Command-Line Flag Arguments.
gziemski
parents:
31236
diff
changeset
|
1027 |
return Flag::SUCCESS; |
1 | 1028 |
} |
1029 |
||
33775
3ae47fa978ea
8139765: set_numeric_flag can call Flag::find_flag to determine the flag type
ddmitriev
parents:
33604
diff
changeset
|
1030 |
Flag::Error CommandLineFlags::intxAtPut(const char* name, size_t len, intx* value, Flag::Flags origin) { |
3ae47fa978ea
8139765: set_numeric_flag can call Flag::find_flag to determine the flag type
ddmitriev
parents:
33604
diff
changeset
|
1031 |
Flag* result = Flag::find_flag(name, len); |
3ae47fa978ea
8139765: set_numeric_flag can call Flag::find_flag to determine the flag type
ddmitriev
parents:
33604
diff
changeset
|
1032 |
return intxAtPut(result, value, origin); |
3ae47fa978ea
8139765: set_numeric_flag can call Flag::find_flag to determine the flag type
ddmitriev
parents:
33604
diff
changeset
|
1033 |
} |
3ae47fa978ea
8139765: set_numeric_flag can call Flag::find_flag to determine the flag type
ddmitriev
parents:
33604
diff
changeset
|
1034 |
|
31371
311143309e73
8122937: [JEP 245] Validate JVM Command-Line Flag Arguments.
gziemski
parents:
31236
diff
changeset
|
1035 |
Flag::Error CommandLineFlagsEx::intxAtPut(CommandLineFlagWithType flag, intx value, Flag::Flags origin) { |
1 | 1036 |
Flag* faddr = address_of_flag(flag); |
1037 |
guarantee(faddr != NULL && faddr->is_intx(), "wrong flag type"); |
|
33775
3ae47fa978ea
8139765: set_numeric_flag can call Flag::find_flag to determine the flag type
ddmitriev
parents:
33604
diff
changeset
|
1038 |
return CommandLineFlags::intxAtPut(faddr, &value, origin); |
1 | 1039 |
} |
1040 |
||
31371
311143309e73
8122937: [JEP 245] Validate JVM Command-Line Flag Arguments.
gziemski
parents:
31236
diff
changeset
|
1041 |
Flag::Error CommandLineFlags::uintxAt(const char* name, size_t len, uintx* value, bool allow_locked, bool return_flag) { |
27417
576e2b527e1c
8061443: Whitebox get*VMFlag() methods fail with develop flags in product builds
thartmann
parents:
27166
diff
changeset
|
1042 |
Flag* result = Flag::find_flag(name, len, allow_locked, return_flag); |
31371
311143309e73
8122937: [JEP 245] Validate JVM Command-Line Flag Arguments.
gziemski
parents:
31236
diff
changeset
|
1043 |
if (result == NULL) return Flag::INVALID_FLAG; |
311143309e73
8122937: [JEP 245] Validate JVM Command-Line Flag Arguments.
gziemski
parents:
31236
diff
changeset
|
1044 |
if (!result->is_uintx()) return Flag::WRONG_FORMAT; |
1 | 1045 |
*value = result->get_uintx(); |
31371
311143309e73
8122937: [JEP 245] Validate JVM Command-Line Flag Arguments.
gziemski
parents:
31236
diff
changeset
|
1046 |
return Flag::SUCCESS; |
1 | 1047 |
} |
1048 |
||
33775
3ae47fa978ea
8139765: set_numeric_flag can call Flag::find_flag to determine the flag type
ddmitriev
parents:
33604
diff
changeset
|
1049 |
static Flag::Error apply_constraint_and_check_range_uintx(const char* name, uintx new_value, bool verbose) { |
32351 | 1050 |
Flag::Error status = Flag::SUCCESS; |
31371
311143309e73
8122937: [JEP 245] Validate JVM Command-Line Flag Arguments.
gziemski
parents:
31236
diff
changeset
|
1051 |
CommandLineFlagRange* range = CommandLineFlagRangeList::find(name); |
311143309e73
8122937: [JEP 245] Validate JVM Command-Line Flag Arguments.
gziemski
parents:
31236
diff
changeset
|
1052 |
if (range != NULL) { |
32351 | 1053 |
status = range->check_uintx(new_value, verbose); |
31371
311143309e73
8122937: [JEP 245] Validate JVM Command-Line Flag Arguments.
gziemski
parents:
31236
diff
changeset
|
1054 |
} |
32351 | 1055 |
if (status == Flag::SUCCESS) { |
1056 |
CommandLineFlagConstraint* constraint = CommandLineFlagConstraintList::find_if_needs_check(name); |
|
1057 |
if (constraint != NULL) { |
|
1058 |
status = constraint->apply_uintx(new_value, verbose); |
|
1059 |
} |
|
31371
311143309e73
8122937: [JEP 245] Validate JVM Command-Line Flag Arguments.
gziemski
parents:
31236
diff
changeset
|
1060 |
} |
32351 | 1061 |
return status; |
31371
311143309e73
8122937: [JEP 245] Validate JVM Command-Line Flag Arguments.
gziemski
parents:
31236
diff
changeset
|
1062 |
} |
311143309e73
8122937: [JEP 245] Validate JVM Command-Line Flag Arguments.
gziemski
parents:
31236
diff
changeset
|
1063 |
|
33775
3ae47fa978ea
8139765: set_numeric_flag can call Flag::find_flag to determine the flag type
ddmitriev
parents:
33604
diff
changeset
|
1064 |
Flag::Error CommandLineFlags::uintxAtPut(Flag* flag, uintx* value, Flag::Flags origin) { |
3ae47fa978ea
8139765: set_numeric_flag can call Flag::find_flag to determine the flag type
ddmitriev
parents:
33604
diff
changeset
|
1065 |
const char* name; |
3ae47fa978ea
8139765: set_numeric_flag can call Flag::find_flag to determine the flag type
ddmitriev
parents:
33604
diff
changeset
|
1066 |
if (flag == NULL) return Flag::INVALID_FLAG; |
3ae47fa978ea
8139765: set_numeric_flag can call Flag::find_flag to determine the flag type
ddmitriev
parents:
33604
diff
changeset
|
1067 |
if (!flag->is_uintx()) return Flag::WRONG_FORMAT; |
3ae47fa978ea
8139765: set_numeric_flag can call Flag::find_flag to determine the flag type
ddmitriev
parents:
33604
diff
changeset
|
1068 |
name = flag->_name; |
32351 | 1069 |
Flag::Error check = apply_constraint_and_check_range_uintx(name, *value, !CommandLineFlagConstraintList::validated_after_ergo()); |
31371
311143309e73
8122937: [JEP 245] Validate JVM Command-Line Flag Arguments.
gziemski
parents:
31236
diff
changeset
|
1070 |
if (check != Flag::SUCCESS) return check; |
33775
3ae47fa978ea
8139765: set_numeric_flag can call Flag::find_flag to determine the flag type
ddmitriev
parents:
33604
diff
changeset
|
1071 |
uintx old_value = flag->get_uintx(); |
22527 | 1072 |
trace_flag_changed<EventUnsignedLongFlagChanged, u8>(name, old_value, *value, origin); |
33775
3ae47fa978ea
8139765: set_numeric_flag can call Flag::find_flag to determine the flag type
ddmitriev
parents:
33604
diff
changeset
|
1073 |
flag->set_uintx(*value); |
1 | 1074 |
*value = old_value; |
33775
3ae47fa978ea
8139765: set_numeric_flag can call Flag::find_flag to determine the flag type
ddmitriev
parents:
33604
diff
changeset
|
1075 |
flag->set_origin(origin); |
31371
311143309e73
8122937: [JEP 245] Validate JVM Command-Line Flag Arguments.
gziemski
parents:
31236
diff
changeset
|
1076 |
return Flag::SUCCESS; |
1 | 1077 |
} |
1078 |
||
33775
3ae47fa978ea
8139765: set_numeric_flag can call Flag::find_flag to determine the flag type
ddmitriev
parents:
33604
diff
changeset
|
1079 |
Flag::Error CommandLineFlags::uintxAtPut(const char* name, size_t len, uintx* value, Flag::Flags origin) { |
3ae47fa978ea
8139765: set_numeric_flag can call Flag::find_flag to determine the flag type
ddmitriev
parents:
33604
diff
changeset
|
1080 |
Flag* result = Flag::find_flag(name, len); |
3ae47fa978ea
8139765: set_numeric_flag can call Flag::find_flag to determine the flag type
ddmitriev
parents:
33604
diff
changeset
|
1081 |
return uintxAtPut(result, value, origin); |
3ae47fa978ea
8139765: set_numeric_flag can call Flag::find_flag to determine the flag type
ddmitriev
parents:
33604
diff
changeset
|
1082 |
} |
3ae47fa978ea
8139765: set_numeric_flag can call Flag::find_flag to determine the flag type
ddmitriev
parents:
33604
diff
changeset
|
1083 |
|
31371
311143309e73
8122937: [JEP 245] Validate JVM Command-Line Flag Arguments.
gziemski
parents:
31236
diff
changeset
|
1084 |
Flag::Error CommandLineFlagsEx::uintxAtPut(CommandLineFlagWithType flag, uintx value, Flag::Flags origin) { |
1 | 1085 |
Flag* faddr = address_of_flag(flag); |
1086 |
guarantee(faddr != NULL && faddr->is_uintx(), "wrong flag type"); |
|
33775
3ae47fa978ea
8139765: set_numeric_flag can call Flag::find_flag to determine the flag type
ddmitriev
parents:
33604
diff
changeset
|
1087 |
return CommandLineFlags::uintxAtPut(faddr, &value, origin); |
31371
311143309e73
8122937: [JEP 245] Validate JVM Command-Line Flag Arguments.
gziemski
parents:
31236
diff
changeset
|
1088 |
} |
311143309e73
8122937: [JEP 245] Validate JVM Command-Line Flag Arguments.
gziemski
parents:
31236
diff
changeset
|
1089 |
|
311143309e73
8122937: [JEP 245] Validate JVM Command-Line Flag Arguments.
gziemski
parents:
31236
diff
changeset
|
1090 |
Flag::Error CommandLineFlags::uint64_tAt(const char* name, size_t len, uint64_t* value, bool allow_locked, bool return_flag) { |
311143309e73
8122937: [JEP 245] Validate JVM Command-Line Flag Arguments.
gziemski
parents:
31236
diff
changeset
|
1091 |
Flag* result = Flag::find_flag(name, len, allow_locked, return_flag); |
311143309e73
8122937: [JEP 245] Validate JVM Command-Line Flag Arguments.
gziemski
parents:
31236
diff
changeset
|
1092 |
if (result == NULL) return Flag::INVALID_FLAG; |
311143309e73
8122937: [JEP 245] Validate JVM Command-Line Flag Arguments.
gziemski
parents:
31236
diff
changeset
|
1093 |
if (!result->is_uint64_t()) return Flag::WRONG_FORMAT; |
311143309e73
8122937: [JEP 245] Validate JVM Command-Line Flag Arguments.
gziemski
parents:
31236
diff
changeset
|
1094 |
*value = result->get_uint64_t(); |
311143309e73
8122937: [JEP 245] Validate JVM Command-Line Flag Arguments.
gziemski
parents:
31236
diff
changeset
|
1095 |
return Flag::SUCCESS; |
1 | 1096 |
} |
1097 |
||
33775
3ae47fa978ea
8139765: set_numeric_flag can call Flag::find_flag to determine the flag type
ddmitriev
parents:
33604
diff
changeset
|
1098 |
static Flag::Error apply_constraint_and_check_range_uint64_t(const char* name, uint64_t new_value, bool verbose) { |
32351 | 1099 |
Flag::Error status = Flag::SUCCESS; |
31371
311143309e73
8122937: [JEP 245] Validate JVM Command-Line Flag Arguments.
gziemski
parents:
31236
diff
changeset
|
1100 |
CommandLineFlagRange* range = CommandLineFlagRangeList::find(name); |
311143309e73
8122937: [JEP 245] Validate JVM Command-Line Flag Arguments.
gziemski
parents:
31236
diff
changeset
|
1101 |
if (range != NULL) { |
32351 | 1102 |
status = range->check_uint64_t(new_value, verbose); |
31371
311143309e73
8122937: [JEP 245] Validate JVM Command-Line Flag Arguments.
gziemski
parents:
31236
diff
changeset
|
1103 |
} |
32351 | 1104 |
if (status == Flag::SUCCESS) { |
1105 |
CommandLineFlagConstraint* constraint = CommandLineFlagConstraintList::find_if_needs_check(name); |
|
1106 |
if (constraint != NULL) { |
|
1107 |
status = constraint->apply_uint64_t(new_value, verbose); |
|
1108 |
} |
|
31371
311143309e73
8122937: [JEP 245] Validate JVM Command-Line Flag Arguments.
gziemski
parents:
31236
diff
changeset
|
1109 |
} |
32351 | 1110 |
return status; |
4434 | 1111 |
} |
1112 |
||
33775
3ae47fa978ea
8139765: set_numeric_flag can call Flag::find_flag to determine the flag type
ddmitriev
parents:
33604
diff
changeset
|
1113 |
Flag::Error CommandLineFlags::uint64_tAtPut(Flag* flag, uint64_t* value, Flag::Flags origin) { |
3ae47fa978ea
8139765: set_numeric_flag can call Flag::find_flag to determine the flag type
ddmitriev
parents:
33604
diff
changeset
|
1114 |
const char* name; |
3ae47fa978ea
8139765: set_numeric_flag can call Flag::find_flag to determine the flag type
ddmitriev
parents:
33604
diff
changeset
|
1115 |
if (flag == NULL) return Flag::INVALID_FLAG; |
3ae47fa978ea
8139765: set_numeric_flag can call Flag::find_flag to determine the flag type
ddmitriev
parents:
33604
diff
changeset
|
1116 |
if (!flag->is_uint64_t()) return Flag::WRONG_FORMAT; |
3ae47fa978ea
8139765: set_numeric_flag can call Flag::find_flag to determine the flag type
ddmitriev
parents:
33604
diff
changeset
|
1117 |
name = flag->_name; |
32351 | 1118 |
Flag::Error check = apply_constraint_and_check_range_uint64_t(name, *value, !CommandLineFlagConstraintList::validated_after_ergo()); |
31371
311143309e73
8122937: [JEP 245] Validate JVM Command-Line Flag Arguments.
gziemski
parents:
31236
diff
changeset
|
1119 |
if (check != Flag::SUCCESS) return check; |
33775
3ae47fa978ea
8139765: set_numeric_flag can call Flag::find_flag to determine the flag type
ddmitriev
parents:
33604
diff
changeset
|
1120 |
uint64_t old_value = flag->get_uint64_t(); |
22527 | 1121 |
trace_flag_changed<EventUnsignedLongFlagChanged, u8>(name, old_value, *value, origin); |
33775
3ae47fa978ea
8139765: set_numeric_flag can call Flag::find_flag to determine the flag type
ddmitriev
parents:
33604
diff
changeset
|
1122 |
flag->set_uint64_t(*value); |
4434 | 1123 |
*value = old_value; |
33775
3ae47fa978ea
8139765: set_numeric_flag can call Flag::find_flag to determine the flag type
ddmitriev
parents:
33604
diff
changeset
|
1124 |
flag->set_origin(origin); |
31371
311143309e73
8122937: [JEP 245] Validate JVM Command-Line Flag Arguments.
gziemski
parents:
31236
diff
changeset
|
1125 |
return Flag::SUCCESS; |
4434 | 1126 |
} |
1127 |
||
33775
3ae47fa978ea
8139765: set_numeric_flag can call Flag::find_flag to determine the flag type
ddmitriev
parents:
33604
diff
changeset
|
1128 |
Flag::Error CommandLineFlags::uint64_tAtPut(const char* name, size_t len, uint64_t* value, Flag::Flags origin) { |
3ae47fa978ea
8139765: set_numeric_flag can call Flag::find_flag to determine the flag type
ddmitriev
parents:
33604
diff
changeset
|
1129 |
Flag* result = Flag::find_flag(name, len); |
3ae47fa978ea
8139765: set_numeric_flag can call Flag::find_flag to determine the flag type
ddmitriev
parents:
33604
diff
changeset
|
1130 |
return uint64_tAtPut(result, value, origin); |
3ae47fa978ea
8139765: set_numeric_flag can call Flag::find_flag to determine the flag type
ddmitriev
parents:
33604
diff
changeset
|
1131 |
} |
3ae47fa978ea
8139765: set_numeric_flag can call Flag::find_flag to determine the flag type
ddmitriev
parents:
33604
diff
changeset
|
1132 |
|
31371
311143309e73
8122937: [JEP 245] Validate JVM Command-Line Flag Arguments.
gziemski
parents:
31236
diff
changeset
|
1133 |
Flag::Error CommandLineFlagsEx::uint64_tAtPut(CommandLineFlagWithType flag, uint64_t value, Flag::Flags origin) { |
4434 | 1134 |
Flag* faddr = address_of_flag(flag); |
1135 |
guarantee(faddr != NULL && faddr->is_uint64_t(), "wrong flag type"); |
|
33775
3ae47fa978ea
8139765: set_numeric_flag can call Flag::find_flag to determine the flag type
ddmitriev
parents:
33604
diff
changeset
|
1136 |
return CommandLineFlags::uint64_tAtPut(faddr, &value, origin); |
31371
311143309e73
8122937: [JEP 245] Validate JVM Command-Line Flag Arguments.
gziemski
parents:
31236
diff
changeset
|
1137 |
} |
311143309e73
8122937: [JEP 245] Validate JVM Command-Line Flag Arguments.
gziemski
parents:
31236
diff
changeset
|
1138 |
|
311143309e73
8122937: [JEP 245] Validate JVM Command-Line Flag Arguments.
gziemski
parents:
31236
diff
changeset
|
1139 |
Flag::Error CommandLineFlags::size_tAt(const char* name, size_t len, size_t* value, bool allow_locked, bool return_flag) { |
311143309e73
8122937: [JEP 245] Validate JVM Command-Line Flag Arguments.
gziemski
parents:
31236
diff
changeset
|
1140 |
Flag* result = Flag::find_flag(name, len, allow_locked, return_flag); |
311143309e73
8122937: [JEP 245] Validate JVM Command-Line Flag Arguments.
gziemski
parents:
31236
diff
changeset
|
1141 |
if (result == NULL) return Flag::INVALID_FLAG; |
311143309e73
8122937: [JEP 245] Validate JVM Command-Line Flag Arguments.
gziemski
parents:
31236
diff
changeset
|
1142 |
if (!result->is_size_t()) return Flag::WRONG_FORMAT; |
311143309e73
8122937: [JEP 245] Validate JVM Command-Line Flag Arguments.
gziemski
parents:
31236
diff
changeset
|
1143 |
*value = result->get_size_t(); |
311143309e73
8122937: [JEP 245] Validate JVM Command-Line Flag Arguments.
gziemski
parents:
31236
diff
changeset
|
1144 |
return Flag::SUCCESS; |
4434 | 1145 |
} |
1146 |
||
33775
3ae47fa978ea
8139765: set_numeric_flag can call Flag::find_flag to determine the flag type
ddmitriev
parents:
33604
diff
changeset
|
1147 |
static Flag::Error apply_constraint_and_check_range_size_t(const char* name, size_t new_value, bool verbose) { |
32351 | 1148 |
Flag::Error status = Flag::SUCCESS; |
31371
311143309e73
8122937: [JEP 245] Validate JVM Command-Line Flag Arguments.
gziemski
parents:
31236
diff
changeset
|
1149 |
CommandLineFlagRange* range = CommandLineFlagRangeList::find(name); |
311143309e73
8122937: [JEP 245] Validate JVM Command-Line Flag Arguments.
gziemski
parents:
31236
diff
changeset
|
1150 |
if (range != NULL) { |
32351 | 1151 |
status = range->check_size_t(new_value, verbose); |
31371
311143309e73
8122937: [JEP 245] Validate JVM Command-Line Flag Arguments.
gziemski
parents:
31236
diff
changeset
|
1152 |
} |
32351 | 1153 |
if (status == Flag::SUCCESS) { |
1154 |
CommandLineFlagConstraint* constraint = CommandLineFlagConstraintList::find_if_needs_check(name); |
|
1155 |
if (constraint != NULL) { |
|
1156 |
status = constraint->apply_size_t(new_value, verbose); |
|
1157 |
} |
|
31371
311143309e73
8122937: [JEP 245] Validate JVM Command-Line Flag Arguments.
gziemski
parents:
31236
diff
changeset
|
1158 |
} |
32351 | 1159 |
return status; |
25959 | 1160 |
} |
1161 |
||
33775
3ae47fa978ea
8139765: set_numeric_flag can call Flag::find_flag to determine the flag type
ddmitriev
parents:
33604
diff
changeset
|
1162 |
|
3ae47fa978ea
8139765: set_numeric_flag can call Flag::find_flag to determine the flag type
ddmitriev
parents:
33604
diff
changeset
|
1163 |
Flag::Error CommandLineFlags::size_tAtPut(Flag* flag, size_t* value, Flag::Flags origin) { |
3ae47fa978ea
8139765: set_numeric_flag can call Flag::find_flag to determine the flag type
ddmitriev
parents:
33604
diff
changeset
|
1164 |
const char* name; |
3ae47fa978ea
8139765: set_numeric_flag can call Flag::find_flag to determine the flag type
ddmitriev
parents:
33604
diff
changeset
|
1165 |
if (flag == NULL) return Flag::INVALID_FLAG; |
3ae47fa978ea
8139765: set_numeric_flag can call Flag::find_flag to determine the flag type
ddmitriev
parents:
33604
diff
changeset
|
1166 |
if (!flag->is_size_t()) return Flag::WRONG_FORMAT; |
3ae47fa978ea
8139765: set_numeric_flag can call Flag::find_flag to determine the flag type
ddmitriev
parents:
33604
diff
changeset
|
1167 |
name = flag->_name; |
32351 | 1168 |
Flag::Error check = apply_constraint_and_check_range_size_t(name, *value, !CommandLineFlagConstraintList::validated_after_ergo()); |
31371
311143309e73
8122937: [JEP 245] Validate JVM Command-Line Flag Arguments.
gziemski
parents:
31236
diff
changeset
|
1169 |
if (check != Flag::SUCCESS) return check; |
33775
3ae47fa978ea
8139765: set_numeric_flag can call Flag::find_flag to determine the flag type
ddmitriev
parents:
33604
diff
changeset
|
1170 |
size_t old_value = flag->get_size_t(); |
25959 | 1171 |
trace_flag_changed<EventUnsignedLongFlagChanged, u8>(name, old_value, *value, origin); |
33775
3ae47fa978ea
8139765: set_numeric_flag can call Flag::find_flag to determine the flag type
ddmitriev
parents:
33604
diff
changeset
|
1172 |
flag->set_size_t(*value); |
25959 | 1173 |
*value = old_value; |
33775
3ae47fa978ea
8139765: set_numeric_flag can call Flag::find_flag to determine the flag type
ddmitriev
parents:
33604
diff
changeset
|
1174 |
flag->set_origin(origin); |
31371
311143309e73
8122937: [JEP 245] Validate JVM Command-Line Flag Arguments.
gziemski
parents:
31236
diff
changeset
|
1175 |
return Flag::SUCCESS; |
25959 | 1176 |
} |
1177 |
||
33775
3ae47fa978ea
8139765: set_numeric_flag can call Flag::find_flag to determine the flag type
ddmitriev
parents:
33604
diff
changeset
|
1178 |
Flag::Error CommandLineFlags::size_tAtPut(const char* name, size_t len, size_t* value, Flag::Flags origin) { |
3ae47fa978ea
8139765: set_numeric_flag can call Flag::find_flag to determine the flag type
ddmitriev
parents:
33604
diff
changeset
|
1179 |
Flag* result = Flag::find_flag(name, len); |
3ae47fa978ea
8139765: set_numeric_flag can call Flag::find_flag to determine the flag type
ddmitriev
parents:
33604
diff
changeset
|
1180 |
return size_tAtPut(result, value, origin); |
3ae47fa978ea
8139765: set_numeric_flag can call Flag::find_flag to determine the flag type
ddmitriev
parents:
33604
diff
changeset
|
1181 |
} |
3ae47fa978ea
8139765: set_numeric_flag can call Flag::find_flag to determine the flag type
ddmitriev
parents:
33604
diff
changeset
|
1182 |
|
31371
311143309e73
8122937: [JEP 245] Validate JVM Command-Line Flag Arguments.
gziemski
parents:
31236
diff
changeset
|
1183 |
Flag::Error CommandLineFlagsEx::size_tAtPut(CommandLineFlagWithType flag, size_t value, Flag::Flags origin) { |
25959 | 1184 |
Flag* faddr = address_of_flag(flag); |
1185 |
guarantee(faddr != NULL && faddr->is_size_t(), "wrong flag type"); |
|
33775
3ae47fa978ea
8139765: set_numeric_flag can call Flag::find_flag to determine the flag type
ddmitriev
parents:
33604
diff
changeset
|
1186 |
return CommandLineFlags::size_tAtPut(faddr, &value, origin); |
31371
311143309e73
8122937: [JEP 245] Validate JVM Command-Line Flag Arguments.
gziemski
parents:
31236
diff
changeset
|
1187 |
} |
311143309e73
8122937: [JEP 245] Validate JVM Command-Line Flag Arguments.
gziemski
parents:
31236
diff
changeset
|
1188 |
|
311143309e73
8122937: [JEP 245] Validate JVM Command-Line Flag Arguments.
gziemski
parents:
31236
diff
changeset
|
1189 |
Flag::Error CommandLineFlags::doubleAt(const char* name, size_t len, double* value, bool allow_locked, bool return_flag) { |
311143309e73
8122937: [JEP 245] Validate JVM Command-Line Flag Arguments.
gziemski
parents:
31236
diff
changeset
|
1190 |
Flag* result = Flag::find_flag(name, len, allow_locked, return_flag); |
311143309e73
8122937: [JEP 245] Validate JVM Command-Line Flag Arguments.
gziemski
parents:
31236
diff
changeset
|
1191 |
if (result == NULL) return Flag::INVALID_FLAG; |
311143309e73
8122937: [JEP 245] Validate JVM Command-Line Flag Arguments.
gziemski
parents:
31236
diff
changeset
|
1192 |
if (!result->is_double()) return Flag::WRONG_FORMAT; |
311143309e73
8122937: [JEP 245] Validate JVM Command-Line Flag Arguments.
gziemski
parents:
31236
diff
changeset
|
1193 |
*value = result->get_double(); |
311143309e73
8122937: [JEP 245] Validate JVM Command-Line Flag Arguments.
gziemski
parents:
31236
diff
changeset
|
1194 |
return Flag::SUCCESS; |
25959 | 1195 |
} |
1196 |
||
33775
3ae47fa978ea
8139765: set_numeric_flag can call Flag::find_flag to determine the flag type
ddmitriev
parents:
33604
diff
changeset
|
1197 |
static Flag::Error apply_constraint_and_check_range_double(const char* name, double new_value, bool verbose) { |
32351 | 1198 |
Flag::Error status = Flag::SUCCESS; |
31371
311143309e73
8122937: [JEP 245] Validate JVM Command-Line Flag Arguments.
gziemski
parents:
31236
diff
changeset
|
1199 |
CommandLineFlagRange* range = CommandLineFlagRangeList::find(name); |
311143309e73
8122937: [JEP 245] Validate JVM Command-Line Flag Arguments.
gziemski
parents:
31236
diff
changeset
|
1200 |
if (range != NULL) { |
32351 | 1201 |
status = range->check_double(new_value, verbose); |
31371
311143309e73
8122937: [JEP 245] Validate JVM Command-Line Flag Arguments.
gziemski
parents:
31236
diff
changeset
|
1202 |
} |
32351 | 1203 |
if (status == Flag::SUCCESS) { |
1204 |
CommandLineFlagConstraint* constraint = CommandLineFlagConstraintList::find_if_needs_check(name); |
|
1205 |
if (constraint != NULL) { |
|
1206 |
status = constraint->apply_double(new_value, verbose); |
|
1207 |
} |
|
31371
311143309e73
8122937: [JEP 245] Validate JVM Command-Line Flag Arguments.
gziemski
parents:
31236
diff
changeset
|
1208 |
} |
32351 | 1209 |
return status; |
1 | 1210 |
} |
1211 |
||
33775
3ae47fa978ea
8139765: set_numeric_flag can call Flag::find_flag to determine the flag type
ddmitriev
parents:
33604
diff
changeset
|
1212 |
Flag::Error CommandLineFlags::doubleAtPut(Flag* flag, double* value, Flag::Flags origin) { |
3ae47fa978ea
8139765: set_numeric_flag can call Flag::find_flag to determine the flag type
ddmitriev
parents:
33604
diff
changeset
|
1213 |
const char* name; |
3ae47fa978ea
8139765: set_numeric_flag can call Flag::find_flag to determine the flag type
ddmitriev
parents:
33604
diff
changeset
|
1214 |
if (flag == NULL) return Flag::INVALID_FLAG; |
3ae47fa978ea
8139765: set_numeric_flag can call Flag::find_flag to determine the flag type
ddmitriev
parents:
33604
diff
changeset
|
1215 |
if (!flag->is_double()) return Flag::WRONG_FORMAT; |
3ae47fa978ea
8139765: set_numeric_flag can call Flag::find_flag to determine the flag type
ddmitriev
parents:
33604
diff
changeset
|
1216 |
name = flag->_name; |
32351 | 1217 |
Flag::Error check = apply_constraint_and_check_range_double(name, *value, !CommandLineFlagConstraintList::validated_after_ergo()); |
31371
311143309e73
8122937: [JEP 245] Validate JVM Command-Line Flag Arguments.
gziemski
parents:
31236
diff
changeset
|
1218 |
if (check != Flag::SUCCESS) return check; |
33775
3ae47fa978ea
8139765: set_numeric_flag can call Flag::find_flag to determine the flag type
ddmitriev
parents:
33604
diff
changeset
|
1219 |
double old_value = flag->get_double(); |
22527 | 1220 |
trace_flag_changed<EventDoubleFlagChanged, double>(name, old_value, *value, origin); |
33775
3ae47fa978ea
8139765: set_numeric_flag can call Flag::find_flag to determine the flag type
ddmitriev
parents:
33604
diff
changeset
|
1221 |
flag->set_double(*value); |
1 | 1222 |
*value = old_value; |
33775
3ae47fa978ea
8139765: set_numeric_flag can call Flag::find_flag to determine the flag type
ddmitriev
parents:
33604
diff
changeset
|
1223 |
flag->set_origin(origin); |
31371
311143309e73
8122937: [JEP 245] Validate JVM Command-Line Flag Arguments.
gziemski
parents:
31236
diff
changeset
|
1224 |
return Flag::SUCCESS; |
1 | 1225 |
} |
1226 |
||
33775
3ae47fa978ea
8139765: set_numeric_flag can call Flag::find_flag to determine the flag type
ddmitriev
parents:
33604
diff
changeset
|
1227 |
Flag::Error CommandLineFlags::doubleAtPut(const char* name, size_t len, double* value, Flag::Flags origin) { |
3ae47fa978ea
8139765: set_numeric_flag can call Flag::find_flag to determine the flag type
ddmitriev
parents:
33604
diff
changeset
|
1228 |
Flag* result = Flag::find_flag(name, len); |
3ae47fa978ea
8139765: set_numeric_flag can call Flag::find_flag to determine the flag type
ddmitriev
parents:
33604
diff
changeset
|
1229 |
return doubleAtPut(result, value, origin); |
3ae47fa978ea
8139765: set_numeric_flag can call Flag::find_flag to determine the flag type
ddmitriev
parents:
33604
diff
changeset
|
1230 |
} |
3ae47fa978ea
8139765: set_numeric_flag can call Flag::find_flag to determine the flag type
ddmitriev
parents:
33604
diff
changeset
|
1231 |
|
31371
311143309e73
8122937: [JEP 245] Validate JVM Command-Line Flag Arguments.
gziemski
parents:
31236
diff
changeset
|
1232 |
Flag::Error CommandLineFlagsEx::doubleAtPut(CommandLineFlagWithType flag, double value, Flag::Flags origin) { |
1 | 1233 |
Flag* faddr = address_of_flag(flag); |
1234 |
guarantee(faddr != NULL && faddr->is_double(), "wrong flag type"); |
|
33775
3ae47fa978ea
8139765: set_numeric_flag can call Flag::find_flag to determine the flag type
ddmitriev
parents:
33604
diff
changeset
|
1235 |
return CommandLineFlags::doubleAtPut(faddr, &value, origin); |
1 | 1236 |
} |
1237 |
||
31371
311143309e73
8122937: [JEP 245] Validate JVM Command-Line Flag Arguments.
gziemski
parents:
31236
diff
changeset
|
1238 |
Flag::Error CommandLineFlags::ccstrAt(const char* name, size_t len, ccstr* value, bool allow_locked, bool return_flag) { |
27417
576e2b527e1c
8061443: Whitebox get*VMFlag() methods fail with develop flags in product builds
thartmann
parents:
27166
diff
changeset
|
1239 |
Flag* result = Flag::find_flag(name, len, allow_locked, return_flag); |
31371
311143309e73
8122937: [JEP 245] Validate JVM Command-Line Flag Arguments.
gziemski
parents:
31236
diff
changeset
|
1240 |
if (result == NULL) return Flag::INVALID_FLAG; |
311143309e73
8122937: [JEP 245] Validate JVM Command-Line Flag Arguments.
gziemski
parents:
31236
diff
changeset
|
1241 |
if (!result->is_ccstr()) return Flag::WRONG_FORMAT; |
1 | 1242 |
*value = result->get_ccstr(); |
31371
311143309e73
8122937: [JEP 245] Validate JVM Command-Line Flag Arguments.
gziemski
parents:
31236
diff
changeset
|
1243 |
return Flag::SUCCESS; |
1 | 1244 |
} |
1245 |
||
31371
311143309e73
8122937: [JEP 245] Validate JVM Command-Line Flag Arguments.
gziemski
parents:
31236
diff
changeset
|
1246 |
Flag::Error CommandLineFlags::ccstrAtPut(const char* name, size_t len, ccstr* value, Flag::Flags origin) { |
1 | 1247 |
Flag* result = Flag::find_flag(name, len); |
31371
311143309e73
8122937: [JEP 245] Validate JVM Command-Line Flag Arguments.
gziemski
parents:
31236
diff
changeset
|
1248 |
if (result == NULL) return Flag::INVALID_FLAG; |
311143309e73
8122937: [JEP 245] Validate JVM Command-Line Flag Arguments.
gziemski
parents:
31236
diff
changeset
|
1249 |
if (!result->is_ccstr()) return Flag::WRONG_FORMAT; |
1 | 1250 |
ccstr old_value = result->get_ccstr(); |
22527 | 1251 |
trace_flag_changed<EventStringFlagChanged, const char*>(name, old_value, *value, origin); |
1402
ccb40ce62b79
6744783: HotSpot segfaults if given -XX options with an empty string argument
never
parents:
670
diff
changeset
|
1252 |
char* new_value = NULL; |
ccb40ce62b79
6744783: HotSpot segfaults if given -XX options with an empty string argument
never
parents:
670
diff
changeset
|
1253 |
if (*value != NULL) { |
27471 | 1254 |
new_value = os::strdup_check_oom(*value); |
1402
ccb40ce62b79
6744783: HotSpot segfaults if given -XX options with an empty string argument
never
parents:
670
diff
changeset
|
1255 |
} |
1 | 1256 |
result->set_ccstr(new_value); |
20288
e2d549f40de9
8024545: make develop and notproduct flag values available in product builds
twisti
parents:
19710
diff
changeset
|
1257 |
if (result->is_default() && old_value != NULL) { |
1 | 1258 |
// Prior value is NOT heap allocated, but was a literal constant. |
27471 | 1259 |
old_value = os::strdup_check_oom(old_value); |
1 | 1260 |
} |
1261 |
*value = old_value; |
|
20288
e2d549f40de9
8024545: make develop and notproduct flag values available in product builds
twisti
parents:
19710
diff
changeset
|
1262 |
result->set_origin(origin); |
31371
311143309e73
8122937: [JEP 245] Validate JVM Command-Line Flag Arguments.
gziemski
parents:
31236
diff
changeset
|
1263 |
return Flag::SUCCESS; |
1 | 1264 |
} |
1265 |
||
31371
311143309e73
8122937: [JEP 245] Validate JVM Command-Line Flag Arguments.
gziemski
parents:
31236
diff
changeset
|
1266 |
Flag::Error CommandLineFlagsEx::ccstrAtPut(CommandLineFlagWithType flag, ccstr value, Flag::Flags origin) { |
1 | 1267 |
Flag* faddr = address_of_flag(flag); |
1268 |
guarantee(faddr != NULL && faddr->is_ccstr(), "wrong flag type"); |
|
1269 |
ccstr old_value = faddr->get_ccstr(); |
|
22527 | 1270 |
trace_flag_changed<EventStringFlagChanged, const char*>(faddr->_name, old_value, value, origin); |
27471 | 1271 |
char* new_value = os::strdup_check_oom(value); |
1 | 1272 |
faddr->set_ccstr(new_value); |
20288
e2d549f40de9
8024545: make develop and notproduct flag values available in product builds
twisti
parents:
19710
diff
changeset
|
1273 |
if (!faddr->is_default() && old_value != NULL) { |
1 | 1274 |
// Prior value is heap allocated so free it. |
27880
afb974a04396
8060074: os::free() takes MemoryTrackingLevel but doesn't need it
coleenp
parents:
27471
diff
changeset
|
1275 |
FREE_C_HEAP_ARRAY(char, old_value); |
1 | 1276 |
} |
20288
e2d549f40de9
8024545: make develop and notproduct flag values available in product builds
twisti
parents:
19710
diff
changeset
|
1277 |
faddr->set_origin(origin); |
31371
311143309e73
8122937: [JEP 245] Validate JVM Command-Line Flag Arguments.
gziemski
parents:
31236
diff
changeset
|
1278 |
return Flag::SUCCESS; |
1 | 1279 |
} |
1280 |
||
1281 |
extern "C" { |
|
1282 |
static int compare_flags(const void* void_a, const void* void_b) { |
|
20288
e2d549f40de9
8024545: make develop and notproduct flag values available in product builds
twisti
parents:
19710
diff
changeset
|
1283 |
return strcmp((*((Flag**) void_a))->_name, (*((Flag**) void_b))->_name); |
1 | 1284 |
} |
1285 |
} |
|
1286 |
||
11441 | 1287 |
void CommandLineFlags::printSetFlags(outputStream* out) { |
1 | 1288 |
// Print which flags were set on the command line |
1289 |
// note: this method is called before the thread structure is in place |
|
1290 |
// which means resource allocation cannot be used. |
|
1291 |
||
20288
e2d549f40de9
8024545: make develop and notproduct flag values available in product builds
twisti
parents:
19710
diff
changeset
|
1292 |
// The last entry is the null entry. |
e2d549f40de9
8024545: make develop and notproduct flag values available in product builds
twisti
parents:
19710
diff
changeset
|
1293 |
const size_t length = Flag::numFlags - 1; |
1 | 1294 |
|
1295 |
// Sort |
|
13195 | 1296 |
Flag** array = NEW_C_HEAP_ARRAY(Flag*, length, mtInternal); |
20288
e2d549f40de9
8024545: make develop and notproduct flag values available in product builds
twisti
parents:
19710
diff
changeset
|
1297 |
for (size_t i = 0; i < length; i++) { |
e2d549f40de9
8024545: make develop and notproduct flag values available in product builds
twisti
parents:
19710
diff
changeset
|
1298 |
array[i] = &flagTable[i]; |
1 | 1299 |
} |
1300 |
qsort(array, length, sizeof(Flag*), compare_flags); |
|
1301 |
||
1302 |
||
20288
e2d549f40de9
8024545: make develop and notproduct flag values available in product builds
twisti
parents:
19710
diff
changeset
|
1303 |
for (size_t i = 0; i < length; i++) { |
e2d549f40de9
8024545: make develop and notproduct flag values available in product builds
twisti
parents:
19710
diff
changeset
|
1304 |
if (array[i]->get_origin() /* naked field! */) { |
11441 | 1305 |
array[i]->print_as_flag(out); |
1306 |
out->print(" "); |
|
1 | 1307 |
} |
1308 |
} |
|
11441 | 1309 |
out->cr(); |
27880
afb974a04396
8060074: os::free() takes MemoryTrackingLevel but doesn't need it
coleenp
parents:
27471
diff
changeset
|
1310 |
FREE_C_HEAP_ARRAY(Flag*, array); |
1 | 1311 |
} |
1312 |
||
1313 |
#ifndef PRODUCT |
|
1314 |
||
1315 |
void CommandLineFlags::verify() { |
|
1316 |
assert(Arguments::check_vm_args_consistency(), "Some flag settings conflict"); |
|
1317 |
} |
|
1318 |
||
4579 | 1319 |
#endif // PRODUCT |
1320 |
||
31371
311143309e73
8122937: [JEP 245] Validate JVM Command-Line Flag Arguments.
gziemski
parents:
31236
diff
changeset
|
1321 |
void CommandLineFlags::printFlags(outputStream* out, bool withComments, bool printRanges) { |
1 | 1322 |
// Print the flags sorted by name |
1323 |
// note: this method is called before the thread structure is in place |
|
1324 |
// which means resource allocation cannot be used. |
|
1325 |
||
20288
e2d549f40de9
8024545: make develop and notproduct flag values available in product builds
twisti
parents:
19710
diff
changeset
|
1326 |
// The last entry is the null entry. |
e2d549f40de9
8024545: make develop and notproduct flag values available in product builds
twisti
parents:
19710
diff
changeset
|
1327 |
const size_t length = Flag::numFlags - 1; |
1 | 1328 |
|
1329 |
// Sort |
|
13195 | 1330 |
Flag** array = NEW_C_HEAP_ARRAY(Flag*, length, mtInternal); |
20288
e2d549f40de9
8024545: make develop and notproduct flag values available in product builds
twisti
parents:
19710
diff
changeset
|
1331 |
for (size_t i = 0; i < length; i++) { |
e2d549f40de9
8024545: make develop and notproduct flag values available in product builds
twisti
parents:
19710
diff
changeset
|
1332 |
array[i] = &flagTable[i]; |
1 | 1333 |
} |
1334 |
qsort(array, length, sizeof(Flag*), compare_flags); |
|
1335 |
||
1336 |
||
31371
311143309e73
8122937: [JEP 245] Validate JVM Command-Line Flag Arguments.
gziemski
parents:
31236
diff
changeset
|
1337 |
if (!printRanges) { |
311143309e73
8122937: [JEP 245] Validate JVM Command-Line Flag Arguments.
gziemski
parents:
31236
diff
changeset
|
1338 |
out->print_cr("[Global flags]"); |
311143309e73
8122937: [JEP 245] Validate JVM Command-Line Flag Arguments.
gziemski
parents:
31236
diff
changeset
|
1339 |
} else { |
311143309e73
8122937: [JEP 245] Validate JVM Command-Line Flag Arguments.
gziemski
parents:
31236
diff
changeset
|
1340 |
out->print_cr("[Global flags ranges]"); |
311143309e73
8122937: [JEP 245] Validate JVM Command-Line Flag Arguments.
gziemski
parents:
31236
diff
changeset
|
1341 |
} |
311143309e73
8122937: [JEP 245] Validate JVM Command-Line Flag Arguments.
gziemski
parents:
31236
diff
changeset
|
1342 |
|
20288
e2d549f40de9
8024545: make develop and notproduct flag values available in product builds
twisti
parents:
19710
diff
changeset
|
1343 |
for (size_t i = 0; i < length; i++) { |
1 | 1344 |
if (array[i]->is_unlocked()) { |
31371
311143309e73
8122937: [JEP 245] Validate JVM Command-Line Flag Arguments.
gziemski
parents:
31236
diff
changeset
|
1345 |
array[i]->print_on(out, withComments, printRanges); |
1 | 1346 |
} |
1347 |
} |
|
27880
afb974a04396
8060074: os::free() takes MemoryTrackingLevel but doesn't need it
coleenp
parents:
27471
diff
changeset
|
1348 |
FREE_C_HEAP_ARRAY(Flag*, array); |
1 | 1349 |
} |