Mercurial > hg > graal-jvmci-8
annotate src/share/vm/runtime/arguments.cpp @ 1936:8d88c9ac9247
Correct deopt handler entry. New flag -XX:+TraceSignals. More detailed deopt printing.
author | Thomas Wuerthinger <wuerthinger@ssw.jku.at> |
---|---|
date | Thu, 23 Dec 2010 18:13:28 +0100 |
parents | 2d26b0046e0d |
children | 06f017f7daa7 |
rev | line source |
---|---|
0 | 1 /* |
1552
c18cbe5936b8
6941466: Oracle rebranding changes for Hotspot repositories
trims
parents:
1506
diff
changeset
|
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:
1506
diff
changeset
|
19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA |
c18cbe5936b8
6941466: Oracle rebranding changes for Hotspot repositories
trims
parents:
1506
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:
1506
diff
changeset
|
21 * questions. |
0 | 22 * |
23 */ | |
24 | |
25 #include "incls/_precompiled.incl" | |
26 #include "incls/_arguments.cpp.incl" | |
27 | |
28 #define DEFAULT_VENDOR_URL_BUG "http://java.sun.com/webapps/bugreport/crash.jsp" | |
29 #define DEFAULT_JAVA_LAUNCHER "generic" | |
30 | |
31 char** Arguments::_jvm_flags_array = NULL; | |
32 int Arguments::_num_jvm_flags = 0; | |
33 char** Arguments::_jvm_args_array = NULL; | |
34 int Arguments::_num_jvm_args = 0; | |
1437
9e5e83ca2259
Enabled -C1X:OPTIONS when running HotSpot/C1X. Enabled checkstyle for the HotSpotVM Java project.
Thomas Wuerthinger <wuerthinger@ssw.jku.at>
parents:
1356
diff
changeset
|
35 char** Arguments::_c1x_args_array = NULL; |
9e5e83ca2259
Enabled -C1X:OPTIONS when running HotSpot/C1X. Enabled checkstyle for the HotSpotVM Java project.
Thomas Wuerthinger <wuerthinger@ssw.jku.at>
parents:
1356
diff
changeset
|
36 int Arguments::_num_c1x_args = 0; |
0 | 37 char* Arguments::_java_command = NULL; |
38 SystemProperty* Arguments::_system_properties = NULL; | |
39 const char* Arguments::_gc_log_filename = NULL; | |
40 bool Arguments::_has_profile = false; | |
41 bool Arguments::_has_alloc_profile = false; | |
42 uintx Arguments::_min_heap_size = 0; | |
43 Arguments::Mode Arguments::_mode = _mixed; | |
44 bool Arguments::_java_compiler = false; | |
45 bool Arguments::_xdebug_mode = false; | |
46 const char* Arguments::_java_vendor_url_bug = DEFAULT_VENDOR_URL_BUG; | |
47 const char* Arguments::_sun_java_launcher = DEFAULT_JAVA_LAUNCHER; | |
48 int Arguments::_sun_java_launcher_pid = -1; | |
49 | |
50 // These parameters are reset in method parse_vm_init_args(JavaVMInitArgs*) | |
51 bool Arguments::_AlwaysCompileLoopMethods = AlwaysCompileLoopMethods; | |
52 bool Arguments::_UseOnStackReplacement = UseOnStackReplacement; | |
53 bool Arguments::_BackgroundCompilation = BackgroundCompilation; | |
54 bool Arguments::_ClipInlining = ClipInlining; | |
55 | |
56 char* Arguments::SharedArchivePath = NULL; | |
57 | |
58 AgentLibraryList Arguments::_libraryList; | |
59 AgentLibraryList Arguments::_agentList; | |
60 | |
61 abort_hook_t Arguments::_abort_hook = NULL; | |
62 exit_hook_t Arguments::_exit_hook = NULL; | |
63 vfprintf_hook_t Arguments::_vfprintf_hook = NULL; | |
64 | |
65 | |
66 SystemProperty *Arguments::_java_ext_dirs = NULL; | |
67 SystemProperty *Arguments::_java_endorsed_dirs = NULL; | |
68 SystemProperty *Arguments::_sun_boot_library_path = NULL; | |
69 SystemProperty *Arguments::_java_library_path = NULL; | |
70 SystemProperty *Arguments::_java_home = NULL; | |
71 SystemProperty *Arguments::_java_class_path = NULL; | |
72 SystemProperty *Arguments::_sun_boot_class_path = NULL; | |
73 | |
74 char* Arguments::_meta_index_path = NULL; | |
75 char* Arguments::_meta_index_dir = NULL; | |
76 | |
77 static bool force_client_mode = false; | |
78 | |
79 // Check if head of 'option' matches 'name', and sets 'tail' remaining part of option string | |
80 | |
81 static bool match_option(const JavaVMOption *option, const char* name, | |
82 const char** tail) { | |
83 int len = (int)strlen(name); | |
84 if (strncmp(option->optionString, name, len) == 0) { | |
85 *tail = option->optionString + len; | |
86 return true; | |
87 } else { | |
88 return false; | |
89 } | |
90 } | |
91 | |
92 static void logOption(const char* opt) { | |
93 if (PrintVMOptions) { | |
94 jio_fprintf(defaultStream::output_stream(), "VM option '%s'\n", opt); | |
95 } | |
96 } | |
97 | |
98 // Process java launcher properties. | |
99 void Arguments::process_sun_java_launcher_properties(JavaVMInitArgs* args) { | |
100 // See if sun.java.launcher or sun.java.launcher.pid is defined. | |
101 // Must do this before setting up other system properties, | |
102 // as some of them may depend on launcher type. | |
103 for (int index = 0; index < args->nOptions; index++) { | |
104 const JavaVMOption* option = args->options + index; | |
105 const char* tail; | |
106 | |
107 if (match_option(option, "-Dsun.java.launcher=", &tail)) { | |
108 process_java_launcher_argument(tail, option->extraInfo); | |
109 continue; | |
110 } | |
111 if (match_option(option, "-Dsun.java.launcher.pid=", &tail)) { | |
112 _sun_java_launcher_pid = atoi(tail); | |
113 continue; | |
114 } | |
115 } | |
116 } | |
117 | |
118 // Initialize system properties key and value. | |
119 void Arguments::init_system_properties() { | |
120 | |
121 PropertyList_add(&_system_properties, new SystemProperty("java.vm.specification.version", "1.0", false)); | |
122 PropertyList_add(&_system_properties, new SystemProperty("java.vm.specification.name", | |
123 "Java Virtual Machine Specification", false)); | |
124 PropertyList_add(&_system_properties, new SystemProperty("java.vm.version", VM_Version::vm_release(), false)); | |
125 PropertyList_add(&_system_properties, new SystemProperty("java.vm.name", VM_Version::vm_name(), false)); | |
126 PropertyList_add(&_system_properties, new SystemProperty("java.vm.info", VM_Version::vm_info_string(), true)); | |
127 | |
128 // following are JVMTI agent writeable properties. | |
129 // Properties values are set to NULL and they are | |
130 // os specific they are initialized in os::init_system_properties_values(). | |
131 _java_ext_dirs = new SystemProperty("java.ext.dirs", NULL, true); | |
132 _java_endorsed_dirs = new SystemProperty("java.endorsed.dirs", NULL, true); | |
133 _sun_boot_library_path = new SystemProperty("sun.boot.library.path", NULL, true); | |
134 _java_library_path = new SystemProperty("java.library.path", NULL, true); | |
135 _java_home = new SystemProperty("java.home", NULL, true); | |
136 _sun_boot_class_path = new SystemProperty("sun.boot.class.path", NULL, true); | |
137 | |
138 _java_class_path = new SystemProperty("java.class.path", "", true); | |
139 | |
140 // Add to System Property list. | |
141 PropertyList_add(&_system_properties, _java_ext_dirs); | |
142 PropertyList_add(&_system_properties, _java_endorsed_dirs); | |
143 PropertyList_add(&_system_properties, _sun_boot_library_path); | |
144 PropertyList_add(&_system_properties, _java_library_path); | |
145 PropertyList_add(&_system_properties, _java_home); | |
146 PropertyList_add(&_system_properties, _java_class_path); | |
147 PropertyList_add(&_system_properties, _sun_boot_class_path); | |
148 | |
149 // Set OS specific system properties values | |
150 os::init_system_properties_values(); | |
151 } | |
152 | |
1864
dfb38ea7da17
6988363: Rebrand vm vendor property settings (jdk7 only)
zgu
parents:
1805
diff
changeset
|
153 |
dfb38ea7da17
6988363: Rebrand vm vendor property settings (jdk7 only)
zgu
parents:
1805
diff
changeset
|
154 // Update/Initialize System properties after JDK version number is known |
dfb38ea7da17
6988363: Rebrand vm vendor property settings (jdk7 only)
zgu
parents:
1805
diff
changeset
|
155 void Arguments::init_version_specific_system_properties() { |
dfb38ea7da17
6988363: Rebrand vm vendor property settings (jdk7 only)
zgu
parents:
1805
diff
changeset
|
156 PropertyList_add(&_system_properties, new SystemProperty("java.vm.specification.vendor", |
dfb38ea7da17
6988363: Rebrand vm vendor property settings (jdk7 only)
zgu
parents:
1805
diff
changeset
|
157 JDK_Version::is_gte_jdk17x_version() ? "Oracle Corporation" : "Sun Microsystems Inc.", false)); |
dfb38ea7da17
6988363: Rebrand vm vendor property settings (jdk7 only)
zgu
parents:
1805
diff
changeset
|
158 PropertyList_add(&_system_properties, new SystemProperty("java.vm.vendor", VM_Version::vm_vendor(), false)); |
dfb38ea7da17
6988363: Rebrand vm vendor property settings (jdk7 only)
zgu
parents:
1805
diff
changeset
|
159 } |
dfb38ea7da17
6988363: Rebrand vm vendor property settings (jdk7 only)
zgu
parents:
1805
diff
changeset
|
160 |
242 | 161 /** |
162 * Provide a slightly more user-friendly way of eliminating -XX flags. | |
163 * When a flag is eliminated, it can be added to this list in order to | |
164 * continue accepting this flag on the command-line, while issuing a warning | |
165 * and ignoring the value. Once the JDK version reaches the 'accept_until' | |
166 * limit, we flatly refuse to admit the existence of the flag. This allows | |
167 * a flag to die correctly over JDK releases using HSX. | |
168 */ | |
169 typedef struct { | |
170 const char* name; | |
171 JDK_Version obsoleted_in; // when the flag went away | |
172 JDK_Version accept_until; // which version to start denying the existence | |
173 } ObsoleteFlag; | |
0 | 174 |
242 | 175 static ObsoleteFlag obsolete_jvm_flags[] = { |
176 { "UseTrainGC", JDK_Version::jdk(5), JDK_Version::jdk(7) }, | |
177 { "UseSpecialLargeObjectHandling", JDK_Version::jdk(5), JDK_Version::jdk(7) }, | |
178 { "UseOversizedCarHandling", JDK_Version::jdk(5), JDK_Version::jdk(7) }, | |
179 { "TraceCarAllocation", JDK_Version::jdk(5), JDK_Version::jdk(7) }, | |
180 { "PrintTrainGCProcessingStats", JDK_Version::jdk(5), JDK_Version::jdk(7) }, | |
181 { "LogOfCarSpaceSize", JDK_Version::jdk(5), JDK_Version::jdk(7) }, | |
182 { "OversizedCarThreshold", JDK_Version::jdk(5), JDK_Version::jdk(7) }, | |
183 { "MinTickInterval", JDK_Version::jdk(5), JDK_Version::jdk(7) }, | |
184 { "DefaultTickInterval", JDK_Version::jdk(5), JDK_Version::jdk(7) }, | |
185 { "MaxTickInterval", JDK_Version::jdk(5), JDK_Version::jdk(7) }, | |
186 { "DelayTickAdjustment", JDK_Version::jdk(5), JDK_Version::jdk(7) }, | |
187 { "ProcessingToTenuringRatio", JDK_Version::jdk(5), JDK_Version::jdk(7) }, | |
188 { "MinTrainLength", JDK_Version::jdk(5), JDK_Version::jdk(7) }, | |
189 { "AppendRatio", JDK_Version::jdk_update(6,10), JDK_Version::jdk(7) }, | |
1064 | 190 { "DefaultMaxRAM", JDK_Version::jdk_update(6,18), JDK_Version::jdk(7) }, |
191 { "DefaultInitialRAMFraction", | |
192 JDK_Version::jdk_update(6,18), JDK_Version::jdk(7) }, | |
1706
9d7a8ab3736b
6962589: remove breadth first scanning code from parallel gc
tonyp
parents:
1628
diff
changeset
|
193 { "UseDepthFirstScavengeOrder", |
9d7a8ab3736b
6962589: remove breadth first scanning code from parallel gc
tonyp
parents:
1628
diff
changeset
|
194 JDK_Version::jdk_update(6,22), JDK_Version::jdk(7) }, |
1888
a7214d79fcf1
6896603: CMS/GCH: collection_attempt_is_safe() ergo should use more recent data
ysr
parents:
1832
diff
changeset
|
195 { "HandlePromotionFailure", |
a7214d79fcf1
6896603: CMS/GCH: collection_attempt_is_safe() ergo should use more recent data
ysr
parents:
1832
diff
changeset
|
196 JDK_Version::jdk_update(6,24), JDK_Version::jdk(8) }, |
a7214d79fcf1
6896603: CMS/GCH: collection_attempt_is_safe() ergo should use more recent data
ysr
parents:
1832
diff
changeset
|
197 { "MaxLiveObjectEvacuationRatio", |
a7214d79fcf1
6896603: CMS/GCH: collection_attempt_is_safe() ergo should use more recent data
ysr
parents:
1832
diff
changeset
|
198 JDK_Version::jdk_update(6,24), JDK_Version::jdk(8) }, |
242 | 199 { NULL, JDK_Version(0), JDK_Version(0) } |
200 }; | |
201 | |
202 // Returns true if the flag is obsolete and fits into the range specified | |
203 // for being ignored. In the case that the flag is ignored, the 'version' | |
204 // value is filled in with the version number when the flag became | |
205 // obsolete so that that value can be displayed to the user. | |
206 bool Arguments::is_newly_obsolete(const char *s, JDK_Version* version) { | |
0 | 207 int i = 0; |
242 | 208 assert(version != NULL, "Must provide a version buffer"); |
209 while (obsolete_jvm_flags[i].name != NULL) { | |
210 const ObsoleteFlag& flag_status = obsolete_jvm_flags[i]; | |
0 | 211 // <flag>=xxx form |
212 // [-|+]<flag> form | |
242 | 213 if ((strncmp(flag_status.name, s, strlen(flag_status.name)) == 0) || |
0 | 214 ((s[0] == '+' || s[0] == '-') && |
242 | 215 (strncmp(flag_status.name, &s[1], strlen(flag_status.name)) == 0))) { |
216 if (JDK_Version::current().compare(flag_status.accept_until) == -1) { | |
217 *version = flag_status.obsoleted_in; | |
218 return true; | |
219 } | |
0 | 220 } |
221 i++; | |
222 } | |
223 return false; | |
224 } | |
225 | |
226 // Constructs the system class path (aka boot class path) from the following | |
227 // components, in order: | |
228 // | |
229 // prefix // from -Xbootclasspath/p:... | |
230 // endorsed // the expansion of -Djava.endorsed.dirs=... | |
231 // base // from os::get_system_properties() or -Xbootclasspath= | |
232 // suffix // from -Xbootclasspath/a:... | |
233 // | |
234 // java.endorsed.dirs is a list of directories; any jar or zip files in the | |
235 // directories are added to the sysclasspath just before the base. | |
236 // | |
237 // This could be AllStatic, but it isn't needed after argument processing is | |
238 // complete. | |
239 class SysClassPath: public StackObj { | |
240 public: | |
241 SysClassPath(const char* base); | |
242 ~SysClassPath(); | |
243 | |
244 inline void set_base(const char* base); | |
245 inline void add_prefix(const char* prefix); | |
531
40ee984935b9
6792705: Add JAR file to bootclasspath when using AggressiveOpts
phh
parents:
513
diff
changeset
|
246 inline void add_suffix_to_prefix(const char* suffix); |
0 | 247 inline void add_suffix(const char* suffix); |
248 inline void reset_path(const char* base); | |
249 | |
250 // Expand the jar/zip files in each directory listed by the java.endorsed.dirs | |
251 // property. Must be called after all command-line arguments have been | |
252 // processed (in particular, -Djava.endorsed.dirs=...) and before calling | |
253 // combined_path(). | |
254 void expand_endorsed(); | |
255 | |
256 inline const char* get_base() const { return _items[_scp_base]; } | |
257 inline const char* get_prefix() const { return _items[_scp_prefix]; } | |
258 inline const char* get_suffix() const { return _items[_scp_suffix]; } | |
259 inline const char* get_endorsed() const { return _items[_scp_endorsed]; } | |
260 | |
261 // Combine all the components into a single c-heap-allocated string; caller | |
262 // must free the string if/when no longer needed. | |
263 char* combined_path(); | |
264 | |
265 private: | |
266 // Utility routines. | |
267 static char* add_to_path(const char* path, const char* str, bool prepend); | |
268 static char* add_jars_to_path(char* path, const char* directory); | |
269 | |
270 inline void reset_item_at(int index); | |
271 | |
272 // Array indices for the items that make up the sysclasspath. All except the | |
273 // base are allocated in the C heap and freed by this class. | |
274 enum { | |
275 _scp_prefix, // from -Xbootclasspath/p:... | |
276 _scp_endorsed, // the expansion of -Djava.endorsed.dirs=... | |
277 _scp_base, // the default sysclasspath | |
278 _scp_suffix, // from -Xbootclasspath/a:... | |
279 _scp_nitems // the number of items, must be last. | |
280 }; | |
281 | |
282 const char* _items[_scp_nitems]; | |
283 DEBUG_ONLY(bool _expansion_done;) | |
284 }; | |
285 | |
286 SysClassPath::SysClassPath(const char* base) { | |
287 memset(_items, 0, sizeof(_items)); | |
288 _items[_scp_base] = base; | |
289 DEBUG_ONLY(_expansion_done = false;) | |
290 } | |
291 | |
292 SysClassPath::~SysClassPath() { | |
293 // Free everything except the base. | |
294 for (int i = 0; i < _scp_nitems; ++i) { | |
295 if (i != _scp_base) reset_item_at(i); | |
296 } | |
297 DEBUG_ONLY(_expansion_done = false;) | |
298 } | |
299 | |
300 inline void SysClassPath::set_base(const char* base) { | |
301 _items[_scp_base] = base; | |
302 } | |
303 | |
304 inline void SysClassPath::add_prefix(const char* prefix) { | |
305 _items[_scp_prefix] = add_to_path(_items[_scp_prefix], prefix, true); | |
306 } | |
307 | |
531
40ee984935b9
6792705: Add JAR file to bootclasspath when using AggressiveOpts
phh
parents:
513
diff
changeset
|
308 inline void SysClassPath::add_suffix_to_prefix(const char* suffix) { |
40ee984935b9
6792705: Add JAR file to bootclasspath when using AggressiveOpts
phh
parents:
513
diff
changeset
|
309 _items[_scp_prefix] = add_to_path(_items[_scp_prefix], suffix, false); |
40ee984935b9
6792705: Add JAR file to bootclasspath when using AggressiveOpts
phh
parents:
513
diff
changeset
|
310 } |
40ee984935b9
6792705: Add JAR file to bootclasspath when using AggressiveOpts
phh
parents:
513
diff
changeset
|
311 |
0 | 312 inline void SysClassPath::add_suffix(const char* suffix) { |
313 _items[_scp_suffix] = add_to_path(_items[_scp_suffix], suffix, false); | |
314 } | |
315 | |
316 inline void SysClassPath::reset_item_at(int index) { | |
317 assert(index < _scp_nitems && index != _scp_base, "just checking"); | |
318 if (_items[index] != NULL) { | |
319 FREE_C_HEAP_ARRAY(char, _items[index]); | |
320 _items[index] = NULL; | |
321 } | |
322 } | |
323 | |
324 inline void SysClassPath::reset_path(const char* base) { | |
325 // Clear the prefix and suffix. | |
326 reset_item_at(_scp_prefix); | |
327 reset_item_at(_scp_suffix); | |
328 set_base(base); | |
329 } | |
330 | |
331 //------------------------------------------------------------------------------ | |
332 | |
333 void SysClassPath::expand_endorsed() { | |
334 assert(_items[_scp_endorsed] == NULL, "can only be called once."); | |
335 | |
336 const char* path = Arguments::get_property("java.endorsed.dirs"); | |
337 if (path == NULL) { | |
338 path = Arguments::get_endorsed_dir(); | |
339 assert(path != NULL, "no default for java.endorsed.dirs"); | |
340 } | |
341 | |
342 char* expanded_path = NULL; | |
343 const char separator = *os::path_separator(); | |
344 const char* const end = path + strlen(path); | |
345 while (path < end) { | |
346 const char* tmp_end = strchr(path, separator); | |
347 if (tmp_end == NULL) { | |
348 expanded_path = add_jars_to_path(expanded_path, path); | |
349 path = end; | |
350 } else { | |
351 char* dirpath = NEW_C_HEAP_ARRAY(char, tmp_end - path + 1); | |
352 memcpy(dirpath, path, tmp_end - path); | |
353 dirpath[tmp_end - path] = '\0'; | |
354 expanded_path = add_jars_to_path(expanded_path, dirpath); | |
355 FREE_C_HEAP_ARRAY(char, dirpath); | |
356 path = tmp_end + 1; | |
357 } | |
358 } | |
359 _items[_scp_endorsed] = expanded_path; | |
360 DEBUG_ONLY(_expansion_done = true;) | |
361 } | |
362 | |
363 // Combine the bootclasspath elements, some of which may be null, into a single | |
364 // c-heap-allocated string. | |
365 char* SysClassPath::combined_path() { | |
366 assert(_items[_scp_base] != NULL, "empty default sysclasspath"); | |
367 assert(_expansion_done, "must call expand_endorsed() first."); | |
368 | |
369 size_t lengths[_scp_nitems]; | |
370 size_t total_len = 0; | |
371 | |
372 const char separator = *os::path_separator(); | |
373 | |
374 // Get the lengths. | |
375 int i; | |
376 for (i = 0; i < _scp_nitems; ++i) { | |
377 if (_items[i] != NULL) { | |
378 lengths[i] = strlen(_items[i]); | |
379 // Include space for the separator char (or a NULL for the last item). | |
380 total_len += lengths[i] + 1; | |
381 } | |
382 } | |
383 assert(total_len > 0, "empty sysclasspath not allowed"); | |
384 | |
385 // Copy the _items to a single string. | |
386 char* cp = NEW_C_HEAP_ARRAY(char, total_len); | |
387 char* cp_tmp = cp; | |
388 for (i = 0; i < _scp_nitems; ++i) { | |
389 if (_items[i] != NULL) { | |
390 memcpy(cp_tmp, _items[i], lengths[i]); | |
391 cp_tmp += lengths[i]; | |
392 *cp_tmp++ = separator; | |
393 } | |
394 } | |
395 *--cp_tmp = '\0'; // Replace the extra separator. | |
396 return cp; | |
397 } | |
398 | |
399 // Note: path must be c-heap-allocated (or NULL); it is freed if non-null. | |
400 char* | |
401 SysClassPath::add_to_path(const char* path, const char* str, bool prepend) { | |
402 char *cp; | |
403 | |
404 assert(str != NULL, "just checking"); | |
405 if (path == NULL) { | |
406 size_t len = strlen(str) + 1; | |
407 cp = NEW_C_HEAP_ARRAY(char, len); | |
408 memcpy(cp, str, len); // copy the trailing null | |
409 } else { | |
410 const char separator = *os::path_separator(); | |
411 size_t old_len = strlen(path); | |
412 size_t str_len = strlen(str); | |
413 size_t len = old_len + str_len + 2; | |
414 | |
415 if (prepend) { | |
416 cp = NEW_C_HEAP_ARRAY(char, len); | |
417 char* cp_tmp = cp; | |
418 memcpy(cp_tmp, str, str_len); | |
419 cp_tmp += str_len; | |
420 *cp_tmp = separator; | |
421 memcpy(++cp_tmp, path, old_len + 1); // copy the trailing null | |
422 FREE_C_HEAP_ARRAY(char, path); | |
423 } else { | |
424 cp = REALLOC_C_HEAP_ARRAY(char, path, len); | |
425 char* cp_tmp = cp + old_len; | |
426 *cp_tmp = separator; | |
427 memcpy(++cp_tmp, str, str_len + 1); // copy the trailing null | |
428 } | |
429 } | |
430 return cp; | |
431 } | |
432 | |
433 // Scan the directory and append any jar or zip files found to path. | |
434 // Note: path must be c-heap-allocated (or NULL); it is freed if non-null. | |
435 char* SysClassPath::add_jars_to_path(char* path, const char* directory) { | |
436 DIR* dir = os::opendir(directory); | |
437 if (dir == NULL) return path; | |
438 | |
439 char dir_sep[2] = { '\0', '\0' }; | |
440 size_t directory_len = strlen(directory); | |
441 const char fileSep = *os::file_separator(); | |
442 if (directory[directory_len - 1] != fileSep) dir_sep[0] = fileSep; | |
443 | |
444 /* Scan the directory for jars/zips, appending them to path. */ | |
445 struct dirent *entry; | |
446 char *dbuf = NEW_C_HEAP_ARRAY(char, os::readdir_buf_size(directory)); | |
447 while ((entry = os::readdir(dir, (dirent *) dbuf)) != NULL) { | |
448 const char* name = entry->d_name; | |
449 const char* ext = name + strlen(name) - 4; | |
450 bool isJarOrZip = ext > name && | |
451 (os::file_name_strcmp(ext, ".jar") == 0 || | |
452 os::file_name_strcmp(ext, ".zip") == 0); | |
453 if (isJarOrZip) { | |
454 char* jarpath = NEW_C_HEAP_ARRAY(char, directory_len + 2 + strlen(name)); | |
455 sprintf(jarpath, "%s%s%s", directory, dir_sep, name); | |
456 path = add_to_path(path, jarpath, false); | |
457 FREE_C_HEAP_ARRAY(char, jarpath); | |
458 } | |
459 } | |
460 FREE_C_HEAP_ARRAY(char, dbuf); | |
461 os::closedir(dir); | |
462 return path; | |
463 } | |
464 | |
465 // Parses a memory size specification string. | |
489
2494ab195856
6653214: MemoryPoolMXBean.setUsageThreshold() does not support large heap sizes.
swamyv
parents:
483
diff
changeset
|
466 static bool atomull(const char *s, julong* result) { |
2494ab195856
6653214: MemoryPoolMXBean.setUsageThreshold() does not support large heap sizes.
swamyv
parents:
483
diff
changeset
|
467 julong n = 0; |
2494ab195856
6653214: MemoryPoolMXBean.setUsageThreshold() does not support large heap sizes.
swamyv
parents:
483
diff
changeset
|
468 int args_read = sscanf(s, os::julong_format_specifier(), &n); |
0 | 469 if (args_read != 1) { |
470 return false; | |
471 } | |
472 while (*s != '\0' && isdigit(*s)) { | |
473 s++; | |
474 } | |
475 // 4705540: illegal if more characters are found after the first non-digit | |
476 if (strlen(s) > 1) { | |
477 return false; | |
478 } | |
479 switch (*s) { | |
480 case 'T': case 't': | |
481 *result = n * G * K; | |
489
2494ab195856
6653214: MemoryPoolMXBean.setUsageThreshold() does not support large heap sizes.
swamyv
parents:
483
diff
changeset
|
482 // Check for overflow. |
2494ab195856
6653214: MemoryPoolMXBean.setUsageThreshold() does not support large heap sizes.
swamyv
parents:
483
diff
changeset
|
483 if (*result/((julong)G * K) != n) return false; |
0 | 484 return true; |
485 case 'G': case 'g': | |
486 *result = n * G; | |
489
2494ab195856
6653214: MemoryPoolMXBean.setUsageThreshold() does not support large heap sizes.
swamyv
parents:
483
diff
changeset
|
487 if (*result/G != n) return false; |
0 | 488 return true; |
489 case 'M': case 'm': | |
490 *result = n * M; | |
489
2494ab195856
6653214: MemoryPoolMXBean.setUsageThreshold() does not support large heap sizes.
swamyv
parents:
483
diff
changeset
|
491 if (*result/M != n) return false; |
0 | 492 return true; |
493 case 'K': case 'k': | |
494 *result = n * K; | |
489
2494ab195856
6653214: MemoryPoolMXBean.setUsageThreshold() does not support large heap sizes.
swamyv
parents:
483
diff
changeset
|
495 if (*result/K != n) return false; |
0 | 496 return true; |
497 case '\0': | |
498 *result = n; | |
499 return true; | |
500 default: | |
501 return false; | |
502 } | |
503 } | |
504 | |
489
2494ab195856
6653214: MemoryPoolMXBean.setUsageThreshold() does not support large heap sizes.
swamyv
parents:
483
diff
changeset
|
505 Arguments::ArgsRange Arguments::check_memory_size(julong size, julong min_size) { |
0 | 506 if (size < min_size) return arg_too_small; |
507 // Check that size will fit in a size_t (only relevant on 32-bit) | |
489
2494ab195856
6653214: MemoryPoolMXBean.setUsageThreshold() does not support large heap sizes.
swamyv
parents:
483
diff
changeset
|
508 if (size > max_uintx) return arg_too_big; |
0 | 509 return arg_in_range; |
510 } | |
511 | |
512 // Describe an argument out of range error | |
513 void Arguments::describe_range_error(ArgsRange errcode) { | |
514 switch(errcode) { | |
515 case arg_too_big: | |
516 jio_fprintf(defaultStream::error_stream(), | |
517 "The specified size exceeds the maximum " | |
518 "representable size.\n"); | |
519 break; | |
520 case arg_too_small: | |
521 case arg_unreadable: | |
522 case arg_in_range: | |
523 // do nothing for now | |
524 break; | |
525 default: | |
526 ShouldNotReachHere(); | |
527 } | |
528 } | |
529 | |
530 static bool set_bool_flag(char* name, bool value, FlagValueOrigin origin) { | |
531 return CommandLineFlags::boolAtPut(name, &value, origin); | |
532 } | |
533 | |
534 static bool set_fp_numeric_flag(char* name, char* value, FlagValueOrigin origin) { | |
535 double v; | |
536 if (sscanf(value, "%lf", &v) != 1) { | |
537 return false; | |
538 } | |
539 | |
540 if (CommandLineFlags::doubleAtPut(name, &v, origin)) { | |
541 return true; | |
542 } | |
543 return false; | |
544 } | |
545 | |
546 static bool set_numeric_flag(char* name, char* value, FlagValueOrigin origin) { | |
489
2494ab195856
6653214: MemoryPoolMXBean.setUsageThreshold() does not support large heap sizes.
swamyv
parents:
483
diff
changeset
|
547 julong v; |
0 | 548 intx intx_v; |
549 bool is_neg = false; | |
489
2494ab195856
6653214: MemoryPoolMXBean.setUsageThreshold() does not support large heap sizes.
swamyv
parents:
483
diff
changeset
|
550 // Check the sign first since atomull() parses only unsigned values. |
0 | 551 if (*value == '-') { |
552 if (!CommandLineFlags::intxAt(name, &intx_v)) { | |
553 return false; | |
554 } | |
555 value++; | |
556 is_neg = true; | |
557 } | |
489
2494ab195856
6653214: MemoryPoolMXBean.setUsageThreshold() does not support large heap sizes.
swamyv
parents:
483
diff
changeset
|
558 if (!atomull(value, &v)) { |
0 | 559 return false; |
560 } | |
561 intx_v = (intx) v; | |
562 if (is_neg) { | |
563 intx_v = -intx_v; | |
564 } | |
565 if (CommandLineFlags::intxAtPut(name, &intx_v, origin)) { | |
566 return true; | |
567 } | |
568 uintx uintx_v = (uintx) v; | |
569 if (!is_neg && CommandLineFlags::uintxAtPut(name, &uintx_v, origin)) { | |
570 return true; | |
571 } | |
1064 | 572 uint64_t uint64_t_v = (uint64_t) v; |
573 if (!is_neg && CommandLineFlags::uint64_tAtPut(name, &uint64_t_v, origin)) { | |
574 return true; | |
575 } | |
0 | 576 return false; |
577 } | |
578 | |
579 static bool set_string_flag(char* name, const char* value, FlagValueOrigin origin) { | |
580 if (!CommandLineFlags::ccstrAtPut(name, &value, origin)) return false; | |
581 // Contract: CommandLineFlags always returns a pointer that needs freeing. | |
582 FREE_C_HEAP_ARRAY(char, value); | |
583 return true; | |
584 } | |
585 | |
586 static bool append_to_string_flag(char* name, const char* new_value, FlagValueOrigin origin) { | |
587 const char* old_value = ""; | |
588 if (!CommandLineFlags::ccstrAt(name, &old_value)) return false; | |
589 size_t old_len = old_value != NULL ? strlen(old_value) : 0; | |
590 size_t new_len = strlen(new_value); | |
591 const char* value; | |
592 char* free_this_too = NULL; | |
593 if (old_len == 0) { | |
594 value = new_value; | |
595 } else if (new_len == 0) { | |
596 value = old_value; | |
597 } else { | |
598 char* buf = NEW_C_HEAP_ARRAY(char, old_len + 1 + new_len + 1); | |
599 // each new setting adds another LINE to the switch: | |
600 sprintf(buf, "%s\n%s", old_value, new_value); | |
601 value = buf; | |
602 free_this_too = buf; | |
603 } | |
604 (void) CommandLineFlags::ccstrAtPut(name, &value, origin); | |
605 // CommandLineFlags always returns a pointer that needs freeing. | |
606 FREE_C_HEAP_ARRAY(char, value); | |
607 if (free_this_too != NULL) { | |
608 // CommandLineFlags made its own copy, so I must delete my own temp. buffer. | |
609 FREE_C_HEAP_ARRAY(char, free_this_too); | |
610 } | |
611 return true; | |
612 } | |
613 | |
614 bool Arguments::parse_argument(const char* arg, FlagValueOrigin origin) { | |
615 | |
616 // range of acceptable characters spelled out for portability reasons | |
617 #define NAME_RANGE "[abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789_]" | |
618 #define BUFLEN 255 | |
619 char name[BUFLEN+1]; | |
620 char dummy; | |
621 | |
622 if (sscanf(arg, "-%" XSTR(BUFLEN) NAME_RANGE "%c", name, &dummy) == 1) { | |
623 return set_bool_flag(name, false, origin); | |
624 } | |
625 if (sscanf(arg, "+%" XSTR(BUFLEN) NAME_RANGE "%c", name, &dummy) == 1) { | |
626 return set_bool_flag(name, true, origin); | |
627 } | |
628 | |
629 char punct; | |
630 if (sscanf(arg, "%" XSTR(BUFLEN) NAME_RANGE "%c", name, &punct) == 2 && punct == '=') { | |
631 const char* value = strchr(arg, '=') + 1; | |
632 Flag* flag = Flag::find_flag(name, strlen(name)); | |
633 if (flag != NULL && flag->is_ccstr()) { | |
634 if (flag->ccstr_accumulates()) { | |
635 return append_to_string_flag(name, value, origin); | |
636 } else { | |
637 if (value[0] == '\0') { | |
638 value = NULL; | |
639 } | |
640 return set_string_flag(name, value, origin); | |
641 } | |
642 } | |
643 } | |
644 | |
645 if (sscanf(arg, "%" XSTR(BUFLEN) NAME_RANGE ":%c", name, &punct) == 2 && punct == '=') { | |
646 const char* value = strchr(arg, '=') + 1; | |
647 // -XX:Foo:=xxx will reset the string flag to the given value. | |
648 if (value[0] == '\0') { | |
649 value = NULL; | |
650 } | |
651 return set_string_flag(name, value, origin); | |
652 } | |
653 | |
654 #define SIGNED_FP_NUMBER_RANGE "[-0123456789.]" | |
655 #define SIGNED_NUMBER_RANGE "[-0123456789]" | |
656 #define NUMBER_RANGE "[0123456789]" | |
657 char value[BUFLEN + 1]; | |
658 char value2[BUFLEN + 1]; | |
659 if (sscanf(arg, "%" XSTR(BUFLEN) NAME_RANGE "=" "%" XSTR(BUFLEN) SIGNED_NUMBER_RANGE "." "%" XSTR(BUFLEN) NUMBER_RANGE "%c", name, value, value2, &dummy) == 3) { | |
660 // Looks like a floating-point number -- try again with more lenient format string | |
661 if (sscanf(arg, "%" XSTR(BUFLEN) NAME_RANGE "=" "%" XSTR(BUFLEN) SIGNED_FP_NUMBER_RANGE "%c", name, value, &dummy) == 2) { | |
662 return set_fp_numeric_flag(name, value, origin); | |
663 } | |
664 } | |
665 | |
666 #define VALUE_RANGE "[-kmgtKMGT0123456789]" | |
667 if (sscanf(arg, "%" XSTR(BUFLEN) NAME_RANGE "=" "%" XSTR(BUFLEN) VALUE_RANGE "%c", name, value, &dummy) == 2) { | |
668 return set_numeric_flag(name, value, origin); | |
669 } | |
670 | |
671 return false; | |
672 } | |
673 | |
674 void Arguments::add_string(char*** bldarray, int* count, const char* arg) { | |
675 assert(bldarray != NULL, "illegal argument"); | |
676 | |
677 if (arg == NULL) { | |
678 return; | |
679 } | |
680 | |
681 int index = *count; | |
682 | |
683 // expand the array and add arg to the last element | |
684 (*count)++; | |
685 if (*bldarray == NULL) { | |
686 *bldarray = NEW_C_HEAP_ARRAY(char*, *count); | |
687 } else { | |
688 *bldarray = REALLOC_C_HEAP_ARRAY(char*, *bldarray, *count); | |
689 } | |
690 (*bldarray)[index] = strdup(arg); | |
691 } | |
692 | |
693 void Arguments::build_jvm_args(const char* arg) { | |
694 add_string(&_jvm_args_array, &_num_jvm_args, arg); | |
695 } | |
696 | |
697 void Arguments::build_jvm_flags(const char* arg) { | |
698 add_string(&_jvm_flags_array, &_num_jvm_flags, arg); | |
699 } | |
700 | |
1437
9e5e83ca2259
Enabled -C1X:OPTIONS when running HotSpot/C1X. Enabled checkstyle for the HotSpotVM Java project.
Thomas Wuerthinger <wuerthinger@ssw.jku.at>
parents:
1356
diff
changeset
|
701 void Arguments::add_c1x_arg(const char* arg) { |
9e5e83ca2259
Enabled -C1X:OPTIONS when running HotSpot/C1X. Enabled checkstyle for the HotSpotVM Java project.
Thomas Wuerthinger <wuerthinger@ssw.jku.at>
parents:
1356
diff
changeset
|
702 add_string(&_c1x_args_array, &_num_c1x_args, arg); |
9e5e83ca2259
Enabled -C1X:OPTIONS when running HotSpot/C1X. Enabled checkstyle for the HotSpotVM Java project.
Thomas Wuerthinger <wuerthinger@ssw.jku.at>
parents:
1356
diff
changeset
|
703 } |
9e5e83ca2259
Enabled -C1X:OPTIONS when running HotSpot/C1X. Enabled checkstyle for the HotSpotVM Java project.
Thomas Wuerthinger <wuerthinger@ssw.jku.at>
parents:
1356
diff
changeset
|
704 |
0 | 705 // utility function to return a string that concatenates all |
706 // strings in a given char** array | |
707 const char* Arguments::build_resource_string(char** args, int count) { | |
708 if (args == NULL || count == 0) { | |
709 return NULL; | |
710 } | |
711 size_t length = strlen(args[0]) + 1; // add 1 for the null terminator | |
712 for (int i = 1; i < count; i++) { | |
713 length += strlen(args[i]) + 1; // add 1 for a space | |
714 } | |
715 char* s = NEW_RESOURCE_ARRAY(char, length); | |
716 strcpy(s, args[0]); | |
717 for (int j = 1; j < count; j++) { | |
718 strcat(s, " "); | |
719 strcat(s, args[j]); | |
720 } | |
721 return (const char*) s; | |
722 } | |
723 | |
724 void Arguments::print_on(outputStream* st) { | |
725 st->print_cr("VM Arguments:"); | |
726 if (num_jvm_flags() > 0) { | |
727 st->print("jvm_flags: "); print_jvm_flags_on(st); | |
728 } | |
729 if (num_jvm_args() > 0) { | |
730 st->print("jvm_args: "); print_jvm_args_on(st); | |
731 } | |
732 st->print_cr("java_command: %s", java_command() ? java_command() : "<unknown>"); | |
733 st->print_cr("Launcher Type: %s", _sun_java_launcher); | |
734 } | |
735 | |
736 void Arguments::print_jvm_flags_on(outputStream* st) { | |
737 if (_num_jvm_flags > 0) { | |
738 for (int i=0; i < _num_jvm_flags; i++) { | |
739 st->print("%s ", _jvm_flags_array[i]); | |
740 } | |
741 st->print_cr(""); | |
742 } | |
743 } | |
744 | |
745 void Arguments::print_jvm_args_on(outputStream* st) { | |
746 if (_num_jvm_args > 0) { | |
747 for (int i=0; i < _num_jvm_args; i++) { | |
748 st->print("%s ", _jvm_args_array[i]); | |
749 } | |
750 st->print_cr(""); | |
751 } | |
752 } | |
753 | |
242 | 754 bool Arguments::process_argument(const char* arg, |
755 jboolean ignore_unrecognized, FlagValueOrigin origin) { | |
756 | |
757 JDK_Version since = JDK_Version(); | |
0 | 758 |
759 if (parse_argument(arg, origin)) { | |
760 // do nothing | |
242 | 761 } else if (is_newly_obsolete(arg, &since)) { |
762 enum { bufsize = 256 }; | |
763 char buffer[bufsize]; | |
764 since.to_string(buffer, bufsize); | |
0 | 765 jio_fprintf(defaultStream::error_stream(), |
242 | 766 "Warning: The flag %s has been EOL'd as of %s and will" |
767 " be ignored\n", arg, buffer); | |
0 | 768 } else { |
769 if (!ignore_unrecognized) { | |
770 jio_fprintf(defaultStream::error_stream(), | |
771 "Unrecognized VM option '%s'\n", arg); | |
772 // allow for commandline "commenting out" options like -XX:#+Verbose | |
773 if (strlen(arg) == 0 || arg[0] != '#') { | |
774 return false; | |
775 } | |
776 } | |
777 } | |
778 return true; | |
779 } | |
780 | |
781 bool Arguments::process_settings_file(const char* file_name, bool should_exist, jboolean ignore_unrecognized) { | |
782 FILE* stream = fopen(file_name, "rb"); | |
783 if (stream == NULL) { | |
784 if (should_exist) { | |
785 jio_fprintf(defaultStream::error_stream(), | |
786 "Could not open settings file %s\n", file_name); | |
787 return false; | |
788 } else { | |
789 return true; | |
790 } | |
791 } | |
792 | |
793 char token[1024]; | |
794 int pos = 0; | |
795 | |
796 bool in_white_space = true; | |
797 bool in_comment = false; | |
798 bool in_quote = false; | |
799 char quote_c = 0; | |
800 bool result = true; | |
801 | |
802 int c = getc(stream); | |
803 while(c != EOF) { | |
804 if (in_white_space) { | |
805 if (in_comment) { | |
806 if (c == '\n') in_comment = false; | |
807 } else { | |
808 if (c == '#') in_comment = true; | |
809 else if (!isspace(c)) { | |
810 in_white_space = false; | |
811 token[pos++] = c; | |
812 } | |
813 } | |
814 } else { | |
815 if (c == '\n' || (!in_quote && isspace(c))) { | |
816 // token ends at newline, or at unquoted whitespace | |
817 // this allows a way to include spaces in string-valued options | |
818 token[pos] = '\0'; | |
819 logOption(token); | |
820 result &= process_argument(token, ignore_unrecognized, CONFIG_FILE); | |
821 build_jvm_flags(token); | |
822 pos = 0; | |
823 in_white_space = true; | |
824 in_quote = false; | |
825 } else if (!in_quote && (c == '\'' || c == '"')) { | |
826 in_quote = true; | |
827 quote_c = c; | |
828 } else if (in_quote && (c == quote_c)) { | |
829 in_quote = false; | |
830 } else { | |
831 token[pos++] = c; | |
832 } | |
833 } | |
834 c = getc(stream); | |
835 } | |
836 if (pos > 0) { | |
837 token[pos] = '\0'; | |
838 result &= process_argument(token, ignore_unrecognized, CONFIG_FILE); | |
839 build_jvm_flags(token); | |
840 } | |
841 fclose(stream); | |
842 return result; | |
843 } | |
844 | |
845 //============================================================================================================= | |
846 // Parsing of properties (-D) | |
847 | |
848 const char* Arguments::get_property(const char* key) { | |
849 return PropertyList_get_value(system_properties(), key); | |
850 } | |
851 | |
852 bool Arguments::add_property(const char* prop) { | |
853 const char* eq = strchr(prop, '='); | |
854 char* key; | |
855 // ns must be static--its address may be stored in a SystemProperty object. | |
856 const static char ns[1] = {0}; | |
857 char* value = (char *)ns; | |
858 | |
859 size_t key_len = (eq == NULL) ? strlen(prop) : (eq - prop); | |
860 key = AllocateHeap(key_len + 1, "add_property"); | |
861 strncpy(key, prop, key_len); | |
862 key[key_len] = '\0'; | |
863 | |
864 if (eq != NULL) { | |
865 size_t value_len = strlen(prop) - key_len - 1; | |
866 value = AllocateHeap(value_len + 1, "add_property"); | |
867 strncpy(value, &prop[key_len + 1], value_len + 1); | |
868 } | |
869 | |
870 if (strcmp(key, "java.compiler") == 0) { | |
871 process_java_compiler_argument(value); | |
872 FreeHeap(key); | |
873 if (eq != NULL) { | |
874 FreeHeap(value); | |
875 } | |
876 return true; | |
691 | 877 } else if (strcmp(key, "sun.java.command") == 0) { |
0 | 878 _java_command = value; |
879 | |
880 // don't add this property to the properties exposed to the java application | |
881 FreeHeap(key); | |
882 return true; | |
691 | 883 } else if (strcmp(key, "sun.java.launcher.pid") == 0) { |
0 | 884 // launcher.pid property is private and is processed |
885 // in process_sun_java_launcher_properties(); | |
886 // the sun.java.launcher property is passed on to the java application | |
887 FreeHeap(key); | |
888 if (eq != NULL) { | |
889 FreeHeap(value); | |
890 } | |
891 return true; | |
691 | 892 } else if (strcmp(key, "java.vendor.url.bug") == 0) { |
0 | 893 // save it in _java_vendor_url_bug, so JVM fatal error handler can access |
894 // its value without going through the property list or making a Java call. | |
895 _java_vendor_url_bug = value; | |
691 | 896 } else if (strcmp(key, "sun.boot.library.path") == 0) { |
897 PropertyList_unique_add(&_system_properties, key, value, true); | |
898 return true; | |
0 | 899 } |
900 // Create new property and add at the end of the list | |
901 PropertyList_unique_add(&_system_properties, key, value); | |
902 return true; | |
903 } | |
904 | |
905 //=========================================================================================================== | |
906 // Setting int/mixed/comp mode flags | |
907 | |
908 void Arguments::set_mode_flags(Mode mode) { | |
909 // Set up default values for all flags. | |
910 // If you add a flag to any of the branches below, | |
911 // add a default value for it here. | |
912 set_java_compiler(false); | |
913 _mode = mode; | |
914 | |
915 // Ensure Agent_OnLoad has the correct initial values. | |
916 // This may not be the final mode; mode may change later in onload phase. | |
917 PropertyList_unique_add(&_system_properties, "java.vm.info", | |
691 | 918 (char*)Abstract_VM_Version::vm_info_string(), false); |
0 | 919 |
920 UseInterpreter = true; | |
921 UseCompiler = true; | |
922 UseLoopCounter = true; | |
923 | |
924 // Default values may be platform/compiler dependent - | |
925 // use the saved values | |
926 ClipInlining = Arguments::_ClipInlining; | |
927 AlwaysCompileLoopMethods = Arguments::_AlwaysCompileLoopMethods; | |
928 UseOnStackReplacement = Arguments::_UseOnStackReplacement; | |
929 BackgroundCompilation = Arguments::_BackgroundCompilation; | |
930 | |
931 // Change from defaults based on mode | |
932 switch (mode) { | |
933 default: | |
934 ShouldNotReachHere(); | |
935 break; | |
936 case _int: | |
937 UseCompiler = false; | |
938 UseLoopCounter = false; | |
939 AlwaysCompileLoopMethods = false; | |
940 UseOnStackReplacement = false; | |
941 break; | |
942 case _mixed: | |
943 // same as default | |
944 break; | |
945 case _comp: | |
946 UseInterpreter = false; | |
947 BackgroundCompilation = false; | |
948 ClipInlining = false; | |
949 break; | |
950 } | |
951 } | |
952 | |
953 // Conflict: required to use shared spaces (-Xshare:on), but | |
954 // incompatible command line options were chosen. | |
955 | |
956 static void no_shared_spaces() { | |
957 if (RequireSharedSpaces) { | |
958 jio_fprintf(defaultStream::error_stream(), | |
959 "Class data sharing is inconsistent with other specified options.\n"); | |
960 vm_exit_during_initialization("Unable to use shared archive.", NULL); | |
961 } else { | |
962 FLAG_SET_DEFAULT(UseSharedSpaces, false); | |
963 } | |
964 } | |
965 | |
1891
9de67bf4244d
6996136: VM crash in src/share/vm/runtime/virtualspace.cpp:424
iveresov
parents:
1890
diff
changeset
|
966 void Arguments::check_compressed_oops_compat() { |
9de67bf4244d
6996136: VM crash in src/share/vm/runtime/virtualspace.cpp:424
iveresov
parents:
1890
diff
changeset
|
967 #ifdef _LP64 |
9de67bf4244d
6996136: VM crash in src/share/vm/runtime/virtualspace.cpp:424
iveresov
parents:
1890
diff
changeset
|
968 assert(UseCompressedOops, "Precondition"); |
9de67bf4244d
6996136: VM crash in src/share/vm/runtime/virtualspace.cpp:424
iveresov
parents:
1890
diff
changeset
|
969 # if defined(COMPILER1) && !defined(TIERED) |
9de67bf4244d
6996136: VM crash in src/share/vm/runtime/virtualspace.cpp:424
iveresov
parents:
1890
diff
changeset
|
970 // Until c1 supports compressed oops turn them off. |
9de67bf4244d
6996136: VM crash in src/share/vm/runtime/virtualspace.cpp:424
iveresov
parents:
1890
diff
changeset
|
971 FLAG_SET_DEFAULT(UseCompressedOops, false); |
9de67bf4244d
6996136: VM crash in src/share/vm/runtime/virtualspace.cpp:424
iveresov
parents:
1890
diff
changeset
|
972 # else |
9de67bf4244d
6996136: VM crash in src/share/vm/runtime/virtualspace.cpp:424
iveresov
parents:
1890
diff
changeset
|
973 // Is it on by default or set on ergonomically |
9de67bf4244d
6996136: VM crash in src/share/vm/runtime/virtualspace.cpp:424
iveresov
parents:
1890
diff
changeset
|
974 bool is_on_by_default = FLAG_IS_DEFAULT(UseCompressedOops) || FLAG_IS_ERGO(UseCompressedOops); |
9de67bf4244d
6996136: VM crash in src/share/vm/runtime/virtualspace.cpp:424
iveresov
parents:
1890
diff
changeset
|
975 |
9de67bf4244d
6996136: VM crash in src/share/vm/runtime/virtualspace.cpp:424
iveresov
parents:
1890
diff
changeset
|
976 // Tiered currently doesn't work with compressed oops |
9de67bf4244d
6996136: VM crash in src/share/vm/runtime/virtualspace.cpp:424
iveresov
parents:
1890
diff
changeset
|
977 if (TieredCompilation) { |
9de67bf4244d
6996136: VM crash in src/share/vm/runtime/virtualspace.cpp:424
iveresov
parents:
1890
diff
changeset
|
978 if (is_on_by_default) { |
9de67bf4244d
6996136: VM crash in src/share/vm/runtime/virtualspace.cpp:424
iveresov
parents:
1890
diff
changeset
|
979 FLAG_SET_DEFAULT(UseCompressedOops, false); |
9de67bf4244d
6996136: VM crash in src/share/vm/runtime/virtualspace.cpp:424
iveresov
parents:
1890
diff
changeset
|
980 return; |
9de67bf4244d
6996136: VM crash in src/share/vm/runtime/virtualspace.cpp:424
iveresov
parents:
1890
diff
changeset
|
981 } else { |
9de67bf4244d
6996136: VM crash in src/share/vm/runtime/virtualspace.cpp:424
iveresov
parents:
1890
diff
changeset
|
982 vm_exit_during_initialization( |
9de67bf4244d
6996136: VM crash in src/share/vm/runtime/virtualspace.cpp:424
iveresov
parents:
1890
diff
changeset
|
983 "Tiered compilation is not supported with compressed oops yet", NULL); |
9de67bf4244d
6996136: VM crash in src/share/vm/runtime/virtualspace.cpp:424
iveresov
parents:
1890
diff
changeset
|
984 } |
9de67bf4244d
6996136: VM crash in src/share/vm/runtime/virtualspace.cpp:424
iveresov
parents:
1890
diff
changeset
|
985 } |
9de67bf4244d
6996136: VM crash in src/share/vm/runtime/virtualspace.cpp:424
iveresov
parents:
1890
diff
changeset
|
986 |
9de67bf4244d
6996136: VM crash in src/share/vm/runtime/virtualspace.cpp:424
iveresov
parents:
1890
diff
changeset
|
987 // If dumping an archive or forcing its use, disable compressed oops if possible |
9de67bf4244d
6996136: VM crash in src/share/vm/runtime/virtualspace.cpp:424
iveresov
parents:
1890
diff
changeset
|
988 if (DumpSharedSpaces || RequireSharedSpaces) { |
9de67bf4244d
6996136: VM crash in src/share/vm/runtime/virtualspace.cpp:424
iveresov
parents:
1890
diff
changeset
|
989 if (is_on_by_default) { |
9de67bf4244d
6996136: VM crash in src/share/vm/runtime/virtualspace.cpp:424
iveresov
parents:
1890
diff
changeset
|
990 FLAG_SET_DEFAULT(UseCompressedOops, false); |
9de67bf4244d
6996136: VM crash in src/share/vm/runtime/virtualspace.cpp:424
iveresov
parents:
1890
diff
changeset
|
991 return; |
9de67bf4244d
6996136: VM crash in src/share/vm/runtime/virtualspace.cpp:424
iveresov
parents:
1890
diff
changeset
|
992 } else { |
9de67bf4244d
6996136: VM crash in src/share/vm/runtime/virtualspace.cpp:424
iveresov
parents:
1890
diff
changeset
|
993 vm_exit_during_initialization( |
9de67bf4244d
6996136: VM crash in src/share/vm/runtime/virtualspace.cpp:424
iveresov
parents:
1890
diff
changeset
|
994 "Class Data Sharing is not supported with compressed oops yet", NULL); |
9de67bf4244d
6996136: VM crash in src/share/vm/runtime/virtualspace.cpp:424
iveresov
parents:
1890
diff
changeset
|
995 } |
9de67bf4244d
6996136: VM crash in src/share/vm/runtime/virtualspace.cpp:424
iveresov
parents:
1890
diff
changeset
|
996 } else if (UseSharedSpaces) { |
9de67bf4244d
6996136: VM crash in src/share/vm/runtime/virtualspace.cpp:424
iveresov
parents:
1890
diff
changeset
|
997 // UseSharedSpaces is on by default. With compressed oops, we turn it off. |
9de67bf4244d
6996136: VM crash in src/share/vm/runtime/virtualspace.cpp:424
iveresov
parents:
1890
diff
changeset
|
998 FLAG_SET_DEFAULT(UseSharedSpaces, false); |
9de67bf4244d
6996136: VM crash in src/share/vm/runtime/virtualspace.cpp:424
iveresov
parents:
1890
diff
changeset
|
999 } |
9de67bf4244d
6996136: VM crash in src/share/vm/runtime/virtualspace.cpp:424
iveresov
parents:
1890
diff
changeset
|
1000 |
9de67bf4244d
6996136: VM crash in src/share/vm/runtime/virtualspace.cpp:424
iveresov
parents:
1890
diff
changeset
|
1001 # endif // defined(COMPILER1) && !defined(TIERED) |
9de67bf4244d
6996136: VM crash in src/share/vm/runtime/virtualspace.cpp:424
iveresov
parents:
1890
diff
changeset
|
1002 #endif // _LP64 |
9de67bf4244d
6996136: VM crash in src/share/vm/runtime/virtualspace.cpp:424
iveresov
parents:
1890
diff
changeset
|
1003 } |
9de67bf4244d
6996136: VM crash in src/share/vm/runtime/virtualspace.cpp:424
iveresov
parents:
1890
diff
changeset
|
1004 |
1783 | 1005 void Arguments::set_tiered_flags() { |
1006 if (FLAG_IS_DEFAULT(CompilationPolicyChoice)) { | |
1007 FLAG_SET_DEFAULT(CompilationPolicyChoice, 2); | |
1008 } | |
1009 if (CompilationPolicyChoice < 2) { | |
1010 vm_exit_during_initialization( | |
1011 "Incompatible compilation policy selected", NULL); | |
1012 } | |
1891
9de67bf4244d
6996136: VM crash in src/share/vm/runtime/virtualspace.cpp:424
iveresov
parents:
1890
diff
changeset
|
1013 // Increase the code cache size - tiered compiles a lot more. |
1783 | 1014 if (FLAG_IS_DEFAULT(ReservedCodeCacheSize)) { |
1015 FLAG_SET_DEFAULT(ReservedCodeCacheSize, ReservedCodeCacheSize * 2); | |
1016 } | |
1017 } | |
1018 | |
1145
e018e6884bd8
6631166: CMS: better heuristics when combatting fragmentation
ysr
parents:
1074
diff
changeset
|
1019 #ifndef KERNEL |
0 | 1020 // If the user has chosen ParallelGCThreads > 0, we set UseParNewGC |
1021 // if it's not explictly set or unset. If the user has chosen | |
1022 // UseParNewGC and not explicitly set ParallelGCThreads we | |
1023 // set it, unless this is a single cpu machine. | |
1024 void Arguments::set_parnew_gc_flags() { | |
1064 | 1025 assert(!UseSerialGC && !UseParallelOldGC && !UseParallelGC && !UseG1GC, |
342
37f87013dfd8
6711316: Open source the Garbage-First garbage collector
ysr
parents:
135
diff
changeset
|
1026 "control point invariant"); |
37f87013dfd8
6711316: Open source the Garbage-First garbage collector
ysr
parents:
135
diff
changeset
|
1027 assert(UseParNewGC, "Error"); |
0 | 1028 |
10
28372612af5e
6362677: Change parallel GC collector default number of parallel GC threads.
jmasa
parents:
0
diff
changeset
|
1029 // Turn off AdaptiveSizePolicy by default for parnew until it is |
28372612af5e
6362677: Change parallel GC collector default number of parallel GC threads.
jmasa
parents:
0
diff
changeset
|
1030 // complete. |
342
37f87013dfd8
6711316: Open source the Garbage-First garbage collector
ysr
parents:
135
diff
changeset
|
1031 if (FLAG_IS_DEFAULT(UseAdaptiveSizePolicy)) { |
10
28372612af5e
6362677: Change parallel GC collector default number of parallel GC threads.
jmasa
parents:
0
diff
changeset
|
1032 FLAG_SET_DEFAULT(UseAdaptiveSizePolicy, false); |
28372612af5e
6362677: Change parallel GC collector default number of parallel GC threads.
jmasa
parents:
0
diff
changeset
|
1033 } |
28372612af5e
6362677: Change parallel GC collector default number of parallel GC threads.
jmasa
parents:
0
diff
changeset
|
1034 |
342
37f87013dfd8
6711316: Open source the Garbage-First garbage collector
ysr
parents:
135
diff
changeset
|
1035 if (ParallelGCThreads == 0) { |
10
28372612af5e
6362677: Change parallel GC collector default number of parallel GC threads.
jmasa
parents:
0
diff
changeset
|
1036 FLAG_SET_DEFAULT(ParallelGCThreads, |
28372612af5e
6362677: Change parallel GC collector default number of parallel GC threads.
jmasa
parents:
0
diff
changeset
|
1037 Abstract_VM_Version::parallel_worker_threads()); |
1064 | 1038 if (ParallelGCThreads == 1) { |
0 | 1039 FLAG_SET_DEFAULT(UseParNewGC, false); |
1064 | 1040 FLAG_SET_DEFAULT(ParallelGCThreads, 0); |
0 | 1041 } |
1042 } | |
1064 | 1043 if (UseParNewGC) { |
1044 // CDS doesn't work with ParNew yet | |
0 | 1045 no_shared_spaces(); |
1046 | |
695 | 1047 // By default YoungPLABSize and OldPLABSize are set to 4096 and 1024 respectively, |
0 | 1048 // these settings are default for Parallel Scavenger. For ParNew+Tenured configuration |
1049 // we set them to 1024 and 1024. | |
1050 // See CR 6362902. | |
1051 if (FLAG_IS_DEFAULT(YoungPLABSize)) { | |
1052 FLAG_SET_DEFAULT(YoungPLABSize, (intx)1024); | |
1053 } | |
1054 if (FLAG_IS_DEFAULT(OldPLABSize)) { | |
1055 FLAG_SET_DEFAULT(OldPLABSize, (intx)1024); | |
1056 } | |
1057 | |
1064 | 1058 // AlwaysTenure flag should make ParNew promote all at first collection. |
0 | 1059 // See CR 6362902. |
1060 if (AlwaysTenure) { | |
1061 FLAG_SET_CMDLINE(intx, MaxTenuringThreshold, 0); | |
1062 } | |
695 | 1063 // When using compressed oops, we use local overflow stacks, |
1064 // rather than using a global overflow list chained through | |
1065 // the klass word of the object's pre-image. | |
1066 if (UseCompressedOops && !ParGCUseLocalOverflow) { | |
1067 if (!FLAG_IS_DEFAULT(ParGCUseLocalOverflow)) { | |
1068 warning("Forcing +ParGCUseLocalOverflow: needed if using compressed references"); | |
1069 } | |
1070 FLAG_SET_DEFAULT(ParGCUseLocalOverflow, true); | |
1071 } | |
1072 assert(ParGCUseLocalOverflow || !UseCompressedOops, "Error"); | |
0 | 1073 } |
1074 } | |
1075 | |
1076 // Adjust some sizes to suit CMS and/or ParNew needs; these work well on | |
1077 // sparc/solaris for certain applications, but would gain from | |
1078 // further optimization and tuning efforts, and would almost | |
1079 // certainly gain from analysis of platform and environment. | |
1080 void Arguments::set_cms_and_parnew_gc_flags() { | |
1064 | 1081 assert(!UseSerialGC && !UseParallelOldGC && !UseParallelGC, "Error"); |
10
28372612af5e
6362677: Change parallel GC collector default number of parallel GC threads.
jmasa
parents:
0
diff
changeset
|
1082 assert(UseConcMarkSweepGC, "CMS is expected to be on here"); |
28372612af5e
6362677: Change parallel GC collector default number of parallel GC threads.
jmasa
parents:
0
diff
changeset
|
1083 |
0 | 1084 // If we are using CMS, we prefer to UseParNewGC, |
1085 // unless explicitly forbidden. | |
342
37f87013dfd8
6711316: Open source the Garbage-First garbage collector
ysr
parents:
135
diff
changeset
|
1086 if (FLAG_IS_DEFAULT(UseParNewGC)) { |
10
28372612af5e
6362677: Change parallel GC collector default number of parallel GC threads.
jmasa
parents:
0
diff
changeset
|
1087 FLAG_SET_ERGO(bool, UseParNewGC, true); |
0 | 1088 } |
1089 | |
1090 // Turn off AdaptiveSizePolicy by default for cms until it is | |
10
28372612af5e
6362677: Change parallel GC collector default number of parallel GC threads.
jmasa
parents:
0
diff
changeset
|
1091 // complete. |
28372612af5e
6362677: Change parallel GC collector default number of parallel GC threads.
jmasa
parents:
0
diff
changeset
|
1092 if (FLAG_IS_DEFAULT(UseAdaptiveSizePolicy)) { |
0 | 1093 FLAG_SET_DEFAULT(UseAdaptiveSizePolicy, false); |
1094 } | |
1095 | |
1096 // In either case, adjust ParallelGCThreads and/or UseParNewGC | |
1097 // as needed. | |
10
28372612af5e
6362677: Change parallel GC collector default number of parallel GC threads.
jmasa
parents:
0
diff
changeset
|
1098 if (UseParNewGC) { |
28372612af5e
6362677: Change parallel GC collector default number of parallel GC threads.
jmasa
parents:
0
diff
changeset
|
1099 set_parnew_gc_flags(); |
0 | 1100 } |
1101 | |
1102 // Now make adjustments for CMS | |
1103 size_t young_gen_per_worker; | |
1104 intx new_ratio; | |
1105 size_t min_new_default; | |
1106 intx tenuring_default; | |
1107 if (CMSUseOldDefaults) { // old defaults: "old" as of 6.0 | |
1108 if FLAG_IS_DEFAULT(CMSYoungGenPerWorker) { | |
13
183f41cf8bfe
6557851: CMS: ergonomics defaults are not set with FLAG_SET_ERGO
jmasa
parents:
10
diff
changeset
|
1109 FLAG_SET_ERGO(intx, CMSYoungGenPerWorker, 4*M); |
0 | 1110 } |
1111 young_gen_per_worker = 4*M; | |
1112 new_ratio = (intx)15; | |
1113 min_new_default = 4*M; | |
1114 tenuring_default = (intx)0; | |
1115 } else { // new defaults: "new" as of 6.0 | |
1116 young_gen_per_worker = CMSYoungGenPerWorker; | |
1117 new_ratio = (intx)7; | |
1118 min_new_default = 16*M; | |
1119 tenuring_default = (intx)4; | |
1120 } | |
1121 | |
1122 // Preferred young gen size for "short" pauses | |
1123 const uintx parallel_gc_threads = | |
1124 (ParallelGCThreads == 0 ? 1 : ParallelGCThreads); | |
1125 const size_t preferred_max_new_size_unaligned = | |
1126 ScaleForWordSize(young_gen_per_worker * parallel_gc_threads); | |
1127 const size_t preferred_max_new_size = | |
1128 align_size_up(preferred_max_new_size_unaligned, os::vm_page_size()); | |
1129 | |
1130 // Unless explicitly requested otherwise, size young gen | |
1131 // for "short" pauses ~ 4M*ParallelGCThreads | |
886
061cd4d965fc
6862534: -XX:NewRatio completely ignored when combined with -XX:+UseConcMarkSweepG
jmasa
parents:
845
diff
changeset
|
1132 |
061cd4d965fc
6862534: -XX:NewRatio completely ignored when combined with -XX:+UseConcMarkSweepG
jmasa
parents:
845
diff
changeset
|
1133 // If either MaxNewSize or NewRatio is set on the command line, |
061cd4d965fc
6862534: -XX:NewRatio completely ignored when combined with -XX:+UseConcMarkSweepG
jmasa
parents:
845
diff
changeset
|
1134 // assume the user is trying to set the size of the young gen. |
061cd4d965fc
6862534: -XX:NewRatio completely ignored when combined with -XX:+UseConcMarkSweepG
jmasa
parents:
845
diff
changeset
|
1135 |
061cd4d965fc
6862534: -XX:NewRatio completely ignored when combined with -XX:+UseConcMarkSweepG
jmasa
parents:
845
diff
changeset
|
1136 if (FLAG_IS_DEFAULT(MaxNewSize) && FLAG_IS_DEFAULT(NewRatio)) { |
061cd4d965fc
6862534: -XX:NewRatio completely ignored when combined with -XX:+UseConcMarkSweepG
jmasa
parents:
845
diff
changeset
|
1137 |
061cd4d965fc
6862534: -XX:NewRatio completely ignored when combined with -XX:+UseConcMarkSweepG
jmasa
parents:
845
diff
changeset
|
1138 // Set MaxNewSize to our calculated preferred_max_new_size unless |
061cd4d965fc
6862534: -XX:NewRatio completely ignored when combined with -XX:+UseConcMarkSweepG
jmasa
parents:
845
diff
changeset
|
1139 // NewSize was set on the command line and it is larger than |
061cd4d965fc
6862534: -XX:NewRatio completely ignored when combined with -XX:+UseConcMarkSweepG
jmasa
parents:
845
diff
changeset
|
1140 // preferred_max_new_size. |
0 | 1141 if (!FLAG_IS_DEFAULT(NewSize)) { // NewSize explicitly set at command-line |
13
183f41cf8bfe
6557851: CMS: ergonomics defaults are not set with FLAG_SET_ERGO
jmasa
parents:
10
diff
changeset
|
1142 FLAG_SET_ERGO(uintx, MaxNewSize, MAX2(NewSize, preferred_max_new_size)); |
0 | 1143 } else { |
13
183f41cf8bfe
6557851: CMS: ergonomics defaults are not set with FLAG_SET_ERGO
jmasa
parents:
10
diff
changeset
|
1144 FLAG_SET_ERGO(uintx, MaxNewSize, preferred_max_new_size); |
0 | 1145 } |
1064 | 1146 if (PrintGCDetails && Verbose) { |
13
183f41cf8bfe
6557851: CMS: ergonomics defaults are not set with FLAG_SET_ERGO
jmasa
parents:
10
diff
changeset
|
1147 // Too early to use gclog_or_tty |
183f41cf8bfe
6557851: CMS: ergonomics defaults are not set with FLAG_SET_ERGO
jmasa
parents:
10
diff
changeset
|
1148 tty->print_cr("Ergo set MaxNewSize: " SIZE_FORMAT, MaxNewSize); |
886
061cd4d965fc
6862534: -XX:NewRatio completely ignored when combined with -XX:+UseConcMarkSweepG
jmasa
parents:
845
diff
changeset
|
1149 } |
061cd4d965fc
6862534: -XX:NewRatio completely ignored when combined with -XX:+UseConcMarkSweepG
jmasa
parents:
845
diff
changeset
|
1150 |
061cd4d965fc
6862534: -XX:NewRatio completely ignored when combined with -XX:+UseConcMarkSweepG
jmasa
parents:
845
diff
changeset
|
1151 // Unless explicitly requested otherwise, prefer a large |
061cd4d965fc
6862534: -XX:NewRatio completely ignored when combined with -XX:+UseConcMarkSweepG
jmasa
parents:
845
diff
changeset
|
1152 // Old to Young gen size so as to shift the collection load |
061cd4d965fc
6862534: -XX:NewRatio completely ignored when combined with -XX:+UseConcMarkSweepG
jmasa
parents:
845
diff
changeset
|
1153 // to the old generation concurrent collector |
061cd4d965fc
6862534: -XX:NewRatio completely ignored when combined with -XX:+UseConcMarkSweepG
jmasa
parents:
845
diff
changeset
|
1154 |
061cd4d965fc
6862534: -XX:NewRatio completely ignored when combined with -XX:+UseConcMarkSweepG
jmasa
parents:
845
diff
changeset
|
1155 // If this is only guarded by FLAG_IS_DEFAULT(NewRatio) |
061cd4d965fc
6862534: -XX:NewRatio completely ignored when combined with -XX:+UseConcMarkSweepG
jmasa
parents:
845
diff
changeset
|
1156 // then NewSize and OldSize may be calculated. That would |
061cd4d965fc
6862534: -XX:NewRatio completely ignored when combined with -XX:+UseConcMarkSweepG
jmasa
parents:
845
diff
changeset
|
1157 // generally lead to some differences with ParNewGC for which |
061cd4d965fc
6862534: -XX:NewRatio completely ignored when combined with -XX:+UseConcMarkSweepG
jmasa
parents:
845
diff
changeset
|
1158 // there was no obvious reason. Also limit to the case where |
061cd4d965fc
6862534: -XX:NewRatio completely ignored when combined with -XX:+UseConcMarkSweepG
jmasa
parents:
845
diff
changeset
|
1159 // MaxNewSize has not been set. |
061cd4d965fc
6862534: -XX:NewRatio completely ignored when combined with -XX:+UseConcMarkSweepG
jmasa
parents:
845
diff
changeset
|
1160 |
13
183f41cf8bfe
6557851: CMS: ergonomics defaults are not set with FLAG_SET_ERGO
jmasa
parents:
10
diff
changeset
|
1161 FLAG_SET_ERGO(intx, NewRatio, MAX2(NewRatio, new_ratio)); |
0 | 1162 |
886
061cd4d965fc
6862534: -XX:NewRatio completely ignored when combined with -XX:+UseConcMarkSweepG
jmasa
parents:
845
diff
changeset
|
1163 // Code along this path potentially sets NewSize and OldSize |
061cd4d965fc
6862534: -XX:NewRatio completely ignored when combined with -XX:+UseConcMarkSweepG
jmasa
parents:
845
diff
changeset
|
1164 |
061cd4d965fc
6862534: -XX:NewRatio completely ignored when combined with -XX:+UseConcMarkSweepG
jmasa
parents:
845
diff
changeset
|
1165 // Calculate the desired minimum size of the young gen but if |
061cd4d965fc
6862534: -XX:NewRatio completely ignored when combined with -XX:+UseConcMarkSweepG
jmasa
parents:
845
diff
changeset
|
1166 // NewSize has been set on the command line, use it here since |
061cd4d965fc
6862534: -XX:NewRatio completely ignored when combined with -XX:+UseConcMarkSweepG
jmasa
parents:
845
diff
changeset
|
1167 // it should be the final value. |
061cd4d965fc
6862534: -XX:NewRatio completely ignored when combined with -XX:+UseConcMarkSweepG
jmasa
parents:
845
diff
changeset
|
1168 size_t min_new; |
061cd4d965fc
6862534: -XX:NewRatio completely ignored when combined with -XX:+UseConcMarkSweepG
jmasa
parents:
845
diff
changeset
|
1169 if (FLAG_IS_DEFAULT(NewSize)) { |
061cd4d965fc
6862534: -XX:NewRatio completely ignored when combined with -XX:+UseConcMarkSweepG
jmasa
parents:
845
diff
changeset
|
1170 min_new = align_size_up(ScaleForWordSize(min_new_default), |
061cd4d965fc
6862534: -XX:NewRatio completely ignored when combined with -XX:+UseConcMarkSweepG
jmasa
parents:
845
diff
changeset
|
1171 os::vm_page_size()); |
061cd4d965fc
6862534: -XX:NewRatio completely ignored when combined with -XX:+UseConcMarkSweepG
jmasa
parents:
845
diff
changeset
|
1172 } else { |
061cd4d965fc
6862534: -XX:NewRatio completely ignored when combined with -XX:+UseConcMarkSweepG
jmasa
parents:
845
diff
changeset
|
1173 min_new = NewSize; |
061cd4d965fc
6862534: -XX:NewRatio completely ignored when combined with -XX:+UseConcMarkSweepG
jmasa
parents:
845
diff
changeset
|
1174 } |
1064 | 1175 size_t prev_initial_size = InitialHeapSize; |
1176 if (prev_initial_size != 0 && prev_initial_size < min_new + OldSize) { | |
1177 FLAG_SET_ERGO(uintx, InitialHeapSize, min_new + OldSize); | |
0 | 1178 // Currently minimum size and the initial heap sizes are the same. |
1064 | 1179 set_min_heap_size(InitialHeapSize); |
0 | 1180 if (PrintGCDetails && Verbose) { |
1181 warning("Initial heap size increased to " SIZE_FORMAT " M from " | |
1182 SIZE_FORMAT " M; use -XX:NewSize=... for finer control.", | |
1064 | 1183 InitialHeapSize/M, prev_initial_size/M); |
0 | 1184 } |
1185 } | |
886
061cd4d965fc
6862534: -XX:NewRatio completely ignored when combined with -XX:+UseConcMarkSweepG
jmasa
parents:
845
diff
changeset
|
1186 |
0 | 1187 // MaxHeapSize is aligned down in collectorPolicy |
886
061cd4d965fc
6862534: -XX:NewRatio completely ignored when combined with -XX:+UseConcMarkSweepG
jmasa
parents:
845
diff
changeset
|
1188 size_t max_heap = |
061cd4d965fc
6862534: -XX:NewRatio completely ignored when combined with -XX:+UseConcMarkSweepG
jmasa
parents:
845
diff
changeset
|
1189 align_size_down(MaxHeapSize, |
061cd4d965fc
6862534: -XX:NewRatio completely ignored when combined with -XX:+UseConcMarkSweepG
jmasa
parents:
845
diff
changeset
|
1190 CardTableRS::ct_max_alignment_constraint()); |
0 | 1191 |
1064 | 1192 if (PrintGCDetails && Verbose) { |
13
183f41cf8bfe
6557851: CMS: ergonomics defaults are not set with FLAG_SET_ERGO
jmasa
parents:
10
diff
changeset
|
1193 // Too early to use gclog_or_tty |
183f41cf8bfe
6557851: CMS: ergonomics defaults are not set with FLAG_SET_ERGO
jmasa
parents:
10
diff
changeset
|
1194 tty->print_cr("CMS set min_heap_size: " SIZE_FORMAT |
183f41cf8bfe
6557851: CMS: ergonomics defaults are not set with FLAG_SET_ERGO
jmasa
parents:
10
diff
changeset
|
1195 " initial_heap_size: " SIZE_FORMAT |
183f41cf8bfe
6557851: CMS: ergonomics defaults are not set with FLAG_SET_ERGO
jmasa
parents:
10
diff
changeset
|
1196 " max_heap: " SIZE_FORMAT, |
1064 | 1197 min_heap_size(), InitialHeapSize, max_heap); |
13
183f41cf8bfe
6557851: CMS: ergonomics defaults are not set with FLAG_SET_ERGO
jmasa
parents:
10
diff
changeset
|
1198 } |
0 | 1199 if (max_heap > min_new) { |
1200 // Unless explicitly requested otherwise, make young gen | |
1201 // at least min_new, and at most preferred_max_new_size. | |
1202 if (FLAG_IS_DEFAULT(NewSize)) { | |
13
183f41cf8bfe
6557851: CMS: ergonomics defaults are not set with FLAG_SET_ERGO
jmasa
parents:
10
diff
changeset
|
1203 FLAG_SET_ERGO(uintx, NewSize, MAX2(NewSize, min_new)); |
183f41cf8bfe
6557851: CMS: ergonomics defaults are not set with FLAG_SET_ERGO
jmasa
parents:
10
diff
changeset
|
1204 FLAG_SET_ERGO(uintx, NewSize, MIN2(preferred_max_new_size, NewSize)); |
1064 | 1205 if (PrintGCDetails && Verbose) { |
13
183f41cf8bfe
6557851: CMS: ergonomics defaults are not set with FLAG_SET_ERGO
jmasa
parents:
10
diff
changeset
|
1206 // Too early to use gclog_or_tty |
183f41cf8bfe
6557851: CMS: ergonomics defaults are not set with FLAG_SET_ERGO
jmasa
parents:
10
diff
changeset
|
1207 tty->print_cr("Ergo set NewSize: " SIZE_FORMAT, NewSize); |
183f41cf8bfe
6557851: CMS: ergonomics defaults are not set with FLAG_SET_ERGO
jmasa
parents:
10
diff
changeset
|
1208 } |
0 | 1209 } |
1210 // Unless explicitly requested otherwise, size old gen | |
1211 // so that it's at least 3X of NewSize to begin with; | |
1212 // later NewRatio will decide how it grows; see above. | |
1213 if (FLAG_IS_DEFAULT(OldSize)) { | |
1214 if (max_heap > NewSize) { | |
1064 | 1215 FLAG_SET_ERGO(uintx, OldSize, MIN2(3*NewSize, max_heap - NewSize)); |
1216 if (PrintGCDetails && Verbose) { | |
13
183f41cf8bfe
6557851: CMS: ergonomics defaults are not set with FLAG_SET_ERGO
jmasa
parents:
10
diff
changeset
|
1217 // Too early to use gclog_or_tty |
183f41cf8bfe
6557851: CMS: ergonomics defaults are not set with FLAG_SET_ERGO
jmasa
parents:
10
diff
changeset
|
1218 tty->print_cr("Ergo set OldSize: " SIZE_FORMAT, OldSize); |
183f41cf8bfe
6557851: CMS: ergonomics defaults are not set with FLAG_SET_ERGO
jmasa
parents:
10
diff
changeset
|
1219 } |
0 | 1220 } |
1221 } | |
1222 } | |
1223 } | |
1224 // Unless explicitly requested otherwise, definitely | |
1225 // promote all objects surviving "tenuring_default" scavenges. | |
1226 if (FLAG_IS_DEFAULT(MaxTenuringThreshold) && | |
1227 FLAG_IS_DEFAULT(SurvivorRatio)) { | |
13
183f41cf8bfe
6557851: CMS: ergonomics defaults are not set with FLAG_SET_ERGO
jmasa
parents:
10
diff
changeset
|
1228 FLAG_SET_ERGO(intx, MaxTenuringThreshold, tenuring_default); |
0 | 1229 } |
1230 // If we decided above (or user explicitly requested) | |
1231 // `promote all' (via MaxTenuringThreshold := 0), | |
1232 // prefer minuscule survivor spaces so as not to waste | |
1233 // space for (non-existent) survivors | |
1234 if (FLAG_IS_DEFAULT(SurvivorRatio) && MaxTenuringThreshold == 0) { | |
13
183f41cf8bfe
6557851: CMS: ergonomics defaults are not set with FLAG_SET_ERGO
jmasa
parents:
10
diff
changeset
|
1235 FLAG_SET_ERGO(intx, SurvivorRatio, MAX2((intx)1024, SurvivorRatio)); |
0 | 1236 } |
1237 // If OldPLABSize is set and CMSParPromoteBlocksToClaim is not, | |
1238 // set CMSParPromoteBlocksToClaim equal to OldPLABSize. | |
1239 // This is done in order to make ParNew+CMS configuration to work | |
1240 // with YoungPLABSize and OldPLABSize options. | |
1241 // See CR 6362902. | |
1242 if (!FLAG_IS_DEFAULT(OldPLABSize)) { | |
1243 if (FLAG_IS_DEFAULT(CMSParPromoteBlocksToClaim)) { | |
13
183f41cf8bfe
6557851: CMS: ergonomics defaults are not set with FLAG_SET_ERGO
jmasa
parents:
10
diff
changeset
|
1244 // OldPLABSize is not the default value but CMSParPromoteBlocksToClaim |
183f41cf8bfe
6557851: CMS: ergonomics defaults are not set with FLAG_SET_ERGO
jmasa
parents:
10
diff
changeset
|
1245 // is. In this situtation let CMSParPromoteBlocksToClaim follow |
183f41cf8bfe
6557851: CMS: ergonomics defaults are not set with FLAG_SET_ERGO
jmasa
parents:
10
diff
changeset
|
1246 // the value (either from the command line or ergonomics) of |
183f41cf8bfe
6557851: CMS: ergonomics defaults are not set with FLAG_SET_ERGO
jmasa
parents:
10
diff
changeset
|
1247 // OldPLABSize. Following OldPLABSize is an ergonomics decision. |
183f41cf8bfe
6557851: CMS: ergonomics defaults are not set with FLAG_SET_ERGO
jmasa
parents:
10
diff
changeset
|
1248 FLAG_SET_ERGO(uintx, CMSParPromoteBlocksToClaim, OldPLABSize); |
1145
e018e6884bd8
6631166: CMS: better heuristics when combatting fragmentation
ysr
parents:
1074
diff
changeset
|
1249 } else { |
0 | 1250 // OldPLABSize and CMSParPromoteBlocksToClaim are both set. |
1251 // CMSParPromoteBlocksToClaim is a collector-specific flag, so | |
1252 // we'll let it to take precedence. | |
1253 jio_fprintf(defaultStream::error_stream(), | |
886
061cd4d965fc
6862534: -XX:NewRatio completely ignored when combined with -XX:+UseConcMarkSweepG
jmasa
parents:
845
diff
changeset
|
1254 "Both OldPLABSize and CMSParPromoteBlocksToClaim" |
061cd4d965fc
6862534: -XX:NewRatio completely ignored when combined with -XX:+UseConcMarkSweepG
jmasa
parents:
845
diff
changeset
|
1255 " options are specified for the CMS collector." |
061cd4d965fc
6862534: -XX:NewRatio completely ignored when combined with -XX:+UseConcMarkSweepG
jmasa
parents:
845
diff
changeset
|
1256 " CMSParPromoteBlocksToClaim will take precedence.\n"); |
0 | 1257 } |
1258 } | |
1145
e018e6884bd8
6631166: CMS: better heuristics when combatting fragmentation
ysr
parents:
1074
diff
changeset
|
1259 if (!FLAG_IS_DEFAULT(ResizeOldPLAB) && !ResizeOldPLAB) { |
e018e6884bd8
6631166: CMS: better heuristics when combatting fragmentation
ysr
parents:
1074
diff
changeset
|
1260 // OldPLAB sizing manually turned off: Use a larger default setting, |
e018e6884bd8
6631166: CMS: better heuristics when combatting fragmentation
ysr
parents:
1074
diff
changeset
|
1261 // unless it was manually specified. This is because a too-low value |
e018e6884bd8
6631166: CMS: better heuristics when combatting fragmentation
ysr
parents:
1074
diff
changeset
|
1262 // will slow down scavenges. |
e018e6884bd8
6631166: CMS: better heuristics when combatting fragmentation
ysr
parents:
1074
diff
changeset
|
1263 if (FLAG_IS_DEFAULT(CMSParPromoteBlocksToClaim)) { |
e018e6884bd8
6631166: CMS: better heuristics when combatting fragmentation
ysr
parents:
1074
diff
changeset
|
1264 FLAG_SET_ERGO(uintx, CMSParPromoteBlocksToClaim, 50); // default value before 6631166 |
e018e6884bd8
6631166: CMS: better heuristics when combatting fragmentation
ysr
parents:
1074
diff
changeset
|
1265 } |
e018e6884bd8
6631166: CMS: better heuristics when combatting fragmentation
ysr
parents:
1074
diff
changeset
|
1266 } |
e018e6884bd8
6631166: CMS: better heuristics when combatting fragmentation
ysr
parents:
1074
diff
changeset
|
1267 // Overwrite OldPLABSize which is the variable we will internally use everywhere. |
e018e6884bd8
6631166: CMS: better heuristics when combatting fragmentation
ysr
parents:
1074
diff
changeset
|
1268 FLAG_SET_ERGO(uintx, OldPLABSize, CMSParPromoteBlocksToClaim); |
e018e6884bd8
6631166: CMS: better heuristics when combatting fragmentation
ysr
parents:
1074
diff
changeset
|
1269 // If either of the static initialization defaults have changed, note this |
e018e6884bd8
6631166: CMS: better heuristics when combatting fragmentation
ysr
parents:
1074
diff
changeset
|
1270 // modification. |
e018e6884bd8
6631166: CMS: better heuristics when combatting fragmentation
ysr
parents:
1074
diff
changeset
|
1271 if (!FLAG_IS_DEFAULT(CMSParPromoteBlocksToClaim) || !FLAG_IS_DEFAULT(OldPLABWeight)) { |
e018e6884bd8
6631166: CMS: better heuristics when combatting fragmentation
ysr
parents:
1074
diff
changeset
|
1272 CFLS_LAB::modify_initialization(OldPLABSize, OldPLABWeight); |
e018e6884bd8
6631166: CMS: better heuristics when combatting fragmentation
ysr
parents:
1074
diff
changeset
|
1273 } |
1284 | 1274 if (PrintGCDetails && Verbose) { |
1275 tty->print_cr("MarkStackSize: %uk MarkStackSizeMax: %uk", | |
1276 MarkStackSize / K, MarkStackSizeMax / K); | |
1277 tty->print_cr("ConcGCThreads: %u", ConcGCThreads); | |
1278 } | |
0 | 1279 } |
1145
e018e6884bd8
6631166: CMS: better heuristics when combatting fragmentation
ysr
parents:
1074
diff
changeset
|
1280 #endif // KERNEL |
0 | 1281 |
1571
2d127394260e
6916623: Align object to 16 bytes to use Compressed Oops with java heap up to 64Gb
kvn
parents:
1506
diff
changeset
|
1282 void set_object_alignment() { |
2d127394260e
6916623: Align object to 16 bytes to use Compressed Oops with java heap up to 64Gb
kvn
parents:
1506
diff
changeset
|
1283 // Object alignment. |
2d127394260e
6916623: Align object to 16 bytes to use Compressed Oops with java heap up to 64Gb
kvn
parents:
1506
diff
changeset
|
1284 assert(is_power_of_2(ObjectAlignmentInBytes), "ObjectAlignmentInBytes must be power of 2"); |
2d127394260e
6916623: Align object to 16 bytes to use Compressed Oops with java heap up to 64Gb
kvn
parents:
1506
diff
changeset
|
1285 MinObjAlignmentInBytes = ObjectAlignmentInBytes; |
2d127394260e
6916623: Align object to 16 bytes to use Compressed Oops with java heap up to 64Gb
kvn
parents:
1506
diff
changeset
|
1286 assert(MinObjAlignmentInBytes >= HeapWordsPerLong * HeapWordSize, "ObjectAlignmentInBytes value is too small"); |
2d127394260e
6916623: Align object to 16 bytes to use Compressed Oops with java heap up to 64Gb
kvn
parents:
1506
diff
changeset
|
1287 MinObjAlignment = MinObjAlignmentInBytes / HeapWordSize; |
2d127394260e
6916623: Align object to 16 bytes to use Compressed Oops with java heap up to 64Gb
kvn
parents:
1506
diff
changeset
|
1288 assert(MinObjAlignmentInBytes == MinObjAlignment * HeapWordSize, "ObjectAlignmentInBytes value is incorrect"); |
2d127394260e
6916623: Align object to 16 bytes to use Compressed Oops with java heap up to 64Gb
kvn
parents:
1506
diff
changeset
|
1289 MinObjAlignmentInBytesMask = MinObjAlignmentInBytes - 1; |
2d127394260e
6916623: Align object to 16 bytes to use Compressed Oops with java heap up to 64Gb
kvn
parents:
1506
diff
changeset
|
1290 |
2d127394260e
6916623: Align object to 16 bytes to use Compressed Oops with java heap up to 64Gb
kvn
parents:
1506
diff
changeset
|
1291 LogMinObjAlignmentInBytes = exact_log2(ObjectAlignmentInBytes); |
2d127394260e
6916623: Align object to 16 bytes to use Compressed Oops with java heap up to 64Gb
kvn
parents:
1506
diff
changeset
|
1292 LogMinObjAlignment = LogMinObjAlignmentInBytes - LogHeapWordSize; |
2d127394260e
6916623: Align object to 16 bytes to use Compressed Oops with java heap up to 64Gb
kvn
parents:
1506
diff
changeset
|
1293 |
2d127394260e
6916623: Align object to 16 bytes to use Compressed Oops with java heap up to 64Gb
kvn
parents:
1506
diff
changeset
|
1294 // Oop encoding heap max |
2d127394260e
6916623: Align object to 16 bytes to use Compressed Oops with java heap up to 64Gb
kvn
parents:
1506
diff
changeset
|
1295 OopEncodingHeapMax = (uint64_t(max_juint) + 1) << LogMinObjAlignmentInBytes; |
2d127394260e
6916623: Align object to 16 bytes to use Compressed Oops with java heap up to 64Gb
kvn
parents:
1506
diff
changeset
|
1296 |
2d127394260e
6916623: Align object to 16 bytes to use Compressed Oops with java heap up to 64Gb
kvn
parents:
1506
diff
changeset
|
1297 #ifndef KERNEL |
2d127394260e
6916623: Align object to 16 bytes to use Compressed Oops with java heap up to 64Gb
kvn
parents:
1506
diff
changeset
|
1298 // Set CMS global values |
2d127394260e
6916623: Align object to 16 bytes to use Compressed Oops with java heap up to 64Gb
kvn
parents:
1506
diff
changeset
|
1299 CompactibleFreeListSpace::set_cms_values(); |
2d127394260e
6916623: Align object to 16 bytes to use Compressed Oops with java heap up to 64Gb
kvn
parents:
1506
diff
changeset
|
1300 #endif // KERNEL |
2d127394260e
6916623: Align object to 16 bytes to use Compressed Oops with java heap up to 64Gb
kvn
parents:
1506
diff
changeset
|
1301 } |
2d127394260e
6916623: Align object to 16 bytes to use Compressed Oops with java heap up to 64Gb
kvn
parents:
1506
diff
changeset
|
1302 |
2d127394260e
6916623: Align object to 16 bytes to use Compressed Oops with java heap up to 64Gb
kvn
parents:
1506
diff
changeset
|
1303 bool verify_object_alignment() { |
2d127394260e
6916623: Align object to 16 bytes to use Compressed Oops with java heap up to 64Gb
kvn
parents:
1506
diff
changeset
|
1304 // Object alignment. |
2d127394260e
6916623: Align object to 16 bytes to use Compressed Oops with java heap up to 64Gb
kvn
parents:
1506
diff
changeset
|
1305 if (!is_power_of_2(ObjectAlignmentInBytes)) { |
2d127394260e
6916623: Align object to 16 bytes to use Compressed Oops with java heap up to 64Gb
kvn
parents:
1506
diff
changeset
|
1306 jio_fprintf(defaultStream::error_stream(), |
1829
fe08403130db
6979458: VM crashes when -XX:ObjectAlignmentInBytes is too big
kvn
parents:
1796
diff
changeset
|
1307 "error: ObjectAlignmentInBytes=%d must be power of 2\n", |
fe08403130db
6979458: VM crashes when -XX:ObjectAlignmentInBytes is too big
kvn
parents:
1796
diff
changeset
|
1308 (int)ObjectAlignmentInBytes); |
1571
2d127394260e
6916623: Align object to 16 bytes to use Compressed Oops with java heap up to 64Gb
kvn
parents:
1506
diff
changeset
|
1309 return false; |
2d127394260e
6916623: Align object to 16 bytes to use Compressed Oops with java heap up to 64Gb
kvn
parents:
1506
diff
changeset
|
1310 } |
2d127394260e
6916623: Align object to 16 bytes to use Compressed Oops with java heap up to 64Gb
kvn
parents:
1506
diff
changeset
|
1311 if ((int)ObjectAlignmentInBytes < BytesPerLong) { |
2d127394260e
6916623: Align object to 16 bytes to use Compressed Oops with java heap up to 64Gb
kvn
parents:
1506
diff
changeset
|
1312 jio_fprintf(defaultStream::error_stream(), |
1829
fe08403130db
6979458: VM crashes when -XX:ObjectAlignmentInBytes is too big
kvn
parents:
1796
diff
changeset
|
1313 "error: ObjectAlignmentInBytes=%d must be greater or equal %d\n", |
fe08403130db
6979458: VM crashes when -XX:ObjectAlignmentInBytes is too big
kvn
parents:
1796
diff
changeset
|
1314 (int)ObjectAlignmentInBytes, BytesPerLong); |
fe08403130db
6979458: VM crashes when -XX:ObjectAlignmentInBytes is too big
kvn
parents:
1796
diff
changeset
|
1315 return false; |
fe08403130db
6979458: VM crashes when -XX:ObjectAlignmentInBytes is too big
kvn
parents:
1796
diff
changeset
|
1316 } |
fe08403130db
6979458: VM crashes when -XX:ObjectAlignmentInBytes is too big
kvn
parents:
1796
diff
changeset
|
1317 // It does not make sense to have big object alignment |
fe08403130db
6979458: VM crashes when -XX:ObjectAlignmentInBytes is too big
kvn
parents:
1796
diff
changeset
|
1318 // since a space lost due to alignment will be greater |
fe08403130db
6979458: VM crashes when -XX:ObjectAlignmentInBytes is too big
kvn
parents:
1796
diff
changeset
|
1319 // then a saved space from compressed oops. |
fe08403130db
6979458: VM crashes when -XX:ObjectAlignmentInBytes is too big
kvn
parents:
1796
diff
changeset
|
1320 if ((int)ObjectAlignmentInBytes > 256) { |
fe08403130db
6979458: VM crashes when -XX:ObjectAlignmentInBytes is too big
kvn
parents:
1796
diff
changeset
|
1321 jio_fprintf(defaultStream::error_stream(), |
fe08403130db
6979458: VM crashes when -XX:ObjectAlignmentInBytes is too big
kvn
parents:
1796
diff
changeset
|
1322 "error: ObjectAlignmentInBytes=%d must not be greater then 256\n", |
fe08403130db
6979458: VM crashes when -XX:ObjectAlignmentInBytes is too big
kvn
parents:
1796
diff
changeset
|
1323 (int)ObjectAlignmentInBytes); |
fe08403130db
6979458: VM crashes when -XX:ObjectAlignmentInBytes is too big
kvn
parents:
1796
diff
changeset
|
1324 return false; |
fe08403130db
6979458: VM crashes when -XX:ObjectAlignmentInBytes is too big
kvn
parents:
1796
diff
changeset
|
1325 } |
fe08403130db
6979458: VM crashes when -XX:ObjectAlignmentInBytes is too big
kvn
parents:
1796
diff
changeset
|
1326 // In case page size is very small. |
fe08403130db
6979458: VM crashes when -XX:ObjectAlignmentInBytes is too big
kvn
parents:
1796
diff
changeset
|
1327 if ((int)ObjectAlignmentInBytes >= os::vm_page_size()) { |
fe08403130db
6979458: VM crashes when -XX:ObjectAlignmentInBytes is too big
kvn
parents:
1796
diff
changeset
|
1328 jio_fprintf(defaultStream::error_stream(), |
fe08403130db
6979458: VM crashes when -XX:ObjectAlignmentInBytes is too big
kvn
parents:
1796
diff
changeset
|
1329 "error: ObjectAlignmentInBytes=%d must be less then page size %d\n", |
fe08403130db
6979458: VM crashes when -XX:ObjectAlignmentInBytes is too big
kvn
parents:
1796
diff
changeset
|
1330 (int)ObjectAlignmentInBytes, os::vm_page_size()); |
1571
2d127394260e
6916623: Align object to 16 bytes to use Compressed Oops with java heap up to 64Gb
kvn
parents:
1506
diff
changeset
|
1331 return false; |
2d127394260e
6916623: Align object to 16 bytes to use Compressed Oops with java heap up to 64Gb
kvn
parents:
1506
diff
changeset
|
1332 } |
2d127394260e
6916623: Align object to 16 bytes to use Compressed Oops with java heap up to 64Gb
kvn
parents:
1506
diff
changeset
|
1333 return true; |
2d127394260e
6916623: Align object to 16 bytes to use Compressed Oops with java heap up to 64Gb
kvn
parents:
1506
diff
changeset
|
1334 } |
2d127394260e
6916623: Align object to 16 bytes to use Compressed Oops with java heap up to 64Gb
kvn
parents:
1506
diff
changeset
|
1335 |
135
b7268662a986
6689523: max heap calculation for compressed oops is off by MaxPermSize
coleenp
parents:
113
diff
changeset
|
1336 inline uintx max_heap_for_compressed_oops() { |
1795
a8b66e00933b
6984368: Large default heap size does not allow to use zero based compressed oops
kvn
parents:
1783
diff
changeset
|
1337 // Heap should be above HeapBaseMinAddress to get zero based compressed oops. |
a8b66e00933b
6984368: Large default heap size does not allow to use zero based compressed oops
kvn
parents:
1783
diff
changeset
|
1338 LP64_ONLY(return OopEncodingHeapMax - MaxPermSize - os::vm_page_size() - HeapBaseMinAddress); |
1064 | 1339 NOT_LP64(ShouldNotReachHere(); return 0); |
135
b7268662a986
6689523: max heap calculation for compressed oops is off by MaxPermSize
coleenp
parents:
113
diff
changeset
|
1340 } |
b7268662a986
6689523: max heap calculation for compressed oops is off by MaxPermSize
coleenp
parents:
113
diff
changeset
|
1341 |
0 | 1342 bool Arguments::should_auto_select_low_pause_collector() { |
1343 if (UseAutoGCSelectPolicy && | |
1344 !FLAG_IS_DEFAULT(MaxGCPauseMillis) && | |
1345 (MaxGCPauseMillis <= AutoGCSelectPauseMillis)) { | |
1346 if (PrintGCDetails) { | |
1347 // Cannot use gclog_or_tty yet. | |
1348 tty->print_cr("Automatic selection of the low pause collector" | |
1349 " based on pause goal of %d (ms)", MaxGCPauseMillis); | |
1350 } | |
1351 return true; | |
1352 } | |
1353 return false; | |
1354 } | |
1355 | |
1356 void Arguments::set_ergonomics_flags() { | |
1357 // Parallel GC is not compatible with sharing. If one specifies | |
1064 | 1358 // that they want sharing explicitly, do not set ergonomics flags. |
0 | 1359 if (DumpSharedSpaces || ForceSharedSpaces) { |
1360 return; | |
1361 } | |
1362 | |
1363 if (os::is_server_class_machine() && !force_client_mode ) { | |
1364 // If no other collector is requested explicitly, | |
1365 // let the VM select the collector based on | |
1366 // machine class and automatic selection policy. | |
1367 if (!UseSerialGC && | |
1368 !UseConcMarkSweepGC && | |
342
37f87013dfd8
6711316: Open source the Garbage-First garbage collector
ysr
parents:
135
diff
changeset
|
1369 !UseG1GC && |
0 | 1370 !UseParNewGC && |
1371 !DumpSharedSpaces && | |
1372 FLAG_IS_DEFAULT(UseParallelGC)) { | |
1373 if (should_auto_select_low_pause_collector()) { | |
1374 FLAG_SET_ERGO(bool, UseConcMarkSweepGC, true); | |
1375 } else { | |
1376 FLAG_SET_ERGO(bool, UseParallelGC, true); | |
1377 } | |
1378 no_shared_spaces(); | |
1379 } | |
1380 } | |
113
ba764ed4b6f2
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
76
diff
changeset
|
1381 |
1010 | 1382 #ifndef ZERO |
113
ba764ed4b6f2
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
76
diff
changeset
|
1383 #ifdef _LP64 |
ba764ed4b6f2
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
76
diff
changeset
|
1384 // Check that UseCompressedOops can be set with the max heap size allocated |
ba764ed4b6f2
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
76
diff
changeset
|
1385 // by ergonomics. |
187 | 1386 if (MaxHeapSize <= max_heap_for_compressed_oops()) { |
1783 | 1387 #if !defined(COMPILER1) || defined(TIERED) |
932 | 1388 if (FLAG_IS_DEFAULT(UseCompressedOops) && !UseG1GC) { |
1389 FLAG_SET_ERGO(bool, UseCompressedOops, true); | |
113
ba764ed4b6f2
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
76
diff
changeset
|
1390 } |
1060 | 1391 #endif |
325
93befa083681
6741004: UseLargePages + UseCompressedOops breaks implicit null checking guard page
coleenp
parents:
276
diff
changeset
|
1392 #ifdef _WIN64 |
93befa083681
6741004: UseLargePages + UseCompressedOops breaks implicit null checking guard page
coleenp
parents:
276
diff
changeset
|
1393 if (UseLargePages && UseCompressedOops) { |
93befa083681
6741004: UseLargePages + UseCompressedOops breaks implicit null checking guard page
coleenp
parents:
276
diff
changeset
|
1394 // Cannot allocate guard pages for implicit checks in indexed addressing |
93befa083681
6741004: UseLargePages + UseCompressedOops breaks implicit null checking guard page
coleenp
parents:
276
diff
changeset
|
1395 // mode, when large pages are specified on windows. |
642
660978a2a31a
6791178: Specialize for zero as the compressed oop vm heap base
kvn
parents:
570
diff
changeset
|
1396 // This flag could be switched ON if narrow oop base address is set to 0, |
660978a2a31a
6791178: Specialize for zero as the compressed oop vm heap base
kvn
parents:
570
diff
changeset
|
1397 // see code in Universe::initialize_heap(). |
660978a2a31a
6791178: Specialize for zero as the compressed oop vm heap base
kvn
parents:
570
diff
changeset
|
1398 Universe::set_narrow_oop_use_implicit_null_checks(false); |
325
93befa083681
6741004: UseLargePages + UseCompressedOops breaks implicit null checking guard page
coleenp
parents:
276
diff
changeset
|
1399 } |
93befa083681
6741004: UseLargePages + UseCompressedOops breaks implicit null checking guard page
coleenp
parents:
276
diff
changeset
|
1400 #endif // _WIN64 |
113
ba764ed4b6f2
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
76
diff
changeset
|
1401 } else { |
ba764ed4b6f2
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
76
diff
changeset
|
1402 if (UseCompressedOops && !FLAG_IS_DEFAULT(UseCompressedOops)) { |
344 | 1403 warning("Max heap size too large for Compressed Oops"); |
113
ba764ed4b6f2
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
76
diff
changeset
|
1404 FLAG_SET_DEFAULT(UseCompressedOops, false); |
ba764ed4b6f2
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
76
diff
changeset
|
1405 } |
ba764ed4b6f2
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
76
diff
changeset
|
1406 } |
ba764ed4b6f2
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
76
diff
changeset
|
1407 // Also checks that certain machines are slower with compressed oops |
ba764ed4b6f2
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
76
diff
changeset
|
1408 // in vm_version initialization code. |
ba764ed4b6f2
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
76
diff
changeset
|
1409 #endif // _LP64 |
1010 | 1410 #endif // !ZERO |
0 | 1411 } |
1412 | |
1413 void Arguments::set_parallel_gc_flags() { | |
342
37f87013dfd8
6711316: Open source the Garbage-First garbage collector
ysr
parents:
135
diff
changeset
|
1414 assert(UseParallelGC || UseParallelOldGC, "Error"); |
0 | 1415 // If parallel old was requested, automatically enable parallel scavenge. |
1416 if (UseParallelOldGC && !UseParallelGC && FLAG_IS_DEFAULT(UseParallelGC)) { | |
1417 FLAG_SET_DEFAULT(UseParallelGC, true); | |
1418 } | |
1419 | |
1420 // If no heap maximum was requested explicitly, use some reasonable fraction | |
1421 // of the physical memory, up to a maximum of 1GB. | |
1422 if (UseParallelGC) { | |
10
28372612af5e
6362677: Change parallel GC collector default number of parallel GC threads.
jmasa
parents:
0
diff
changeset
|
1423 FLAG_SET_ERGO(uintx, ParallelGCThreads, |
28372612af5e
6362677: Change parallel GC collector default number of parallel GC threads.
jmasa
parents:
0
diff
changeset
|
1424 Abstract_VM_Version::parallel_worker_threads()); |
28372612af5e
6362677: Change parallel GC collector default number of parallel GC threads.
jmasa
parents:
0
diff
changeset
|
1425 |
0 | 1426 // If InitialSurvivorRatio or MinSurvivorRatio were not specified, but the |
1427 // SurvivorRatio has been set, reset their default values to SurvivorRatio + | |
1428 // 2. By doing this we make SurvivorRatio also work for Parallel Scavenger. | |
1429 // See CR 6362902 for details. | |
1430 if (!FLAG_IS_DEFAULT(SurvivorRatio)) { | |
1431 if (FLAG_IS_DEFAULT(InitialSurvivorRatio)) { | |
1432 FLAG_SET_DEFAULT(InitialSurvivorRatio, SurvivorRatio + 2); | |
1433 } | |
1434 if (FLAG_IS_DEFAULT(MinSurvivorRatio)) { | |
1435 FLAG_SET_DEFAULT(MinSurvivorRatio, SurvivorRatio + 2); | |
1436 } | |
1437 } | |
1438 | |
1439 if (UseParallelOldGC) { | |
1440 // Par compact uses lower default values since they are treated as | |
13
183f41cf8bfe
6557851: CMS: ergonomics defaults are not set with FLAG_SET_ERGO
jmasa
parents:
10
diff
changeset
|
1441 // minimums. These are different defaults because of the different |
183f41cf8bfe
6557851: CMS: ergonomics defaults are not set with FLAG_SET_ERGO
jmasa
parents:
10
diff
changeset
|
1442 // interpretation and are not ergonomically set. |
0 | 1443 if (FLAG_IS_DEFAULT(MarkSweepDeadRatio)) { |
13
183f41cf8bfe
6557851: CMS: ergonomics defaults are not set with FLAG_SET_ERGO
jmasa
parents:
10
diff
changeset
|
1444 FLAG_SET_DEFAULT(MarkSweepDeadRatio, 1); |
0 | 1445 } |
1446 if (FLAG_IS_DEFAULT(PermMarkSweepDeadRatio)) { | |
13
183f41cf8bfe
6557851: CMS: ergonomics defaults are not set with FLAG_SET_ERGO
jmasa
parents:
10
diff
changeset
|
1447 FLAG_SET_DEFAULT(PermMarkSweepDeadRatio, 5); |
0 | 1448 } |
1449 } | |
1450 } | |
1451 } | |
1452 | |
342
37f87013dfd8
6711316: Open source the Garbage-First garbage collector
ysr
parents:
135
diff
changeset
|
1453 void Arguments::set_g1_gc_flags() { |
37f87013dfd8
6711316: Open source the Garbage-First garbage collector
ysr
parents:
135
diff
changeset
|
1454 assert(UseG1GC, "Error"); |
37f87013dfd8
6711316: Open source the Garbage-First garbage collector
ysr
parents:
135
diff
changeset
|
1455 #ifdef COMPILER1 |
37f87013dfd8
6711316: Open source the Garbage-First garbage collector
ysr
parents:
135
diff
changeset
|
1456 FastTLABRefill = false; |
37f87013dfd8
6711316: Open source the Garbage-First garbage collector
ysr
parents:
135
diff
changeset
|
1457 #endif |
37f87013dfd8
6711316: Open source the Garbage-First garbage collector
ysr
parents:
135
diff
changeset
|
1458 FLAG_SET_DEFAULT(ParallelGCThreads, |
37f87013dfd8
6711316: Open source the Garbage-First garbage collector
ysr
parents:
135
diff
changeset
|
1459 Abstract_VM_Version::parallel_worker_threads()); |
37f87013dfd8
6711316: Open source the Garbage-First garbage collector
ysr
parents:
135
diff
changeset
|
1460 if (ParallelGCThreads == 0) { |
37f87013dfd8
6711316: Open source the Garbage-First garbage collector
ysr
parents:
135
diff
changeset
|
1461 FLAG_SET_DEFAULT(ParallelGCThreads, |
751 | 1462 Abstract_VM_Version::parallel_worker_threads()); |
342
37f87013dfd8
6711316: Open source the Garbage-First garbage collector
ysr
parents:
135
diff
changeset
|
1463 } |
37f87013dfd8
6711316: Open source the Garbage-First garbage collector
ysr
parents:
135
diff
changeset
|
1464 no_shared_spaces(); |
751 | 1465 |
1284 | 1466 if (FLAG_IS_DEFAULT(MarkStackSize)) { |
1311
2a1472c30599
4396719: Mark Sweep stack overflow on deeply nested Object arrays
jcoomes
parents:
1284
diff
changeset
|
1467 FLAG_SET_DEFAULT(MarkStackSize, 128 * TASKQUEUE_SIZE); |
1284 | 1468 } |
1469 if (PrintGCDetails && Verbose) { | |
1470 tty->print_cr("MarkStackSize: %uk MarkStackSizeMax: %uk", | |
1471 MarkStackSize / K, MarkStackSizeMax / K); | |
1472 tty->print_cr("ConcGCThreads: %u", ConcGCThreads); | |
1473 } | |
1356 | 1474 |
1475 if (FLAG_IS_DEFAULT(GCTimeRatio) || GCTimeRatio == 0) { | |
1476 // In G1, we want the default GC overhead goal to be higher than | |
1477 // say in PS. So we set it here to 10%. Otherwise the heap might | |
1478 // be expanded more aggressively than we would like it to. In | |
1479 // fact, even 10% seems to not be high enough in some cases | |
1480 // (especially small GC stress tests that the main thing they do | |
1481 // is allocation). We might consider increase it further. | |
1482 FLAG_SET_DEFAULT(GCTimeRatio, 9); | |
1483 } | |
342
37f87013dfd8
6711316: Open source the Garbage-First garbage collector
ysr
parents:
135
diff
changeset
|
1484 } |
37f87013dfd8
6711316: Open source the Garbage-First garbage collector
ysr
parents:
135
diff
changeset
|
1485 |
1064 | 1486 void Arguments::set_heap_size() { |
1487 if (!FLAG_IS_DEFAULT(DefaultMaxRAMFraction)) { | |
1488 // Deprecated flag | |
1489 FLAG_SET_CMDLINE(uintx, MaxRAMFraction, DefaultMaxRAMFraction); | |
1490 } | |
1491 | |
1492 const julong phys_mem = | |
1493 FLAG_IS_DEFAULT(MaxRAM) ? MIN2(os::physical_memory(), (julong)MaxRAM) | |
1494 : (julong)MaxRAM; | |
1495 | |
1496 // If the maximum heap size has not been set with -Xmx, | |
1497 // then set it as fraction of the size of physical memory, | |
1498 // respecting the maximum and minimum sizes of the heap. | |
342
37f87013dfd8
6711316: Open source the Garbage-First garbage collector
ysr
parents:
135
diff
changeset
|
1499 if (FLAG_IS_DEFAULT(MaxHeapSize)) { |
1064 | 1500 julong reasonable_max = phys_mem / MaxRAMFraction; |
1501 | |
1502 if (phys_mem <= MaxHeapSize * MinRAMFraction) { | |
1503 // Small physical memory, so use a minimum fraction of it for the heap | |
1504 reasonable_max = phys_mem / MinRAMFraction; | |
1505 } else { | |
1506 // Not-small physical memory, so require a heap at least | |
1507 // as large as MaxHeapSize | |
1508 reasonable_max = MAX2(reasonable_max, (julong)MaxHeapSize); | |
1509 } | |
1510 if (!FLAG_IS_DEFAULT(ErgoHeapSizeLimit) && ErgoHeapSizeLimit != 0) { | |
1511 // Limit the heap size to ErgoHeapSizeLimit | |
1512 reasonable_max = MIN2(reasonable_max, (julong)ErgoHeapSizeLimit); | |
342
37f87013dfd8
6711316: Open source the Garbage-First garbage collector
ysr
parents:
135
diff
changeset
|
1513 } |
1064 | 1514 if (UseCompressedOops) { |
1515 // Limit the heap size to the maximum possible when using compressed oops | |
1516 reasonable_max = MIN2(reasonable_max, (julong)max_heap_for_compressed_oops()); | |
1517 } | |
1518 reasonable_max = os::allocatable_physical_memory(reasonable_max); | |
1519 | |
1520 if (!FLAG_IS_DEFAULT(InitialHeapSize)) { | |
1521 // An initial heap size was specified on the command line, | |
1522 // so be sure that the maximum size is consistent. Done | |
1523 // after call to allocatable_physical_memory because that | |
1524 // method might reduce the allocation size. | |
1525 reasonable_max = MAX2(reasonable_max, (julong)InitialHeapSize); | |
1526 } | |
1527 | |
342
37f87013dfd8
6711316: Open source the Garbage-First garbage collector
ysr
parents:
135
diff
changeset
|
1528 if (PrintGCDetails && Verbose) { |
37f87013dfd8
6711316: Open source the Garbage-First garbage collector
ysr
parents:
135
diff
changeset
|
1529 // Cannot use gclog_or_tty yet. |
1064 | 1530 tty->print_cr(" Maximum heap size " SIZE_FORMAT, reasonable_max); |
342
37f87013dfd8
6711316: Open source the Garbage-First garbage collector
ysr
parents:
135
diff
changeset
|
1531 } |
1064 | 1532 FLAG_SET_ERGO(uintx, MaxHeapSize, (uintx)reasonable_max); |
1533 } | |
1534 | |
1535 // If the initial_heap_size has not been set with InitialHeapSize | |
1536 // or -Xms, then set it as fraction of the size of physical memory, | |
1537 // respecting the maximum and minimum sizes of the heap. | |
1538 if (FLAG_IS_DEFAULT(InitialHeapSize)) { | |
1074
84cb6f20afb3
6900899: vm fails to start when -Xmx value is less than OldSize + NewSize
phh
parents:
1069
diff
changeset
|
1539 julong reasonable_minimum = (julong)(OldSize + NewSize); |
84cb6f20afb3
6900899: vm fails to start when -Xmx value is less than OldSize + NewSize
phh
parents:
1069
diff
changeset
|
1540 |
84cb6f20afb3
6900899: vm fails to start when -Xmx value is less than OldSize + NewSize
phh
parents:
1069
diff
changeset
|
1541 reasonable_minimum = MIN2(reasonable_minimum, (julong)MaxHeapSize); |
84cb6f20afb3
6900899: vm fails to start when -Xmx value is less than OldSize + NewSize
phh
parents:
1069
diff
changeset
|
1542 |
84cb6f20afb3
6900899: vm fails to start when -Xmx value is less than OldSize + NewSize
phh
parents:
1069
diff
changeset
|
1543 reasonable_minimum = os::allocatable_physical_memory(reasonable_minimum); |
84cb6f20afb3
6900899: vm fails to start when -Xmx value is less than OldSize + NewSize
phh
parents:
1069
diff
changeset
|
1544 |
1064 | 1545 julong reasonable_initial = phys_mem / InitialRAMFraction; |
1546 | |
1074
84cb6f20afb3
6900899: vm fails to start when -Xmx value is less than OldSize + NewSize
phh
parents:
1069
diff
changeset
|
1547 reasonable_initial = MAX2(reasonable_initial, reasonable_minimum); |
1064 | 1548 reasonable_initial = MIN2(reasonable_initial, (julong)MaxHeapSize); |
1549 | |
1550 reasonable_initial = os::allocatable_physical_memory(reasonable_initial); | |
1551 | |
1552 if (PrintGCDetails && Verbose) { | |
1553 // Cannot use gclog_or_tty yet. | |
1554 tty->print_cr(" Initial heap size " SIZE_FORMAT, (uintx)reasonable_initial); | |
1074
84cb6f20afb3
6900899: vm fails to start when -Xmx value is less than OldSize + NewSize
phh
parents:
1069
diff
changeset
|
1555 tty->print_cr(" Minimum heap size " SIZE_FORMAT, (uintx)reasonable_minimum); |
342
37f87013dfd8
6711316: Open source the Garbage-First garbage collector
ysr
parents:
135
diff
changeset
|
1556 } |
1064 | 1557 FLAG_SET_ERGO(uintx, InitialHeapSize, (uintx)reasonable_initial); |
1074
84cb6f20afb3
6900899: vm fails to start when -Xmx value is less than OldSize + NewSize
phh
parents:
1069
diff
changeset
|
1558 set_min_heap_size((uintx)reasonable_minimum); |
342
37f87013dfd8
6711316: Open source the Garbage-First garbage collector
ysr
parents:
135
diff
changeset
|
1559 } |
37f87013dfd8
6711316: Open source the Garbage-First garbage collector
ysr
parents:
135
diff
changeset
|
1560 } |
37f87013dfd8
6711316: Open source the Garbage-First garbage collector
ysr
parents:
135
diff
changeset
|
1561 |
0 | 1562 // This must be called after ergonomics because we want bytecode rewriting |
1563 // if the server compiler is used, or if UseSharedSpaces is disabled. | |
1564 void Arguments::set_bytecode_flags() { | |
1565 // Better not attempt to store into a read-only space. | |
1566 if (UseSharedSpaces) { | |
1567 FLAG_SET_DEFAULT(RewriteBytecodes, false); | |
1568 FLAG_SET_DEFAULT(RewriteFrequentPairs, false); | |
1569 } | |
1570 | |
1571 if (!RewriteBytecodes) { | |
1572 FLAG_SET_DEFAULT(RewriteFrequentPairs, false); | |
1573 } | |
1574 } | |
1575 | |
1576 // Aggressive optimization flags -XX:+AggressiveOpts | |
1577 void Arguments::set_aggressive_opts_flags() { | |
17
ff5961f4c095
6395208: Elide autoboxing for calls to HashMap.get(int) and HashMap.get(long)
never
parents:
0
diff
changeset
|
1578 #ifdef COMPILER2 |
ff5961f4c095
6395208: Elide autoboxing for calls to HashMap.get(int) and HashMap.get(long)
never
parents:
0
diff
changeset
|
1579 if (AggressiveOpts || !FLAG_IS_DEFAULT(AutoBoxCacheMax)) { |
ff5961f4c095
6395208: Elide autoboxing for calls to HashMap.get(int) and HashMap.get(long)
never
parents:
0
diff
changeset
|
1580 if (FLAG_IS_DEFAULT(EliminateAutoBox)) { |
ff5961f4c095
6395208: Elide autoboxing for calls to HashMap.get(int) and HashMap.get(long)
never
parents:
0
diff
changeset
|
1581 FLAG_SET_DEFAULT(EliminateAutoBox, true); |
ff5961f4c095
6395208: Elide autoboxing for calls to HashMap.get(int) and HashMap.get(long)
never
parents:
0
diff
changeset
|
1582 } |
ff5961f4c095
6395208: Elide autoboxing for calls to HashMap.get(int) and HashMap.get(long)
never
parents:
0
diff
changeset
|
1583 if (FLAG_IS_DEFAULT(AutoBoxCacheMax)) { |
ff5961f4c095
6395208: Elide autoboxing for calls to HashMap.get(int) and HashMap.get(long)
never
parents:
0
diff
changeset
|
1584 FLAG_SET_DEFAULT(AutoBoxCacheMax, 20000); |
ff5961f4c095
6395208: Elide autoboxing for calls to HashMap.get(int) and HashMap.get(long)
never
parents:
0
diff
changeset
|
1585 } |
ff5961f4c095
6395208: Elide autoboxing for calls to HashMap.get(int) and HashMap.get(long)
never
parents:
0
diff
changeset
|
1586 |
ff5961f4c095
6395208: Elide autoboxing for calls to HashMap.get(int) and HashMap.get(long)
never
parents:
0
diff
changeset
|
1587 // Feed the cache size setting into the JDK |
ff5961f4c095
6395208: Elide autoboxing for calls to HashMap.get(int) and HashMap.get(long)
never
parents:
0
diff
changeset
|
1588 char buffer[1024]; |
513
2328d1d3f8cf
6781583: Hotspot build fails on linux 64 bit platform with gcc 4.3.2
xlu
parents:
489
diff
changeset
|
1589 sprintf(buffer, "java.lang.Integer.IntegerCache.high=" INTX_FORMAT, AutoBoxCacheMax); |
17
ff5961f4c095
6395208: Elide autoboxing for calls to HashMap.get(int) and HashMap.get(long)
never
parents:
0
diff
changeset
|
1590 add_property(buffer); |
ff5961f4c095
6395208: Elide autoboxing for calls to HashMap.get(int) and HashMap.get(long)
never
parents:
0
diff
changeset
|
1591 } |
65 | 1592 if (AggressiveOpts && FLAG_IS_DEFAULT(DoEscapeAnalysis)) { |
1593 FLAG_SET_DEFAULT(DoEscapeAnalysis, true); | |
1594 } | |
416
b6cfd754403d
6649622: HotSpot Biased locking needs tuning on latest CPUs
never
parents:
363
diff
changeset
|
1595 if (AggressiveOpts && FLAG_IS_DEFAULT(BiasedLockingStartupDelay)) { |
b6cfd754403d
6649622: HotSpot Biased locking needs tuning on latest CPUs
never
parents:
363
diff
changeset
|
1596 FLAG_SET_DEFAULT(BiasedLockingStartupDelay, 500); |
b6cfd754403d
6649622: HotSpot Biased locking needs tuning on latest CPUs
never
parents:
363
diff
changeset
|
1597 } |
1622 | 1598 if (AggressiveOpts && FLAG_IS_DEFAULT(OptimizeStringConcat)) { |
1599 FLAG_SET_DEFAULT(OptimizeStringConcat, true); | |
1600 } | |
1763 | 1601 if (AggressiveOpts && FLAG_IS_DEFAULT(OptimizeFill)) { |
1602 FLAG_SET_DEFAULT(OptimizeFill, true); | |
1603 } | |
17
ff5961f4c095
6395208: Elide autoboxing for calls to HashMap.get(int) and HashMap.get(long)
never
parents:
0
diff
changeset
|
1604 #endif |
ff5961f4c095
6395208: Elide autoboxing for calls to HashMap.get(int) and HashMap.get(long)
never
parents:
0
diff
changeset
|
1605 |
0 | 1606 if (AggressiveOpts) { |
61 | 1607 // Sample flag setting code |
1608 // if (FLAG_IS_DEFAULT(EliminateZeroing)) { | |
1609 // FLAG_SET_DEFAULT(EliminateZeroing, true); | |
1610 // } | |
0 | 1611 } |
1612 } | |
1613 | |
1614 //=========================================================================================================== | |
1615 // Parsing of java.compiler property | |
1616 | |
1617 void Arguments::process_java_compiler_argument(char* arg) { | |
1618 // For backwards compatibility, Djava.compiler=NONE or "" | |
1619 // causes us to switch to -Xint mode UNLESS -Xdebug | |
1620 // is also specified. | |
1621 if (strlen(arg) == 0 || strcasecmp(arg, "NONE") == 0) { | |
1622 set_java_compiler(true); // "-Djava.compiler[=...]" most recently seen. | |
1623 } | |
1624 } | |
1625 | |
1626 void Arguments::process_java_launcher_argument(const char* launcher, void* extra_info) { | |
1627 _sun_java_launcher = strdup(launcher); | |
1628 } | |
1629 | |
1630 bool Arguments::created_by_java_launcher() { | |
1631 assert(_sun_java_launcher != NULL, "property must have value"); | |
1632 return strcmp(DEFAULT_JAVA_LAUNCHER, _sun_java_launcher) != 0; | |
1633 } | |
1634 | |
1635 //=========================================================================================================== | |
1636 // Parsing of main arguments | |
1637 | |
1244
745c853ee57f
6885297: java -XX:RefDiscoveryPolicy=2 or -XX:TLABWasteTargetPercent=0 cause VM crash
johnc
parents:
1188
diff
changeset
|
1638 bool Arguments::verify_interval(uintx val, uintx min, |
745c853ee57f
6885297: java -XX:RefDiscoveryPolicy=2 or -XX:TLABWasteTargetPercent=0 cause VM crash
johnc
parents:
1188
diff
changeset
|
1639 uintx max, const char* name) { |
745c853ee57f
6885297: java -XX:RefDiscoveryPolicy=2 or -XX:TLABWasteTargetPercent=0 cause VM crash
johnc
parents:
1188
diff
changeset
|
1640 // Returns true iff value is in the inclusive interval [min..max] |
745c853ee57f
6885297: java -XX:RefDiscoveryPolicy=2 or -XX:TLABWasteTargetPercent=0 cause VM crash
johnc
parents:
1188
diff
changeset
|
1641 // false, otherwise. |
745c853ee57f
6885297: java -XX:RefDiscoveryPolicy=2 or -XX:TLABWasteTargetPercent=0 cause VM crash
johnc
parents:
1188
diff
changeset
|
1642 if (val >= min && val <= max) { |
745c853ee57f
6885297: java -XX:RefDiscoveryPolicy=2 or -XX:TLABWasteTargetPercent=0 cause VM crash
johnc
parents:
1188
diff
changeset
|
1643 return true; |
745c853ee57f
6885297: java -XX:RefDiscoveryPolicy=2 or -XX:TLABWasteTargetPercent=0 cause VM crash
johnc
parents:
1188
diff
changeset
|
1644 } |
745c853ee57f
6885297: java -XX:RefDiscoveryPolicy=2 or -XX:TLABWasteTargetPercent=0 cause VM crash
johnc
parents:
1188
diff
changeset
|
1645 jio_fprintf(defaultStream::error_stream(), |
745c853ee57f
6885297: java -XX:RefDiscoveryPolicy=2 or -XX:TLABWasteTargetPercent=0 cause VM crash
johnc
parents:
1188
diff
changeset
|
1646 "%s of " UINTX_FORMAT " is invalid; must be between " UINTX_FORMAT |
745c853ee57f
6885297: java -XX:RefDiscoveryPolicy=2 or -XX:TLABWasteTargetPercent=0 cause VM crash
johnc
parents:
1188
diff
changeset
|
1647 " and " UINTX_FORMAT "\n", |
745c853ee57f
6885297: java -XX:RefDiscoveryPolicy=2 or -XX:TLABWasteTargetPercent=0 cause VM crash
johnc
parents:
1188
diff
changeset
|
1648 name, val, min, max); |
745c853ee57f
6885297: java -XX:RefDiscoveryPolicy=2 or -XX:TLABWasteTargetPercent=0 cause VM crash
johnc
parents:
1188
diff
changeset
|
1649 return false; |
745c853ee57f
6885297: java -XX:RefDiscoveryPolicy=2 or -XX:TLABWasteTargetPercent=0 cause VM crash
johnc
parents:
1188
diff
changeset
|
1650 } |
745c853ee57f
6885297: java -XX:RefDiscoveryPolicy=2 or -XX:TLABWasteTargetPercent=0 cause VM crash
johnc
parents:
1188
diff
changeset
|
1651 |
1744
f8c5d1bdaad4
6885308: The incorrect -XX:StackRedPages, -XX:StackShadowPages, -XX:StackYellowPages could cause VM crash
ptisnovs
parents:
1681
diff
changeset
|
1652 bool Arguments::verify_min_value(intx val, intx min, const char* name) { |
f8c5d1bdaad4
6885308: The incorrect -XX:StackRedPages, -XX:StackShadowPages, -XX:StackYellowPages could cause VM crash
ptisnovs
parents:
1681
diff
changeset
|
1653 // Returns true if given value is greater than specified min threshold |
f8c5d1bdaad4
6885308: The incorrect -XX:StackRedPages, -XX:StackShadowPages, -XX:StackYellowPages could cause VM crash
ptisnovs
parents:
1681
diff
changeset
|
1654 // false, otherwise. |
f8c5d1bdaad4
6885308: The incorrect -XX:StackRedPages, -XX:StackShadowPages, -XX:StackYellowPages could cause VM crash
ptisnovs
parents:
1681
diff
changeset
|
1655 if (val >= min ) { |
f8c5d1bdaad4
6885308: The incorrect -XX:StackRedPages, -XX:StackShadowPages, -XX:StackYellowPages could cause VM crash
ptisnovs
parents:
1681
diff
changeset
|
1656 return true; |
f8c5d1bdaad4
6885308: The incorrect -XX:StackRedPages, -XX:StackShadowPages, -XX:StackYellowPages could cause VM crash
ptisnovs
parents:
1681
diff
changeset
|
1657 } |
f8c5d1bdaad4
6885308: The incorrect -XX:StackRedPages, -XX:StackShadowPages, -XX:StackYellowPages could cause VM crash
ptisnovs
parents:
1681
diff
changeset
|
1658 jio_fprintf(defaultStream::error_stream(), |
f8c5d1bdaad4
6885308: The incorrect -XX:StackRedPages, -XX:StackShadowPages, -XX:StackYellowPages could cause VM crash
ptisnovs
parents:
1681
diff
changeset
|
1659 "%s of " INTX_FORMAT " is invalid; must be greater than " INTX_FORMAT "\n", |
f8c5d1bdaad4
6885308: The incorrect -XX:StackRedPages, -XX:StackShadowPages, -XX:StackYellowPages could cause VM crash
ptisnovs
parents:
1681
diff
changeset
|
1660 name, val, min); |
f8c5d1bdaad4
6885308: The incorrect -XX:StackRedPages, -XX:StackShadowPages, -XX:StackYellowPages could cause VM crash
ptisnovs
parents:
1681
diff
changeset
|
1661 return false; |
f8c5d1bdaad4
6885308: The incorrect -XX:StackRedPages, -XX:StackShadowPages, -XX:StackYellowPages could cause VM crash
ptisnovs
parents:
1681
diff
changeset
|
1662 } |
f8c5d1bdaad4
6885308: The incorrect -XX:StackRedPages, -XX:StackShadowPages, -XX:StackYellowPages could cause VM crash
ptisnovs
parents:
1681
diff
changeset
|
1663 |
0 | 1664 bool Arguments::verify_percentage(uintx value, const char* name) { |
1665 if (value <= 100) { | |
1666 return true; | |
1667 } | |
1668 jio_fprintf(defaultStream::error_stream(), | |
1669 "%s of " UINTX_FORMAT " is invalid; must be between 0 and 100\n", | |
1670 name, value); | |
1671 return false; | |
1672 } | |
1673 | |
1064 | 1674 static void force_serial_gc() { |
0 | 1675 FLAG_SET_DEFAULT(UseSerialGC, true); |
1676 FLAG_SET_DEFAULT(UseParNewGC, false); | |
1677 FLAG_SET_DEFAULT(UseConcMarkSweepGC, false); | |
945
68ef3fdcdb76
6872136: CMS: confusing message may be printed when a collector is switched off implicitly
ysr
parents:
932
diff
changeset
|
1678 FLAG_SET_DEFAULT(CMSIncrementalMode, false); // special CMS suboption |
0 | 1679 FLAG_SET_DEFAULT(UseParallelGC, false); |
1680 FLAG_SET_DEFAULT(UseParallelOldGC, false); | |
342
37f87013dfd8
6711316: Open source the Garbage-First garbage collector
ysr
parents:
135
diff
changeset
|
1681 FLAG_SET_DEFAULT(UseG1GC, false); |
0 | 1682 } |
1683 | |
1684 static bool verify_serial_gc_flags() { | |
1685 return (UseSerialGC && | |
945
68ef3fdcdb76
6872136: CMS: confusing message may be printed when a collector is switched off implicitly
ysr
parents:
932
diff
changeset
|
1686 !(UseParNewGC || (UseConcMarkSweepGC || CMSIncrementalMode) || UseG1GC || |
342
37f87013dfd8
6711316: Open source the Garbage-First garbage collector
ysr
parents:
135
diff
changeset
|
1687 UseParallelGC || UseParallelOldGC)); |
0 | 1688 } |
1689 | |
10
28372612af5e
6362677: Change parallel GC collector default number of parallel GC threads.
jmasa
parents:
0
diff
changeset
|
1690 // Check consistency of GC selection |
28372612af5e
6362677: Change parallel GC collector default number of parallel GC threads.
jmasa
parents:
0
diff
changeset
|
1691 bool Arguments::check_gc_consistency() { |
28372612af5e
6362677: Change parallel GC collector default number of parallel GC threads.
jmasa
parents:
0
diff
changeset
|
1692 bool status = true; |
28372612af5e
6362677: Change parallel GC collector default number of parallel GC threads.
jmasa
parents:
0
diff
changeset
|
1693 // Ensure that the user has not selected conflicting sets |
28372612af5e
6362677: Change parallel GC collector default number of parallel GC threads.
jmasa
parents:
0
diff
changeset
|
1694 // of collectors. [Note: this check is merely a user convenience; |
28372612af5e
6362677: Change parallel GC collector default number of parallel GC threads.
jmasa
parents:
0
diff
changeset
|
1695 // collectors over-ride each other so that only a non-conflicting |
28372612af5e
6362677: Change parallel GC collector default number of parallel GC threads.
jmasa
parents:
0
diff
changeset
|
1696 // set is selected; however what the user gets is not what they |
28372612af5e
6362677: Change parallel GC collector default number of parallel GC threads.
jmasa
parents:
0
diff
changeset
|
1697 // may have expected from the combination they asked for. It's |
28372612af5e
6362677: Change parallel GC collector default number of parallel GC threads.
jmasa
parents:
0
diff
changeset
|
1698 // better to reduce user confusion by not allowing them to |
28372612af5e
6362677: Change parallel GC collector default number of parallel GC threads.
jmasa
parents:
0
diff
changeset
|
1699 // select conflicting combinations. |
28372612af5e
6362677: Change parallel GC collector default number of parallel GC threads.
jmasa
parents:
0
diff
changeset
|
1700 uint i = 0; |
28372612af5e
6362677: Change parallel GC collector default number of parallel GC threads.
jmasa
parents:
0
diff
changeset
|
1701 if (UseSerialGC) i++; |
28372612af5e
6362677: Change parallel GC collector default number of parallel GC threads.
jmasa
parents:
0
diff
changeset
|
1702 if (UseConcMarkSweepGC || UseParNewGC) i++; |
28372612af5e
6362677: Change parallel GC collector default number of parallel GC threads.
jmasa
parents:
0
diff
changeset
|
1703 if (UseParallelGC || UseParallelOldGC) i++; |
845
df6caf649ff7
6700789: G1: Enable use of compressed oops with G1 heaps
ysr
parents:
751
diff
changeset
|
1704 if (UseG1GC) i++; |
10
28372612af5e
6362677: Change parallel GC collector default number of parallel GC threads.
jmasa
parents:
0
diff
changeset
|
1705 if (i > 1) { |
28372612af5e
6362677: Change parallel GC collector default number of parallel GC threads.
jmasa
parents:
0
diff
changeset
|
1706 jio_fprintf(defaultStream::error_stream(), |
28372612af5e
6362677: Change parallel GC collector default number of parallel GC threads.
jmasa
parents:
0
diff
changeset
|
1707 "Conflicting collector combinations in option list; " |
28372612af5e
6362677: Change parallel GC collector default number of parallel GC threads.
jmasa
parents:
0
diff
changeset
|
1708 "please refer to the release notes for the combinations " |
28372612af5e
6362677: Change parallel GC collector default number of parallel GC threads.
jmasa
parents:
0
diff
changeset
|
1709 "allowed\n"); |
28372612af5e
6362677: Change parallel GC collector default number of parallel GC threads.
jmasa
parents:
0
diff
changeset
|
1710 status = false; |
28372612af5e
6362677: Change parallel GC collector default number of parallel GC threads.
jmasa
parents:
0
diff
changeset
|
1711 } |
28372612af5e
6362677: Change parallel GC collector default number of parallel GC threads.
jmasa
parents:
0
diff
changeset
|
1712 |
28372612af5e
6362677: Change parallel GC collector default number of parallel GC threads.
jmasa
parents:
0
diff
changeset
|
1713 return status; |
28372612af5e
6362677: Change parallel GC collector default number of parallel GC threads.
jmasa
parents:
0
diff
changeset
|
1714 } |
28372612af5e
6362677: Change parallel GC collector default number of parallel GC threads.
jmasa
parents:
0
diff
changeset
|
1715 |
1744
f8c5d1bdaad4
6885308: The incorrect -XX:StackRedPages, -XX:StackShadowPages, -XX:StackYellowPages could cause VM crash
ptisnovs
parents:
1681
diff
changeset
|
1716 // Check stack pages settings |
f8c5d1bdaad4
6885308: The incorrect -XX:StackRedPages, -XX:StackShadowPages, -XX:StackYellowPages could cause VM crash
ptisnovs
parents:
1681
diff
changeset
|
1717 bool Arguments::check_stack_pages() |
f8c5d1bdaad4
6885308: The incorrect -XX:StackRedPages, -XX:StackShadowPages, -XX:StackYellowPages could cause VM crash
ptisnovs
parents:
1681
diff
changeset
|
1718 { |
f8c5d1bdaad4
6885308: The incorrect -XX:StackRedPages, -XX:StackShadowPages, -XX:StackYellowPages could cause VM crash
ptisnovs
parents:
1681
diff
changeset
|
1719 bool status = true; |
f8c5d1bdaad4
6885308: The incorrect -XX:StackRedPages, -XX:StackShadowPages, -XX:StackYellowPages could cause VM crash
ptisnovs
parents:
1681
diff
changeset
|
1720 status = status && verify_min_value(StackYellowPages, 1, "StackYellowPages"); |
f8c5d1bdaad4
6885308: The incorrect -XX:StackRedPages, -XX:StackShadowPages, -XX:StackYellowPages could cause VM crash
ptisnovs
parents:
1681
diff
changeset
|
1721 status = status && verify_min_value(StackRedPages, 1, "StackRedPages"); |
1867
b6aedd1acdc0
6983240: guarantee((Solaris::min_stack_allowed >= (StackYellowPages+StackRedPages...) wrong
coleenp
parents:
1864
diff
changeset
|
1722 // greater stack shadow pages can't generate instruction to bang stack |
b6aedd1acdc0
6983240: guarantee((Solaris::min_stack_allowed >= (StackYellowPages+StackRedPages...) wrong
coleenp
parents:
1864
diff
changeset
|
1723 status = status && verify_interval(StackShadowPages, 1, 50, "StackShadowPages"); |
1744
f8c5d1bdaad4
6885308: The incorrect -XX:StackRedPages, -XX:StackShadowPages, -XX:StackYellowPages could cause VM crash
ptisnovs
parents:
1681
diff
changeset
|
1724 return status; |
f8c5d1bdaad4
6885308: The incorrect -XX:StackRedPages, -XX:StackShadowPages, -XX:StackYellowPages could cause VM crash
ptisnovs
parents:
1681
diff
changeset
|
1725 } |
f8c5d1bdaad4
6885308: The incorrect -XX:StackRedPages, -XX:StackShadowPages, -XX:StackYellowPages could cause VM crash
ptisnovs
parents:
1681
diff
changeset
|
1726 |
0 | 1727 // Check the consistency of vm_init_args |
1728 bool Arguments::check_vm_args_consistency() { | |
1729 // Method for adding checks for flag consistency. | |
1730 // The intent is to warn the user of all possible conflicts, | |
1731 // before returning an error. | |
1732 // Note: Needs platform-dependent factoring. | |
1733 bool status = true; | |
1734 | |
1735 #if ( (defined(COMPILER2) && defined(SPARC))) | |
1736 // NOTE: The call to VM_Version_init depends on the fact that VM_Version_init | |
1737 // on sparc doesn't require generation of a stub as is the case on, e.g., | |
1738 // x86. Normally, VM_Version_init must be called from init_globals in | |
1739 // init.cpp, which is called by the initial java thread *after* arguments | |
1740 // have been parsed. VM_Version_init gets called twice on sparc. | |
1741 extern void VM_Version_init(); | |
1742 VM_Version_init(); | |
1743 if (!VM_Version::has_v9()) { | |
1744 jio_fprintf(defaultStream::error_stream(), | |
1745 "V8 Machine detected, Server requires V9\n"); | |
1746 status = false; | |
1747 } | |
1748 #endif /* COMPILER2 && SPARC */ | |
1749 | |
1750 // Allow both -XX:-UseStackBanging and -XX:-UseBoundThreads in non-product | |
1751 // builds so the cost of stack banging can be measured. | |
1752 #if (defined(PRODUCT) && defined(SOLARIS)) | |
1753 if (!UseBoundThreads && !UseStackBanging) { | |
1754 jio_fprintf(defaultStream::error_stream(), | |
1755 "-UseStackBanging conflicts with -UseBoundThreads\n"); | |
1756 | |
1757 status = false; | |
1758 } | |
1759 #endif | |
1760 | |
1761 if (TLABRefillWasteFraction == 0) { | |
1762 jio_fprintf(defaultStream::error_stream(), | |
1763 "TLABRefillWasteFraction should be a denominator, " | |
1764 "not " SIZE_FORMAT "\n", | |
1765 TLABRefillWasteFraction); | |
1766 status = false; | |
1767 } | |
1768 | |
10
28372612af5e
6362677: Change parallel GC collector default number of parallel GC threads.
jmasa
parents:
0
diff
changeset
|
1769 status = status && verify_percentage(AdaptiveSizePolicyWeight, |
0 | 1770 "AdaptiveSizePolicyWeight"); |
10
28372612af5e
6362677: Change parallel GC collector default number of parallel GC threads.
jmasa
parents:
0
diff
changeset
|
1771 status = status && verify_percentage(AdaptivePermSizeWeight, "AdaptivePermSizeWeight"); |
28372612af5e
6362677: Change parallel GC collector default number of parallel GC threads.
jmasa
parents:
0
diff
changeset
|
1772 status = status && verify_percentage(ThresholdTolerance, "ThresholdTolerance"); |
28372612af5e
6362677: Change parallel GC collector default number of parallel GC threads.
jmasa
parents:
0
diff
changeset
|
1773 status = status && verify_percentage(MinHeapFreeRatio, "MinHeapFreeRatio"); |
28372612af5e
6362677: Change parallel GC collector default number of parallel GC threads.
jmasa
parents:
0
diff
changeset
|
1774 status = status && verify_percentage(MaxHeapFreeRatio, "MaxHeapFreeRatio"); |
0 | 1775 |
1776 if (MinHeapFreeRatio > MaxHeapFreeRatio) { | |
1777 jio_fprintf(defaultStream::error_stream(), | |
1778 "MinHeapFreeRatio (" UINTX_FORMAT ") must be less than or " | |
1779 "equal to MaxHeapFreeRatio (" UINTX_FORMAT ")\n", | |
1780 MinHeapFreeRatio, MaxHeapFreeRatio); | |
1781 status = false; | |
1782 } | |
1783 // Keeping the heap 100% free is hard ;-) so limit it to 99%. | |
1784 MinHeapFreeRatio = MIN2(MinHeapFreeRatio, (uintx) 99); | |
1785 | |
1786 if (FullGCALot && FLAG_IS_DEFAULT(MarkSweepAlwaysCompactCount)) { | |
1787 MarkSweepAlwaysCompactCount = 1; // Move objects every gc. | |
1788 } | |
1789 | |
483
0f773163217d
6765954: par compact - stress mode for splitting young gen spaces
jcoomes
parents:
449
diff
changeset
|
1790 if (UseParallelOldGC && ParallelOldGCSplitALot) { |
0f773163217d
6765954: par compact - stress mode for splitting young gen spaces
jcoomes
parents:
449
diff
changeset
|
1791 // Settings to encourage splitting. |
0f773163217d
6765954: par compact - stress mode for splitting young gen spaces
jcoomes
parents:
449
diff
changeset
|
1792 if (!FLAG_IS_CMDLINE(NewRatio)) { |
0f773163217d
6765954: par compact - stress mode for splitting young gen spaces
jcoomes
parents:
449
diff
changeset
|
1793 FLAG_SET_CMDLINE(intx, NewRatio, 2); |
0f773163217d
6765954: par compact - stress mode for splitting young gen spaces
jcoomes
parents:
449
diff
changeset
|
1794 } |
0f773163217d
6765954: par compact - stress mode for splitting young gen spaces
jcoomes
parents:
449
diff
changeset
|
1795 if (!FLAG_IS_CMDLINE(ScavengeBeforeFullGC)) { |
0f773163217d
6765954: par compact - stress mode for splitting young gen spaces
jcoomes
parents:
449
diff
changeset
|
1796 FLAG_SET_CMDLINE(bool, ScavengeBeforeFullGC, false); |
0f773163217d
6765954: par compact - stress mode for splitting young gen spaces
jcoomes
parents:
449
diff
changeset
|
1797 } |
0f773163217d
6765954: par compact - stress mode for splitting young gen spaces
jcoomes
parents:
449
diff
changeset
|
1798 } |
0f773163217d
6765954: par compact - stress mode for splitting young gen spaces
jcoomes
parents:
449
diff
changeset
|
1799 |
10
28372612af5e
6362677: Change parallel GC collector default number of parallel GC threads.
jmasa
parents:
0
diff
changeset
|
1800 status = status && verify_percentage(GCHeapFreeLimit, "GCHeapFreeLimit"); |
28372612af5e
6362677: Change parallel GC collector default number of parallel GC threads.
jmasa
parents:
0
diff
changeset
|
1801 status = status && verify_percentage(GCTimeLimit, "GCTimeLimit"); |
0 | 1802 if (GCTimeLimit == 100) { |
1803 // Turn off gc-overhead-limit-exceeded checks | |
1804 FLAG_SET_DEFAULT(UseGCOverheadLimit, false); | |
1805 } | |
1806 | |
10
28372612af5e
6362677: Change parallel GC collector default number of parallel GC threads.
jmasa
parents:
0
diff
changeset
|
1807 status = status && verify_percentage(GCHeapFreeLimit, "GCHeapFreeLimit"); |
0 | 1808 |
1626
1a11430e0326
6888573: class data sharing does not always disable large pages
jcoomes
parents:
1579
diff
changeset
|
1809 // Check whether user-specified sharing option conflicts with GC or page size. |
1a11430e0326
6888573: class data sharing does not always disable large pages
jcoomes
parents:
1579
diff
changeset
|
1810 // Both sharing and large pages are enabled by default on some platforms; |
1a11430e0326
6888573: class data sharing does not always disable large pages
jcoomes
parents:
1579
diff
changeset
|
1811 // large pages override sharing only if explicitly set on the command line. |
1a11430e0326
6888573: class data sharing does not always disable large pages
jcoomes
parents:
1579
diff
changeset
|
1812 const bool cannot_share = UseConcMarkSweepGC || CMSIncrementalMode || |
1a11430e0326
6888573: class data sharing does not always disable large pages
jcoomes
parents:
1579
diff
changeset
|
1813 UseG1GC || UseParNewGC || UseParallelGC || UseParallelOldGC || |
1a11430e0326
6888573: class data sharing does not always disable large pages
jcoomes
parents:
1579
diff
changeset
|
1814 UseLargePages && FLAG_IS_CMDLINE(UseLargePages); |
0 | 1815 if (cannot_share) { |
1816 // Either force sharing on by forcing the other options off, or | |
1817 // force sharing off. | |
1818 if (DumpSharedSpaces || ForceSharedSpaces) { | |
945
68ef3fdcdb76
6872136: CMS: confusing message may be printed when a collector is switched off implicitly
ysr
parents:
932
diff
changeset
|
1819 jio_fprintf(defaultStream::error_stream(), |
1626
1a11430e0326
6888573: class data sharing does not always disable large pages
jcoomes
parents:
1579
diff
changeset
|
1820 "Using Serial GC and default page size because of %s\n", |
1a11430e0326
6888573: class data sharing does not always disable large pages
jcoomes
parents:
1579
diff
changeset
|
1821 ForceSharedSpaces ? "-Xshare:on" : "-Xshare:dump"); |
1064 | 1822 force_serial_gc(); |
1626
1a11430e0326
6888573: class data sharing does not always disable large pages
jcoomes
parents:
1579
diff
changeset
|
1823 FLAG_SET_DEFAULT(UseLargePages, false); |
0 | 1824 } else { |
1064 | 1825 if (UseSharedSpaces && Verbose) { |
945
68ef3fdcdb76
6872136: CMS: confusing message may be printed when a collector is switched off implicitly
ysr
parents:
932
diff
changeset
|
1826 jio_fprintf(defaultStream::error_stream(), |
68ef3fdcdb76
6872136: CMS: confusing message may be printed when a collector is switched off implicitly
ysr
parents:
932
diff
changeset
|
1827 "Turning off use of shared archive because of " |
1064 | 1828 "choice of garbage collector or large pages\n"); |
945
68ef3fdcdb76
6872136: CMS: confusing message may be printed when a collector is switched off implicitly
ysr
parents:
932
diff
changeset
|
1829 } |
0 | 1830 no_shared_spaces(); |
1831 } | |
1626
1a11430e0326
6888573: class data sharing does not always disable large pages
jcoomes
parents:
1579
diff
changeset
|
1832 } else if (UseLargePages && (UseSharedSpaces || DumpSharedSpaces)) { |
1a11430e0326
6888573: class data sharing does not always disable large pages
jcoomes
parents:
1579
diff
changeset
|
1833 FLAG_SET_DEFAULT(UseLargePages, false); |
0 | 1834 } |
1835 | |
10
28372612af5e
6362677: Change parallel GC collector default number of parallel GC threads.
jmasa
parents:
0
diff
changeset
|
1836 status = status && check_gc_consistency(); |
1744
f8c5d1bdaad4
6885308: The incorrect -XX:StackRedPages, -XX:StackShadowPages, -XX:StackYellowPages could cause VM crash
ptisnovs
parents:
1681
diff
changeset
|
1837 status = status && check_stack_pages(); |
0 | 1838 |
1839 if (_has_alloc_profile) { | |
1840 if (UseParallelGC || UseParallelOldGC) { | |
1841 jio_fprintf(defaultStream::error_stream(), | |
1842 "error: invalid argument combination.\n" | |
1843 "Allocation profiling (-Xaprof) cannot be used together with " | |
1844 "Parallel GC (-XX:+UseParallelGC or -XX:+UseParallelOldGC).\n"); | |
1845 status = false; | |
1846 } | |
1847 if (UseConcMarkSweepGC) { | |
1848 jio_fprintf(defaultStream::error_stream(), | |
1849 "error: invalid argument combination.\n" | |
1850 "Allocation profiling (-Xaprof) cannot be used together with " | |
1851 "the CMS collector (-XX:+UseConcMarkSweepGC).\n"); | |
1852 status = false; | |
1853 } | |
1854 } | |
1855 | |
1856 if (CMSIncrementalMode) { | |
1857 if (!UseConcMarkSweepGC) { | |
1858 jio_fprintf(defaultStream::error_stream(), | |
1859 "error: invalid argument combination.\n" | |
1860 "The CMS collector (-XX:+UseConcMarkSweepGC) must be " | |
1861 "selected in order\nto use CMSIncrementalMode.\n"); | |
1862 status = false; | |
1863 } else { | |
10
28372612af5e
6362677: Change parallel GC collector default number of parallel GC threads.
jmasa
parents:
0
diff
changeset
|
1864 status = status && verify_percentage(CMSIncrementalDutyCycle, |
0 | 1865 "CMSIncrementalDutyCycle"); |
10
28372612af5e
6362677: Change parallel GC collector default number of parallel GC threads.
jmasa
parents:
0
diff
changeset
|
1866 status = status && verify_percentage(CMSIncrementalDutyCycleMin, |
0 | 1867 "CMSIncrementalDutyCycleMin"); |
10
28372612af5e
6362677: Change parallel GC collector default number of parallel GC threads.
jmasa
parents:
0
diff
changeset
|
1868 status = status && verify_percentage(CMSIncrementalSafetyFactor, |
0 | 1869 "CMSIncrementalSafetyFactor"); |
10
28372612af5e
6362677: Change parallel GC collector default number of parallel GC threads.
jmasa
parents:
0
diff
changeset
|
1870 status = status && verify_percentage(CMSIncrementalOffset, |
0 | 1871 "CMSIncrementalOffset"); |
10
28372612af5e
6362677: Change parallel GC collector default number of parallel GC threads.
jmasa
parents:
0
diff
changeset
|
1872 status = status && verify_percentage(CMSExpAvgFactor, |
0 | 1873 "CMSExpAvgFactor"); |
1874 // If it was not set on the command line, set | |
1875 // CMSInitiatingOccupancyFraction to 1 so icms can initiate cycles early. | |
1876 if (CMSInitiatingOccupancyFraction < 0) { | |
1877 FLAG_SET_DEFAULT(CMSInitiatingOccupancyFraction, 1); | |
1878 } | |
1879 } | |
1880 } | |
1881 | |
1882 // CMS space iteration, which FLSVerifyAllHeapreferences entails, | |
1883 // insists that we hold the requisite locks so that the iteration is | |
1884 // MT-safe. For the verification at start-up and shut-down, we don't | |
1885 // yet have a good way of acquiring and releasing these locks, | |
1886 // which are not visible at the CollectedHeap level. We want to | |
1887 // be able to acquire these locks and then do the iteration rather | |
1888 // than just disable the lock verification. This will be fixed under | |
1889 // bug 4788986. | |
1890 if (UseConcMarkSweepGC && FLSVerifyAllHeapReferences) { | |
1891 if (VerifyGCStartAt == 0) { | |
1892 warning("Heap verification at start-up disabled " | |
1893 "(due to current incompatibility with FLSVerifyAllHeapReferences)"); | |
1894 VerifyGCStartAt = 1; // Disable verification at start-up | |
1895 } | |
1896 if (VerifyBeforeExit) { | |
1897 warning("Heap verification at shutdown disabled " | |
1898 "(due to current incompatibility with FLSVerifyAllHeapReferences)"); | |
1899 VerifyBeforeExit = false; // Disable verification at shutdown | |
1900 } | |
1901 } | |
1902 | |
1903 // Note: only executed in non-PRODUCT mode | |
1904 if (!UseAsyncConcMarkSweepGC && | |
1905 (ExplicitGCInvokesConcurrent || | |
1906 ExplicitGCInvokesConcurrentAndUnloadsClasses)) { | |
1907 jio_fprintf(defaultStream::error_stream(), | |
1908 "error: +ExplictGCInvokesConcurrent[AndUnloadsClasses] conflicts" | |
1909 " with -UseAsyncConcMarkSweepGC"); | |
1910 status = false; | |
1911 } | |
1912 | |
1283
1c72304f1885
6928073: G1: use existing command line parameters for marking cycle initiation
tonyp
parents:
1257
diff
changeset
|
1913 if (UseG1GC) { |
1c72304f1885
6928073: G1: use existing command line parameters for marking cycle initiation
tonyp
parents:
1257
diff
changeset
|
1914 status = status && verify_percentage(InitiatingHeapOccupancyPercent, |
1c72304f1885
6928073: G1: use existing command line parameters for marking cycle initiation
tonyp
parents:
1257
diff
changeset
|
1915 "InitiatingHeapOccupancyPercent"); |
1c72304f1885
6928073: G1: use existing command line parameters for marking cycle initiation
tonyp
parents:
1257
diff
changeset
|
1916 } |
1c72304f1885
6928073: G1: use existing command line parameters for marking cycle initiation
tonyp
parents:
1257
diff
changeset
|
1917 |
1244
745c853ee57f
6885297: java -XX:RefDiscoveryPolicy=2 or -XX:TLABWasteTargetPercent=0 cause VM crash
johnc
parents:
1188
diff
changeset
|
1918 status = status && verify_interval(RefDiscoveryPolicy, |
745c853ee57f
6885297: java -XX:RefDiscoveryPolicy=2 or -XX:TLABWasteTargetPercent=0 cause VM crash
johnc
parents:
1188
diff
changeset
|
1919 ReferenceProcessor::DiscoveryPolicyMin, |
745c853ee57f
6885297: java -XX:RefDiscoveryPolicy=2 or -XX:TLABWasteTargetPercent=0 cause VM crash
johnc
parents:
1188
diff
changeset
|
1920 ReferenceProcessor::DiscoveryPolicyMax, |
745c853ee57f
6885297: java -XX:RefDiscoveryPolicy=2 or -XX:TLABWasteTargetPercent=0 cause VM crash
johnc
parents:
1188
diff
changeset
|
1921 "RefDiscoveryPolicy"); |
745c853ee57f
6885297: java -XX:RefDiscoveryPolicy=2 or -XX:TLABWasteTargetPercent=0 cause VM crash
johnc
parents:
1188
diff
changeset
|
1922 |
745c853ee57f
6885297: java -XX:RefDiscoveryPolicy=2 or -XX:TLABWasteTargetPercent=0 cause VM crash
johnc
parents:
1188
diff
changeset
|
1923 // Limit the lower bound of this flag to 1 as it is used in a division |
745c853ee57f
6885297: java -XX:RefDiscoveryPolicy=2 or -XX:TLABWasteTargetPercent=0 cause VM crash
johnc
parents:
1188
diff
changeset
|
1924 // expression. |
745c853ee57f
6885297: java -XX:RefDiscoveryPolicy=2 or -XX:TLABWasteTargetPercent=0 cause VM crash
johnc
parents:
1188
diff
changeset
|
1925 status = status && verify_interval(TLABWasteTargetPercent, |
745c853ee57f
6885297: java -XX:RefDiscoveryPolicy=2 or -XX:TLABWasteTargetPercent=0 cause VM crash
johnc
parents:
1188
diff
changeset
|
1926 1, 100, "TLABWasteTargetPercent"); |
745c853ee57f
6885297: java -XX:RefDiscoveryPolicy=2 or -XX:TLABWasteTargetPercent=0 cause VM crash
johnc
parents:
1188
diff
changeset
|
1927 |
1571
2d127394260e
6916623: Align object to 16 bytes to use Compressed Oops with java heap up to 64Gb
kvn
parents:
1506
diff
changeset
|
1928 status = status && verify_object_alignment(); |
2d127394260e
6916623: Align object to 16 bytes to use Compressed Oops with java heap up to 64Gb
kvn
parents:
1506
diff
changeset
|
1929 |
0 | 1930 return status; |
1931 } | |
1932 | |
1933 bool Arguments::is_bad_option(const JavaVMOption* option, jboolean ignore, | |
1934 const char* option_type) { | |
1935 if (ignore) return false; | |
1936 | |
1937 const char* spacer = " "; | |
1938 if (option_type == NULL) { | |
1939 option_type = ++spacer; // Set both to the empty string. | |
1940 } | |
1941 | |
1942 if (os::obsolete_option(option)) { | |
1943 jio_fprintf(defaultStream::error_stream(), | |
1944 "Obsolete %s%soption: %s\n", option_type, spacer, | |
1945 option->optionString); | |
1946 return false; | |
1947 } else { | |
1948 jio_fprintf(defaultStream::error_stream(), | |
1949 "Unrecognized %s%soption: %s\n", option_type, spacer, | |
1950 option->optionString); | |
1951 return true; | |
1952 } | |
1953 } | |
1954 | |
1955 static const char* user_assertion_options[] = { | |
1956 "-da", "-ea", "-disableassertions", "-enableassertions", 0 | |
1957 }; | |
1958 | |
1959 static const char* system_assertion_options[] = { | |
1960 "-dsa", "-esa", "-disablesystemassertions", "-enablesystemassertions", 0 | |
1961 }; | |
1962 | |
1963 // Return true if any of the strings in null-terminated array 'names' matches. | |
1964 // If tail_allowed is true, then the tail must begin with a colon; otherwise, | |
1965 // the option must match exactly. | |
1966 static bool match_option(const JavaVMOption* option, const char** names, const char** tail, | |
1967 bool tail_allowed) { | |
1968 for (/* empty */; *names != NULL; ++names) { | |
1969 if (match_option(option, *names, tail)) { | |
1970 if (**tail == '\0' || tail_allowed && **tail == ':') { | |
1971 return true; | |
1972 } | |
1973 } | |
1974 } | |
1975 return false; | |
1976 } | |
1977 | |
1284 | 1978 bool Arguments::parse_uintx(const char* value, |
1979 uintx* uintx_arg, | |
1980 uintx min_size) { | |
1981 | |
1982 // Check the sign first since atomull() parses only unsigned values. | |
1983 bool value_is_positive = !(*value == '-'); | |
1984 | |
1985 if (value_is_positive) { | |
1986 julong n; | |
1987 bool good_return = atomull(value, &n); | |
1988 if (good_return) { | |
1989 bool above_minimum = n >= min_size; | |
1990 bool value_is_too_large = n > max_uintx; | |
1991 | |
1992 if (above_minimum && !value_is_too_large) { | |
1993 *uintx_arg = n; | |
1994 return true; | |
1995 } | |
1996 } | |
1997 } | |
1998 return false; | |
1999 } | |
2000 | |
0 | 2001 Arguments::ArgsRange Arguments::parse_memory_size(const char* s, |
489
2494ab195856
6653214: MemoryPoolMXBean.setUsageThreshold() does not support large heap sizes.
swamyv
parents:
483
diff
changeset
|
2002 julong* long_arg, |
2494ab195856
6653214: MemoryPoolMXBean.setUsageThreshold() does not support large heap sizes.
swamyv
parents:
483
diff
changeset
|
2003 julong min_size) { |
2494ab195856
6653214: MemoryPoolMXBean.setUsageThreshold() does not support large heap sizes.
swamyv
parents:
483
diff
changeset
|
2004 if (!atomull(s, long_arg)) return arg_unreadable; |
0 | 2005 return check_memory_size(*long_arg, min_size); |
2006 } | |
2007 | |
2008 // Parse JavaVMInitArgs structure | |
2009 | |
2010 jint Arguments::parse_vm_init_args(const JavaVMInitArgs* args) { | |
2011 // For components of the system classpath. | |
2012 SysClassPath scp(Arguments::get_sysclasspath()); | |
2013 bool scp_assembly_required = false; | |
2014 | |
2015 // Save default settings for some mode flags | |
2016 Arguments::_AlwaysCompileLoopMethods = AlwaysCompileLoopMethods; | |
2017 Arguments::_UseOnStackReplacement = UseOnStackReplacement; | |
2018 Arguments::_ClipInlining = ClipInlining; | |
2019 Arguments::_BackgroundCompilation = BackgroundCompilation; | |
2020 | |
2021 // Parse JAVA_TOOL_OPTIONS environment variable (if present) | |
2022 jint result = parse_java_tool_options_environment_variable(&scp, &scp_assembly_required); | |
2023 if (result != JNI_OK) { | |
2024 return result; | |
2025 } | |
2026 | |
2027 // Parse JavaVMInitArgs structure passed in | |
2028 result = parse_each_vm_init_arg(args, &scp, &scp_assembly_required, COMMAND_LINE); | |
2029 if (result != JNI_OK) { | |
2030 return result; | |
2031 } | |
2032 | |
531
40ee984935b9
6792705: Add JAR file to bootclasspath when using AggressiveOpts
phh
parents:
513
diff
changeset
|
2033 if (AggressiveOpts) { |
40ee984935b9
6792705: Add JAR file to bootclasspath when using AggressiveOpts
phh
parents:
513
diff
changeset
|
2034 // Insert alt-rt.jar between user-specified bootclasspath |
40ee984935b9
6792705: Add JAR file to bootclasspath when using AggressiveOpts
phh
parents:
513
diff
changeset
|
2035 // prefix and the default bootclasspath. os::set_boot_path() |
40ee984935b9
6792705: Add JAR file to bootclasspath when using AggressiveOpts
phh
parents:
513
diff
changeset
|
2036 // uses meta_index_dir as the default bootclasspath directory. |
40ee984935b9
6792705: Add JAR file to bootclasspath when using AggressiveOpts
phh
parents:
513
diff
changeset
|
2037 const char* altclasses_jar = "alt-rt.jar"; |
40ee984935b9
6792705: Add JAR file to bootclasspath when using AggressiveOpts
phh
parents:
513
diff
changeset
|
2038 size_t altclasses_path_len = strlen(get_meta_index_dir()) + 1 + |
40ee984935b9
6792705: Add JAR file to bootclasspath when using AggressiveOpts
phh
parents:
513
diff
changeset
|
2039 strlen(altclasses_jar); |
40ee984935b9
6792705: Add JAR file to bootclasspath when using AggressiveOpts
phh
parents:
513
diff
changeset
|
2040 char* altclasses_path = NEW_C_HEAP_ARRAY(char, altclasses_path_len); |
40ee984935b9
6792705: Add JAR file to bootclasspath when using AggressiveOpts
phh
parents:
513
diff
changeset
|
2041 strcpy(altclasses_path, get_meta_index_dir()); |
40ee984935b9
6792705: Add JAR file to bootclasspath when using AggressiveOpts
phh
parents:
513
diff
changeset
|
2042 strcat(altclasses_path, altclasses_jar); |
40ee984935b9
6792705: Add JAR file to bootclasspath when using AggressiveOpts
phh
parents:
513
diff
changeset
|
2043 scp.add_suffix_to_prefix(altclasses_path); |
40ee984935b9
6792705: Add JAR file to bootclasspath when using AggressiveOpts
phh
parents:
513
diff
changeset
|
2044 scp_assembly_required = true; |
40ee984935b9
6792705: Add JAR file to bootclasspath when using AggressiveOpts
phh
parents:
513
diff
changeset
|
2045 FREE_C_HEAP_ARRAY(char, altclasses_path); |
40ee984935b9
6792705: Add JAR file to bootclasspath when using AggressiveOpts
phh
parents:
513
diff
changeset
|
2046 } |
40ee984935b9
6792705: Add JAR file to bootclasspath when using AggressiveOpts
phh
parents:
513
diff
changeset
|
2047 |
0 | 2048 // Parse _JAVA_OPTIONS environment variable (if present) (mimics classic VM) |
2049 result = parse_java_options_environment_variable(&scp, &scp_assembly_required); | |
2050 if (result != JNI_OK) { | |
2051 return result; | |
2052 } | |
2053 | |
2054 // Do final processing now that all arguments have been parsed | |
2055 result = finalize_vm_init_args(&scp, scp_assembly_required); | |
2056 if (result != JNI_OK) { | |
2057 return result; | |
2058 } | |
2059 | |
2060 return JNI_OK; | |
2061 } | |
2062 | |
2063 jint Arguments::parse_each_vm_init_arg(const JavaVMInitArgs* args, | |
2064 SysClassPath* scp_p, | |
2065 bool* scp_assembly_required_p, | |
2066 FlagValueOrigin origin) { | |
2067 // Remaining part of option string | |
2068 const char* tail; | |
2069 | |
2070 // iterate over arguments | |
2071 for (int index = 0; index < args->nOptions; index++) { | |
2072 bool is_absolute_path = false; // for -agentpath vs -agentlib | |
2073 | |
2074 const JavaVMOption* option = args->options + index; | |
2075 | |
2076 if (!match_option(option, "-Djava.class.path", &tail) && | |
2077 !match_option(option, "-Dsun.java.command", &tail) && | |
2078 !match_option(option, "-Dsun.java.launcher", &tail)) { | |
2079 | |
2080 // add all jvm options to the jvm_args string. This string | |
2081 // is used later to set the java.vm.args PerfData string constant. | |
2082 // the -Djava.class.path and the -Dsun.java.command options are | |
2083 // omitted from jvm_args string as each have their own PerfData | |
2084 // string constant object. | |
2085 build_jvm_args(option->optionString); | |
2086 } | |
2087 | |
2088 // -verbose:[class/gc/jni] | |
2089 if (match_option(option, "-verbose", &tail)) { | |
2090 if (!strcmp(tail, ":class") || !strcmp(tail, "")) { | |
2091 FLAG_SET_CMDLINE(bool, TraceClassLoading, true); | |
2092 FLAG_SET_CMDLINE(bool, TraceClassUnloading, true); | |
2093 } else if (!strcmp(tail, ":gc")) { | |
2094 FLAG_SET_CMDLINE(bool, PrintGC, true); | |
2095 } else if (!strcmp(tail, ":jni")) { | |
2096 FLAG_SET_CMDLINE(bool, PrintJNIResolving, true); | |
2097 } | |
2098 // -da / -ea / -disableassertions / -enableassertions | |
2099 // These accept an optional class/package name separated by a colon, e.g., | |
2100 // -da:java.lang.Thread. | |
2101 } else if (match_option(option, user_assertion_options, &tail, true)) { | |
2102 bool enable = option->optionString[1] == 'e'; // char after '-' is 'e' | |
2103 if (*tail == '\0') { | |
2104 JavaAssertions::setUserClassDefault(enable); | |
2105 } else { | |
2106 assert(*tail == ':', "bogus match by match_option()"); | |
2107 JavaAssertions::addOption(tail + 1, enable); | |
2108 } | |
2109 // -dsa / -esa / -disablesystemassertions / -enablesystemassertions | |
2110 } else if (match_option(option, system_assertion_options, &tail, false)) { | |
2111 bool enable = option->optionString[1] == 'e'; // char after '-' is 'e' | |
2112 JavaAssertions::setSystemClassDefault(enable); | |
2113 // -bootclasspath: | |
2114 } else if (match_option(option, "-Xbootclasspath:", &tail)) { | |
2115 scp_p->reset_path(tail); | |
2116 *scp_assembly_required_p = true; | |
2117 // -bootclasspath/a: | |
2118 } else if (match_option(option, "-Xbootclasspath/a:", &tail)) { | |
2119 scp_p->add_suffix(tail); | |
2120 *scp_assembly_required_p = true; | |
2121 // -bootclasspath/p: | |
2122 } else if (match_option(option, "-Xbootclasspath/p:", &tail)) { | |
2123 scp_p->add_prefix(tail); | |
2124 *scp_assembly_required_p = true; | |
2125 // -Xrun | |
2126 } else if (match_option(option, "-Xrun", &tail)) { | |
531
40ee984935b9
6792705: Add JAR file to bootclasspath when using AggressiveOpts
phh
parents:
513
diff
changeset
|
2127 if (tail != NULL) { |
0 | 2128 const char* pos = strchr(tail, ':'); |
2129 size_t len = (pos == NULL) ? strlen(tail) : pos - tail; | |
2130 char* name = (char*)memcpy(NEW_C_HEAP_ARRAY(char, len + 1), tail, len); | |
2131 name[len] = '\0'; | |
2132 | |
2133 char *options = NULL; | |
2134 if(pos != NULL) { | |
2135 size_t len2 = strlen(pos+1) + 1; // options start after ':'. Final zero must be copied. | |
2136 options = (char*)memcpy(NEW_C_HEAP_ARRAY(char, len2), pos+1, len2); | |
2137 } | |
2138 #ifdef JVMTI_KERNEL | |
2139 if ((strcmp(name, "hprof") == 0) || (strcmp(name, "jdwp") == 0)) { | |
2140 warning("profiling and debugging agents are not supported with Kernel VM"); | |
2141 } else | |
2142 #endif // JVMTI_KERNEL | |
2143 add_init_library(name, options); | |
2144 } | |
2145 // -agentlib and -agentpath | |
2146 } else if (match_option(option, "-agentlib:", &tail) || | |
2147 (is_absolute_path = match_option(option, "-agentpath:", &tail))) { | |
2148 if(tail != NULL) { | |
2149 const char* pos = strchr(tail, '='); | |
2150 size_t len = (pos == NULL) ? strlen(tail) : pos - tail; | |
2151 char* name = strncpy(NEW_C_HEAP_ARRAY(char, len + 1), tail, len); | |
2152 name[len] = '\0'; | |
2153 | |
2154 char *options = NULL; | |
2155 if(pos != NULL) { | |
2156 options = strcpy(NEW_C_HEAP_ARRAY(char, strlen(pos + 1) + 1), pos + 1); | |
2157 } | |
2158 #ifdef JVMTI_KERNEL | |
2159 if ((strcmp(name, "hprof") == 0) || (strcmp(name, "jdwp") == 0)) { | |
2160 warning("profiling and debugging agents are not supported with Kernel VM"); | |
2161 } else | |
2162 #endif // JVMTI_KERNEL | |
2163 add_init_agent(name, options, is_absolute_path); | |
2164 | |
2165 } | |
2166 // -javaagent | |
2167 } else if (match_option(option, "-javaagent:", &tail)) { | |
2168 if(tail != NULL) { | |
2169 char *options = strcpy(NEW_C_HEAP_ARRAY(char, strlen(tail) + 1), tail); | |
2170 add_init_agent("instrument", options, false); | |
2171 } | |
2172 // -Xnoclassgc | |
2173 } else if (match_option(option, "-Xnoclassgc", &tail)) { | |
2174 FLAG_SET_CMDLINE(bool, ClassUnloading, false); | |
2175 // -Xincgc: i-CMS | |
2176 } else if (match_option(option, "-Xincgc", &tail)) { | |
2177 FLAG_SET_CMDLINE(bool, UseConcMarkSweepGC, true); | |
2178 FLAG_SET_CMDLINE(bool, CMSIncrementalMode, true); | |
2179 // -Xnoincgc: no i-CMS | |
2180 } else if (match_option(option, "-Xnoincgc", &tail)) { | |
2181 FLAG_SET_CMDLINE(bool, UseConcMarkSweepGC, false); | |
2182 FLAG_SET_CMDLINE(bool, CMSIncrementalMode, false); | |
2183 // -Xconcgc | |
2184 } else if (match_option(option, "-Xconcgc", &tail)) { | |
2185 FLAG_SET_CMDLINE(bool, UseConcMarkSweepGC, true); | |
2186 // -Xnoconcgc | |
2187 } else if (match_option(option, "-Xnoconcgc", &tail)) { | |
2188 FLAG_SET_CMDLINE(bool, UseConcMarkSweepGC, false); | |
2189 // -Xbatch | |
2190 } else if (match_option(option, "-Xbatch", &tail)) { | |
2191 FLAG_SET_CMDLINE(bool, BackgroundCompilation, false); | |
2192 // -Xmn for compatibility with other JVM vendors | |
2193 } else if (match_option(option, "-Xmn", &tail)) { | |
489
2494ab195856
6653214: MemoryPoolMXBean.setUsageThreshold() does not support large heap sizes.
swamyv
parents:
483
diff
changeset
|
2194 julong long_initial_eden_size = 0; |
0 | 2195 ArgsRange errcode = parse_memory_size(tail, &long_initial_eden_size, 1); |
2196 if (errcode != arg_in_range) { | |
2197 jio_fprintf(defaultStream::error_stream(), | |
2198 "Invalid initial eden size: %s\n", option->optionString); | |
2199 describe_range_error(errcode); | |
2200 return JNI_EINVAL; | |
2201 } | |
1064 | 2202 FLAG_SET_CMDLINE(uintx, MaxNewSize, (uintx)long_initial_eden_size); |
2203 FLAG_SET_CMDLINE(uintx, NewSize, (uintx)long_initial_eden_size); | |
0 | 2204 // -Xms |
2205 } else if (match_option(option, "-Xms", &tail)) { | |
489
2494ab195856
6653214: MemoryPoolMXBean.setUsageThreshold() does not support large heap sizes.
swamyv
parents:
483
diff
changeset
|
2206 julong long_initial_heap_size = 0; |
0 | 2207 ArgsRange errcode = parse_memory_size(tail, &long_initial_heap_size, 1); |
2208 if (errcode != arg_in_range) { | |
2209 jio_fprintf(defaultStream::error_stream(), | |
2210 "Invalid initial heap size: %s\n", option->optionString); | |
2211 describe_range_error(errcode); | |
2212 return JNI_EINVAL; | |
2213 } | |
1064 | 2214 FLAG_SET_CMDLINE(uintx, InitialHeapSize, (uintx)long_initial_heap_size); |
0 | 2215 // Currently the minimum size and the initial heap sizes are the same. |
1064 | 2216 set_min_heap_size(InitialHeapSize); |
0 | 2217 // -Xmx |
2218 } else if (match_option(option, "-Xmx", &tail)) { | |
489
2494ab195856
6653214: MemoryPoolMXBean.setUsageThreshold() does not support large heap sizes.
swamyv
parents:
483
diff
changeset
|
2219 julong long_max_heap_size = 0; |
0 | 2220 ArgsRange errcode = parse_memory_size(tail, &long_max_heap_size, 1); |
2221 if (errcode != arg_in_range) { | |
2222 jio_fprintf(defaultStream::error_stream(), | |
2223 "Invalid maximum heap size: %s\n", option->optionString); | |
2224 describe_range_error(errcode); | |
2225 return JNI_EINVAL; | |
2226 } | |
1064 | 2227 FLAG_SET_CMDLINE(uintx, MaxHeapSize, (uintx)long_max_heap_size); |
0 | 2228 // Xmaxf |
2229 } else if (match_option(option, "-Xmaxf", &tail)) { | |
2230 int maxf = (int)(atof(tail) * 100); | |
2231 if (maxf < 0 || maxf > 100) { | |
2232 jio_fprintf(defaultStream::error_stream(), | |
2233 "Bad max heap free percentage size: %s\n", | |
2234 option->optionString); | |
2235 return JNI_EINVAL; | |
2236 } else { | |
2237 FLAG_SET_CMDLINE(uintx, MaxHeapFreeRatio, maxf); | |
2238 } | |
2239 // Xminf | |
2240 } else if (match_option(option, "-Xminf", &tail)) { | |
2241 int minf = (int)(atof(tail) * 100); | |
2242 if (minf < 0 || minf > 100) { | |
2243 jio_fprintf(defaultStream::error_stream(), | |
2244 "Bad min heap free percentage size: %s\n", | |
2245 option->optionString); | |
2246 return JNI_EINVAL; | |
2247 } else { | |
2248 FLAG_SET_CMDLINE(uintx, MinHeapFreeRatio, minf); | |
2249 } | |
2250 // -Xss | |
2251 } else if (match_option(option, "-Xss", &tail)) { | |
489
2494ab195856
6653214: MemoryPoolMXBean.setUsageThreshold() does not support large heap sizes.
swamyv
parents:
483
diff
changeset
|
2252 julong long_ThreadStackSize = 0; |
0 | 2253 ArgsRange errcode = parse_memory_size(tail, &long_ThreadStackSize, 1000); |
2254 if (errcode != arg_in_range) { | |
2255 jio_fprintf(defaultStream::error_stream(), | |
2256 "Invalid thread stack size: %s\n", option->optionString); | |
2257 describe_range_error(errcode); | |
2258 return JNI_EINVAL; | |
2259 } | |
2260 // Internally track ThreadStackSize in units of 1024 bytes. | |
2261 FLAG_SET_CMDLINE(intx, ThreadStackSize, | |
2262 round_to((int)long_ThreadStackSize, K) / K); | |
2263 // -Xoss | |
2264 } else if (match_option(option, "-Xoss", &tail)) { | |
2265 // HotSpot does not have separate native and Java stacks, ignore silently for compatibility | |
2266 // -Xmaxjitcodesize | |
2267 } else if (match_option(option, "-Xmaxjitcodesize", &tail)) { | |
489
2494ab195856
6653214: MemoryPoolMXBean.setUsageThreshold() does not support large heap sizes.
swamyv
parents:
483
diff
changeset
|
2268 julong long_ReservedCodeCacheSize = 0; |
0 | 2269 ArgsRange errcode = parse_memory_size(tail, &long_ReservedCodeCacheSize, |
489
2494ab195856
6653214: MemoryPoolMXBean.setUsageThreshold() does not support large heap sizes.
swamyv
parents:
483
diff
changeset
|
2270 (size_t)InitialCodeCacheSize); |
0 | 2271 if (errcode != arg_in_range) { |
2272 jio_fprintf(defaultStream::error_stream(), | |
2273 "Invalid maximum code cache size: %s\n", | |
2274 option->optionString); | |
2275 describe_range_error(errcode); | |
2276 return JNI_EINVAL; | |
2277 } | |
2278 FLAG_SET_CMDLINE(uintx, ReservedCodeCacheSize, (uintx)long_ReservedCodeCacheSize); | |
2279 // -green | |
2280 } else if (match_option(option, "-green", &tail)) { | |
2281 jio_fprintf(defaultStream::error_stream(), | |
2282 "Green threads support not available\n"); | |
2283 return JNI_EINVAL; | |
2284 // -native | |
2285 } else if (match_option(option, "-native", &tail)) { | |
2286 // HotSpot always uses native threads, ignore silently for compatibility | |
2287 // -Xsqnopause | |
2288 } else if (match_option(option, "-Xsqnopause", &tail)) { | |
2289 // EVM option, ignore silently for compatibility | |
2290 // -Xrs | |
2291 } else if (match_option(option, "-Xrs", &tail)) { | |
2292 // Classic/EVM option, new functionality | |
2293 FLAG_SET_CMDLINE(bool, ReduceSignalUsage, true); | |
2294 } else if (match_option(option, "-Xusealtsigs", &tail)) { | |
2295 // change default internal VM signals used - lower case for back compat | |
2296 FLAG_SET_CMDLINE(bool, UseAltSigs, true); | |
2297 // -Xoptimize | |
2298 } else if (match_option(option, "-Xoptimize", &tail)) { | |
2299 // EVM option, ignore silently for compatibility | |
2300 // -Xprof | |
2301 } else if (match_option(option, "-Xprof", &tail)) { | |
2302 #ifndef FPROF_KERNEL | |
2303 _has_profile = true; | |
2304 #else // FPROF_KERNEL | |
2305 // do we have to exit? | |
2306 warning("Kernel VM does not support flat profiling."); | |
2307 #endif // FPROF_KERNEL | |
2308 // -Xaprof | |
2309 } else if (match_option(option, "-Xaprof", &tail)) { | |
2310 _has_alloc_profile = true; | |
2311 // -Xconcurrentio | |
2312 } else if (match_option(option, "-Xconcurrentio", &tail)) { | |
2313 FLAG_SET_CMDLINE(bool, UseLWPSynchronization, true); | |
2314 FLAG_SET_CMDLINE(bool, BackgroundCompilation, false); | |
2315 FLAG_SET_CMDLINE(intx, DeferThrSuspendLoopCount, 1); | |
2316 FLAG_SET_CMDLINE(bool, UseTLAB, false); | |
2317 FLAG_SET_CMDLINE(uintx, NewSizeThreadIncrease, 16 * K); // 20Kb per thread added to new generation | |
2318 | |
2319 // -Xinternalversion | |
2320 } else if (match_option(option, "-Xinternalversion", &tail)) { | |
2321 jio_fprintf(defaultStream::output_stream(), "%s\n", | |
2322 VM_Version::internal_vm_info_string()); | |
2323 vm_exit(0); | |
2324 #ifndef PRODUCT | |
2325 // -Xprintflags | |
2326 } else if (match_option(option, "-Xprintflags", &tail)) { | |
2327 CommandLineFlags::printFlags(); | |
2328 vm_exit(0); | |
2329 #endif | |
2330 // -D | |
2331 } else if (match_option(option, "-D", &tail)) { | |
2332 if (!add_property(tail)) { | |
2333 return JNI_ENOMEM; | |
2334 } | |
2335 // Out of the box management support | |
2336 if (match_option(option, "-Dcom.sun.management", &tail)) { | |
2337 FLAG_SET_CMDLINE(bool, ManagementServer, true); | |
2338 } | |
2339 // -Xint | |
2340 } else if (match_option(option, "-Xint", &tail)) { | |
2341 set_mode_flags(_int); | |
2342 // -Xmixed | |
2343 } else if (match_option(option, "-Xmixed", &tail)) { | |
2344 set_mode_flags(_mixed); | |
2345 // -Xcomp | |
2346 } else if (match_option(option, "-Xcomp", &tail)) { | |
2347 // for testing the compiler; turn off all flags that inhibit compilation | |
2348 set_mode_flags(_comp); | |
2349 | |
2350 // -Xshare:dump | |
2351 } else if (match_option(option, "-Xshare:dump", &tail)) { | |
2352 #ifdef TIERED | |
2353 FLAG_SET_CMDLINE(bool, DumpSharedSpaces, true); | |
2354 set_mode_flags(_int); // Prevent compilation, which creates objects | |
2355 #elif defined(COMPILER2) | |
2356 vm_exit_during_initialization( | |
2357 "Dumping a shared archive is not supported on the Server JVM.", NULL); | |
2358 #elif defined(KERNEL) | |
2359 vm_exit_during_initialization( | |
2360 "Dumping a shared archive is not supported on the Kernel JVM.", NULL); | |
2361 #else | |
2362 FLAG_SET_CMDLINE(bool, DumpSharedSpaces, true); | |
2363 set_mode_flags(_int); // Prevent compilation, which creates objects | |
2364 #endif | |
2365 // -Xshare:on | |
2366 } else if (match_option(option, "-Xshare:on", &tail)) { | |
2367 FLAG_SET_CMDLINE(bool, UseSharedSpaces, true); | |
2368 FLAG_SET_CMDLINE(bool, RequireSharedSpaces, true); | |
2369 #ifdef TIERED | |
2370 FLAG_SET_CMDLINE(bool, ForceSharedSpaces, true); | |
2371 #endif // TIERED | |
2372 // -Xshare:auto | |
2373 } else if (match_option(option, "-Xshare:auto", &tail)) { | |
2374 FLAG_SET_CMDLINE(bool, UseSharedSpaces, true); | |
2375 FLAG_SET_CMDLINE(bool, RequireSharedSpaces, false); | |
2376 // -Xshare:off | |
2377 } else if (match_option(option, "-Xshare:off", &tail)) { | |
2378 FLAG_SET_CMDLINE(bool, UseSharedSpaces, false); | |
2379 FLAG_SET_CMDLINE(bool, RequireSharedSpaces, false); | |
2380 | |
2381 // -Xverify | |
2382 } else if (match_option(option, "-Xverify", &tail)) { | |
2383 if (strcmp(tail, ":all") == 0 || strcmp(tail, "") == 0) { | |
2384 FLAG_SET_CMDLINE(bool, BytecodeVerificationLocal, true); | |
2385 FLAG_SET_CMDLINE(bool, BytecodeVerificationRemote, true); | |
2386 } else if (strcmp(tail, ":remote") == 0) { | |
2387 FLAG_SET_CMDLINE(bool, BytecodeVerificationLocal, false); | |
2388 FLAG_SET_CMDLINE(bool, BytecodeVerificationRemote, true); | |
2389 } else if (strcmp(tail, ":none") == 0) { | |
2390 FLAG_SET_CMDLINE(bool, BytecodeVerificationLocal, false); | |
2391 FLAG_SET_CMDLINE(bool, BytecodeVerificationRemote, false); | |
2392 } else if (is_bad_option(option, args->ignoreUnrecognized, "verification")) { | |
2393 return JNI_EINVAL; | |
2394 } | |
2395 // -Xdebug | |
2396 } else if (match_option(option, "-Xdebug", &tail)) { | |
2397 // note this flag has been used, then ignore | |
2398 set_xdebug_mode(true); | |
2399 // -Xnoagent | |
2400 } else if (match_option(option, "-Xnoagent", &tail)) { | |
2401 // For compatibility with classic. HotSpot refuses to load the old style agent.dll. | |
2402 } else if (match_option(option, "-Xboundthreads", &tail)) { | |
2403 // Bind user level threads to kernel threads (Solaris only) | |
2404 FLAG_SET_CMDLINE(bool, UseBoundThreads, true); | |
2405 } else if (match_option(option, "-Xloggc:", &tail)) { | |
2406 // Redirect GC output to the file. -Xloggc:<filename> | |
2407 // ostream_init_log(), when called will use this filename | |
2408 // to initialize a fileStream. | |
2409 _gc_log_filename = strdup(tail); | |
2410 FLAG_SET_CMDLINE(bool, PrintGC, true); | |
2411 FLAG_SET_CMDLINE(bool, PrintGCTimeStamps, true); | |
2412 FLAG_SET_CMDLINE(bool, TraceClassUnloading, true); | |
2413 | |
2414 // JNI hooks | |
2415 } else if (match_option(option, "-Xcheck", &tail)) { | |
2416 if (!strcmp(tail, ":jni")) { | |
2417 CheckJNICalls = true; | |
2418 } else if (is_bad_option(option, args->ignoreUnrecognized, | |
2419 "check")) { | |
2420 return JNI_EINVAL; | |
2421 } | |
2422 } else if (match_option(option, "vfprintf", &tail)) { | |
2423 _vfprintf_hook = CAST_TO_FN_PTR(vfprintf_hook_t, option->extraInfo); | |
2424 } else if (match_option(option, "exit", &tail)) { | |
2425 _exit_hook = CAST_TO_FN_PTR(exit_hook_t, option->extraInfo); | |
2426 } else if (match_option(option, "abort", &tail)) { | |
2427 _abort_hook = CAST_TO_FN_PTR(abort_hook_t, option->extraInfo); | |
2428 // -XX:+AggressiveHeap | |
2429 } else if (match_option(option, "-XX:+AggressiveHeap", &tail)) { | |
2430 | |
2431 // This option inspects the machine and attempts to set various | |
2432 // parameters to be optimal for long-running, memory allocation | |
2433 // intensive jobs. It is intended for machines with large | |
2434 // amounts of cpu and memory. | |
2435 | |
2436 // initHeapSize is needed since _initial_heap_size is 4 bytes on a 32 bit | |
2437 // VM, but we may not be able to represent the total physical memory | |
2438 // available (like having 8gb of memory on a box but using a 32bit VM). | |
2439 // Thus, we need to make sure we're using a julong for intermediate | |
2440 // calculations. | |
2441 julong initHeapSize; | |
2442 julong total_memory = os::physical_memory(); | |
2443 | |
2444 if (total_memory < (julong)256*M) { | |
2445 jio_fprintf(defaultStream::error_stream(), | |
2446 "You need at least 256mb of memory to use -XX:+AggressiveHeap\n"); | |
2447 vm_exit(1); | |
2448 } | |
2449 | |
2450 // The heap size is half of available memory, or (at most) | |
2451 // all of possible memory less 160mb (leaving room for the OS | |
2452 // when using ISM). This is the maximum; because adaptive sizing | |
2453 // is turned on below, the actual space used may be smaller. | |
2454 | |
2455 initHeapSize = MIN2(total_memory / (julong)2, | |
2456 total_memory - (julong)160*M); | |
2457 | |
2458 // Make sure that if we have a lot of memory we cap the 32 bit | |
2459 // process space. The 64bit VM version of this function is a nop. | |
2460 initHeapSize = os::allocatable_physical_memory(initHeapSize); | |
2461 | |
2462 // The perm gen is separate but contiguous with the | |
2463 // object heap (and is reserved with it) so subtract it | |
2464 // from the heap size. | |
2465 if (initHeapSize > MaxPermSize) { | |
2466 initHeapSize = initHeapSize - MaxPermSize; | |
2467 } else { | |
2468 warning("AggressiveHeap and MaxPermSize values may conflict"); | |
2469 } | |
2470 | |
2471 if (FLAG_IS_DEFAULT(MaxHeapSize)) { | |
2472 FLAG_SET_CMDLINE(uintx, MaxHeapSize, initHeapSize); | |
1064 | 2473 FLAG_SET_CMDLINE(uintx, InitialHeapSize, initHeapSize); |
0 | 2474 // Currently the minimum size and the initial heap sizes are the same. |
1064 | 2475 set_min_heap_size(initHeapSize); |
0 | 2476 } |
2477 if (FLAG_IS_DEFAULT(NewSize)) { | |
2478 // Make the young generation 3/8ths of the total heap. | |
2479 FLAG_SET_CMDLINE(uintx, NewSize, | |
2480 ((julong)MaxHeapSize / (julong)8) * (julong)3); | |
2481 FLAG_SET_CMDLINE(uintx, MaxNewSize, NewSize); | |
2482 } | |
2483 | |
2484 FLAG_SET_DEFAULT(UseLargePages, true); | |
2485 | |
2486 // Increase some data structure sizes for efficiency | |
2487 FLAG_SET_CMDLINE(uintx, BaseFootPrintEstimate, MaxHeapSize); | |
2488 FLAG_SET_CMDLINE(bool, ResizeTLAB, false); | |
2489 FLAG_SET_CMDLINE(uintx, TLABSize, 256*K); | |
2490 | |
2491 // See the OldPLABSize comment below, but replace 'after promotion' | |
2492 // with 'after copying'. YoungPLABSize is the size of the survivor | |
2493 // space per-gc-thread buffers. The default is 4kw. | |
2494 FLAG_SET_CMDLINE(uintx, YoungPLABSize, 256*K); // Note: this is in words | |
2495 | |
2496 // OldPLABSize is the size of the buffers in the old gen that | |
2497 // UseParallelGC uses to promote live data that doesn't fit in the | |
2498 // survivor spaces. At any given time, there's one for each gc thread. | |
2499 // The default size is 1kw. These buffers are rarely used, since the | |
2500 // survivor spaces are usually big enough. For specjbb, however, there | |
2501 // are occasions when there's lots of live data in the young gen | |
2502 // and we end up promoting some of it. We don't have a definite | |
2503 // explanation for why bumping OldPLABSize helps, but the theory | |
2504 // is that a bigger PLAB results in retaining something like the | |
2505 // original allocation order after promotion, which improves mutator | |
2506 // locality. A minor effect may be that larger PLABs reduce the | |
2507 // number of PLAB allocation events during gc. The value of 8kw | |
2508 // was arrived at by experimenting with specjbb. | |
2509 FLAG_SET_CMDLINE(uintx, OldPLABSize, 8*K); // Note: this is in words | |
2510 | |
2511 // CompilationPolicyChoice=0 causes the server compiler to adopt | |
2512 // a more conservative which-method-do-I-compile policy when one | |
2513 // of the counters maintained by the interpreter trips. The | |
2514 // result is reduced startup time and improved specjbb and | |
2515 // alacrity performance. Zero is the default, but we set it | |
2516 // explicitly here in case the default changes. | |
2517 // See runtime/compilationPolicy.*. | |
2518 FLAG_SET_CMDLINE(intx, CompilationPolicyChoice, 0); | |
2519 | |
2520 // Enable parallel GC and adaptive generation sizing | |
2521 FLAG_SET_CMDLINE(bool, UseParallelGC, true); | |
10
28372612af5e
6362677: Change parallel GC collector default number of parallel GC threads.
jmasa
parents:
0
diff
changeset
|
2522 FLAG_SET_DEFAULT(ParallelGCThreads, |
28372612af5e
6362677: Change parallel GC collector default number of parallel GC threads.
jmasa
parents:
0
diff
changeset
|
2523 Abstract_VM_Version::parallel_worker_threads()); |
0 | 2524 |
2525 // Encourage steady state memory management | |
2526 FLAG_SET_CMDLINE(uintx, ThresholdTolerance, 100); | |
2527 | |
2528 // This appears to improve mutator locality | |
2529 FLAG_SET_CMDLINE(bool, ScavengeBeforeFullGC, false); | |
2530 | |
2531 // Get around early Solaris scheduling bug | |
2532 // (affinity vs other jobs on system) | |
2533 // but disallow DR and offlining (5008695). | |
2534 FLAG_SET_CMDLINE(bool, BindGCTaskThreadsToCPUs, true); | |
2535 | |
2536 } else if (match_option(option, "-XX:+NeverTenure", &tail)) { | |
2537 // The last option must always win. | |
2538 FLAG_SET_CMDLINE(bool, AlwaysTenure, false); | |
2539 FLAG_SET_CMDLINE(bool, NeverTenure, true); | |
2540 } else if (match_option(option, "-XX:+AlwaysTenure", &tail)) { | |
2541 // The last option must always win. | |
2542 FLAG_SET_CMDLINE(bool, NeverTenure, false); | |
2543 FLAG_SET_CMDLINE(bool, AlwaysTenure, true); | |
2544 } else if (match_option(option, "-XX:+CMSPermGenSweepingEnabled", &tail) || | |
2545 match_option(option, "-XX:-CMSPermGenSweepingEnabled", &tail)) { | |
2546 jio_fprintf(defaultStream::error_stream(), | |
2547 "Please use CMSClassUnloadingEnabled in place of " | |
2548 "CMSPermGenSweepingEnabled in the future\n"); | |
2549 } else if (match_option(option, "-XX:+UseGCTimeLimit", &tail)) { | |
2550 FLAG_SET_CMDLINE(bool, UseGCOverheadLimit, true); | |
2551 jio_fprintf(defaultStream::error_stream(), | |
2552 "Please use -XX:+UseGCOverheadLimit in place of " | |
2553 "-XX:+UseGCTimeLimit in the future\n"); | |
2554 } else if (match_option(option, "-XX:-UseGCTimeLimit", &tail)) { | |
2555 FLAG_SET_CMDLINE(bool, UseGCOverheadLimit, false); | |
2556 jio_fprintf(defaultStream::error_stream(), | |
2557 "Please use -XX:-UseGCOverheadLimit in place of " | |
2558 "-XX:-UseGCTimeLimit in the future\n"); | |
2559 // The TLE options are for compatibility with 1.3 and will be | |
2560 // removed without notice in a future release. These options | |
2561 // are not to be documented. | |
2562 } else if (match_option(option, "-XX:MaxTLERatio=", &tail)) { | |
2563 // No longer used. | |
2564 } else if (match_option(option, "-XX:+ResizeTLE", &tail)) { | |
2565 FLAG_SET_CMDLINE(bool, ResizeTLAB, true); | |
2566 } else if (match_option(option, "-XX:-ResizeTLE", &tail)) { | |
2567 FLAG_SET_CMDLINE(bool, ResizeTLAB, false); | |
2568 } else if (match_option(option, "-XX:+PrintTLE", &tail)) { | |
2569 FLAG_SET_CMDLINE(bool, PrintTLAB, true); | |
2570 } else if (match_option(option, "-XX:-PrintTLE", &tail)) { | |
2571 FLAG_SET_CMDLINE(bool, PrintTLAB, false); | |
2572 } else if (match_option(option, "-XX:TLEFragmentationRatio=", &tail)) { | |
2573 // No longer used. | |
2574 } else if (match_option(option, "-XX:TLESize=", &tail)) { | |
489
2494ab195856
6653214: MemoryPoolMXBean.setUsageThreshold() does not support large heap sizes.
swamyv
parents:
483
diff
changeset
|
2575 julong long_tlab_size = 0; |
0 | 2576 ArgsRange errcode = parse_memory_size(tail, &long_tlab_size, 1); |
2577 if (errcode != arg_in_range) { | |
2578 jio_fprintf(defaultStream::error_stream(), | |
2579 "Invalid TLAB size: %s\n", option->optionString); | |
2580 describe_range_error(errcode); | |
2581 return JNI_EINVAL; | |
2582 } | |
2583 FLAG_SET_CMDLINE(uintx, TLABSize, long_tlab_size); | |
2584 } else if (match_option(option, "-XX:TLEThreadRatio=", &tail)) { | |
2585 // No longer used. | |
2586 } else if (match_option(option, "-XX:+UseTLE", &tail)) { | |
2587 FLAG_SET_CMDLINE(bool, UseTLAB, true); | |
2588 } else if (match_option(option, "-XX:-UseTLE", &tail)) { | |
2589 FLAG_SET_CMDLINE(bool, UseTLAB, false); | |
2590 SOLARIS_ONLY( | |
2591 } else if (match_option(option, "-XX:+UsePermISM", &tail)) { | |
2592 warning("-XX:+UsePermISM is obsolete."); | |
2593 FLAG_SET_CMDLINE(bool, UseISM, true); | |
2594 } else if (match_option(option, "-XX:-UsePermISM", &tail)) { | |
2595 FLAG_SET_CMDLINE(bool, UseISM, false); | |
2596 ) | |
2597 } else if (match_option(option, "-XX:+DisplayVMOutputToStderr", &tail)) { | |
2598 FLAG_SET_CMDLINE(bool, DisplayVMOutputToStdout, false); | |
2599 FLAG_SET_CMDLINE(bool, DisplayVMOutputToStderr, true); | |
2600 } else if (match_option(option, "-XX:+DisplayVMOutputToStdout", &tail)) { | |
2601 FLAG_SET_CMDLINE(bool, DisplayVMOutputToStderr, false); | |
2602 FLAG_SET_CMDLINE(bool, DisplayVMOutputToStdout, true); | |
2603 } else if (match_option(option, "-XX:+ExtendedDTraceProbes", &tail)) { | |
2604 #ifdef SOLARIS | |
2605 FLAG_SET_CMDLINE(bool, ExtendedDTraceProbes, true); | |
2606 FLAG_SET_CMDLINE(bool, DTraceMethodProbes, true); | |
2607 FLAG_SET_CMDLINE(bool, DTraceAllocProbes, true); | |
2608 FLAG_SET_CMDLINE(bool, DTraceMonitorProbes, true); | |
2609 #else // ndef SOLARIS | |
2610 jio_fprintf(defaultStream::error_stream(), | |
2611 "ExtendedDTraceProbes flag is only applicable on Solaris\n"); | |
2612 return JNI_EINVAL; | |
2613 #endif // ndef SOLARIS | |
2614 #ifdef ASSERT | |
1145
e018e6884bd8
6631166: CMS: better heuristics when combatting fragmentation
ysr
parents:
1074
diff
changeset
|
2615 } else if (match_option(option, "-XX:+FullGCALot", &tail)) { |
0 | 2616 FLAG_SET_CMDLINE(bool, FullGCALot, true); |
2617 // disable scavenge before parallel mark-compact | |
2618 FLAG_SET_CMDLINE(bool, ScavengeBeforeFullGC, false); | |
2619 #endif | |
1145
e018e6884bd8
6631166: CMS: better heuristics when combatting fragmentation
ysr
parents:
1074
diff
changeset
|
2620 } else if (match_option(option, "-XX:CMSParPromoteBlocksToClaim=", &tail)) { |
0 | 2621 julong cms_blocks_to_claim = (julong)atol(tail); |
2622 FLAG_SET_CMDLINE(uintx, CMSParPromoteBlocksToClaim, cms_blocks_to_claim); | |
2623 jio_fprintf(defaultStream::error_stream(), | |
1145
e018e6884bd8
6631166: CMS: better heuristics when combatting fragmentation
ysr
parents:
1074
diff
changeset
|
2624 "Please use -XX:OldPLABSize in place of " |
e018e6884bd8
6631166: CMS: better heuristics when combatting fragmentation
ysr
parents:
1074
diff
changeset
|
2625 "-XX:CMSParPromoteBlocksToClaim in the future\n"); |
e018e6884bd8
6631166: CMS: better heuristics when combatting fragmentation
ysr
parents:
1074
diff
changeset
|
2626 } else if (match_option(option, "-XX:ParCMSPromoteBlocksToClaim=", &tail)) { |
e018e6884bd8
6631166: CMS: better heuristics when combatting fragmentation
ysr
parents:
1074
diff
changeset
|
2627 julong cms_blocks_to_claim = (julong)atol(tail); |
e018e6884bd8
6631166: CMS: better heuristics when combatting fragmentation
ysr
parents:
1074
diff
changeset
|
2628 FLAG_SET_CMDLINE(uintx, CMSParPromoteBlocksToClaim, cms_blocks_to_claim); |
e018e6884bd8
6631166: CMS: better heuristics when combatting fragmentation
ysr
parents:
1074
diff
changeset
|
2629 jio_fprintf(defaultStream::error_stream(), |
e018e6884bd8
6631166: CMS: better heuristics when combatting fragmentation
ysr
parents:
1074
diff
changeset
|
2630 "Please use -XX:OldPLABSize in place of " |
0 | 2631 "-XX:ParCMSPromoteBlocksToClaim in the future\n"); |
1145
e018e6884bd8
6631166: CMS: better heuristics when combatting fragmentation
ysr
parents:
1074
diff
changeset
|
2632 } else if (match_option(option, "-XX:ParallelGCOldGenAllocBufferSize=", &tail)) { |
489
2494ab195856
6653214: MemoryPoolMXBean.setUsageThreshold() does not support large heap sizes.
swamyv
parents:
483
diff
changeset
|
2633 julong old_plab_size = 0; |
0 | 2634 ArgsRange errcode = parse_memory_size(tail, &old_plab_size, 1); |
2635 if (errcode != arg_in_range) { | |
2636 jio_fprintf(defaultStream::error_stream(), | |
2637 "Invalid old PLAB size: %s\n", option->optionString); | |
2638 describe_range_error(errcode); | |
2639 return JNI_EINVAL; | |
2640 } | |
489
2494ab195856
6653214: MemoryPoolMXBean.setUsageThreshold() does not support large heap sizes.
swamyv
parents:
483
diff
changeset
|
2641 FLAG_SET_CMDLINE(uintx, OldPLABSize, old_plab_size); |
0 | 2642 jio_fprintf(defaultStream::error_stream(), |
2643 "Please use -XX:OldPLABSize in place of " | |
2644 "-XX:ParallelGCOldGenAllocBufferSize in the future\n"); | |
1145
e018e6884bd8
6631166: CMS: better heuristics when combatting fragmentation
ysr
parents:
1074
diff
changeset
|
2645 } else if (match_option(option, "-XX:ParallelGCToSpaceAllocBufferSize=", &tail)) { |
489
2494ab195856
6653214: MemoryPoolMXBean.setUsageThreshold() does not support large heap sizes.
swamyv
parents:
483
diff
changeset
|
2646 julong young_plab_size = 0; |
0 | 2647 ArgsRange errcode = parse_memory_size(tail, &young_plab_size, 1); |
2648 if (errcode != arg_in_range) { | |
2649 jio_fprintf(defaultStream::error_stream(), | |
2650 "Invalid young PLAB size: %s\n", option->optionString); | |
2651 describe_range_error(errcode); | |
2652 return JNI_EINVAL; | |
2653 } | |
489
2494ab195856
6653214: MemoryPoolMXBean.setUsageThreshold() does not support large heap sizes.
swamyv
parents:
483
diff
changeset
|
2654 FLAG_SET_CMDLINE(uintx, YoungPLABSize, young_plab_size); |
0 | 2655 jio_fprintf(defaultStream::error_stream(), |
2656 "Please use -XX:YoungPLABSize in place of " | |
2657 "-XX:ParallelGCToSpaceAllocBufferSize in the future\n"); | |
1284 | 2658 } else if (match_option(option, "-XX:CMSMarkStackSize=", &tail) || |
2659 match_option(option, "-XX:G1MarkStackSize=", &tail)) { | |
2660 julong stack_size = 0; | |
2661 ArgsRange errcode = parse_memory_size(tail, &stack_size, 1); | |
2662 if (errcode != arg_in_range) { | |
2663 jio_fprintf(defaultStream::error_stream(), | |
2664 "Invalid mark stack size: %s\n", option->optionString); | |
2665 describe_range_error(errcode); | |
2666 return JNI_EINVAL; | |
2667 } | |
2668 FLAG_SET_CMDLINE(uintx, MarkStackSize, stack_size); | |
2669 } else if (match_option(option, "-XX:CMSMarkStackSizeMax=", &tail)) { | |
2670 julong max_stack_size = 0; | |
2671 ArgsRange errcode = parse_memory_size(tail, &max_stack_size, 1); | |
2672 if (errcode != arg_in_range) { | |
2673 jio_fprintf(defaultStream::error_stream(), | |
2674 "Invalid maximum mark stack size: %s\n", | |
2675 option->optionString); | |
2676 describe_range_error(errcode); | |
2677 return JNI_EINVAL; | |
2678 } | |
2679 FLAG_SET_CMDLINE(uintx, MarkStackSizeMax, max_stack_size); | |
2680 } else if (match_option(option, "-XX:ParallelMarkingThreads=", &tail) || | |
2681 match_option(option, "-XX:ParallelCMSThreads=", &tail)) { | |
2682 uintx conc_threads = 0; | |
2683 if (!parse_uintx(tail, &conc_threads, 1)) { | |
2684 jio_fprintf(defaultStream::error_stream(), | |
2685 "Invalid concurrent threads: %s\n", option->optionString); | |
2686 return JNI_EINVAL; | |
2687 } | |
2688 FLAG_SET_CMDLINE(uintx, ConcGCThreads, conc_threads); | |
1145
e018e6884bd8
6631166: CMS: better heuristics when combatting fragmentation
ysr
parents:
1074
diff
changeset
|
2689 } else if (match_option(option, "-XX:", &tail)) { // -XX:xxxx |
0 | 2690 // Skip -XX:Flags= since that case has already been handled |
2691 if (strncmp(tail, "Flags=", strlen("Flags=")) != 0) { | |
2692 if (!process_argument(tail, args->ignoreUnrecognized, origin)) { | |
2693 return JNI_EINVAL; | |
2694 } | |
2695 } | |
1483
ba37b9335e1e
New option "-graal" that sets up the correct boot class path and C1X options using only the two environment variables MAXINE and GRAAL.
Thomas Wuerthinger <wuerthinger@ssw.jku.at>
parents:
1437
diff
changeset
|
2696 } else if (match_option(option, "-graal", &tail)) { |
ba37b9335e1e
New option "-graal" that sets up the correct boot class path and C1X options using only the two environment variables MAXINE and GRAAL.
Thomas Wuerthinger <wuerthinger@ssw.jku.at>
parents:
1437
diff
changeset
|
2697 if (PrintVMOptions) { |
ba37b9335e1e
New option "-graal" that sets up the correct boot class path and C1X options using only the two environment variables MAXINE and GRAAL.
Thomas Wuerthinger <wuerthinger@ssw.jku.at>
parents:
1437
diff
changeset
|
2698 tty->print("Running Graal VM... "); |
ba37b9335e1e
New option "-graal" that sets up the correct boot class path and C1X options using only the two environment variables MAXINE and GRAAL.
Thomas Wuerthinger <wuerthinger@ssw.jku.at>
parents:
1437
diff
changeset
|
2699 } |
ba37b9335e1e
New option "-graal" that sets up the correct boot class path and C1X options using only the two environment variables MAXINE and GRAAL.
Thomas Wuerthinger <wuerthinger@ssw.jku.at>
parents:
1437
diff
changeset
|
2700 UseC1X = true; |
ba37b9335e1e
New option "-graal" that sets up the correct boot class path and C1X options using only the two environment variables MAXINE and GRAAL.
Thomas Wuerthinger <wuerthinger@ssw.jku.at>
parents:
1437
diff
changeset
|
2701 BootstrapC1X = true; |
ba37b9335e1e
New option "-graal" that sets up the correct boot class path and C1X options using only the two environment variables MAXINE and GRAAL.
Thomas Wuerthinger <wuerthinger@ssw.jku.at>
parents:
1437
diff
changeset
|
2702 const int BUFFER_SIZE = 1024; |
ba37b9335e1e
New option "-graal" that sets up the correct boot class path and C1X options using only the two environment variables MAXINE and GRAAL.
Thomas Wuerthinger <wuerthinger@ssw.jku.at>
parents:
1437
diff
changeset
|
2703 char maxine_dir[BUFFER_SIZE]; |
ba37b9335e1e
New option "-graal" that sets up the correct boot class path and C1X options using only the two environment variables MAXINE and GRAAL.
Thomas Wuerthinger <wuerthinger@ssw.jku.at>
parents:
1437
diff
changeset
|
2704 char graal_dir[BUFFER_SIZE]; |
ba37b9335e1e
New option "-graal" that sets up the correct boot class path and C1X options using only the two environment variables MAXINE and GRAAL.
Thomas Wuerthinger <wuerthinger@ssw.jku.at>
parents:
1437
diff
changeset
|
2705 char temp[BUFFER_SIZE]; |
ba37b9335e1e
New option "-graal" that sets up the correct boot class path and C1X options using only the two environment variables MAXINE and GRAAL.
Thomas Wuerthinger <wuerthinger@ssw.jku.at>
parents:
1437
diff
changeset
|
2706 if (!os::getenv("MAXINE", maxine_dir, sizeof(maxine_dir))) { |
ba37b9335e1e
New option "-graal" that sets up the correct boot class path and C1X options using only the two environment variables MAXINE and GRAAL.
Thomas Wuerthinger <wuerthinger@ssw.jku.at>
parents:
1437
diff
changeset
|
2707 fatal("Must set MAXINE environment variable to a Maxine project directory."); |
ba37b9335e1e
New option "-graal" that sets up the correct boot class path and C1X options using only the two environment variables MAXINE and GRAAL.
Thomas Wuerthinger <wuerthinger@ssw.jku.at>
parents:
1437
diff
changeset
|
2708 } |
ba37b9335e1e
New option "-graal" that sets up the correct boot class path and C1X options using only the two environment variables MAXINE and GRAAL.
Thomas Wuerthinger <wuerthinger@ssw.jku.at>
parents:
1437
diff
changeset
|
2709 if (PrintVMOptions) tty->print("MAXINE=%s", maxine_dir); |
ba37b9335e1e
New option "-graal" that sets up the correct boot class path and C1X options using only the two environment variables MAXINE and GRAAL.
Thomas Wuerthinger <wuerthinger@ssw.jku.at>
parents:
1437
diff
changeset
|
2710 if (!os::getenv("GRAAL", graal_dir, sizeof(graal_dir))) { |
ba37b9335e1e
New option "-graal" that sets up the correct boot class path and C1X options using only the two environment variables MAXINE and GRAAL.
Thomas Wuerthinger <wuerthinger@ssw.jku.at>
parents:
1437
diff
changeset
|
2711 fatal("Must set GRAAL environment variable to a Graal project directory."); |
ba37b9335e1e
New option "-graal" that sets up the correct boot class path and C1X options using only the two environment variables MAXINE and GRAAL.
Thomas Wuerthinger <wuerthinger@ssw.jku.at>
parents:
1437
diff
changeset
|
2712 } |
ba37b9335e1e
New option "-graal" that sets up the correct boot class path and C1X options using only the two environment variables MAXINE and GRAAL.
Thomas Wuerthinger <wuerthinger@ssw.jku.at>
parents:
1437
diff
changeset
|
2713 if (PrintVMOptions) tty->print_cr(" GRAAL=%s", graal_dir); |
ba37b9335e1e
New option "-graal" that sets up the correct boot class path and C1X options using only the two environment variables MAXINE and GRAAL.
Thomas Wuerthinger <wuerthinger@ssw.jku.at>
parents:
1437
diff
changeset
|
2714 sprintf(temp, "%s/C1X/bin", maxine_dir); |
ba37b9335e1e
New option "-graal" that sets up the correct boot class path and C1X options using only the two environment variables MAXINE and GRAAL.
Thomas Wuerthinger <wuerthinger@ssw.jku.at>
parents:
1437
diff
changeset
|
2715 scp_p->add_prefix(temp); |
ba37b9335e1e
New option "-graal" that sets up the correct boot class path and C1X options using only the two environment variables MAXINE and GRAAL.
Thomas Wuerthinger <wuerthinger@ssw.jku.at>
parents:
1437
diff
changeset
|
2716 sprintf(temp, "%s/CRI/bin", maxine_dir); |
ba37b9335e1e
New option "-graal" that sets up the correct boot class path and C1X options using only the two environment variables MAXINE and GRAAL.
Thomas Wuerthinger <wuerthinger@ssw.jku.at>
parents:
1437
diff
changeset
|
2717 scp_p->add_prefix(temp); |
ba37b9335e1e
New option "-graal" that sets up the correct boot class path and C1X options using only the two environment variables MAXINE and GRAAL.
Thomas Wuerthinger <wuerthinger@ssw.jku.at>
parents:
1437
diff
changeset
|
2718 sprintf(temp, "%s/Base/bin", maxine_dir); |
ba37b9335e1e
New option "-graal" that sets up the correct boot class path and C1X options using only the two environment variables MAXINE and GRAAL.
Thomas Wuerthinger <wuerthinger@ssw.jku.at>
parents:
1437
diff
changeset
|
2719 scp_p->add_prefix(temp); |
ba37b9335e1e
New option "-graal" that sets up the correct boot class path and C1X options using only the two environment variables MAXINE and GRAAL.
Thomas Wuerthinger <wuerthinger@ssw.jku.at>
parents:
1437
diff
changeset
|
2720 sprintf(temp, "%s/Assembler/bin", maxine_dir); |
ba37b9335e1e
New option "-graal" that sets up the correct boot class path and C1X options using only the two environment variables MAXINE and GRAAL.
Thomas Wuerthinger <wuerthinger@ssw.jku.at>
parents:
1437
diff
changeset
|
2721 scp_p->add_prefix(temp); |
ba37b9335e1e
New option "-graal" that sets up the correct boot class path and C1X options using only the two environment variables MAXINE and GRAAL.
Thomas Wuerthinger <wuerthinger@ssw.jku.at>
parents:
1437
diff
changeset
|
2722 sprintf(temp, "%s/c1x4hotspotsrc/HotSpotVM/bin", graal_dir); |
ba37b9335e1e
New option "-graal" that sets up the correct boot class path and C1X options using only the two environment variables MAXINE and GRAAL.
Thomas Wuerthinger <wuerthinger@ssw.jku.at>
parents:
1437
diff
changeset
|
2723 scp_p->add_prefix(temp); |
ba37b9335e1e
New option "-graal" that sets up the correct boot class path and C1X options using only the two environment variables MAXINE and GRAAL.
Thomas Wuerthinger <wuerthinger@ssw.jku.at>
parents:
1437
diff
changeset
|
2724 *scp_assembly_required_p = true; |
1437
9e5e83ca2259
Enabled -C1X:OPTIONS when running HotSpot/C1X. Enabled checkstyle for the HotSpotVM Java project.
Thomas Wuerthinger <wuerthinger@ssw.jku.at>
parents:
1356
diff
changeset
|
2725 } else if (match_option(option, "-C1X:", &tail)) { // -C1X:xxxx |
9e5e83ca2259
Enabled -C1X:OPTIONS when running HotSpot/C1X. Enabled checkstyle for the HotSpotVM Java project.
Thomas Wuerthinger <wuerthinger@ssw.jku.at>
parents:
1356
diff
changeset
|
2726 // Option for the C1X compiler. |
9e5e83ca2259
Enabled -C1X:OPTIONS when running HotSpot/C1X. Enabled checkstyle for the HotSpotVM Java project.
Thomas Wuerthinger <wuerthinger@ssw.jku.at>
parents:
1356
diff
changeset
|
2727 if (PrintVMOptions) { |
9e5e83ca2259
Enabled -C1X:OPTIONS when running HotSpot/C1X. Enabled checkstyle for the HotSpotVM Java project.
Thomas Wuerthinger <wuerthinger@ssw.jku.at>
parents:
1356
diff
changeset
|
2728 tty->print_cr("C1X option %s", tail); |
9e5e83ca2259
Enabled -C1X:OPTIONS when running HotSpot/C1X. Enabled checkstyle for the HotSpotVM Java project.
Thomas Wuerthinger <wuerthinger@ssw.jku.at>
parents:
1356
diff
changeset
|
2729 } |
9e5e83ca2259
Enabled -C1X:OPTIONS when running HotSpot/C1X. Enabled checkstyle for the HotSpotVM Java project.
Thomas Wuerthinger <wuerthinger@ssw.jku.at>
parents:
1356
diff
changeset
|
2730 Arguments::add_c1x_arg(tail); |
9e5e83ca2259
Enabled -C1X:OPTIONS when running HotSpot/C1X. Enabled checkstyle for the HotSpotVM Java project.
Thomas Wuerthinger <wuerthinger@ssw.jku.at>
parents:
1356
diff
changeset
|
2731 |
0 | 2732 // Unknown option |
2733 } else if (is_bad_option(option, args->ignoreUnrecognized)) { | |
2734 return JNI_ERR; | |
2735 } | |
2736 } | |
449
171e581e8161
6554406: Change switch UseVMInterruptibleIO default to false (sol)
xlu
parents:
420
diff
changeset
|
2737 // Change the default value for flags which have different default values |
171e581e8161
6554406: Change switch UseVMInterruptibleIO default to false (sol)
xlu
parents:
420
diff
changeset
|
2738 // when working with older JDKs. |
171e581e8161
6554406: Change switch UseVMInterruptibleIO default to false (sol)
xlu
parents:
420
diff
changeset
|
2739 if (JDK_Version::current().compare_major(6) <= 0 && |
171e581e8161
6554406: Change switch UseVMInterruptibleIO default to false (sol)
xlu
parents:
420
diff
changeset
|
2740 FLAG_IS_DEFAULT(UseVMInterruptibleIO)) { |
171e581e8161
6554406: Change switch UseVMInterruptibleIO default to false (sol)
xlu
parents:
420
diff
changeset
|
2741 FLAG_SET_DEFAULT(UseVMInterruptibleIO, true); |
171e581e8161
6554406: Change switch UseVMInterruptibleIO default to false (sol)
xlu
parents:
420
diff
changeset
|
2742 } |
1679
3d90023429ec
6888526: Linux getCurrentThreadCpuTime is drastically slower than Windows
aph
parents:
1628
diff
changeset
|
2743 #ifdef LINUX |
3d90023429ec
6888526: Linux getCurrentThreadCpuTime is drastically slower than Windows
aph
parents:
1628
diff
changeset
|
2744 if (JDK_Version::current().compare_major(6) <= 0 && |
3d90023429ec
6888526: Linux getCurrentThreadCpuTime is drastically slower than Windows
aph
parents:
1628
diff
changeset
|
2745 FLAG_IS_DEFAULT(UseLinuxPosixThreadCPUClocks)) { |
3d90023429ec
6888526: Linux getCurrentThreadCpuTime is drastically slower than Windows
aph
parents:
1628
diff
changeset
|
2746 FLAG_SET_DEFAULT(UseLinuxPosixThreadCPUClocks, false); |
3d90023429ec
6888526: Linux getCurrentThreadCpuTime is drastically slower than Windows
aph
parents:
1628
diff
changeset
|
2747 } |
3d90023429ec
6888526: Linux getCurrentThreadCpuTime is drastically slower than Windows
aph
parents:
1628
diff
changeset
|
2748 #endif // LINUX |
0 | 2749 return JNI_OK; |
2750 } | |
2751 | |
2752 jint Arguments::finalize_vm_init_args(SysClassPath* scp_p, bool scp_assembly_required) { | |
2753 // This must be done after all -D arguments have been processed. | |
2754 scp_p->expand_endorsed(); | |
2755 | |
2756 if (scp_assembly_required || scp_p->get_endorsed() != NULL) { | |
2757 // Assemble the bootclasspath elements into the final path. | |
2758 Arguments::set_sysclasspath(scp_p->combined_path()); | |
2759 } | |
2760 | |
2761 // This must be done after all arguments have been processed. | |
2762 // java_compiler() true means set to "NONE" or empty. | |
2763 if (java_compiler() && !xdebug_mode()) { | |
2764 // For backwards compatibility, we switch to interpreted mode if | |
2765 // -Djava.compiler="NONE" or "" is specified AND "-Xdebug" was | |
2766 // not specified. | |
2767 set_mode_flags(_int); | |
2768 } | |
2769 if (CompileThreshold == 0) { | |
2770 set_mode_flags(_int); | |
2771 } | |
2772 | |
2773 #ifndef COMPILER2 | |
2774 // Don't degrade server performance for footprint | |
2775 if (FLAG_IS_DEFAULT(UseLargePages) && | |
2776 MaxHeapSize < LargePageHeapSizeThreshold) { | |
2777 // No need for large granularity pages w/small heaps. | |
2778 // Note that large pages are enabled/disabled for both the | |
2779 // Java heap and the code cache. | |
2780 FLAG_SET_DEFAULT(UseLargePages, false); | |
2781 SOLARIS_ONLY(FLAG_SET_DEFAULT(UseMPSS, false)); | |
2782 SOLARIS_ONLY(FLAG_SET_DEFAULT(UseISM, false)); | |
2783 } | |
342
37f87013dfd8
6711316: Open source the Garbage-First garbage collector
ysr
parents:
135
diff
changeset
|
2784 |
1251
576e77447e3c
6923002: assert(false,"this call site should not be polymorphic")
kvn
parents:
1188
diff
changeset
|
2785 // Tiered compilation is undefined with C1. |
576e77447e3c
6923002: assert(false,"this call site should not be polymorphic")
kvn
parents:
1188
diff
changeset
|
2786 TieredCompilation = false; |
0 | 2787 #else |
2788 if (!FLAG_IS_DEFAULT(OptoLoopAlignment) && FLAG_IS_DEFAULT(MaxLoopPad)) { | |
2789 FLAG_SET_DEFAULT(MaxLoopPad, OptoLoopAlignment-1); | |
2790 } | |
342
37f87013dfd8
6711316: Open source the Garbage-First garbage collector
ysr
parents:
135
diff
changeset
|
2791 // Temporary disable bulk zeroing reduction with G1. See CR 6627983. |
37f87013dfd8
6711316: Open source the Garbage-First garbage collector
ysr
parents:
135
diff
changeset
|
2792 if (UseG1GC) { |
37f87013dfd8
6711316: Open source the Garbage-First garbage collector
ysr
parents:
135
diff
changeset
|
2793 FLAG_SET_DEFAULT(ReduceBulkZeroing, false); |
37f87013dfd8
6711316: Open source the Garbage-First garbage collector
ysr
parents:
135
diff
changeset
|
2794 } |
0 | 2795 #endif |
2796 | |
1681
126ea7725993
6953477: Increase portability and flexibility of building Hotspot
bobv
parents:
1679
diff
changeset
|
2797 // If we are running in a headless jre, force java.awt.headless property |
126ea7725993
6953477: Increase portability and flexibility of building Hotspot
bobv
parents:
1679
diff
changeset
|
2798 // to be true unless the property has already been set. |
126ea7725993
6953477: Increase portability and flexibility of building Hotspot
bobv
parents:
1679
diff
changeset
|
2799 // Also allow the OS environment variable JAVA_AWT_HEADLESS to set headless state. |
126ea7725993
6953477: Increase portability and flexibility of building Hotspot
bobv
parents:
1679
diff
changeset
|
2800 if (os::is_headless_jre()) { |
126ea7725993
6953477: Increase portability and flexibility of building Hotspot
bobv
parents:
1679
diff
changeset
|
2801 const char* headless = Arguments::get_property("java.awt.headless"); |
126ea7725993
6953477: Increase portability and flexibility of building Hotspot
bobv
parents:
1679
diff
changeset
|
2802 if (headless == NULL) { |
126ea7725993
6953477: Increase portability and flexibility of building Hotspot
bobv
parents:
1679
diff
changeset
|
2803 char envbuffer[128]; |
126ea7725993
6953477: Increase portability and flexibility of building Hotspot
bobv
parents:
1679
diff
changeset
|
2804 if (!os::getenv("JAVA_AWT_HEADLESS", envbuffer, sizeof(envbuffer))) { |
126ea7725993
6953477: Increase portability and flexibility of building Hotspot
bobv
parents:
1679
diff
changeset
|
2805 if (!add_property("java.awt.headless=true")) { |
126ea7725993
6953477: Increase portability and flexibility of building Hotspot
bobv
parents:
1679
diff
changeset
|
2806 return JNI_ENOMEM; |
126ea7725993
6953477: Increase portability and flexibility of building Hotspot
bobv
parents:
1679
diff
changeset
|
2807 } |
126ea7725993
6953477: Increase portability and flexibility of building Hotspot
bobv
parents:
1679
diff
changeset
|
2808 } else { |
126ea7725993
6953477: Increase portability and flexibility of building Hotspot
bobv
parents:
1679
diff
changeset
|
2809 char buffer[256]; |
126ea7725993
6953477: Increase portability and flexibility of building Hotspot
bobv
parents:
1679
diff
changeset
|
2810 strcpy(buffer, "java.awt.headless="); |
126ea7725993
6953477: Increase portability and flexibility of building Hotspot
bobv
parents:
1679
diff
changeset
|
2811 strcat(buffer, envbuffer); |
126ea7725993
6953477: Increase portability and flexibility of building Hotspot
bobv
parents:
1679
diff
changeset
|
2812 if (!add_property(buffer)) { |
126ea7725993
6953477: Increase portability and flexibility of building Hotspot
bobv
parents:
1679
diff
changeset
|
2813 return JNI_ENOMEM; |
126ea7725993
6953477: Increase portability and flexibility of building Hotspot
bobv
parents:
1679
diff
changeset
|
2814 } |
126ea7725993
6953477: Increase portability and flexibility of building Hotspot
bobv
parents:
1679
diff
changeset
|
2815 } |
126ea7725993
6953477: Increase portability and flexibility of building Hotspot
bobv
parents:
1679
diff
changeset
|
2816 } |
126ea7725993
6953477: Increase portability and flexibility of building Hotspot
bobv
parents:
1679
diff
changeset
|
2817 } |
126ea7725993
6953477: Increase portability and flexibility of building Hotspot
bobv
parents:
1679
diff
changeset
|
2818 |
0 | 2819 if (!check_vm_args_consistency()) { |
2820 return JNI_ERR; | |
2821 } | |
2822 | |
2823 return JNI_OK; | |
2824 } | |
2825 | |
2826 jint Arguments::parse_java_options_environment_variable(SysClassPath* scp_p, bool* scp_assembly_required_p) { | |
2827 return parse_options_environment_variable("_JAVA_OPTIONS", scp_p, | |
2828 scp_assembly_required_p); | |
2829 } | |
2830 | |
2831 jint Arguments::parse_java_tool_options_environment_variable(SysClassPath* scp_p, bool* scp_assembly_required_p) { | |
2832 return parse_options_environment_variable("JAVA_TOOL_OPTIONS", scp_p, | |
2833 scp_assembly_required_p); | |
2834 } | |
2835 | |
2836 jint Arguments::parse_options_environment_variable(const char* name, SysClassPath* scp_p, bool* scp_assembly_required_p) { | |
2837 const int N_MAX_OPTIONS = 64; | |
2838 const int OPTION_BUFFER_SIZE = 1024; | |
2839 char buffer[OPTION_BUFFER_SIZE]; | |
2840 | |
2841 // The variable will be ignored if it exceeds the length of the buffer. | |
2842 // Don't check this variable if user has special privileges | |
2843 // (e.g. unix su command). | |
2844 if (os::getenv(name, buffer, sizeof(buffer)) && | |
2845 !os::have_special_privileges()) { | |
2846 JavaVMOption options[N_MAX_OPTIONS]; // Construct option array | |
2847 jio_fprintf(defaultStream::error_stream(), | |
2848 "Picked up %s: %s\n", name, buffer); | |
2849 char* rd = buffer; // pointer to the input string (rd) | |
2850 int i; | |
2851 for (i = 0; i < N_MAX_OPTIONS;) { // repeat for all options in the input string | |
2852 while (isspace(*rd)) rd++; // skip whitespace | |
2853 if (*rd == 0) break; // we re done when the input string is read completely | |
2854 | |
2855 // The output, option string, overwrites the input string. | |
2856 // Because of quoting, the pointer to the option string (wrt) may lag the pointer to | |
2857 // input string (rd). | |
2858 char* wrt = rd; | |
2859 | |
2860 options[i++].optionString = wrt; // Fill in option | |
2861 while (*rd != 0 && !isspace(*rd)) { // unquoted strings terminate with a space or NULL | |
2862 if (*rd == '\'' || *rd == '"') { // handle a quoted string | |
2863 int quote = *rd; // matching quote to look for | |
2864 rd++; // don't copy open quote | |
2865 while (*rd != quote) { // include everything (even spaces) up until quote | |
2866 if (*rd == 0) { // string termination means unmatched string | |
2867 jio_fprintf(defaultStream::error_stream(), | |
2868 "Unmatched quote in %s\n", name); | |
2869 return JNI_ERR; | |
2870 } | |
2871 *wrt++ = *rd++; // copy to option string | |
2872 } | |
2873 rd++; // don't copy close quote | |
2874 } else { | |
2875 *wrt++ = *rd++; // copy to option string | |
2876 } | |
2877 } | |
2878 // Need to check if we're done before writing a NULL, | |
2879 // because the write could be to the byte that rd is pointing to. | |
2880 if (*rd++ == 0) { | |
2881 *wrt = 0; | |
2882 break; | |
2883 } | |
2884 *wrt = 0; // Zero terminate option | |
2885 } | |
2886 // Construct JavaVMInitArgs structure and parse as if it was part of the command line | |
2887 JavaVMInitArgs vm_args; | |
2888 vm_args.version = JNI_VERSION_1_2; | |
2889 vm_args.options = options; | |
2890 vm_args.nOptions = i; | |
564 | 2891 vm_args.ignoreUnrecognized = IgnoreUnrecognizedVMOptions; |
0 | 2892 |
2893 if (PrintVMOptions) { | |
2894 const char* tail; | |
2895 for (int i = 0; i < vm_args.nOptions; i++) { | |
2896 const JavaVMOption *option = vm_args.options + i; | |
2897 if (match_option(option, "-XX:", &tail)) { | |
2898 logOption(tail); | |
2899 } | |
2900 } | |
2901 } | |
2902 | |
2903 return(parse_each_vm_init_arg(&vm_args, scp_p, scp_assembly_required_p, ENVIRON_VAR)); | |
2904 } | |
2905 return JNI_OK; | |
2906 } | |
2907 | |
1891
9de67bf4244d
6996136: VM crash in src/share/vm/runtime/virtualspace.cpp:424
iveresov
parents:
1890
diff
changeset
|
2908 |
0 | 2909 // Parse entry point called from JNI_CreateJavaVM |
2910 | |
2911 jint Arguments::parse(const JavaVMInitArgs* args) { | |
2912 | |
2913 // Sharing support | |
2914 // Construct the path to the archive | |
2915 char jvm_path[JVM_MAXPATHLEN]; | |
2916 os::jvm_path(jvm_path, sizeof(jvm_path)); | |
2917 #ifdef TIERED | |
2918 if (strstr(jvm_path, "client") != NULL) { | |
2919 force_client_mode = true; | |
2920 } | |
2921 #endif // TIERED | |
2922 char *end = strrchr(jvm_path, *os::file_separator()); | |
2923 if (end != NULL) *end = '\0'; | |
2924 char *shared_archive_path = NEW_C_HEAP_ARRAY(char, strlen(jvm_path) + | |
2925 strlen(os::file_separator()) + 20); | |
2926 if (shared_archive_path == NULL) return JNI_ENOMEM; | |
2927 strcpy(shared_archive_path, jvm_path); | |
2928 strcat(shared_archive_path, os::file_separator()); | |
2929 strcat(shared_archive_path, "classes"); | |
2930 DEBUG_ONLY(strcat(shared_archive_path, "_g");) | |
2931 strcat(shared_archive_path, ".jsa"); | |
2932 SharedArchivePath = shared_archive_path; | |
2933 | |
2934 // Remaining part of option string | |
2935 const char* tail; | |
2936 | |
2937 // If flag "-XX:Flags=flags-file" is used it will be the first option to be processed. | |
2938 bool settings_file_specified = false; | |
564 | 2939 const char* flags_file; |
0 | 2940 int index; |
2941 for (index = 0; index < args->nOptions; index++) { | |
2942 const JavaVMOption *option = args->options + index; | |
2943 if (match_option(option, "-XX:Flags=", &tail)) { | |
564 | 2944 flags_file = tail; |
0 | 2945 settings_file_specified = true; |
2946 } | |
2947 if (match_option(option, "-XX:+PrintVMOptions", &tail)) { | |
2948 PrintVMOptions = true; | |
2949 } | |
253
b0fe4deeb9fb
6726999: nsk/stress/jck12a/jck12a010 assert(n != null,"Bad immediate dominator info.")
kvn
parents:
196
diff
changeset
|
2950 if (match_option(option, "-XX:-PrintVMOptions", &tail)) { |
b0fe4deeb9fb
6726999: nsk/stress/jck12a/jck12a010 assert(n != null,"Bad immediate dominator info.")
kvn
parents:
196
diff
changeset
|
2951 PrintVMOptions = false; |
b0fe4deeb9fb
6726999: nsk/stress/jck12a/jck12a010 assert(n != null,"Bad immediate dominator info.")
kvn
parents:
196
diff
changeset
|
2952 } |
564 | 2953 if (match_option(option, "-XX:+IgnoreUnrecognizedVMOptions", &tail)) { |
2954 IgnoreUnrecognizedVMOptions = true; | |
2955 } | |
2956 if (match_option(option, "-XX:-IgnoreUnrecognizedVMOptions", &tail)) { | |
2957 IgnoreUnrecognizedVMOptions = false; | |
2958 } | |
1150 | 2959 if (match_option(option, "-XX:+PrintFlagsInitial", &tail)) { |
2960 CommandLineFlags::printFlags(); | |
2961 vm_exit(0); | |
2962 } | |
1768
6ee479178066
6979444: add command line option to print command line flags descriptions
ikrylov
parents:
1745
diff
changeset
|
2963 |
6ee479178066
6979444: add command line option to print command line flags descriptions
ikrylov
parents:
1745
diff
changeset
|
2964 #ifndef PRODUCT |
6ee479178066
6979444: add command line option to print command line flags descriptions
ikrylov
parents:
1745
diff
changeset
|
2965 if (match_option(option, "-XX:+PrintFlagsWithComments", &tail)) { |
6ee479178066
6979444: add command line option to print command line flags descriptions
ikrylov
parents:
1745
diff
changeset
|
2966 CommandLineFlags::printFlags(true); |
6ee479178066
6979444: add command line option to print command line flags descriptions
ikrylov
parents:
1745
diff
changeset
|
2967 vm_exit(0); |
6ee479178066
6979444: add command line option to print command line flags descriptions
ikrylov
parents:
1745
diff
changeset
|
2968 } |
6ee479178066
6979444: add command line option to print command line flags descriptions
ikrylov
parents:
1745
diff
changeset
|
2969 #endif |
564 | 2970 } |
2971 | |
2972 if (IgnoreUnrecognizedVMOptions) { | |
2973 // uncast const to modify the flag args->ignoreUnrecognized | |
2974 *(jboolean*)(&args->ignoreUnrecognized) = true; | |
2975 } | |
2976 | |
2977 // Parse specified settings file | |
2978 if (settings_file_specified) { | |
2979 if (!process_settings_file(flags_file, true, args->ignoreUnrecognized)) { | |
2980 return JNI_EINVAL; | |
2981 } | |
0 | 2982 } |
2983 | |
2984 // Parse default .hotspotrc settings file | |
2985 if (!settings_file_specified) { | |
2986 if (!process_settings_file(".hotspotrc", false, args->ignoreUnrecognized)) { | |
2987 return JNI_EINVAL; | |
2988 } | |
2989 } | |
2990 | |
2991 if (PrintVMOptions) { | |
2992 for (index = 0; index < args->nOptions; index++) { | |
2993 const JavaVMOption *option = args->options + index; | |
2994 if (match_option(option, "-XX:", &tail)) { | |
2995 logOption(tail); | |
2996 } | |
2997 } | |
2998 } | |
2999 | |
3000 // Parse JavaVMInitArgs structure passed in, as well as JAVA_TOOL_OPTIONS and _JAVA_OPTIONS | |
3001 jint result = parse_vm_init_args(args); | |
3002 if (result != JNI_OK) { | |
3003 return result; | |
3004 } | |
3005 | |
3006 #ifndef PRODUCT | |
3007 if (TraceBytecodesAt != 0) { | |
3008 TraceBytecodes = true; | |
3009 } | |
3010 if (CountCompiledCalls) { | |
3011 if (UseCounterDecay) { | |
3012 warning("UseCounterDecay disabled because CountCalls is set"); | |
3013 UseCounterDecay = false; | |
3014 } | |
3015 } | |
3016 #endif // PRODUCT | |
3017 | |
726
be93aad57795
6655646: dynamic languages need dynamically linked call sites
jrose
parents:
712
diff
changeset
|
3018 if (EnableInvokeDynamic && !EnableMethodHandles) { |
be93aad57795
6655646: dynamic languages need dynamically linked call sites
jrose
parents:
712
diff
changeset
|
3019 if (!FLAG_IS_DEFAULT(EnableMethodHandles)) { |
989
148e5441d916
6863023: need non-perm oops in code cache for JSR 292
jrose
parents:
932
diff
changeset
|
3020 warning("forcing EnableMethodHandles true because EnableInvokeDynamic is true"); |
726
be93aad57795
6655646: dynamic languages need dynamically linked call sites
jrose
parents:
712
diff
changeset
|
3021 } |
be93aad57795
6655646: dynamic languages need dynamically linked call sites
jrose
parents:
712
diff
changeset
|
3022 EnableMethodHandles = true; |
be93aad57795
6655646: dynamic languages need dynamically linked call sites
jrose
parents:
712
diff
changeset
|
3023 } |
710 | 3024 if (EnableMethodHandles && !AnonymousClasses) { |
3025 if (!FLAG_IS_DEFAULT(AnonymousClasses)) { | |
989
148e5441d916
6863023: need non-perm oops in code cache for JSR 292
jrose
parents:
932
diff
changeset
|
3026 warning("forcing AnonymousClasses true because EnableMethodHandles is true"); |
710 | 3027 } |
3028 AnonymousClasses = true; | |
3029 } | |
989
148e5441d916
6863023: need non-perm oops in code cache for JSR 292
jrose
parents:
932
diff
changeset
|
3030 if ((EnableMethodHandles || AnonymousClasses) && ScavengeRootsInCode == 0) { |
148e5441d916
6863023: need non-perm oops in code cache for JSR 292
jrose
parents:
932
diff
changeset
|
3031 if (!FLAG_IS_DEFAULT(ScavengeRootsInCode)) { |
148e5441d916
6863023: need non-perm oops in code cache for JSR 292
jrose
parents:
932
diff
changeset
|
3032 warning("forcing ScavengeRootsInCode non-zero because EnableMethodHandles or AnonymousClasses is true"); |
148e5441d916
6863023: need non-perm oops in code cache for JSR 292
jrose
parents:
932
diff
changeset
|
3033 } |
148e5441d916
6863023: need non-perm oops in code cache for JSR 292
jrose
parents:
932
diff
changeset
|
3034 ScavengeRootsInCode = 1; |
148e5441d916
6863023: need non-perm oops in code cache for JSR 292
jrose
parents:
932
diff
changeset
|
3035 } |
1135
e66fd840cb6b
6893081: method handle & invokedynamic code needs additional cleanup (post 6815692, 6858164)
twisti
parents:
1131
diff
changeset
|
3036 #ifdef COMPILER2 |
e66fd840cb6b
6893081: method handle & invokedynamic code needs additional cleanup (post 6815692, 6858164)
twisti
parents:
1131
diff
changeset
|
3037 if (EnableInvokeDynamic && DoEscapeAnalysis) { |
e66fd840cb6b
6893081: method handle & invokedynamic code needs additional cleanup (post 6815692, 6858164)
twisti
parents:
1131
diff
changeset
|
3038 // TODO: We need to find rules for invokedynamic and EA. For now, |
e66fd840cb6b
6893081: method handle & invokedynamic code needs additional cleanup (post 6815692, 6858164)
twisti
parents:
1131
diff
changeset
|
3039 // simply disable EA by default. |
e66fd840cb6b
6893081: method handle & invokedynamic code needs additional cleanup (post 6815692, 6858164)
twisti
parents:
1131
diff
changeset
|
3040 if (FLAG_IS_DEFAULT(DoEscapeAnalysis)) { |
e66fd840cb6b
6893081: method handle & invokedynamic code needs additional cleanup (post 6815692, 6858164)
twisti
parents:
1131
diff
changeset
|
3041 DoEscapeAnalysis = false; |
e66fd840cb6b
6893081: method handle & invokedynamic code needs additional cleanup (post 6815692, 6858164)
twisti
parents:
1131
diff
changeset
|
3042 } |
e66fd840cb6b
6893081: method handle & invokedynamic code needs additional cleanup (post 6815692, 6858164)
twisti
parents:
1131
diff
changeset
|
3043 } |
e66fd840cb6b
6893081: method handle & invokedynamic code needs additional cleanup (post 6815692, 6858164)
twisti
parents:
1131
diff
changeset
|
3044 #endif |
710 | 3045 |
0 | 3046 if (PrintGCDetails) { |
3047 // Turn on -verbose:gc options as well | |
3048 PrintGC = true; | |
3049 } | |
3050 | |
1571
2d127394260e
6916623: Align object to 16 bytes to use Compressed Oops with java heap up to 64Gb
kvn
parents:
1506
diff
changeset
|
3051 // Set object alignment values. |
2d127394260e
6916623: Align object to 16 bytes to use Compressed Oops with java heap up to 64Gb
kvn
parents:
1506
diff
changeset
|
3052 set_object_alignment(); |
2d127394260e
6916623: Align object to 16 bytes to use Compressed Oops with java heap up to 64Gb
kvn
parents:
1506
diff
changeset
|
3053 |
0 | 3054 #ifdef SERIALGC |
1064 | 3055 force_serial_gc(); |
0 | 3056 #endif // SERIALGC |
3057 #ifdef KERNEL | |
3058 no_shared_spaces(); | |
3059 #endif // KERNEL | |
3060 | |
3061 // Set flags based on ergonomics. | |
3062 set_ergonomics_flags(); | |
3063 | |
1135
e66fd840cb6b
6893081: method handle & invokedynamic code needs additional cleanup (post 6815692, 6858164)
twisti
parents:
1131
diff
changeset
|
3064 #ifdef _LP64 |
1891
9de67bf4244d
6996136: VM crash in src/share/vm/runtime/virtualspace.cpp:424
iveresov
parents:
1890
diff
changeset
|
3065 if (UseCompressedOops) { |
9de67bf4244d
6996136: VM crash in src/share/vm/runtime/virtualspace.cpp:424
iveresov
parents:
1890
diff
changeset
|
3066 check_compressed_oops_compat(); |
1135
e66fd840cb6b
6893081: method handle & invokedynamic code needs additional cleanup (post 6815692, 6858164)
twisti
parents:
1131
diff
changeset
|
3067 } |
1891
9de67bf4244d
6996136: VM crash in src/share/vm/runtime/virtualspace.cpp:424
iveresov
parents:
1890
diff
changeset
|
3068 #endif |
1135
e66fd840cb6b
6893081: method handle & invokedynamic code needs additional cleanup (post 6815692, 6858164)
twisti
parents:
1131
diff
changeset
|
3069 |
10
28372612af5e
6362677: Change parallel GC collector default number of parallel GC threads.
jmasa
parents:
0
diff
changeset
|
3070 // Check the GC selections again. |
28372612af5e
6362677: Change parallel GC collector default number of parallel GC threads.
jmasa
parents:
0
diff
changeset
|
3071 if (!check_gc_consistency()) { |
28372612af5e
6362677: Change parallel GC collector default number of parallel GC threads.
jmasa
parents:
0
diff
changeset
|
3072 return JNI_EINVAL; |
28372612af5e
6362677: Change parallel GC collector default number of parallel GC threads.
jmasa
parents:
0
diff
changeset
|
3073 } |
28372612af5e
6362677: Change parallel GC collector default number of parallel GC threads.
jmasa
parents:
0
diff
changeset
|
3074 |
1783 | 3075 if (TieredCompilation) { |
3076 set_tiered_flags(); | |
3077 } else { | |
3078 // Check if the policy is valid. Policies 0 and 1 are valid for non-tiered setup. | |
3079 if (CompilationPolicyChoice >= 2) { | |
3080 vm_exit_during_initialization( | |
3081 "Incompatible compilation policy selected", NULL); | |
3082 } | |
3083 } | |
3084 | |
1145
e018e6884bd8
6631166: CMS: better heuristics when combatting fragmentation
ysr
parents:
1074
diff
changeset
|
3085 #ifndef KERNEL |
1064 | 3086 if (UseConcMarkSweepGC) { |
3087 // Set flags for CMS and ParNew. Check UseConcMarkSweep first | |
3088 // to ensure that when both UseConcMarkSweepGC and UseParNewGC | |
3089 // are true, we don't call set_parnew_gc_flags() as well. | |
10
28372612af5e
6362677: Change parallel GC collector default number of parallel GC threads.
jmasa
parents:
0
diff
changeset
|
3090 set_cms_and_parnew_gc_flags(); |
1064 | 3091 } else { |
3092 // Set heap size based on available physical memory | |
3093 set_heap_size(); | |
3094 // Set per-collector flags | |
3095 if (UseParallelGC || UseParallelOldGC) { | |
3096 set_parallel_gc_flags(); | |
3097 } else if (UseParNewGC) { | |
3098 set_parnew_gc_flags(); | |
3099 } else if (UseG1GC) { | |
3100 set_g1_gc_flags(); | |
3101 } | |
342
37f87013dfd8
6711316: Open source the Garbage-First garbage collector
ysr
parents:
135
diff
changeset
|
3102 } |
1145
e018e6884bd8
6631166: CMS: better heuristics when combatting fragmentation
ysr
parents:
1074
diff
changeset
|
3103 #endif // KERNEL |
10
28372612af5e
6362677: Change parallel GC collector default number of parallel GC threads.
jmasa
parents:
0
diff
changeset
|
3104 |
0 | 3105 #ifdef SERIALGC |
3106 assert(verify_serial_gc_flags(), "SerialGC unset"); | |
3107 #endif // SERIALGC | |
3108 | |
3109 // Set bytecode rewriting flags | |
3110 set_bytecode_flags(); | |
3111 | |
3112 // Set flags if Aggressive optimization flags (-XX:+AggressiveOpts) enabled. | |
3113 set_aggressive_opts_flags(); | |
3114 | |
3115 #ifdef CC_INTERP | |
1131 | 3116 // Clear flags not supported by the C++ interpreter |
3117 FLAG_SET_DEFAULT(ProfileInterpreter, false); | |
0 | 3118 FLAG_SET_DEFAULT(UseBiasedLocking, false); |
1131 | 3119 LP64_ONLY(FLAG_SET_DEFAULT(UseCompressedOops, false)); |
3120 #endif // CC_INTERP | |
3121 | |
420
a1980da045cc
6462850: generate biased locking code in C2 ideal graph
kvn
parents:
416
diff
changeset
|
3122 #ifdef COMPILER2 |
a1980da045cc
6462850: generate biased locking code in C2 ideal graph
kvn
parents:
416
diff
changeset
|
3123 if (!UseBiasedLocking || EmitSync != 0) { |
a1980da045cc
6462850: generate biased locking code in C2 ideal graph
kvn
parents:
416
diff
changeset
|
3124 UseOptoBiasInlining = false; |
a1980da045cc
6462850: generate biased locking code in C2 ideal graph
kvn
parents:
416
diff
changeset
|
3125 } |
a1980da045cc
6462850: generate biased locking code in C2 ideal graph
kvn
parents:
416
diff
changeset
|
3126 #endif |
a1980da045cc
6462850: generate biased locking code in C2 ideal graph
kvn
parents:
416
diff
changeset
|
3127 |
1155
4e6abf09f540
6912062: disassembler plugin needs to produce symbolic information in product mode
jrose
parents:
1150
diff
changeset
|
3128 if (PrintAssembly && FLAG_IS_DEFAULT(DebugNonSafepoints)) { |
4e6abf09f540
6912062: disassembler plugin needs to produce symbolic information in product mode
jrose
parents:
1150
diff
changeset
|
3129 warning("PrintAssembly is enabled; turning on DebugNonSafepoints to gain additional output"); |
4e6abf09f540
6912062: disassembler plugin needs to produce symbolic information in product mode
jrose
parents:
1150
diff
changeset
|
3130 DebugNonSafepoints = true; |
4e6abf09f540
6912062: disassembler plugin needs to produce symbolic information in product mode
jrose
parents:
1150
diff
changeset
|
3131 } |
4e6abf09f540
6912062: disassembler plugin needs to produce symbolic information in product mode
jrose
parents:
1150
diff
changeset
|
3132 |
1188
99af867dfa05
6919886: Sweep CodeCache more aggressively to reduce its usage for CompileTheWorld
kvn
parents:
1161
diff
changeset
|
3133 #ifndef PRODUCT |
99af867dfa05
6919886: Sweep CodeCache more aggressively to reduce its usage for CompileTheWorld
kvn
parents:
1161
diff
changeset
|
3134 if (CompileTheWorld) { |
99af867dfa05
6919886: Sweep CodeCache more aggressively to reduce its usage for CompileTheWorld
kvn
parents:
1161
diff
changeset
|
3135 // Force NmethodSweeper to sweep whole CodeCache each time. |
99af867dfa05
6919886: Sweep CodeCache more aggressively to reduce its usage for CompileTheWorld
kvn
parents:
1161
diff
changeset
|
3136 if (FLAG_IS_DEFAULT(NmethodSweepFraction)) { |
99af867dfa05
6919886: Sweep CodeCache more aggressively to reduce its usage for CompileTheWorld
kvn
parents:
1161
diff
changeset
|
3137 NmethodSweepFraction = 1; |
99af867dfa05
6919886: Sweep CodeCache more aggressively to reduce its usage for CompileTheWorld
kvn
parents:
1161
diff
changeset
|
3138 } |
99af867dfa05
6919886: Sweep CodeCache more aggressively to reduce its usage for CompileTheWorld
kvn
parents:
1161
diff
changeset
|
3139 } |
99af867dfa05
6919886: Sweep CodeCache more aggressively to reduce its usage for CompileTheWorld
kvn
parents:
1161
diff
changeset
|
3140 #endif |
99af867dfa05
6919886: Sweep CodeCache more aggressively to reduce its usage for CompileTheWorld
kvn
parents:
1161
diff
changeset
|
3141 |
0 | 3142 if (PrintCommandLineFlags) { |
3143 CommandLineFlags::printSetFlags(); | |
3144 } | |
3145 | |
1681
126ea7725993
6953477: Increase portability and flexibility of building Hotspot
bobv
parents:
1679
diff
changeset
|
3146 // Apply CPU specific policy for the BiasedLocking |
126ea7725993
6953477: Increase portability and flexibility of building Hotspot
bobv
parents:
1679
diff
changeset
|
3147 if (UseBiasedLocking) { |
126ea7725993
6953477: Increase portability and flexibility of building Hotspot
bobv
parents:
1679
diff
changeset
|
3148 if (!VM_Version::use_biased_locking() && |
126ea7725993
6953477: Increase portability and flexibility of building Hotspot
bobv
parents:
1679
diff
changeset
|
3149 !(FLAG_IS_CMDLINE(UseBiasedLocking))) { |
126ea7725993
6953477: Increase portability and flexibility of building Hotspot
bobv
parents:
1679
diff
changeset
|
3150 UseBiasedLocking = false; |
126ea7725993
6953477: Increase portability and flexibility of building Hotspot
bobv
parents:
1679
diff
changeset
|
3151 } |
126ea7725993
6953477: Increase portability and flexibility of building Hotspot
bobv
parents:
1679
diff
changeset
|
3152 } |
126ea7725993
6953477: Increase portability and flexibility of building Hotspot
bobv
parents:
1679
diff
changeset
|
3153 |
0 | 3154 return JNI_OK; |
3155 } | |
3156 | |
3157 int Arguments::PropertyList_count(SystemProperty* pl) { | |
3158 int count = 0; | |
3159 while(pl != NULL) { | |
3160 count++; | |
3161 pl = pl->next(); | |
3162 } | |
3163 return count; | |
3164 } | |
3165 | |
3166 const char* Arguments::PropertyList_get_value(SystemProperty *pl, const char* key) { | |
3167 assert(key != NULL, "just checking"); | |
3168 SystemProperty* prop; | |
3169 for (prop = pl; prop != NULL; prop = prop->next()) { | |
3170 if (strcmp(key, prop->key()) == 0) return prop->value(); | |
3171 } | |
3172 return NULL; | |
3173 } | |
3174 | |
3175 const char* Arguments::PropertyList_get_key_at(SystemProperty *pl, int index) { | |
3176 int count = 0; | |
3177 const char* ret_val = NULL; | |
3178 | |
3179 while(pl != NULL) { | |
3180 if(count >= index) { | |
3181 ret_val = pl->key(); | |
3182 break; | |
3183 } | |
3184 count++; | |
3185 pl = pl->next(); | |
3186 } | |
3187 | |
3188 return ret_val; | |
3189 } | |
3190 | |
3191 char* Arguments::PropertyList_get_value_at(SystemProperty* pl, int index) { | |
3192 int count = 0; | |
3193 char* ret_val = NULL; | |
3194 | |
3195 while(pl != NULL) { | |
3196 if(count >= index) { | |
3197 ret_val = pl->value(); | |
3198 break; | |
3199 } | |
3200 count++; | |
3201 pl = pl->next(); | |
3202 } | |
3203 | |
3204 return ret_val; | |
3205 } | |
3206 | |
3207 void Arguments::PropertyList_add(SystemProperty** plist, SystemProperty *new_p) { | |
3208 SystemProperty* p = *plist; | |
3209 if (p == NULL) { | |
3210 *plist = new_p; | |
3211 } else { | |
3212 while (p->next() != NULL) { | |
3213 p = p->next(); | |
3214 } | |
3215 p->set_next(new_p); | |
3216 } | |
3217 } | |
3218 | |
3219 void Arguments::PropertyList_add(SystemProperty** plist, const char* k, char* v) { | |
3220 if (plist == NULL) | |
3221 return; | |
3222 | |
3223 SystemProperty* new_p = new SystemProperty(k, v, true); | |
3224 PropertyList_add(plist, new_p); | |
3225 } | |
3226 | |
3227 // This add maintains unique property key in the list. | |
691 | 3228 void Arguments::PropertyList_unique_add(SystemProperty** plist, const char* k, char* v, jboolean append) { |
0 | 3229 if (plist == NULL) |
3230 return; | |
3231 | |
3232 // If property key exist then update with new value. | |
3233 SystemProperty* prop; | |
3234 for (prop = *plist; prop != NULL; prop = prop->next()) { | |
3235 if (strcmp(k, prop->key()) == 0) { | |
691 | 3236 if (append) { |
3237 prop->append_value(v); | |
3238 } else { | |
3239 prop->set_value(v); | |
3240 } | |
0 | 3241 return; |
3242 } | |
3243 } | |
3244 | |
3245 PropertyList_add(plist, k, v); | |
3246 } | |
3247 | |
3248 #ifdef KERNEL | |
3249 char *Arguments::get_kernel_properties() { | |
3250 // Find properties starting with kernel and append them to string | |
3251 // We need to find out how long they are first because the URL's that they | |
3252 // might point to could get long. | |
3253 int length = 0; | |
3254 SystemProperty* prop; | |
3255 for (prop = _system_properties; prop != NULL; prop = prop->next()) { | |
3256 if (strncmp(prop->key(), "kernel.", 7 ) == 0) { | |
3257 length += (strlen(prop->key()) + strlen(prop->value()) + 5); // "-D =" | |
3258 } | |
3259 } | |
3260 // Add one for null terminator. | |
3261 char *props = AllocateHeap(length + 1, "get_kernel_properties"); | |
3262 if (length != 0) { | |
3263 int pos = 0; | |
3264 for (prop = _system_properties; prop != NULL; prop = prop->next()) { | |
3265 if (strncmp(prop->key(), "kernel.", 7 ) == 0) { | |
3266 jio_snprintf(&props[pos], length-pos, | |
3267 "-D%s=%s ", prop->key(), prop->value()); | |
3268 pos = strlen(props); | |
3269 } | |
3270 } | |
3271 } | |
3272 // null terminate props in case of null | |
3273 props[length] = '\0'; | |
3274 return props; | |
3275 } | |
3276 #endif // KERNEL | |
3277 | |
3278 // Copies src into buf, replacing "%%" with "%" and "%p" with pid | |
3279 // Returns true if all of the source pointed by src has been copied over to | |
3280 // the destination buffer pointed by buf. Otherwise, returns false. | |
3281 // Notes: | |
3282 // 1. If the length (buflen) of the destination buffer excluding the | |
3283 // NULL terminator character is not long enough for holding the expanded | |
3284 // pid characters, it also returns false instead of returning the partially | |
3285 // expanded one. | |
3286 // 2. The passed in "buflen" should be large enough to hold the null terminator. | |
3287 bool Arguments::copy_expand_pid(const char* src, size_t srclen, | |
3288 char* buf, size_t buflen) { | |
3289 const char* p = src; | |
3290 char* b = buf; | |
3291 const char* src_end = &src[srclen]; | |
3292 char* buf_end = &buf[buflen - 1]; | |
3293 | |
3294 while (p < src_end && b < buf_end) { | |
3295 if (*p == '%') { | |
3296 switch (*(++p)) { | |
3297 case '%': // "%%" ==> "%" | |
3298 *b++ = *p++; | |
3299 break; | |
3300 case 'p': { // "%p" ==> current process id | |
3301 // buf_end points to the character before the last character so | |
3302 // that we could write '\0' to the end of the buffer. | |
3303 size_t buf_sz = buf_end - b + 1; | |
3304 int ret = jio_snprintf(b, buf_sz, "%d", os::current_process_id()); | |
3305 | |
3306 // if jio_snprintf fails or the buffer is not long enough to hold | |
3307 // the expanded pid, returns false. | |
3308 if (ret < 0 || ret >= (int)buf_sz) { | |
3309 return false; | |
3310 } else { | |
3311 b += ret; | |
3312 assert(*b == '\0', "fail in copy_expand_pid"); | |
3313 if (p == src_end && b == buf_end + 1) { | |
3314 // reach the end of the buffer. | |
3315 return true; | |
3316 } | |
3317 } | |
3318 p++; | |
3319 break; | |
3320 } | |
3321 default : | |
3322 *b++ = '%'; | |
3323 } | |
3324 } else { | |
3325 *b++ = *p++; | |
3326 } | |
3327 } | |
3328 *b = '\0'; | |
3329 return (p == src_end); // return false if not all of the source was copied | |
3330 } |