Mercurial > hg > graal-jvmci-8
annotate src/share/vm/runtime/globals.cpp @ 2192:b92c45f2bc75
7016023: Enable building ARM and PPC from src/closed repository
Reviewed-by: dholmes, bdelsart
author | bobv |
---|---|
date | Wed, 02 Feb 2011 11:35:26 -0500 |
parents | f95d63e2154a |
children | ed69575596ac |
rev | line source |
---|---|
0 | 1 /* |
1692 | 2 * Copyright (c) 1997, 2010, Oracle and/or its affiliates. All rights reserved. |
0 | 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 * | |
1552
c18cbe5936b8
6941466: Oracle rebranding changes for Hotspot repositories
trims
parents:
1150
diff
changeset
|
19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA |
c18cbe5936b8
6941466: Oracle rebranding changes for Hotspot repositories
trims
parents:
1150
diff
changeset
|
20 * or visit www.oracle.com if you need additional information or have any |
c18cbe5936b8
6941466: Oracle rebranding changes for Hotspot repositories
trims
parents:
1150
diff
changeset
|
21 * questions. |
0 | 22 * |
23 */ | |
24 | |
1972 | 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" | |
31 #include "utilities/ostream.hpp" | |
32 #include "utilities/top.hpp" | |
33 #ifndef SERIALGC | |
34 #include "gc_implementation/g1/g1_globals.hpp" | |
35 #endif | |
36 #ifdef COMPILER1 | |
37 #include "c1/c1_globals.hpp" | |
38 #endif | |
39 #ifdef COMPILER2 | |
40 #include "opto/c2_globals.hpp" | |
41 #endif | |
42 #ifdef SHARK | |
43 #include "shark/shark_globals.hpp" | |
44 #endif | |
0 | 45 |
46 | |
47 RUNTIME_FLAGS(MATERIALIZE_DEVELOPER_FLAG, MATERIALIZE_PD_DEVELOPER_FLAG, \ | |
48 MATERIALIZE_PRODUCT_FLAG, MATERIALIZE_PD_PRODUCT_FLAG, \ | |
350
d28aa69f0959
6618726: Introduce -XX:+UnlockExperimentalVMOptions flag
ysr
parents:
342
diff
changeset
|
49 MATERIALIZE_DIAGNOSTIC_FLAG, MATERIALIZE_EXPERIMENTAL_FLAG, \ |
d28aa69f0959
6618726: Introduce -XX:+UnlockExperimentalVMOptions flag
ysr
parents:
342
diff
changeset
|
50 MATERIALIZE_NOTPRODUCT_FLAG, \ |
113
ba764ed4b6f2
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
103
diff
changeset
|
51 MATERIALIZE_MANAGEABLE_FLAG, MATERIALIZE_PRODUCT_RW_FLAG, \ |
ba764ed4b6f2
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
103
diff
changeset
|
52 MATERIALIZE_LP64_PRODUCT_FLAG) |
0 | 53 |
54 RUNTIME_OS_FLAGS(MATERIALIZE_DEVELOPER_FLAG, MATERIALIZE_PD_DEVELOPER_FLAG, \ | |
55 MATERIALIZE_PRODUCT_FLAG, MATERIALIZE_PD_PRODUCT_FLAG, \ | |
56 MATERIALIZE_DIAGNOSTIC_FLAG, MATERIALIZE_NOTPRODUCT_FLAG) | |
57 | |
58 bool Flag::is_unlocker() const { | |
350
d28aa69f0959
6618726: Introduce -XX:+UnlockExperimentalVMOptions flag
ysr
parents:
342
diff
changeset
|
59 return strcmp(name, "UnlockDiagnosticVMOptions") == 0 || |
d28aa69f0959
6618726: Introduce -XX:+UnlockExperimentalVMOptions flag
ysr
parents:
342
diff
changeset
|
60 strcmp(name, "UnlockExperimentalVMOptions") == 0; |
d28aa69f0959
6618726: Introduce -XX:+UnlockExperimentalVMOptions flag
ysr
parents:
342
diff
changeset
|
61 |
0 | 62 } |
63 | |
64 bool Flag::is_unlocked() const { | |
65 if (strcmp(kind, "{diagnostic}") == 0) { | |
66 return UnlockDiagnosticVMOptions; | |
1080
7c57aead6d3e
6892658: C2 should optimize some stringbuilder patterns
never
parents:
1067
diff
changeset
|
67 } else if (strcmp(kind, "{experimental}") == 0 || |
7c57aead6d3e
6892658: C2 should optimize some stringbuilder patterns
never
parents:
1067
diff
changeset
|
68 strcmp(kind, "{C2 experimental}") == 0) { |
350
d28aa69f0959
6618726: Introduce -XX:+UnlockExperimentalVMOptions flag
ysr
parents:
342
diff
changeset
|
69 return UnlockExperimentalVMOptions; |
0 | 70 } else { |
71 return true; | |
72 } | |
73 } | |
74 | |
75 bool Flag::is_writeable() const { | |
76 return (strcmp(kind, "{manageable}") == 0 || strcmp(kind, "{product rw}") == 0); | |
77 } | |
78 | |
79 // All flags except "manageable" are assumed internal flags. | |
80 // Long term, we need to define a mechanism to specify which flags | |
81 // are external/stable and change this function accordingly. | |
82 bool Flag::is_external() const { | |
83 return (strcmp(kind, "{manageable}") == 0); | |
84 } | |
85 | |
86 // Length of format string (e.g. "%.1234s") for printing ccstr below | |
87 #define FORMAT_BUFFER_LEN 16 | |
88 | |
1768
6ee479178066
6979444: add command line option to print command line flags descriptions
ikrylov
parents:
1692
diff
changeset
|
89 void Flag::print_on(outputStream* st, bool withComments) { |
6ee479178066
6979444: add command line option to print command line flags descriptions
ikrylov
parents:
1692
diff
changeset
|
90 st->print("%9s %-40s %c= ", type, name, (origin != DEFAULT ? ':' : ' ')); |
1067
ba7ea42fc66e
6898160: Need serviceability support for new vm argument type 'uint64_t'
phh
parents:
1064
diff
changeset
|
91 if (is_bool()) st->print("%-16s", get_bool() ? "true" : "false"); |
ba7ea42fc66e
6898160: Need serviceability support for new vm argument type 'uint64_t'
phh
parents:
1064
diff
changeset
|
92 if (is_intx()) st->print("%-16ld", get_intx()); |
ba7ea42fc66e
6898160: Need serviceability support for new vm argument type 'uint64_t'
phh
parents:
1064
diff
changeset
|
93 if (is_uintx()) st->print("%-16lu", get_uintx()); |
ba7ea42fc66e
6898160: Need serviceability support for new vm argument type 'uint64_t'
phh
parents:
1064
diff
changeset
|
94 if (is_uint64_t()) st->print("%-16lu", get_uint64_t()); |
1768
6ee479178066
6979444: add command line option to print command line flags descriptions
ikrylov
parents:
1692
diff
changeset
|
95 if (is_double()) st->print("%-16f", get_double()); |
6ee479178066
6979444: add command line option to print command line flags descriptions
ikrylov
parents:
1692
diff
changeset
|
96 |
0 | 97 if (is_ccstr()) { |
1768
6ee479178066
6979444: add command line option to print command line flags descriptions
ikrylov
parents:
1692
diff
changeset
|
98 const char* cp = get_ccstr(); |
6ee479178066
6979444: add command line option to print command line flags descriptions
ikrylov
parents:
1692
diff
changeset
|
99 if (cp != NULL) { |
6ee479178066
6979444: add command line option to print command line flags descriptions
ikrylov
parents:
1692
diff
changeset
|
100 const char* eol; |
6ee479178066
6979444: add command line option to print command line flags descriptions
ikrylov
parents:
1692
diff
changeset
|
101 while ((eol = strchr(cp, '\n')) != NULL) { |
6ee479178066
6979444: add command line option to print command line flags descriptions
ikrylov
parents:
1692
diff
changeset
|
102 char format_buffer[FORMAT_BUFFER_LEN]; |
6ee479178066
6979444: add command line option to print command line flags descriptions
ikrylov
parents:
1692
diff
changeset
|
103 size_t llen = pointer_delta(eol, cp, sizeof(char)); |
6ee479178066
6979444: add command line option to print command line flags descriptions
ikrylov
parents:
1692
diff
changeset
|
104 jio_snprintf(format_buffer, FORMAT_BUFFER_LEN, |
103 | 105 "%%." SIZE_FORMAT "s", llen); |
1768
6ee479178066
6979444: add command line option to print command line flags descriptions
ikrylov
parents:
1692
diff
changeset
|
106 st->print(format_buffer, cp); |
6ee479178066
6979444: add command line option to print command line flags descriptions
ikrylov
parents:
1692
diff
changeset
|
107 st->cr(); |
6ee479178066
6979444: add command line option to print command line flags descriptions
ikrylov
parents:
1692
diff
changeset
|
108 cp = eol+1; |
6ee479178066
6979444: add command line option to print command line flags descriptions
ikrylov
parents:
1692
diff
changeset
|
109 st->print("%5s %-35s += ", "", name); |
6ee479178066
6979444: add command line option to print command line flags descriptions
ikrylov
parents:
1692
diff
changeset
|
110 } |
6ee479178066
6979444: add command line option to print command line flags descriptions
ikrylov
parents:
1692
diff
changeset
|
111 st->print("%-16s", cp); |
6ee479178066
6979444: add command line option to print command line flags descriptions
ikrylov
parents:
1692
diff
changeset
|
112 } |
6ee479178066
6979444: add command line option to print command line flags descriptions
ikrylov
parents:
1692
diff
changeset
|
113 else st->print("%-16s", ""); |
0 | 114 } |
1768
6ee479178066
6979444: add command line option to print command line flags descriptions
ikrylov
parents:
1692
diff
changeset
|
115 st->print("%-20s", kind); |
6ee479178066
6979444: add command line option to print command line flags descriptions
ikrylov
parents:
1692
diff
changeset
|
116 if (withComments) { |
6ee479178066
6979444: add command line option to print command line flags descriptions
ikrylov
parents:
1692
diff
changeset
|
117 #ifndef PRODUCT |
6ee479178066
6979444: add command line option to print command line flags descriptions
ikrylov
parents:
1692
diff
changeset
|
118 st->print("%s", doc ); |
6ee479178066
6979444: add command line option to print command line flags descriptions
ikrylov
parents:
1692
diff
changeset
|
119 #endif |
6ee479178066
6979444: add command line option to print command line flags descriptions
ikrylov
parents:
1692
diff
changeset
|
120 } |
0 | 121 st->cr(); |
122 } | |
123 | |
124 void Flag::print_as_flag(outputStream* st) { | |
125 if (is_bool()) { | |
126 st->print("-XX:%s%s", get_bool() ? "+" : "-", name); | |
127 } else if (is_intx()) { | |
128 st->print("-XX:%s=" INTX_FORMAT, name, get_intx()); | |
129 } else if (is_uintx()) { | |
130 st->print("-XX:%s=" UINTX_FORMAT, name, get_uintx()); | |
1067
ba7ea42fc66e
6898160: Need serviceability support for new vm argument type 'uint64_t'
phh
parents:
1064
diff
changeset
|
131 } else if (is_uint64_t()) { |
ba7ea42fc66e
6898160: Need serviceability support for new vm argument type 'uint64_t'
phh
parents:
1064
diff
changeset
|
132 st->print("-XX:%s=" UINT64_FORMAT, name, get_uint64_t()); |
0 | 133 } else if (is_ccstr()) { |
134 st->print("-XX:%s=", name); | |
103 | 135 const char* cp = get_ccstr(); |
136 if (cp != NULL) { | |
137 // Need to turn embedded '\n's back into separate arguments | |
138 // Not so efficient to print one character at a time, | |
139 // but the choice is to do the transformation to a buffer | |
140 // and print that. And this need not be efficient. | |
141 for (; *cp != '\0'; cp += 1) { | |
142 switch (*cp) { | |
143 default: | |
144 st->print("%c", *cp); | |
145 break; | |
146 case '\n': | |
147 st->print(" -XX:%s=", name); | |
148 break; | |
149 } | |
0 | 150 } |
151 } | |
152 } else { | |
153 ShouldNotReachHere(); | |
154 } | |
155 } | |
156 | |
157 // 4991491 do not "optimize out" the was_set false values: omitting them | |
158 // tickles a Microsoft compiler bug causing flagTable to be malformed | |
159 | |
1768
6ee479178066
6979444: add command line option to print command line flags descriptions
ikrylov
parents:
1692
diff
changeset
|
160 #define RUNTIME_PRODUCT_FLAG_STRUCT(type, name, value, doc) { #type, XSTR(name), &name, NOT_PRODUCT_ARG(doc) "{product}", DEFAULT }, |
6ee479178066
6979444: add command line option to print command line flags descriptions
ikrylov
parents:
1692
diff
changeset
|
161 #define RUNTIME_PD_PRODUCT_FLAG_STRUCT(type, name, doc) { #type, XSTR(name), &name, NOT_PRODUCT_ARG(doc) "{pd product}", DEFAULT }, |
6ee479178066
6979444: add command line option to print command line flags descriptions
ikrylov
parents:
1692
diff
changeset
|
162 #define RUNTIME_DIAGNOSTIC_FLAG_STRUCT(type, name, value, doc) { #type, XSTR(name), &name, NOT_PRODUCT_ARG(doc) "{diagnostic}", DEFAULT }, |
6ee479178066
6979444: add command line option to print command line flags descriptions
ikrylov
parents:
1692
diff
changeset
|
163 #define RUNTIME_EXPERIMENTAL_FLAG_STRUCT(type, name, value, doc) { #type, XSTR(name), &name, NOT_PRODUCT_ARG(doc) "{experimental}", DEFAULT }, |
6ee479178066
6979444: add command line option to print command line flags descriptions
ikrylov
parents:
1692
diff
changeset
|
164 #define RUNTIME_MANAGEABLE_FLAG_STRUCT(type, name, value, doc) { #type, XSTR(name), &name, NOT_PRODUCT_ARG(doc) "{manageable}", DEFAULT }, |
6ee479178066
6979444: add command line option to print command line flags descriptions
ikrylov
parents:
1692
diff
changeset
|
165 #define RUNTIME_PRODUCT_RW_FLAG_STRUCT(type, name, value, doc) { #type, XSTR(name), &name, NOT_PRODUCT_ARG(doc) "{product rw}", DEFAULT }, |
0 | 166 |
167 #ifdef PRODUCT | |
168 #define RUNTIME_DEVELOP_FLAG_STRUCT(type, name, value, doc) /* flag is constant */ | |
169 #define RUNTIME_PD_DEVELOP_FLAG_STRUCT(type, name, doc) /* flag is constant */ | |
170 #define RUNTIME_NOTPRODUCT_FLAG_STRUCT(type, name, value, doc) | |
171 #else | |
1768
6ee479178066
6979444: add command line option to print command line flags descriptions
ikrylov
parents:
1692
diff
changeset
|
172 #define RUNTIME_DEVELOP_FLAG_STRUCT(type, name, value, doc) { #type, XSTR(name), &name, doc, "", DEFAULT }, |
6ee479178066
6979444: add command line option to print command line flags descriptions
ikrylov
parents:
1692
diff
changeset
|
173 #define RUNTIME_PD_DEVELOP_FLAG_STRUCT(type, name, doc) { #type, XSTR(name), &name, doc, "{pd}", DEFAULT }, |
6ee479178066
6979444: add command line option to print command line flags descriptions
ikrylov
parents:
1692
diff
changeset
|
174 #define RUNTIME_NOTPRODUCT_FLAG_STRUCT(type, name, value, doc) { #type, XSTR(name), &name, doc, "{notproduct}", DEFAULT }, |
0 | 175 #endif |
176 | |
113
ba764ed4b6f2
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
103
diff
changeset
|
177 #ifdef _LP64 |
1768
6ee479178066
6979444: add command line option to print command line flags descriptions
ikrylov
parents:
1692
diff
changeset
|
178 #define RUNTIME_LP64_PRODUCT_FLAG_STRUCT(type, name, value, doc) { #type, XSTR(name), &name, NOT_PRODUCT_ARG(doc) "{lp64_product}", DEFAULT }, |
113
ba764ed4b6f2
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
103
diff
changeset
|
179 #else |
ba764ed4b6f2
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
103
diff
changeset
|
180 #define RUNTIME_LP64_PRODUCT_FLAG_STRUCT(type, name, value, doc) /* flag is constant */ |
ba764ed4b6f2
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
103
diff
changeset
|
181 #endif // _LP64 |
ba764ed4b6f2
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
103
diff
changeset
|
182 |
1768
6ee479178066
6979444: add command line option to print command line flags descriptions
ikrylov
parents:
1692
diff
changeset
|
183 #define C1_PRODUCT_FLAG_STRUCT(type, name, value, doc) { #type, XSTR(name), &name, NOT_PRODUCT_ARG(doc) "{C1 product}", DEFAULT }, |
6ee479178066
6979444: add command line option to print command line flags descriptions
ikrylov
parents:
1692
diff
changeset
|
184 #define C1_PD_PRODUCT_FLAG_STRUCT(type, name, doc) { #type, XSTR(name), &name, NOT_PRODUCT_ARG(doc) "{C1 pd product}", DEFAULT }, |
0 | 185 #ifdef PRODUCT |
186 #define C1_DEVELOP_FLAG_STRUCT(type, name, value, doc) /* flag is constant */ | |
187 #define C1_PD_DEVELOP_FLAG_STRUCT(type, name, doc) /* flag is constant */ | |
188 #define C1_NOTPRODUCT_FLAG_STRUCT(type, name, value, doc) | |
189 #else | |
1768
6ee479178066
6979444: add command line option to print command line flags descriptions
ikrylov
parents:
1692
diff
changeset
|
190 #define C1_DEVELOP_FLAG_STRUCT(type, name, value, doc) { #type, XSTR(name), &name, doc, "{C1}", DEFAULT }, |
6ee479178066
6979444: add command line option to print command line flags descriptions
ikrylov
parents:
1692
diff
changeset
|
191 #define C1_PD_DEVELOP_FLAG_STRUCT(type, name, doc) { #type, XSTR(name), &name, doc, "{C1 pd}", DEFAULT }, |
6ee479178066
6979444: add command line option to print command line flags descriptions
ikrylov
parents:
1692
diff
changeset
|
192 #define C1_NOTPRODUCT_FLAG_STRUCT(type, name, value, doc) { #type, XSTR(name), &name, doc, "{C1 notproduct}", DEFAULT }, |
0 | 193 #endif |
194 | |
195 | |
1768
6ee479178066
6979444: add command line option to print command line flags descriptions
ikrylov
parents:
1692
diff
changeset
|
196 #define C2_PRODUCT_FLAG_STRUCT(type, name, value, doc) { #type, XSTR(name), &name, NOT_PRODUCT_ARG(doc) "{C2 product}", DEFAULT }, |
6ee479178066
6979444: add command line option to print command line flags descriptions
ikrylov
parents:
1692
diff
changeset
|
197 #define C2_PD_PRODUCT_FLAG_STRUCT(type, name, doc) { #type, XSTR(name), &name, NOT_PRODUCT_ARG(doc) "{C2 pd product}", DEFAULT }, |
6ee479178066
6979444: add command line option to print command line flags descriptions
ikrylov
parents:
1692
diff
changeset
|
198 #define C2_DIAGNOSTIC_FLAG_STRUCT(type, name, value, doc) { #type, XSTR(name), &name, NOT_PRODUCT_ARG(doc) "{C2 diagnostic}", DEFAULT }, |
6ee479178066
6979444: add command line option to print command line flags descriptions
ikrylov
parents:
1692
diff
changeset
|
199 #define C2_EXPERIMENTAL_FLAG_STRUCT(type, name, value, doc) { #type, XSTR(name), &name, NOT_PRODUCT_ARG(doc) "{C2 experimental}", DEFAULT }, |
0 | 200 #ifdef PRODUCT |
201 #define C2_DEVELOP_FLAG_STRUCT(type, name, value, doc) /* flag is constant */ | |
202 #define C2_PD_DEVELOP_FLAG_STRUCT(type, name, doc) /* flag is constant */ | |
203 #define C2_NOTPRODUCT_FLAG_STRUCT(type, name, value, doc) | |
204 #else | |
1768
6ee479178066
6979444: add command line option to print command line flags descriptions
ikrylov
parents:
1692
diff
changeset
|
205 #define C2_DEVELOP_FLAG_STRUCT(type, name, value, doc) { #type, XSTR(name), &name, doc, "{C2}", DEFAULT }, |
6ee479178066
6979444: add command line option to print command line flags descriptions
ikrylov
parents:
1692
diff
changeset
|
206 #define C2_PD_DEVELOP_FLAG_STRUCT(type, name, doc) { #type, XSTR(name), &name, doc, "{C2 pd}", DEFAULT }, |
6ee479178066
6979444: add command line option to print command line flags descriptions
ikrylov
parents:
1692
diff
changeset
|
207 #define C2_NOTPRODUCT_FLAG_STRUCT(type, name, value, doc) { #type, XSTR(name), &name, doc, "{C2 notproduct}", DEFAULT }, |
0 | 208 #endif |
209 | |
1768
6ee479178066
6979444: add command line option to print command line flags descriptions
ikrylov
parents:
1692
diff
changeset
|
210 #define SHARK_PRODUCT_FLAG_STRUCT(type, name, value, doc) { #type, XSTR(name), &name, NOT_PRODUCT_ARG(doc) "{Shark product}", DEFAULT }, |
6ee479178066
6979444: add command line option to print command line flags descriptions
ikrylov
parents:
1692
diff
changeset
|
211 #define SHARK_PD_PRODUCT_FLAG_STRUCT(type, name, doc) { #type, XSTR(name), &name, NOT_PRODUCT_ARG(doc) "{Shark pd product}", DEFAULT }, |
6ee479178066
6979444: add command line option to print command line flags descriptions
ikrylov
parents:
1692
diff
changeset
|
212 #define SHARK_DIAGNOSTIC_FLAG_STRUCT(type, name, value, doc) { #type, XSTR(name), &name, NOT_PRODUCT_ARG(doc) "{Shark diagnostic}", DEFAULT }, |
1692 | 213 #ifdef PRODUCT |
214 #define SHARK_DEVELOP_FLAG_STRUCT(type, name, value, doc) /* flag is constant */ | |
215 #define SHARK_PD_DEVELOP_FLAG_STRUCT(type, name, doc) /* flag is constant */ | |
216 #define SHARK_NOTPRODUCT_FLAG_STRUCT(type, name, value, doc) | |
217 #else | |
1768
6ee479178066
6979444: add command line option to print command line flags descriptions
ikrylov
parents:
1692
diff
changeset
|
218 #define SHARK_DEVELOP_FLAG_STRUCT(type, name, value, doc) { #type, XSTR(name), &name, doc, "{Shark}", DEFAULT }, |
6ee479178066
6979444: add command line option to print command line flags descriptions
ikrylov
parents:
1692
diff
changeset
|
219 #define SHARK_PD_DEVELOP_FLAG_STRUCT(type, name, doc) { #type, XSTR(name), &name, doc, "{Shark pd}", DEFAULT }, |
6ee479178066
6979444: add command line option to print command line flags descriptions
ikrylov
parents:
1692
diff
changeset
|
220 #define SHARK_NOTPRODUCT_FLAG_STRUCT(type, name, value, doc) { #type, XSTR(name), &name, doc, "{Shark notproduct}", DEFAULT }, |
1692 | 221 #endif |
0 | 222 |
223 static Flag flagTable[] = { | |
350
d28aa69f0959
6618726: Introduce -XX:+UnlockExperimentalVMOptions flag
ysr
parents:
342
diff
changeset
|
224 RUNTIME_FLAGS(RUNTIME_DEVELOP_FLAG_STRUCT, RUNTIME_PD_DEVELOP_FLAG_STRUCT, RUNTIME_PRODUCT_FLAG_STRUCT, RUNTIME_PD_PRODUCT_FLAG_STRUCT, RUNTIME_DIAGNOSTIC_FLAG_STRUCT, RUNTIME_EXPERIMENTAL_FLAG_STRUCT, RUNTIME_NOTPRODUCT_FLAG_STRUCT, RUNTIME_MANAGEABLE_FLAG_STRUCT, RUNTIME_PRODUCT_RW_FLAG_STRUCT, RUNTIME_LP64_PRODUCT_FLAG_STRUCT) |
0 | 225 RUNTIME_OS_FLAGS(RUNTIME_DEVELOP_FLAG_STRUCT, RUNTIME_PD_DEVELOP_FLAG_STRUCT, RUNTIME_PRODUCT_FLAG_STRUCT, RUNTIME_PD_PRODUCT_FLAG_STRUCT, RUNTIME_DIAGNOSTIC_FLAG_STRUCT, RUNTIME_NOTPRODUCT_FLAG_STRUCT) |
342
37f87013dfd8
6711316: Open source the Garbage-First garbage collector
ysr
parents:
113
diff
changeset
|
226 #ifndef SERIALGC |
350
d28aa69f0959
6618726: Introduce -XX:+UnlockExperimentalVMOptions flag
ysr
parents:
342
diff
changeset
|
227 G1_FLAGS(RUNTIME_DEVELOP_FLAG_STRUCT, RUNTIME_PD_DEVELOP_FLAG_STRUCT, RUNTIME_PRODUCT_FLAG_STRUCT, RUNTIME_PD_PRODUCT_FLAG_STRUCT, RUNTIME_DIAGNOSTIC_FLAG_STRUCT, RUNTIME_EXPERIMENTAL_FLAG_STRUCT, RUNTIME_NOTPRODUCT_FLAG_STRUCT, RUNTIME_MANAGEABLE_FLAG_STRUCT, RUNTIME_PRODUCT_RW_FLAG_STRUCT) |
342
37f87013dfd8
6711316: Open source the Garbage-First garbage collector
ysr
parents:
113
diff
changeset
|
228 #endif // SERIALGC |
0 | 229 #ifdef COMPILER1 |
230 C1_FLAGS(C1_DEVELOP_FLAG_STRUCT, C1_PD_DEVELOP_FLAG_STRUCT, C1_PRODUCT_FLAG_STRUCT, C1_PD_PRODUCT_FLAG_STRUCT, C1_NOTPRODUCT_FLAG_STRUCT) | |
231 #endif | |
232 #ifdef COMPILER2 | |
1080
7c57aead6d3e
6892658: C2 should optimize some stringbuilder patterns
never
parents:
1067
diff
changeset
|
233 C2_FLAGS(C2_DEVELOP_FLAG_STRUCT, C2_PD_DEVELOP_FLAG_STRUCT, C2_PRODUCT_FLAG_STRUCT, C2_PD_PRODUCT_FLAG_STRUCT, C2_DIAGNOSTIC_FLAG_STRUCT, C2_EXPERIMENTAL_FLAG_STRUCT, C2_NOTPRODUCT_FLAG_STRUCT) |
0 | 234 #endif |
1692 | 235 #ifdef SHARK |
236 SHARK_FLAGS(SHARK_DEVELOP_FLAG_STRUCT, SHARK_PD_DEVELOP_FLAG_STRUCT, SHARK_PRODUCT_FLAG_STRUCT, SHARK_PD_PRODUCT_FLAG_STRUCT, SHARK_DIAGNOSTIC_FLAG_STRUCT, SHARK_NOTPRODUCT_FLAG_STRUCT) | |
237 #endif | |
0 | 238 {0, NULL, NULL} |
239 }; | |
240 | |
241 Flag* Flag::flags = flagTable; | |
242 size_t Flag::numFlags = (sizeof(flagTable) / sizeof(Flag)); | |
243 | |
244 inline bool str_equal(const char* s, char* q, size_t len) { | |
245 // s is null terminated, q is not! | |
246 if (strlen(s) != (unsigned int) len) return false; | |
247 return strncmp(s, q, len) == 0; | |
248 } | |
249 | |
250 Flag* Flag::find_flag(char* name, size_t length) { | |
251 for (Flag* current = &flagTable[0]; current->name; current++) { | |
252 if (str_equal(current->name, name, length)) { | |
253 if (!(current->is_unlocked() || current->is_unlocker())) { | |
350
d28aa69f0959
6618726: Introduce -XX:+UnlockExperimentalVMOptions flag
ysr
parents:
342
diff
changeset
|
254 // disable use of diagnostic or experimental flags until they |
d28aa69f0959
6618726: Introduce -XX:+UnlockExperimentalVMOptions flag
ysr
parents:
342
diff
changeset
|
255 // are explicitly unlocked |
0 | 256 return NULL; |
257 } | |
258 return current; | |
259 } | |
260 } | |
261 return NULL; | |
262 } | |
263 | |
264 // Returns the address of the index'th element | |
265 static Flag* address_of_flag(CommandLineFlagWithType flag) { | |
266 assert((size_t)flag < Flag::numFlags, "bad command line flag index"); | |
267 return &Flag::flags[flag]; | |
268 } | |
269 | |
270 bool CommandLineFlagsEx::is_default(CommandLineFlag flag) { | |
271 assert((size_t)flag < Flag::numFlags, "bad command line flag index"); | |
272 Flag* f = &Flag::flags[flag]; | |
273 return (f->origin == DEFAULT); | |
274 } | |
275 | |
13
183f41cf8bfe
6557851: CMS: ergonomics defaults are not set with FLAG_SET_ERGO
jmasa
parents:
0
diff
changeset
|
276 bool CommandLineFlagsEx::is_ergo(CommandLineFlag flag) { |
183f41cf8bfe
6557851: CMS: ergonomics defaults are not set with FLAG_SET_ERGO
jmasa
parents:
0
diff
changeset
|
277 assert((size_t)flag < Flag::numFlags, "bad command line flag index"); |
183f41cf8bfe
6557851: CMS: ergonomics defaults are not set with FLAG_SET_ERGO
jmasa
parents:
0
diff
changeset
|
278 Flag* f = &Flag::flags[flag]; |
183f41cf8bfe
6557851: CMS: ergonomics defaults are not set with FLAG_SET_ERGO
jmasa
parents:
0
diff
changeset
|
279 return (f->origin == ERGONOMIC); |
183f41cf8bfe
6557851: CMS: ergonomics defaults are not set with FLAG_SET_ERGO
jmasa
parents:
0
diff
changeset
|
280 } |
183f41cf8bfe
6557851: CMS: ergonomics defaults are not set with FLAG_SET_ERGO
jmasa
parents:
0
diff
changeset
|
281 |
183f41cf8bfe
6557851: CMS: ergonomics defaults are not set with FLAG_SET_ERGO
jmasa
parents:
0
diff
changeset
|
282 bool CommandLineFlagsEx::is_cmdline(CommandLineFlag flag) { |
183f41cf8bfe
6557851: CMS: ergonomics defaults are not set with FLAG_SET_ERGO
jmasa
parents:
0
diff
changeset
|
283 assert((size_t)flag < Flag::numFlags, "bad command line flag index"); |
183f41cf8bfe
6557851: CMS: ergonomics defaults are not set with FLAG_SET_ERGO
jmasa
parents:
0
diff
changeset
|
284 Flag* f = &Flag::flags[flag]; |
183f41cf8bfe
6557851: CMS: ergonomics defaults are not set with FLAG_SET_ERGO
jmasa
parents:
0
diff
changeset
|
285 return (f->origin == COMMAND_LINE); |
183f41cf8bfe
6557851: CMS: ergonomics defaults are not set with FLAG_SET_ERGO
jmasa
parents:
0
diff
changeset
|
286 } |
183f41cf8bfe
6557851: CMS: ergonomics defaults are not set with FLAG_SET_ERGO
jmasa
parents:
0
diff
changeset
|
287 |
0 | 288 bool CommandLineFlags::wasSetOnCmdline(const char* name, bool* value) { |
289 Flag* result = Flag::find_flag((char*)name, strlen(name)); | |
290 if (result == NULL) return false; | |
291 *value = (result->origin == COMMAND_LINE); | |
292 return true; | |
293 } | |
294 | |
295 bool CommandLineFlags::boolAt(char* name, size_t len, bool* value) { | |
296 Flag* result = Flag::find_flag(name, len); | |
297 if (result == NULL) return false; | |
298 if (!result->is_bool()) return false; | |
299 *value = result->get_bool(); | |
300 return true; | |
301 } | |
302 | |
303 bool CommandLineFlags::boolAtPut(char* name, size_t len, bool* value, FlagValueOrigin origin) { | |
304 Flag* result = Flag::find_flag(name, len); | |
305 if (result == NULL) return false; | |
306 if (!result->is_bool()) return false; | |
307 bool old_value = result->get_bool(); | |
308 result->set_bool(*value); | |
309 *value = old_value; | |
310 result->origin = origin; | |
311 return true; | |
312 } | |
313 | |
314 void CommandLineFlagsEx::boolAtPut(CommandLineFlagWithType flag, bool value, FlagValueOrigin origin) { | |
315 Flag* faddr = address_of_flag(flag); | |
316 guarantee(faddr != NULL && faddr->is_bool(), "wrong flag type"); | |
317 faddr->set_bool(value); | |
318 faddr->origin = origin; | |
319 } | |
320 | |
321 bool CommandLineFlags::intxAt(char* name, size_t len, intx* value) { | |
322 Flag* result = Flag::find_flag(name, len); | |
323 if (result == NULL) return false; | |
324 if (!result->is_intx()) return false; | |
325 *value = result->get_intx(); | |
326 return true; | |
327 } | |
328 | |
329 bool CommandLineFlags::intxAtPut(char* name, size_t len, intx* value, FlagValueOrigin origin) { | |
330 Flag* result = Flag::find_flag(name, len); | |
331 if (result == NULL) return false; | |
332 if (!result->is_intx()) return false; | |
333 intx old_value = result->get_intx(); | |
334 result->set_intx(*value); | |
335 *value = old_value; | |
336 result->origin = origin; | |
337 return true; | |
338 } | |
339 | |
340 void CommandLineFlagsEx::intxAtPut(CommandLineFlagWithType flag, intx value, FlagValueOrigin origin) { | |
341 Flag* faddr = address_of_flag(flag); | |
342 guarantee(faddr != NULL && faddr->is_intx(), "wrong flag type"); | |
343 faddr->set_intx(value); | |
344 faddr->origin = origin; | |
345 } | |
346 | |
347 bool CommandLineFlags::uintxAt(char* name, size_t len, uintx* value) { | |
348 Flag* result = Flag::find_flag(name, len); | |
349 if (result == NULL) return false; | |
350 if (!result->is_uintx()) return false; | |
351 *value = result->get_uintx(); | |
352 return true; | |
353 } | |
354 | |
355 bool CommandLineFlags::uintxAtPut(char* name, size_t len, uintx* value, FlagValueOrigin origin) { | |
356 Flag* result = Flag::find_flag(name, len); | |
357 if (result == NULL) return false; | |
358 if (!result->is_uintx()) return false; | |
359 uintx old_value = result->get_uintx(); | |
360 result->set_uintx(*value); | |
361 *value = old_value; | |
362 result->origin = origin; | |
363 return true; | |
364 } | |
365 | |
366 void CommandLineFlagsEx::uintxAtPut(CommandLineFlagWithType flag, uintx value, FlagValueOrigin origin) { | |
367 Flag* faddr = address_of_flag(flag); | |
368 guarantee(faddr != NULL && faddr->is_uintx(), "wrong flag type"); | |
369 faddr->set_uintx(value); | |
370 faddr->origin = origin; | |
371 } | |
372 | |
1064 | 373 bool CommandLineFlags::uint64_tAt(char* name, size_t len, uint64_t* value) { |
374 Flag* result = Flag::find_flag(name, len); | |
375 if (result == NULL) return false; | |
376 if (!result->is_uint64_t()) return false; | |
377 *value = result->get_uint64_t(); | |
378 return true; | |
379 } | |
380 | |
381 bool CommandLineFlags::uint64_tAtPut(char* name, size_t len, uint64_t* value, FlagValueOrigin origin) { | |
382 Flag* result = Flag::find_flag(name, len); | |
383 if (result == NULL) return false; | |
384 if (!result->is_uint64_t()) return false; | |
385 uint64_t old_value = result->get_uint64_t(); | |
386 result->set_uint64_t(*value); | |
387 *value = old_value; | |
388 result->origin = origin; | |
389 return true; | |
390 } | |
391 | |
392 void CommandLineFlagsEx::uint64_tAtPut(CommandLineFlagWithType flag, uint64_t value, FlagValueOrigin origin) { | |
393 Flag* faddr = address_of_flag(flag); | |
394 guarantee(faddr != NULL && faddr->is_uint64_t(), "wrong flag type"); | |
395 faddr->set_uint64_t(value); | |
396 faddr->origin = origin; | |
397 } | |
398 | |
0 | 399 bool CommandLineFlags::doubleAt(char* name, size_t len, double* value) { |
400 Flag* result = Flag::find_flag(name, len); | |
401 if (result == NULL) return false; | |
402 if (!result->is_double()) return false; | |
403 *value = result->get_double(); | |
404 return true; | |
405 } | |
406 | |
407 bool CommandLineFlags::doubleAtPut(char* name, size_t len, double* value, FlagValueOrigin origin) { | |
408 Flag* result = Flag::find_flag(name, len); | |
409 if (result == NULL) return false; | |
410 if (!result->is_double()) return false; | |
411 double old_value = result->get_double(); | |
412 result->set_double(*value); | |
413 *value = old_value; | |
414 result->origin = origin; | |
415 return true; | |
416 } | |
417 | |
418 void CommandLineFlagsEx::doubleAtPut(CommandLineFlagWithType flag, double value, FlagValueOrigin origin) { | |
419 Flag* faddr = address_of_flag(flag); | |
420 guarantee(faddr != NULL && faddr->is_double(), "wrong flag type"); | |
421 faddr->set_double(value); | |
422 faddr->origin = origin; | |
423 } | |
424 | |
425 bool CommandLineFlags::ccstrAt(char* name, size_t len, ccstr* value) { | |
426 Flag* result = Flag::find_flag(name, len); | |
427 if (result == NULL) return false; | |
428 if (!result->is_ccstr()) return false; | |
429 *value = result->get_ccstr(); | |
430 return true; | |
431 } | |
432 | |
433 // Contract: Flag will make private copy of the incoming value. | |
434 // Outgoing value is always malloc-ed, and caller MUST call free. | |
435 bool CommandLineFlags::ccstrAtPut(char* name, size_t len, ccstr* value, FlagValueOrigin origin) { | |
436 Flag* result = Flag::find_flag(name, len); | |
437 if (result == NULL) return false; | |
438 if (!result->is_ccstr()) return false; | |
439 ccstr old_value = result->get_ccstr(); | |
370
885fe0f95828
6744783: HotSpot segfaults if given -XX options with an empty string argument
never
parents:
196
diff
changeset
|
440 char* new_value = NULL; |
885fe0f95828
6744783: HotSpot segfaults if given -XX options with an empty string argument
never
parents:
196
diff
changeset
|
441 if (*value != NULL) { |
885fe0f95828
6744783: HotSpot segfaults if given -XX options with an empty string argument
never
parents:
196
diff
changeset
|
442 new_value = NEW_C_HEAP_ARRAY(char, strlen(*value)+1); |
885fe0f95828
6744783: HotSpot segfaults if given -XX options with an empty string argument
never
parents:
196
diff
changeset
|
443 strcpy(new_value, *value); |
885fe0f95828
6744783: HotSpot segfaults if given -XX options with an empty string argument
never
parents:
196
diff
changeset
|
444 } |
0 | 445 result->set_ccstr(new_value); |
446 if (result->origin == DEFAULT && old_value != NULL) { | |
447 // Prior value is NOT heap allocated, but was a literal constant. | |
448 char* old_value_to_free = NEW_C_HEAP_ARRAY(char, strlen(old_value)+1); | |
449 strcpy(old_value_to_free, old_value); | |
450 old_value = old_value_to_free; | |
451 } | |
452 *value = old_value; | |
453 result->origin = origin; | |
454 return true; | |
455 } | |
456 | |
457 // Contract: Flag will make private copy of the incoming value. | |
458 void CommandLineFlagsEx::ccstrAtPut(CommandLineFlagWithType flag, ccstr value, FlagValueOrigin origin) { | |
459 Flag* faddr = address_of_flag(flag); | |
460 guarantee(faddr != NULL && faddr->is_ccstr(), "wrong flag type"); | |
461 ccstr old_value = faddr->get_ccstr(); | |
462 char* new_value = NEW_C_HEAP_ARRAY(char, strlen(value)+1); | |
463 strcpy(new_value, value); | |
464 faddr->set_ccstr(new_value); | |
465 if (faddr->origin != DEFAULT && old_value != NULL) { | |
466 // Prior value is heap allocated so free it. | |
467 FREE_C_HEAP_ARRAY(char, old_value); | |
468 } | |
469 faddr->origin = origin; | |
470 } | |
471 | |
472 extern "C" { | |
473 static int compare_flags(const void* void_a, const void* void_b) { | |
474 return strcmp((*((Flag**) void_a))->name, (*((Flag**) void_b))->name); | |
475 } | |
476 } | |
477 | |
478 void CommandLineFlags::printSetFlags() { | |
479 // Print which flags were set on the command line | |
480 // note: this method is called before the thread structure is in place | |
481 // which means resource allocation cannot be used. | |
482 | |
483 // Compute size | |
484 int length= 0; | |
485 while (flagTable[length].name != NULL) length++; | |
486 | |
487 // Sort | |
488 Flag** array = NEW_C_HEAP_ARRAY(Flag*, length); | |
489 for (int index = 0; index < length; index++) { | |
490 array[index] = &flagTable[index]; | |
491 } | |
492 qsort(array, length, sizeof(Flag*), compare_flags); | |
493 | |
494 // Print | |
495 for (int i = 0; i < length; i++) { | |
496 if (array[i]->origin /* naked field! */) { | |
497 array[i]->print_as_flag(tty); | |
498 tty->print(" "); | |
499 } | |
500 } | |
501 tty->cr(); | |
502 FREE_C_HEAP_ARRAY(Flag*, array); | |
503 } | |
504 | |
505 #ifndef PRODUCT | |
506 | |
507 | |
508 void CommandLineFlags::verify() { | |
509 assert(Arguments::check_vm_args_consistency(), "Some flag settings conflict"); | |
510 } | |
511 | |
1150 | 512 #endif // PRODUCT |
513 | |
1768
6ee479178066
6979444: add command line option to print command line flags descriptions
ikrylov
parents:
1692
diff
changeset
|
514 void CommandLineFlags::printFlags(bool withComments) { |
0 | 515 // Print the flags sorted by name |
516 // note: this method is called before the thread structure is in place | |
517 // which means resource allocation cannot be used. | |
518 | |
519 // Compute size | |
520 int length= 0; | |
521 while (flagTable[length].name != NULL) length++; | |
522 | |
523 // Sort | |
524 Flag** array = NEW_C_HEAP_ARRAY(Flag*, length); | |
525 for (int index = 0; index < length; index++) { | |
526 array[index] = &flagTable[index]; | |
527 } | |
528 qsort(array, length, sizeof(Flag*), compare_flags); | |
529 | |
530 // Print | |
531 tty->print_cr("[Global flags]"); | |
532 for (int i = 0; i < length; i++) { | |
533 if (array[i]->is_unlocked()) { | |
1768
6ee479178066
6979444: add command line option to print command line flags descriptions
ikrylov
parents:
1692
diff
changeset
|
534 array[i]->print_on(tty, withComments); |
0 | 535 } |
536 } | |
537 FREE_C_HEAP_ARRAY(Flag*, array); | |
538 } |