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