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