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