Mercurial > hg > truffle
annotate src/share/vm/runtime/arguments.hpp @ 15694:7b999df1dabc
ensure Graal C++ shutdown routines are called exactly once during VM shutdown
author | Doug Simon <doug.simon@oracle.com> |
---|---|
date | Thu, 15 May 2014 22:43:44 +0200 |
parents | 289a017dd9e2 |
children | 52b4284cb496 |
rev | line source |
---|---|
0 | 1 /* |
7951 | 2 * Copyright (c) 1997, 2013, 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:
1284
diff
changeset
|
19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA |
c18cbe5936b8
6941466: Oracle rebranding changes for Hotspot repositories
trims
parents:
1284
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:
1284
diff
changeset
|
21 * questions. |
0 | 22 * |
23 */ | |
24 | |
1972 | 25 #ifndef SHARE_VM_RUNTIME_ARGUMENTS_HPP |
26 #define SHARE_VM_RUNTIME_ARGUMENTS_HPP | |
27 | |
28 #include "runtime/java.hpp" | |
29 #include "runtime/perfData.hpp" | |
30 #include "utilities/top.hpp" | |
31 | |
0 | 32 // Arguments parses the command line and recognizes options |
33 | |
34 // Invocation API hook typedefs (these should really be defined in jni.hpp) | |
35 extern "C" { | |
36 typedef void (JNICALL *abort_hook_t)(void); | |
37 typedef void (JNICALL *exit_hook_t)(jint code); | |
38 typedef jint (JNICALL *vfprintf_hook_t)(FILE *fp, const char *format, va_list args); | |
39 } | |
40 | |
41 // Forward declarations | |
42 | |
43 class SysClassPath; | |
44 | |
45 // Element describing System and User (-Dkey=value flags) defined property. | |
46 | |
6197 | 47 class SystemProperty: public CHeapObj<mtInternal> { |
0 | 48 private: |
49 char* _key; | |
50 char* _value; | |
51 SystemProperty* _next; | |
52 bool _writeable; | |
53 bool writeable() { return _writeable; } | |
54 | |
55 public: | |
56 // Accessors | |
57 const char* key() const { return _key; } | |
58 char* value() const { return _value; } | |
59 SystemProperty* next() const { return _next; } | |
60 void set_next(SystemProperty* next) { _next = next; } | |
61 bool set_value(char *value) { | |
62 if (writeable()) { | |
63 if (_value != NULL) { | |
64 FreeHeap(_value); | |
65 } | |
6197 | 66 _value = AllocateHeap(strlen(value)+1, mtInternal); |
0 | 67 if (_value != NULL) { |
68 strcpy(_value, value); | |
69 } | |
70 return true; | |
71 } | |
72 return false; | |
73 } | |
74 | |
75 void append_value(const char *value) { | |
76 char *sp; | |
77 size_t len = 0; | |
78 if (value != NULL) { | |
79 len = strlen(value); | |
80 if (_value != NULL) { | |
81 len += strlen(_value); | |
82 } | |
6197 | 83 sp = AllocateHeap(len+2, mtInternal); |
0 | 84 if (sp != NULL) { |
85 if (_value != NULL) { | |
86 strcpy(sp, _value); | |
87 strcat(sp, os::path_separator()); | |
88 strcat(sp, value); | |
89 FreeHeap(_value); | |
90 } else { | |
91 strcpy(sp, value); | |
92 } | |
93 _value = sp; | |
94 } | |
95 } | |
96 } | |
97 | |
98 // Constructor | |
99 SystemProperty(const char* key, const char* value, bool writeable) { | |
100 if (key == NULL) { | |
101 _key = NULL; | |
102 } else { | |
6197 | 103 _key = AllocateHeap(strlen(key)+1, mtInternal); |
0 | 104 strcpy(_key, key); |
105 } | |
106 if (value == NULL) { | |
107 _value = NULL; | |
108 } else { | |
6197 | 109 _value = AllocateHeap(strlen(value)+1, mtInternal); |
0 | 110 strcpy(_value, value); |
111 } | |
112 _next = NULL; | |
113 _writeable = writeable; | |
114 } | |
115 }; | |
116 | |
117 | |
118 // For use by -agentlib, -agentpath and -Xrun | |
6197 | 119 class AgentLibrary : public CHeapObj<mtInternal> { |
0 | 120 friend class AgentLibraryList; |
12117
f92b82d454fa
8014135: The JVMTI specification does not conform to recent changes in JNI specification
bpittore
parents:
12056
diff
changeset
|
121 public: |
f92b82d454fa
8014135: The JVMTI specification does not conform to recent changes in JNI specification
bpittore
parents:
12056
diff
changeset
|
122 // Is this library valid or not. Don't rely on os_lib == NULL as statically |
f92b82d454fa
8014135: The JVMTI specification does not conform to recent changes in JNI specification
bpittore
parents:
12056
diff
changeset
|
123 // linked lib could have handle of RTLD_DEFAULT which == 0 on some platforms |
f92b82d454fa
8014135: The JVMTI specification does not conform to recent changes in JNI specification
bpittore
parents:
12056
diff
changeset
|
124 enum AgentState { |
f92b82d454fa
8014135: The JVMTI specification does not conform to recent changes in JNI specification
bpittore
parents:
12056
diff
changeset
|
125 agent_invalid = 0, |
f92b82d454fa
8014135: The JVMTI specification does not conform to recent changes in JNI specification
bpittore
parents:
12056
diff
changeset
|
126 agent_valid = 1 |
f92b82d454fa
8014135: The JVMTI specification does not conform to recent changes in JNI specification
bpittore
parents:
12056
diff
changeset
|
127 }; |
f92b82d454fa
8014135: The JVMTI specification does not conform to recent changes in JNI specification
bpittore
parents:
12056
diff
changeset
|
128 |
0 | 129 private: |
130 char* _name; | |
131 char* _options; | |
132 void* _os_lib; | |
133 bool _is_absolute_path; | |
12117
f92b82d454fa
8014135: The JVMTI specification does not conform to recent changes in JNI specification
bpittore
parents:
12056
diff
changeset
|
134 bool _is_static_lib; |
f92b82d454fa
8014135: The JVMTI specification does not conform to recent changes in JNI specification
bpittore
parents:
12056
diff
changeset
|
135 AgentState _state; |
0 | 136 AgentLibrary* _next; |
137 | |
138 public: | |
139 // Accessors | |
140 const char* name() const { return _name; } | |
141 char* options() const { return _options; } | |
142 bool is_absolute_path() const { return _is_absolute_path; } | |
143 void* os_lib() const { return _os_lib; } | |
144 void set_os_lib(void* os_lib) { _os_lib = os_lib; } | |
145 AgentLibrary* next() const { return _next; } | |
12117
f92b82d454fa
8014135: The JVMTI specification does not conform to recent changes in JNI specification
bpittore
parents:
12056
diff
changeset
|
146 bool is_static_lib() const { return _is_static_lib; } |
12220 | 147 void set_static_lib(bool is_static_lib) { _is_static_lib = is_static_lib; } |
12117
f92b82d454fa
8014135: The JVMTI specification does not conform to recent changes in JNI specification
bpittore
parents:
12056
diff
changeset
|
148 bool valid() { return (_state == agent_valid); } |
f92b82d454fa
8014135: The JVMTI specification does not conform to recent changes in JNI specification
bpittore
parents:
12056
diff
changeset
|
149 void set_valid() { _state = agent_valid; } |
f92b82d454fa
8014135: The JVMTI specification does not conform to recent changes in JNI specification
bpittore
parents:
12056
diff
changeset
|
150 void set_invalid() { _state = agent_invalid; } |
0 | 151 |
152 // Constructor | |
153 AgentLibrary(const char* name, const char* options, bool is_absolute_path, void* os_lib) { | |
6197 | 154 _name = AllocateHeap(strlen(name)+1, mtInternal); |
0 | 155 strcpy(_name, name); |
156 if (options == NULL) { | |
157 _options = NULL; | |
158 } else { | |
6197 | 159 _options = AllocateHeap(strlen(options)+1, mtInternal); |
0 | 160 strcpy(_options, options); |
161 } | |
162 _is_absolute_path = is_absolute_path; | |
163 _os_lib = os_lib; | |
164 _next = NULL; | |
12117
f92b82d454fa
8014135: The JVMTI specification does not conform to recent changes in JNI specification
bpittore
parents:
12056
diff
changeset
|
165 _state = agent_invalid; |
f92b82d454fa
8014135: The JVMTI specification does not conform to recent changes in JNI specification
bpittore
parents:
12056
diff
changeset
|
166 _is_static_lib = false; |
0 | 167 } |
168 }; | |
169 | |
170 // maintain an order of entry list of AgentLibrary | |
171 class AgentLibraryList VALUE_OBJ_CLASS_SPEC { | |
172 private: | |
173 AgentLibrary* _first; | |
174 AgentLibrary* _last; | |
175 public: | |
176 bool is_empty() const { return _first == NULL; } | |
177 AgentLibrary* first() const { return _first; } | |
178 | |
179 // add to the end of the list | |
180 void add(AgentLibrary* lib) { | |
181 if (is_empty()) { | |
182 _first = _last = lib; | |
183 } else { | |
184 _last->_next = lib; | |
185 _last = lib; | |
186 } | |
187 lib->_next = NULL; | |
188 } | |
189 | |
190 // search for and remove a library known to be in the list | |
191 void remove(AgentLibrary* lib) { | |
192 AgentLibrary* curr; | |
193 AgentLibrary* prev = NULL; | |
194 for (curr = first(); curr != NULL; prev = curr, curr = curr->next()) { | |
195 if (curr == lib) { | |
196 break; | |
197 } | |
198 } | |
199 assert(curr != NULL, "always should be found"); | |
200 | |
201 if (curr != NULL) { | |
202 // it was found, by-pass this library | |
203 if (prev == NULL) { | |
204 _first = curr->_next; | |
205 } else { | |
206 prev->_next = curr->_next; | |
207 } | |
208 if (curr == _last) { | |
209 _last = prev; | |
210 } | |
211 curr->_next = NULL; | |
212 } | |
213 } | |
214 | |
215 AgentLibraryList() { | |
216 _first = NULL; | |
217 _last = NULL; | |
218 } | |
219 }; | |
220 | |
221 | |
222 class Arguments : AllStatic { | |
223 friend class VMStructs; | |
224 friend class JvmtiExport; | |
225 public: | |
226 // Operation modi | |
227 enum Mode { | |
228 _int, // corresponds to -Xint | |
229 _mixed, // corresponds to -Xmixed | |
230 _comp // corresponds to -Xcomp | |
231 }; | |
232 | |
233 enum ArgsRange { | |
234 arg_unreadable = -3, | |
235 arg_too_small = -2, | |
236 arg_too_big = -1, | |
237 arg_in_range = 0 | |
238 }; | |
239 | |
240 private: | |
241 | |
242 // an array containing all flags specified in the .hotspotrc file | |
243 static char** _jvm_flags_array; | |
244 static int _num_jvm_flags; | |
245 // an array containing all jvm arguments specified in the command line | |
246 static char** _jvm_args_array; | |
247 static int _num_jvm_args; | |
4657
d4e039a3e083
Print java.exe when execuing "mx vm"
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
4559
diff
changeset
|
248 #ifdef GRAAL |
7125
1baf7f1e3f23
decoupled C++ Graal runtime from C1
Doug Simon <doug.simon@oracle.com>
parents:
6948
diff
changeset
|
249 // an array containing all Graal arguments specified in the command line |
2891
75a99b4f1c98
Rebranded C++ part from C1X to Graal.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
2491
diff
changeset
|
250 static char** _graal_args_array; |
75a99b4f1c98
Rebranded C++ part from C1X to Graal.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
2491
diff
changeset
|
251 static int _num_graal_args; |
4657
d4e039a3e083
Print java.exe when execuing "mx vm"
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
4559
diff
changeset
|
252 #endif |
0 | 253 // string containing all java command (class/jarfile name and app args) |
254 static char* _java_command; | |
255 | |
256 // Property list | |
257 static SystemProperty* _system_properties; | |
258 | |
259 // Quick accessor to System properties in the list: | |
260 static SystemProperty *_java_ext_dirs; | |
261 static SystemProperty *_java_endorsed_dirs; | |
262 static SystemProperty *_sun_boot_library_path; | |
263 static SystemProperty *_java_library_path; | |
264 static SystemProperty *_java_home; | |
265 static SystemProperty *_java_class_path; | |
266 static SystemProperty *_sun_boot_class_path; | |
267 | |
268 // Meta-index for knowing what packages are in the boot class path | |
269 static char* _meta_index_path; | |
270 static char* _meta_index_dir; | |
271 | |
272 // java.vendor.url.bug, bug reporting URL for fatal errors. | |
273 static const char* _java_vendor_url_bug; | |
274 | |
275 // sun.java.launcher, private property to provide information about | |
14909 | 276 // java/gamma launcher |
0 | 277 static const char* _sun_java_launcher; |
278 | |
279 // sun.java.launcher.pid, private property | |
280 static int _sun_java_launcher_pid; | |
281 | |
14909 | 282 // was this VM created by the gamma launcher |
283 static bool _created_by_gamma_launcher; | |
2302
da091bb67459
7022037: Pause when exiting if debugger is attached on windows
sla
parents:
1972
diff
changeset
|
284 |
0 | 285 // Option flags |
286 static bool _has_profile; | |
287 static const char* _gc_log_filename; | |
12233
40136aa2cdb1
8010722: assert: failed: heap size is too big for compressed oops
tschatzl
parents:
12182
diff
changeset
|
288 // Value of the conservative maximum heap alignment needed |
40136aa2cdb1
8010722: assert: failed: heap size is too big for compressed oops
tschatzl
parents:
12182
diff
changeset
|
289 static size_t _conservative_max_heap_alignment; |
40136aa2cdb1
8010722: assert: failed: heap size is too big for compressed oops
tschatzl
parents:
12182
diff
changeset
|
290 |
0 | 291 static uintx _min_heap_size; |
292 | |
293 // -Xrun arguments | |
294 static AgentLibraryList _libraryList; | |
295 static void add_init_library(const char* name, char* options) | |
296 { _libraryList.add(new AgentLibrary(name, options, false, NULL)); } | |
297 | |
298 // -agentlib and -agentpath arguments | |
299 static AgentLibraryList _agentList; | |
300 static void add_init_agent(const char* name, char* options, bool absolute_path) | |
301 { _agentList.add(new AgentLibrary(name, options, absolute_path, NULL)); } | |
302 | |
303 // Late-binding agents not started via arguments | |
12117
f92b82d454fa
8014135: The JVMTI specification does not conform to recent changes in JNI specification
bpittore
parents:
12056
diff
changeset
|
304 static void add_loaded_agent(AgentLibrary *agentLib) |
f92b82d454fa
8014135: The JVMTI specification does not conform to recent changes in JNI specification
bpittore
parents:
12056
diff
changeset
|
305 { _agentList.add(agentLib); } |
0 | 306 static void add_loaded_agent(const char* name, char* options, bool absolute_path, void* os_lib) |
307 { _agentList.add(new AgentLibrary(name, options, absolute_path, os_lib)); } | |
308 | |
309 // Operation modi | |
310 static Mode _mode; | |
311 static void set_mode_flags(Mode mode); | |
312 static bool _java_compiler; | |
313 static void set_java_compiler(bool arg) { _java_compiler = arg; } | |
314 static bool java_compiler() { return _java_compiler; } | |
315 | |
316 // -Xdebug flag | |
317 static bool _xdebug_mode; | |
318 static void set_xdebug_mode(bool arg) { _xdebug_mode = arg; } | |
319 static bool xdebug_mode() { return _xdebug_mode; } | |
320 | |
321 // Used to save default settings | |
322 static bool _AlwaysCompileLoopMethods; | |
323 static bool _UseOnStackReplacement; | |
324 static bool _BackgroundCompilation; | |
325 static bool _ClipInlining; | |
326 static bool _CIDynamicCompilePriority; | |
327 | |
1783 | 328 // Tiered |
329 static void set_tiered_flags(); | |
0 | 330 // CMS/ParNew garbage collectors |
331 static void set_parnew_gc_flags(); | |
332 static void set_cms_and_parnew_gc_flags(); | |
342
37f87013dfd8
6711316: Open source the Garbage-First garbage collector
ysr
parents:
10
diff
changeset
|
333 // UseParallel[Old]GC |
0 | 334 static void set_parallel_gc_flags(); |
342
37f87013dfd8
6711316: Open source the Garbage-First garbage collector
ysr
parents:
10
diff
changeset
|
335 // Garbage-First (UseG1GC) |
37f87013dfd8
6711316: Open source the Garbage-First garbage collector
ysr
parents:
10
diff
changeset
|
336 static void set_g1_gc_flags(); |
0 | 337 // GC ergonomics |
12233
40136aa2cdb1
8010722: assert: failed: heap size is too big for compressed oops
tschatzl
parents:
12182
diff
changeset
|
338 static void set_conservative_max_heap_alignment(); |
8741
eac371996b44
8001049: VM crashes when running with large -Xms and not specifying ObjectAlignmentInBytes
brutisso
parents:
8734
diff
changeset
|
339 static void set_use_compressed_oops(); |
12056
740e263c80c6
8003424: Enable Class Data Sharing for CompressedOops
hseigel
parents:
11096
diff
changeset
|
340 static void set_use_compressed_klass_ptrs(); |
0 | 341 static void set_ergonomics_flags(); |
2362
a2c2eac1ca62
7018056: large pages not always enabled by default
jcoomes
parents:
2302
diff
changeset
|
342 static void set_shared_spaces_flags(); |
8854
754c24457b20
7112912: Message "Error occurred during initialization of VM" on boxes with lots of RAM
tschatzl
parents:
8741
diff
changeset
|
343 // limits the given memory size by the maximum amount of memory this process is |
754c24457b20
7112912: Message "Error occurred during initialization of VM" on boxes with lots of RAM
tschatzl
parents:
8741
diff
changeset
|
344 // currently allowed to allocate or reserve. |
754c24457b20
7112912: Message "Error occurred during initialization of VM" on boxes with lots of RAM
tschatzl
parents:
8741
diff
changeset
|
345 static julong limit_by_allocatable_memory(julong size); |
1064 | 346 // Setup heap size |
347 static void set_heap_size(); | |
0 | 348 // Based on automatic selection criteria, should the |
349 // low pause collector be used. | |
350 static bool should_auto_select_low_pause_collector(); | |
351 | |
352 // Bytecode rewriting | |
353 static void set_bytecode_flags(); | |
354 | |
355 // Invocation API hooks | |
356 static abort_hook_t _abort_hook; | |
357 static exit_hook_t _exit_hook; | |
358 static vfprintf_hook_t _vfprintf_hook; | |
359 | |
360 // System properties | |
361 static bool add_property(const char* prop); | |
362 | |
363 // Aggressive optimization flags. | |
364 static void set_aggressive_opts_flags(); | |
365 | |
366 // Argument parsing | |
367 static void do_pd_flag_adjustments(); | |
12322
72b7e96c1922
8024545: make develop and notproduct flag values available in product builds
twisti
parents:
12253
diff
changeset
|
368 static bool parse_argument(const char* arg, Flag::Flags origin); |
72b7e96c1922
8024545: make develop and notproduct flag values available in product builds
twisti
parents:
12253
diff
changeset
|
369 static bool process_argument(const char* arg, jboolean ignore_unrecognized, Flag::Flags origin); |
0 | 370 static void process_java_launcher_argument(const char*, void*); |
371 static void process_java_compiler_argument(char* arg); | |
372 static jint parse_options_environment_variable(const char* name, SysClassPath* scp_p, bool* scp_assembly_required_p); | |
373 static jint parse_java_tool_options_environment_variable(SysClassPath* scp_p, bool* scp_assembly_required_p); | |
374 static jint parse_java_options_environment_variable(SysClassPath* scp_p, bool* scp_assembly_required_p); | |
375 static jint parse_vm_init_args(const JavaVMInitArgs* args); | |
12322
72b7e96c1922
8024545: make develop and notproduct flag values available in product builds
twisti
parents:
12253
diff
changeset
|
376 static jint parse_each_vm_init_arg(const JavaVMInitArgs* args, SysClassPath* scp_p, bool* scp_assembly_required_p, Flag::Flags origin); |
0 | 377 static jint finalize_vm_init_args(SysClassPath* scp_p, bool scp_assembly_required); |
14909 | 378 static bool is_bad_option(const JavaVMOption* option, jboolean ignore, |
379 const char* option_type); | |
0 | 380 static bool is_bad_option(const JavaVMOption* option, jboolean ignore) { |
381 return is_bad_option(option, ignore, NULL); | |
382 } | |
1244
745c853ee57f
6885297: java -XX:RefDiscoveryPolicy=2 or -XX:TLABWasteTargetPercent=0 cause VM crash
johnc
parents:
1064
diff
changeset
|
383 static bool verify_interval(uintx val, uintx min, |
745c853ee57f
6885297: java -XX:RefDiscoveryPolicy=2 or -XX:TLABWasteTargetPercent=0 cause VM crash
johnc
parents:
1064
diff
changeset
|
384 uintx max, const char* name); |
1744
f8c5d1bdaad4
6885308: The incorrect -XX:StackRedPages, -XX:StackShadowPages, -XX:StackYellowPages could cause VM crash
ptisnovs
parents:
1552
diff
changeset
|
385 static bool verify_min_value(intx val, intx min, const char* name); |
0 | 386 static bool verify_percentage(uintx value, const char* name); |
387 static void describe_range_error(ArgsRange errcode); | |
489
2494ab195856
6653214: MemoryPoolMXBean.setUsageThreshold() does not support large heap sizes.
swamyv
parents:
356
diff
changeset
|
388 static ArgsRange check_memory_size(julong size, julong min_size); |
2494ab195856
6653214: MemoryPoolMXBean.setUsageThreshold() does not support large heap sizes.
swamyv
parents:
356
diff
changeset
|
389 static ArgsRange parse_memory_size(const char* s, julong* long_arg, |
2494ab195856
6653214: MemoryPoolMXBean.setUsageThreshold() does not support large heap sizes.
swamyv
parents:
356
diff
changeset
|
390 julong min_size); |
1284 | 391 // Parse a string for a unsigned integer. Returns true if value |
392 // is an unsigned integer greater than or equal to the minimum | |
393 // parameter passed and returns the value in uintx_arg. Returns | |
394 // false otherwise, with uintx_arg undefined. | |
395 static bool parse_uintx(const char* value, uintx* uintx_arg, | |
396 uintx min_size); | |
0 | 397 |
398 // methods to build strings from individual args | |
399 static void build_jvm_args(const char* arg); | |
400 static void build_jvm_flags(const char* arg); | |
4559
723df37192d6
Make it possible again to build a real client libjvm, drop the UseGraal flag.
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
3546
diff
changeset
|
401 #ifdef GRAAL |
2891
75a99b4f1c98
Rebranded C++ part from C1X to Graal.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
2491
diff
changeset
|
402 static void add_graal_arg(const char* arg); |
4559
723df37192d6
Make it possible again to build a real client libjvm, drop the UseGraal flag.
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
3546
diff
changeset
|
403 #endif |
0 | 404 static void add_string(char*** bldarray, int* count, const char* arg); |
405 static const char* build_resource_string(char** args, int count); | |
406 | |
407 static bool methodExists( | |
408 char* className, char* methodName, | |
409 int classesNum, char** classes, bool* allMethods, | |
410 int methodsNum, char** methods, bool* allClasses | |
411 ); | |
412 | |
413 static void parseOnlyLine( | |
414 const char* line, | |
415 short* classesNum, short* classesMax, char*** classes, bool** allMethods, | |
416 short* methodsNum, short* methodsMax, char*** methods, bool** allClasses | |
417 ); | |
418 | |
242 | 419 // Returns true if the string s is in the list of flags that have recently |
420 // been made obsolete. If we detect one of these flags on the command | |
421 // line, instead of failing we print a warning message and ignore the | |
422 // flag. This gives the user a release or so to stop using the flag. | |
423 static bool is_newly_obsolete(const char* s, JDK_Version* buffer); | |
0 | 424 |
425 static short CompileOnlyClassesNum; | |
426 static short CompileOnlyClassesMax; | |
427 static char** CompileOnlyClasses; | |
428 static bool* CompileOnlyAllMethods; | |
429 | |
430 static short CompileOnlyMethodsNum; | |
431 static short CompileOnlyMethodsMax; | |
432 static char** CompileOnlyMethods; | |
433 static bool* CompileOnlyAllClasses; | |
434 | |
435 static short InterpretOnlyClassesNum; | |
436 static short InterpretOnlyClassesMax; | |
437 static char** InterpretOnlyClasses; | |
438 static bool* InterpretOnlyAllMethods; | |
439 | |
440 static bool CheckCompileOnly; | |
441 | |
442 static char* SharedArchivePath; | |
443 | |
444 public: | |
12233
40136aa2cdb1
8010722: assert: failed: heap size is too big for compressed oops
tschatzl
parents:
12182
diff
changeset
|
445 // Parses the arguments, first phase |
0 | 446 static jint parse(const JavaVMInitArgs* args); |
12233
40136aa2cdb1
8010722: assert: failed: heap size is too big for compressed oops
tschatzl
parents:
12182
diff
changeset
|
447 // Apply ergonomics |
40136aa2cdb1
8010722: assert: failed: heap size is too big for compressed oops
tschatzl
parents:
12182
diff
changeset
|
448 static jint apply_ergo(); |
7177
53715fb1597d
7198334: UseNUMA modifies system parameters on non-NUMA system
brutisso
parents:
6842
diff
changeset
|
449 // Adjusts the arguments after the OS have adjusted the arguments |
53715fb1597d
7198334: UseNUMA modifies system parameters on non-NUMA system
brutisso
parents:
6842
diff
changeset
|
450 static jint adjust_after_os(); |
10
28372612af5e
6362677: Change parallel GC collector default number of parallel GC threads.
jmasa
parents:
0
diff
changeset
|
451 // Check for consistency in the selection of the garbage collector. |
28372612af5e
6362677: Change parallel GC collector default number of parallel GC threads.
jmasa
parents:
0
diff
changeset
|
452 static bool check_gc_consistency(); |
7452
e0ab18eafbde
8003820: Deprecate untested and rarely used GC combinations
brutisso
parents:
7177
diff
changeset
|
453 static void check_deprecated_gcs(); |
8734 | 454 static void check_deprecated_gc_flags(); |
14909 | 455 // Check consistecy or otherwise of VM argument settings |
0 | 456 static bool check_vm_args_consistency(); |
1744
f8c5d1bdaad4
6885308: The incorrect -XX:StackRedPages, -XX:StackShadowPages, -XX:StackYellowPages could cause VM crash
ptisnovs
parents:
1552
diff
changeset
|
457 // Check stack pages settings |
f8c5d1bdaad4
6885308: The incorrect -XX:StackRedPages, -XX:StackShadowPages, -XX:StackYellowPages could cause VM crash
ptisnovs
parents:
1552
diff
changeset
|
458 static bool check_stack_pages(); |
0 | 459 // Used by os_solaris |
460 static bool process_settings_file(const char* file_name, bool should_exist, jboolean ignore_unrecognized); | |
461 | |
12233
40136aa2cdb1
8010722: assert: failed: heap size is too big for compressed oops
tschatzl
parents:
12182
diff
changeset
|
462 static size_t conservative_max_heap_alignment() { return _conservative_max_heap_alignment; } |
40136aa2cdb1
8010722: assert: failed: heap size is too big for compressed oops
tschatzl
parents:
12182
diff
changeset
|
463 // Return the maximum size a heap with compressed oops can take |
40136aa2cdb1
8010722: assert: failed: heap size is too big for compressed oops
tschatzl
parents:
12182
diff
changeset
|
464 static size_t max_heap_for_compressed_oops(); |
40136aa2cdb1
8010722: assert: failed: heap size is too big for compressed oops
tschatzl
parents:
12182
diff
changeset
|
465 |
0 | 466 // return a char* array containing all options |
467 static char** jvm_flags_array() { return _jvm_flags_array; } | |
468 static char** jvm_args_array() { return _jvm_args_array; } | |
4559
723df37192d6
Make it possible again to build a real client libjvm, drop the UseGraal flag.
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
3546
diff
changeset
|
469 #ifdef GRAAL |
2891
75a99b4f1c98
Rebranded C++ part from C1X to Graal.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
2491
diff
changeset
|
470 static char** graal_args_array() { return _graal_args_array; } |
4657
d4e039a3e083
Print java.exe when execuing "mx vm"
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
4559
diff
changeset
|
471 static int num_graal_args() { return _num_graal_args; } |
4559
723df37192d6
Make it possible again to build a real client libjvm, drop the UseGraal flag.
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
3546
diff
changeset
|
472 #endif |
0 | 473 static int num_jvm_flags() { return _num_jvm_flags; } |
474 static int num_jvm_args() { return _num_jvm_args; } | |
475 // return the arguments passed to the Java application | |
476 static const char* java_command() { return _java_command; } | |
477 | |
478 // print jvm_flags, jvm_args and java_command | |
479 static void print_on(outputStream* st); | |
480 | |
481 // convenient methods to obtain / print jvm_flags and jvm_args | |
482 static const char* jvm_flags() { return build_resource_string(_jvm_flags_array, _num_jvm_flags); } | |
483 static const char* jvm_args() { return build_resource_string(_jvm_args_array, _num_jvm_args); } | |
484 static void print_jvm_flags_on(outputStream* st); | |
485 static void print_jvm_args_on(outputStream* st); | |
486 | |
487 // -Dkey=value flags | |
488 static SystemProperty* system_properties() { return _system_properties; } | |
489 static const char* get_property(const char* key); | |
490 | |
491 // -Djava.vendor.url.bug | |
492 static const char* java_vendor_url_bug() { return _java_vendor_url_bug; } | |
493 | |
494 // -Dsun.java.launcher | |
495 static const char* sun_java_launcher() { return _sun_java_launcher; } | |
496 // Was VM created by a Java launcher? | |
497 static bool created_by_java_launcher(); | |
14909 | 498 // Was VM created by the gamma Java launcher? |
499 static bool created_by_gamma_launcher(); | |
0 | 500 // -Dsun.java.launcher.pid |
501 static int sun_java_launcher_pid() { return _sun_java_launcher_pid; } | |
502 | |
503 // -Xloggc:<file>, if not specified will be NULL | |
504 static const char* gc_log_filename() { return _gc_log_filename; } | |
505 | |
11096
71180a6e5080
7133260: AllocationProfiler uses space in metadata and doesn't seem to do anything useful.
jiangli
parents:
10990
diff
changeset
|
506 // -Xprof |
0 | 507 static bool has_profile() { return _has_profile; } |
508 | |
14909 | 509 // -Xms, -Xmx |
0 | 510 static uintx min_heap_size() { return _min_heap_size; } |
511 static void set_min_heap_size(uintx v) { _min_heap_size = v; } | |
512 | |
513 // -Xrun | |
514 static AgentLibrary* libraries() { return _libraryList.first(); } | |
515 static bool init_libraries_at_startup() { return !_libraryList.is_empty(); } | |
516 static void convert_library_to_agent(AgentLibrary* lib) | |
517 { _libraryList.remove(lib); | |
518 _agentList.add(lib); } | |
519 | |
520 // -agentlib -agentpath | |
521 static AgentLibrary* agents() { return _agentList.first(); } | |
522 static bool init_agents_at_startup() { return !_agentList.is_empty(); } | |
523 | |
524 // abort, exit, vfprintf hooks | |
525 static abort_hook_t abort_hook() { return _abort_hook; } | |
526 static exit_hook_t exit_hook() { return _exit_hook; } | |
527 static vfprintf_hook_t vfprintf_hook() { return _vfprintf_hook; } | |
528 | |
529 static bool GetCheckCompileOnly () { return CheckCompileOnly; } | |
530 | |
531 static const char* GetSharedArchivePath() { return SharedArchivePath; } | |
532 | |
533 static bool CompileMethod(char* className, char* methodName) { | |
534 return | |
535 methodExists( | |
536 className, methodName, | |
537 CompileOnlyClassesNum, CompileOnlyClasses, CompileOnlyAllMethods, | |
538 CompileOnlyMethodsNum, CompileOnlyMethods, CompileOnlyAllClasses | |
539 ); | |
540 } | |
541 | |
542 // Java launcher properties | |
543 static void process_sun_java_launcher_properties(JavaVMInitArgs* args); | |
544 | |
545 // System properties | |
546 static void init_system_properties(); | |
547 | |
1864
dfb38ea7da17
6988363: Rebrand vm vendor property settings (jdk7 only)
zgu
parents:
1783
diff
changeset
|
548 // Update/Initialize System properties after JDK version number is known |
dfb38ea7da17
6988363: Rebrand vm vendor property settings (jdk7 only)
zgu
parents:
1783
diff
changeset
|
549 static void init_version_specific_system_properties(); |
dfb38ea7da17
6988363: Rebrand vm vendor property settings (jdk7 only)
zgu
parents:
1783
diff
changeset
|
550 |
691 | 551 // Property List manipulation |
0 | 552 static void PropertyList_add(SystemProperty** plist, SystemProperty *element); |
553 static void PropertyList_add(SystemProperty** plist, const char* k, char* v); | |
691 | 554 static void PropertyList_unique_add(SystemProperty** plist, const char* k, char* v) { |
555 PropertyList_unique_add(plist, k, v, false); | |
556 } | |
557 static void PropertyList_unique_add(SystemProperty** plist, const char* k, char* v, jboolean append); | |
0 | 558 static const char* PropertyList_get_value(SystemProperty* plist, const char* key); |
559 static int PropertyList_count(SystemProperty* pl); | |
560 static const char* PropertyList_get_key_at(SystemProperty* pl,int index); | |
561 static char* PropertyList_get_value_at(SystemProperty* pl,int index); | |
562 | |
563 // Miscellaneous System property value getter and setters. | |
564 static void set_dll_dir(char *value) { _sun_boot_library_path->set_value(value); } | |
565 static void set_java_home(char *value) { _java_home->set_value(value); } | |
566 static void set_library_path(char *value) { _java_library_path->set_value(value); } | |
567 static void set_ext_dirs(char *value) { _java_ext_dirs->set_value(value); } | |
568 static void set_endorsed_dirs(char *value) { _java_endorsed_dirs->set_value(value); } | |
569 static void set_sysclasspath(char *value) { _sun_boot_class_path->set_value(value); } | |
570 static void append_sysclasspath(const char *value) { _sun_boot_class_path->append_value(value); } | |
571 static void set_meta_index_path(char* meta_index_path, char* meta_index_dir) { | |
572 _meta_index_path = meta_index_path; | |
573 _meta_index_dir = meta_index_dir; | |
574 } | |
575 | |
576 static char *get_java_home() { return _java_home->value(); } | |
577 static char *get_dll_dir() { return _sun_boot_library_path->value(); } | |
578 static char *get_endorsed_dir() { return _java_endorsed_dirs->value(); } | |
579 static char *get_sysclasspath() { return _sun_boot_class_path->value(); } | |
580 static char* get_meta_index_path() { return _meta_index_path; } | |
581 static char* get_meta_index_dir() { return _meta_index_dir; } | |
582 | |
583 // Operation modi | |
584 static Mode mode() { return _mode; } | |
585 | |
586 // Utility: copies src into buf, replacing "%%" with "%" and "%p" with pid. | |
587 static bool copy_expand_pid(const char* src, size_t srclen, char* buf, size_t buflen); | |
588 }; | |
1972 | 589 |
590 #endif // SHARE_VM_RUNTIME_ARGUMENTS_HPP |