author | stefank |
Thu, 12 Sep 2013 10:15:54 +0200 | |
changeset 19989 | 0fc247fb59bc |
parent 19986 | 33d188c66ed9 |
child 20006 | 9dc2add3103b |
permissions | -rw-r--r-- |
1 | 1 |
/* |
15432 | 2 |
* Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved. |
1 | 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 |
* |
|
5547
f4b087cbb361
6941466: Oracle rebranding changes for Hotspot repositories
trims
parents:
5035
diff
changeset
|
19 |
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA |
f4b087cbb361
6941466: Oracle rebranding changes for Hotspot repositories
trims
parents:
5035
diff
changeset
|
20 |
* or visit www.oracle.com if you need additional information or have any |
f4b087cbb361
6941466: Oracle rebranding changes for Hotspot repositories
trims
parents:
5035
diff
changeset
|
21 |
* questions. |
1 | 22 |
* |
23 |
*/ |
|
24 |
||
7397 | 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 |
||
1 | 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 |
||
13195 | 47 |
class SystemProperty: public CHeapObj<mtInternal> { |
1 | 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 |
} |
|
13195 | 66 |
_value = AllocateHeap(strlen(value)+1, mtInternal); |
1 | 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 |
} |
|
13195 | 83 |
sp = AllocateHeap(len+2, mtInternal); |
1 | 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 { |
|
13195 | 103 |
_key = AllocateHeap(strlen(key)+1, mtInternal); |
1 | 104 |
strcpy(_key, key); |
105 |
} |
|
106 |
if (value == NULL) { |
|
107 |
_value = NULL; |
|
108 |
} else { |
|
13195 | 109 |
_value = AllocateHeap(strlen(value)+1, mtInternal); |
1 | 110 |
strcpy(_value, value); |
111 |
} |
|
112 |
_next = NULL; |
|
113 |
_writeable = writeable; |
|
114 |
} |
|
115 |
}; |
|
116 |
||
117 |
||
118 |
// For use by -agentlib, -agentpath and -Xrun |
|
13195 | 119 |
class AgentLibrary : public CHeapObj<mtInternal> { |
1 | 120 |
friend class AgentLibraryList; |
19553
9bbd930be684
8014135: The JVMTI specification does not conform to recent changes in JNI specification
bpittore
parents:
19319
diff
changeset
|
121 |
public: |
9bbd930be684
8014135: The JVMTI specification does not conform to recent changes in JNI specification
bpittore
parents:
19319
diff
changeset
|
122 |
// Is this library valid or not. Don't rely on os_lib == NULL as statically |
9bbd930be684
8014135: The JVMTI specification does not conform to recent changes in JNI specification
bpittore
parents:
19319
diff
changeset
|
123 |
// linked lib could have handle of RTLD_DEFAULT which == 0 on some platforms |
9bbd930be684
8014135: The JVMTI specification does not conform to recent changes in JNI specification
bpittore
parents:
19319
diff
changeset
|
124 |
enum AgentState { |
9bbd930be684
8014135: The JVMTI specification does not conform to recent changes in JNI specification
bpittore
parents:
19319
diff
changeset
|
125 |
agent_invalid = 0, |
9bbd930be684
8014135: The JVMTI specification does not conform to recent changes in JNI specification
bpittore
parents:
19319
diff
changeset
|
126 |
agent_valid = 1 |
9bbd930be684
8014135: The JVMTI specification does not conform to recent changes in JNI specification
bpittore
parents:
19319
diff
changeset
|
127 |
}; |
9bbd930be684
8014135: The JVMTI specification does not conform to recent changes in JNI specification
bpittore
parents:
19319
diff
changeset
|
128 |
|
1 | 129 |
private: |
130 |
char* _name; |
|
131 |
char* _options; |
|
132 |
void* _os_lib; |
|
133 |
bool _is_absolute_path; |
|
19553
9bbd930be684
8014135: The JVMTI specification does not conform to recent changes in JNI specification
bpittore
parents:
19319
diff
changeset
|
134 |
bool _is_static_lib; |
9bbd930be684
8014135: The JVMTI specification does not conform to recent changes in JNI specification
bpittore
parents:
19319
diff
changeset
|
135 |
AgentState _state; |
1 | 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; } |
|
19553
9bbd930be684
8014135: The JVMTI specification does not conform to recent changes in JNI specification
bpittore
parents:
19319
diff
changeset
|
146 |
bool is_static_lib() const { return _is_static_lib; } |
9bbd930be684
8014135: The JVMTI specification does not conform to recent changes in JNI specification
bpittore
parents:
19319
diff
changeset
|
147 |
void set_static_lib(bool static_lib) { _is_static_lib = static_lib; } |
9bbd930be684
8014135: The JVMTI specification does not conform to recent changes in JNI specification
bpittore
parents:
19319
diff
changeset
|
148 |
bool valid() { return (_state == agent_valid); } |
9bbd930be684
8014135: The JVMTI specification does not conform to recent changes in JNI specification
bpittore
parents:
19319
diff
changeset
|
149 |
void set_valid() { _state = agent_valid; } |
9bbd930be684
8014135: The JVMTI specification does not conform to recent changes in JNI specification
bpittore
parents:
19319
diff
changeset
|
150 |
void set_invalid() { _state = agent_invalid; } |
1 | 151 |
|
152 |
// Constructor |
|
153 |
AgentLibrary(const char* name, const char* options, bool is_absolute_path, void* os_lib) { |
|
13195 | 154 |
_name = AllocateHeap(strlen(name)+1, mtInternal); |
1 | 155 |
strcpy(_name, name); |
156 |
if (options == NULL) { |
|
157 |
_options = NULL; |
|
158 |
} else { |
|
13195 | 159 |
_options = AllocateHeap(strlen(options)+1, mtInternal); |
1 | 160 |
strcpy(_options, options); |
161 |
} |
|
162 |
_is_absolute_path = is_absolute_path; |
|
163 |
_os_lib = os_lib; |
|
164 |
_next = NULL; |
|
19553
9bbd930be684
8014135: The JVMTI specification does not conform to recent changes in JNI specification
bpittore
parents:
19319
diff
changeset
|
165 |
_state = agent_invalid; |
9bbd930be684
8014135: The JVMTI specification does not conform to recent changes in JNI specification
bpittore
parents:
19319
diff
changeset
|
166 |
_is_static_lib = false; |
1 | 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; |
|
248 |
// string containing all java command (class/jarfile name and app args) |
|
249 |
static char* _java_command; |
|
250 |
||
251 |
// Property list |
|
252 |
static SystemProperty* _system_properties; |
|
253 |
||
254 |
// Quick accessor to System properties in the list: |
|
255 |
static SystemProperty *_java_ext_dirs; |
|
256 |
static SystemProperty *_java_endorsed_dirs; |
|
257 |
static SystemProperty *_sun_boot_library_path; |
|
258 |
static SystemProperty *_java_library_path; |
|
259 |
static SystemProperty *_java_home; |
|
260 |
static SystemProperty *_java_class_path; |
|
261 |
static SystemProperty *_sun_boot_class_path; |
|
262 |
||
263 |
// Meta-index for knowing what packages are in the boot class path |
|
264 |
static char* _meta_index_path; |
|
265 |
static char* _meta_index_dir; |
|
266 |
||
267 |
// java.vendor.url.bug, bug reporting URL for fatal errors. |
|
268 |
static const char* _java_vendor_url_bug; |
|
269 |
||
270 |
// sun.java.launcher, private property to provide information about |
|
271 |
// java/gamma launcher |
|
272 |
static const char* _sun_java_launcher; |
|
273 |
||
274 |
// sun.java.launcher.pid, private property |
|
275 |
static int _sun_java_launcher_pid; |
|
276 |
||
8476
7e34c2d4cf9b
7022037: Pause when exiting if debugger is attached on windows
sla
parents:
7397
diff
changeset
|
277 |
// was this VM created by the gamma launcher |
7e34c2d4cf9b
7022037: Pause when exiting if debugger is attached on windows
sla
parents:
7397
diff
changeset
|
278 |
static bool _created_by_gamma_launcher; |
7e34c2d4cf9b
7022037: Pause when exiting if debugger is attached on windows
sla
parents:
7397
diff
changeset
|
279 |
|
1 | 280 |
// Option flags |
281 |
static bool _has_profile; |
|
282 |
static const char* _gc_log_filename; |
|
19986
33d188c66ed9
8010722: assert: failed: heap size is too big for compressed oops
tschatzl
parents:
19732
diff
changeset
|
283 |
// Value of the conservative maximum heap alignment needed |
33d188c66ed9
8010722: assert: failed: heap size is too big for compressed oops
tschatzl
parents:
19732
diff
changeset
|
284 |
static size_t _conservative_max_heap_alignment; |
33d188c66ed9
8010722: assert: failed: heap size is too big for compressed oops
tschatzl
parents:
19732
diff
changeset
|
285 |
|
1 | 286 |
static uintx _min_heap_size; |
287 |
||
288 |
// -Xrun arguments |
|
289 |
static AgentLibraryList _libraryList; |
|
290 |
static void add_init_library(const char* name, char* options) |
|
291 |
{ _libraryList.add(new AgentLibrary(name, options, false, NULL)); } |
|
292 |
||
293 |
// -agentlib and -agentpath arguments |
|
294 |
static AgentLibraryList _agentList; |
|
295 |
static void add_init_agent(const char* name, char* options, bool absolute_path) |
|
296 |
{ _agentList.add(new AgentLibrary(name, options, absolute_path, NULL)); } |
|
297 |
||
298 |
// Late-binding agents not started via arguments |
|
19553
9bbd930be684
8014135: The JVMTI specification does not conform to recent changes in JNI specification
bpittore
parents:
19319
diff
changeset
|
299 |
static void add_loaded_agent(AgentLibrary *agentLib) |
9bbd930be684
8014135: The JVMTI specification does not conform to recent changes in JNI specification
bpittore
parents:
19319
diff
changeset
|
300 |
{ _agentList.add(agentLib); } |
1 | 301 |
static void add_loaded_agent(const char* name, char* options, bool absolute_path, void* os_lib) |
302 |
{ _agentList.add(new AgentLibrary(name, options, absolute_path, os_lib)); } |
|
303 |
||
304 |
// Operation modi |
|
305 |
static Mode _mode; |
|
306 |
static void set_mode_flags(Mode mode); |
|
307 |
static bool _java_compiler; |
|
308 |
static void set_java_compiler(bool arg) { _java_compiler = arg; } |
|
309 |
static bool java_compiler() { return _java_compiler; } |
|
310 |
||
311 |
// -Xdebug flag |
|
312 |
static bool _xdebug_mode; |
|
313 |
static void set_xdebug_mode(bool arg) { _xdebug_mode = arg; } |
|
314 |
static bool xdebug_mode() { return _xdebug_mode; } |
|
315 |
||
316 |
// Used to save default settings |
|
317 |
static bool _AlwaysCompileLoopMethods; |
|
318 |
static bool _UseOnStackReplacement; |
|
319 |
static bool _BackgroundCompilation; |
|
320 |
static bool _ClipInlining; |
|
321 |
static bool _CIDynamicCompilePriority; |
|
322 |
||
6453 | 323 |
// Tiered |
324 |
static void set_tiered_flags(); |
|
1 | 325 |
// CMS/ParNew garbage collectors |
326 |
static void set_parnew_gc_flags(); |
|
327 |
static void set_cms_and_parnew_gc_flags(); |
|
1374
4c24294029a9
6711316: Open source the Garbage-First garbage collector
ysr
parents:
183
diff
changeset
|
328 |
// UseParallel[Old]GC |
1 | 329 |
static void set_parallel_gc_flags(); |
1374
4c24294029a9
6711316: Open source the Garbage-First garbage collector
ysr
parents:
183
diff
changeset
|
330 |
// Garbage-First (UseG1GC) |
4c24294029a9
6711316: Open source the Garbage-First garbage collector
ysr
parents:
183
diff
changeset
|
331 |
static void set_g1_gc_flags(); |
1 | 332 |
// GC ergonomics |
19986
33d188c66ed9
8010722: assert: failed: heap size is too big for compressed oops
tschatzl
parents:
19732
diff
changeset
|
333 |
static void set_conservative_max_heap_alignment(); |
15957
58302a2ffb9a
8001049: VM crashes when running with large -Xms and not specifying ObjectAlignmentInBytes
brutisso
parents:
15950
diff
changeset
|
334 |
static void set_use_compressed_oops(); |
19319
0ad35be0733a
8003424: Enable Class Data Sharing for CompressedOops
hseigel
parents:
18687
diff
changeset
|
335 |
static void set_use_compressed_klass_ptrs(); |
1 | 336 |
static void set_ergonomics_flags(); |
8681
c691d94813f9
7018056: large pages not always enabled by default
jcoomes
parents:
8476
diff
changeset
|
337 |
static void set_shared_spaces_flags(); |
16605
ba13efd453bc
7112912: Message "Error occurred during initialization of VM" on boxes with lots of RAM
tschatzl
parents:
15957
diff
changeset
|
338 |
// limits the given memory size by the maximum amount of memory this process is |
ba13efd453bc
7112912: Message "Error occurred during initialization of VM" on boxes with lots of RAM
tschatzl
parents:
15957
diff
changeset
|
339 |
// currently allowed to allocate or reserve. |
ba13efd453bc
7112912: Message "Error occurred during initialization of VM" on boxes with lots of RAM
tschatzl
parents:
15957
diff
changeset
|
340 |
static julong limit_by_allocatable_memory(julong size); |
4434 | 341 |
// Setup heap size |
342 |
static void set_heap_size(); |
|
1 | 343 |
// Based on automatic selection criteria, should the |
344 |
// low pause collector be used. |
|
345 |
static bool should_auto_select_low_pause_collector(); |
|
346 |
||
347 |
// Bytecode rewriting |
|
348 |
static void set_bytecode_flags(); |
|
349 |
||
350 |
// Invocation API hooks |
|
351 |
static abort_hook_t _abort_hook; |
|
352 |
static exit_hook_t _exit_hook; |
|
353 |
static vfprintf_hook_t _vfprintf_hook; |
|
354 |
||
355 |
// System properties |
|
356 |
static bool add_property(const char* prop); |
|
357 |
||
358 |
// Aggressive optimization flags. |
|
359 |
static void set_aggressive_opts_flags(); |
|
360 |
||
361 |
// Argument parsing |
|
362 |
static void do_pd_flag_adjustments(); |
|
363 |
static bool parse_argument(const char* arg, FlagValueOrigin origin); |
|
364 |
static bool process_argument(const char* arg, jboolean ignore_unrecognized, FlagValueOrigin origin); |
|
365 |
static void process_java_launcher_argument(const char*, void*); |
|
366 |
static void process_java_compiler_argument(char* arg); |
|
367 |
static jint parse_options_environment_variable(const char* name, SysClassPath* scp_p, bool* scp_assembly_required_p); |
|
368 |
static jint parse_java_tool_options_environment_variable(SysClassPath* scp_p, bool* scp_assembly_required_p); |
|
369 |
static jint parse_java_options_environment_variable(SysClassPath* scp_p, bool* scp_assembly_required_p); |
|
370 |
static jint parse_vm_init_args(const JavaVMInitArgs* args); |
|
371 |
static jint parse_each_vm_init_arg(const JavaVMInitArgs* args, SysClassPath* scp_p, bool* scp_assembly_required_p, FlagValueOrigin origin); |
|
372 |
static jint finalize_vm_init_args(SysClassPath* scp_p, bool scp_assembly_required); |
|
373 |
static bool is_bad_option(const JavaVMOption* option, jboolean ignore, |
|
374 |
const char* option_type); |
|
375 |
static bool is_bad_option(const JavaVMOption* option, jboolean ignore) { |
|
376 |
return is_bad_option(option, ignore, NULL); |
|
377 |
} |
|
4885
cee90a57b58f
6885297: java -XX:RefDiscoveryPolicy=2 or -XX:TLABWasteTargetPercent=0 cause VM crash
johnc
parents:
4434
diff
changeset
|
378 |
static bool verify_interval(uintx val, uintx min, |
cee90a57b58f
6885297: java -XX:RefDiscoveryPolicy=2 or -XX:TLABWasteTargetPercent=0 cause VM crash
johnc
parents:
4434
diff
changeset
|
379 |
uintx max, const char* name); |
6414
ef8d1e9052a8
6885308: The incorrect -XX:StackRedPages, -XX:StackShadowPages, -XX:StackYellowPages could cause VM crash
ptisnovs
parents:
5547
diff
changeset
|
380 |
static bool verify_min_value(intx val, intx min, const char* name); |
1 | 381 |
static bool verify_percentage(uintx value, const char* name); |
382 |
static void describe_range_error(ArgsRange errcode); |
|
1676
d80e69372634
6653214: MemoryPoolMXBean.setUsageThreshold() does not support large heap sizes.
swamyv
parents:
1388
diff
changeset
|
383 |
static ArgsRange check_memory_size(julong size, julong min_size); |
d80e69372634
6653214: MemoryPoolMXBean.setUsageThreshold() does not support large heap sizes.
swamyv
parents:
1388
diff
changeset
|
384 |
static ArgsRange parse_memory_size(const char* s, julong* long_arg, |
d80e69372634
6653214: MemoryPoolMXBean.setUsageThreshold() does not support large heap sizes.
swamyv
parents:
1388
diff
changeset
|
385 |
julong min_size); |
5035 | 386 |
// Parse a string for a unsigned integer. Returns true if value |
387 |
// is an unsigned integer greater than or equal to the minimum |
|
388 |
// parameter passed and returns the value in uintx_arg. Returns |
|
389 |
// false otherwise, with uintx_arg undefined. |
|
390 |
static bool parse_uintx(const char* value, uintx* uintx_arg, |
|
391 |
uintx min_size); |
|
1 | 392 |
|
393 |
// methods to build strings from individual args |
|
394 |
static void build_jvm_args(const char* arg); |
|
395 |
static void build_jvm_flags(const char* arg); |
|
396 |
static void add_string(char*** bldarray, int* count, const char* arg); |
|
397 |
static const char* build_resource_string(char** args, int count); |
|
398 |
||
399 |
static bool methodExists( |
|
400 |
char* className, char* methodName, |
|
401 |
int classesNum, char** classes, bool* allMethods, |
|
402 |
int methodsNum, char** methods, bool* allClasses |
|
403 |
); |
|
404 |
||
405 |
static void parseOnlyLine( |
|
406 |
const char* line, |
|
407 |
short* classesNum, short* classesMax, char*** classes, bool** allMethods, |
|
408 |
short* methodsNum, short* methodsMax, char*** methods, bool** allClasses |
|
409 |
); |
|
410 |
||
950 | 411 |
// Returns true if the string s is in the list of flags that have recently |
412 |
// been made obsolete. If we detect one of these flags on the command |
|
413 |
// line, instead of failing we print a warning message and ignore the |
|
414 |
// flag. This gives the user a release or so to stop using the flag. |
|
415 |
static bool is_newly_obsolete(const char* s, JDK_Version* buffer); |
|
1 | 416 |
|
417 |
static short CompileOnlyClassesNum; |
|
418 |
static short CompileOnlyClassesMax; |
|
419 |
static char** CompileOnlyClasses; |
|
420 |
static bool* CompileOnlyAllMethods; |
|
421 |
||
422 |
static short CompileOnlyMethodsNum; |
|
423 |
static short CompileOnlyMethodsMax; |
|
424 |
static char** CompileOnlyMethods; |
|
425 |
static bool* CompileOnlyAllClasses; |
|
426 |
||
427 |
static short InterpretOnlyClassesNum; |
|
428 |
static short InterpretOnlyClassesMax; |
|
429 |
static char** InterpretOnlyClasses; |
|
430 |
static bool* InterpretOnlyAllMethods; |
|
431 |
||
432 |
static bool CheckCompileOnly; |
|
433 |
||
434 |
static char* SharedArchivePath; |
|
435 |
||
436 |
public: |
|
19986
33d188c66ed9
8010722: assert: failed: heap size is too big for compressed oops
tschatzl
parents:
19732
diff
changeset
|
437 |
// Parses the arguments, first phase |
1 | 438 |
static jint parse(const JavaVMInitArgs* args); |
19986
33d188c66ed9
8010722: assert: failed: heap size is too big for compressed oops
tschatzl
parents:
19732
diff
changeset
|
439 |
// Apply ergonomics |
33d188c66ed9
8010722: assert: failed: heap size is too big for compressed oops
tschatzl
parents:
19732
diff
changeset
|
440 |
static jint apply_ergo(); |
14580
3e2316663327
7198334: UseNUMA modifies system parameters on non-NUMA system
brutisso
parents:
13963
diff
changeset
|
441 |
// Adjusts the arguments after the OS have adjusted the arguments |
3e2316663327
7198334: UseNUMA modifies system parameters on non-NUMA system
brutisso
parents:
13963
diff
changeset
|
442 |
static jint adjust_after_os(); |
183
ba55c7f3fd45
6362677: Change parallel GC collector default number of parallel GC threads.
jmasa
parents:
1
diff
changeset
|
443 |
// Check for consistency in the selection of the garbage collector. |
ba55c7f3fd45
6362677: Change parallel GC collector default number of parallel GC threads.
jmasa
parents:
1
diff
changeset
|
444 |
static bool check_gc_consistency(); |
15092
9228d92ed521
8003820: Deprecate untested and rarely used GC combinations
brutisso
parents:
14580
diff
changeset
|
445 |
static void check_deprecated_gcs(); |
15950 | 446 |
static void check_deprecated_gc_flags(); |
1 | 447 |
// Check consistecy or otherwise of VM argument settings |
448 |
static bool check_vm_args_consistency(); |
|
6414
ef8d1e9052a8
6885308: The incorrect -XX:StackRedPages, -XX:StackShadowPages, -XX:StackYellowPages could cause VM crash
ptisnovs
parents:
5547
diff
changeset
|
449 |
// Check stack pages settings |
ef8d1e9052a8
6885308: The incorrect -XX:StackRedPages, -XX:StackShadowPages, -XX:StackYellowPages could cause VM crash
ptisnovs
parents:
5547
diff
changeset
|
450 |
static bool check_stack_pages(); |
1 | 451 |
// Used by os_solaris |
452 |
static bool process_settings_file(const char* file_name, bool should_exist, jboolean ignore_unrecognized); |
|
453 |
||
19986
33d188c66ed9
8010722: assert: failed: heap size is too big for compressed oops
tschatzl
parents:
19732
diff
changeset
|
454 |
static size_t conservative_max_heap_alignment() { return _conservative_max_heap_alignment; } |
33d188c66ed9
8010722: assert: failed: heap size is too big for compressed oops
tschatzl
parents:
19732
diff
changeset
|
455 |
// Return the maximum size a heap with compressed oops can take |
33d188c66ed9
8010722: assert: failed: heap size is too big for compressed oops
tschatzl
parents:
19732
diff
changeset
|
456 |
static size_t max_heap_for_compressed_oops(); |
33d188c66ed9
8010722: assert: failed: heap size is too big for compressed oops
tschatzl
parents:
19732
diff
changeset
|
457 |
|
1 | 458 |
// return a char* array containing all options |
459 |
static char** jvm_flags_array() { return _jvm_flags_array; } |
|
460 |
static char** jvm_args_array() { return _jvm_args_array; } |
|
461 |
static int num_jvm_flags() { return _num_jvm_flags; } |
|
462 |
static int num_jvm_args() { return _num_jvm_args; } |
|
463 |
// return the arguments passed to the Java application |
|
464 |
static const char* java_command() { return _java_command; } |
|
465 |
||
466 |
// print jvm_flags, jvm_args and java_command |
|
467 |
static void print_on(outputStream* st); |
|
468 |
||
469 |
// convenient methods to obtain / print jvm_flags and jvm_args |
|
470 |
static const char* jvm_flags() { return build_resource_string(_jvm_flags_array, _num_jvm_flags); } |
|
471 |
static const char* jvm_args() { return build_resource_string(_jvm_args_array, _num_jvm_args); } |
|
472 |
static void print_jvm_flags_on(outputStream* st); |
|
473 |
static void print_jvm_args_on(outputStream* st); |
|
474 |
||
475 |
// -Dkey=value flags |
|
476 |
static SystemProperty* system_properties() { return _system_properties; } |
|
477 |
static const char* get_property(const char* key); |
|
478 |
||
479 |
// -Djava.vendor.url.bug |
|
480 |
static const char* java_vendor_url_bug() { return _java_vendor_url_bug; } |
|
481 |
||
482 |
// -Dsun.java.launcher |
|
483 |
static const char* sun_java_launcher() { return _sun_java_launcher; } |
|
484 |
// Was VM created by a Java launcher? |
|
485 |
static bool created_by_java_launcher(); |
|
8476
7e34c2d4cf9b
7022037: Pause when exiting if debugger is attached on windows
sla
parents:
7397
diff
changeset
|
486 |
// Was VM created by the gamma Java launcher? |
7e34c2d4cf9b
7022037: Pause when exiting if debugger is attached on windows
sla
parents:
7397
diff
changeset
|
487 |
static bool created_by_gamma_launcher(); |
1 | 488 |
// -Dsun.java.launcher.pid |
489 |
static int sun_java_launcher_pid() { return _sun_java_launcher_pid; } |
|
490 |
||
491 |
// -Xloggc:<file>, if not specified will be NULL |
|
492 |
static const char* gc_log_filename() { return _gc_log_filename; } |
|
493 |
||
18687
5a0543c157c9
7133260: AllocationProfiler uses space in metadata and doesn't seem to do anything useful.
jiangli
parents:
18090
diff
changeset
|
494 |
// -Xprof |
1 | 495 |
static bool has_profile() { return _has_profile; } |
496 |
||
4434 | 497 |
// -Xms, -Xmx |
1 | 498 |
static uintx min_heap_size() { return _min_heap_size; } |
499 |
static void set_min_heap_size(uintx v) { _min_heap_size = v; } |
|
500 |
||
501 |
// -Xrun |
|
502 |
static AgentLibrary* libraries() { return _libraryList.first(); } |
|
503 |
static bool init_libraries_at_startup() { return !_libraryList.is_empty(); } |
|
504 |
static void convert_library_to_agent(AgentLibrary* lib) |
|
505 |
{ _libraryList.remove(lib); |
|
506 |
_agentList.add(lib); } |
|
507 |
||
508 |
// -agentlib -agentpath |
|
509 |
static AgentLibrary* agents() { return _agentList.first(); } |
|
510 |
static bool init_agents_at_startup() { return !_agentList.is_empty(); } |
|
511 |
||
512 |
// abort, exit, vfprintf hooks |
|
513 |
static abort_hook_t abort_hook() { return _abort_hook; } |
|
514 |
static exit_hook_t exit_hook() { return _exit_hook; } |
|
515 |
static vfprintf_hook_t vfprintf_hook() { return _vfprintf_hook; } |
|
516 |
||
517 |
static bool GetCheckCompileOnly () { return CheckCompileOnly; } |
|
518 |
||
519 |
static const char* GetSharedArchivePath() { return SharedArchivePath; } |
|
520 |
||
521 |
static bool CompileMethod(char* className, char* methodName) { |
|
522 |
return |
|
523 |
methodExists( |
|
524 |
className, methodName, |
|
525 |
CompileOnlyClassesNum, CompileOnlyClasses, CompileOnlyAllMethods, |
|
526 |
CompileOnlyMethodsNum, CompileOnlyMethods, CompileOnlyAllClasses |
|
527 |
); |
|
528 |
} |
|
529 |
||
530 |
// Java launcher properties |
|
531 |
static void process_sun_java_launcher_properties(JavaVMInitArgs* args); |
|
532 |
||
533 |
// System properties |
|
534 |
static void init_system_properties(); |
|
535 |
||
6961
a32b2fc66321
6988363: Rebrand vm vendor property settings (jdk7 only)
zgu
parents:
6453
diff
changeset
|
536 |
// Update/Initialize System properties after JDK version number is known |
a32b2fc66321
6988363: Rebrand vm vendor property settings (jdk7 only)
zgu
parents:
6453
diff
changeset
|
537 |
static void init_version_specific_system_properties(); |
a32b2fc66321
6988363: Rebrand vm vendor property settings (jdk7 only)
zgu
parents:
6453
diff
changeset
|
538 |
|
2358 | 539 |
// Property List manipulation |
1 | 540 |
static void PropertyList_add(SystemProperty** plist, SystemProperty *element); |
541 |
static void PropertyList_add(SystemProperty** plist, const char* k, char* v); |
|
2358 | 542 |
static void PropertyList_unique_add(SystemProperty** plist, const char* k, char* v) { |
543 |
PropertyList_unique_add(plist, k, v, false); |
|
544 |
} |
|
545 |
static void PropertyList_unique_add(SystemProperty** plist, const char* k, char* v, jboolean append); |
|
1 | 546 |
static const char* PropertyList_get_value(SystemProperty* plist, const char* key); |
547 |
static int PropertyList_count(SystemProperty* pl); |
|
548 |
static const char* PropertyList_get_key_at(SystemProperty* pl,int index); |
|
549 |
static char* PropertyList_get_value_at(SystemProperty* pl,int index); |
|
550 |
||
551 |
// Miscellaneous System property value getter and setters. |
|
552 |
static void set_dll_dir(char *value) { _sun_boot_library_path->set_value(value); } |
|
553 |
static void set_java_home(char *value) { _java_home->set_value(value); } |
|
554 |
static void set_library_path(char *value) { _java_library_path->set_value(value); } |
|
555 |
static void set_ext_dirs(char *value) { _java_ext_dirs->set_value(value); } |
|
556 |
static void set_endorsed_dirs(char *value) { _java_endorsed_dirs->set_value(value); } |
|
557 |
static void set_sysclasspath(char *value) { _sun_boot_class_path->set_value(value); } |
|
558 |
static void append_sysclasspath(const char *value) { _sun_boot_class_path->append_value(value); } |
|
559 |
static void set_meta_index_path(char* meta_index_path, char* meta_index_dir) { |
|
560 |
_meta_index_path = meta_index_path; |
|
561 |
_meta_index_dir = meta_index_dir; |
|
562 |
} |
|
563 |
||
564 |
static char *get_java_home() { return _java_home->value(); } |
|
565 |
static char *get_dll_dir() { return _sun_boot_library_path->value(); } |
|
566 |
static char *get_endorsed_dir() { return _java_endorsed_dirs->value(); } |
|
567 |
static char *get_sysclasspath() { return _sun_boot_class_path->value(); } |
|
568 |
static char* get_meta_index_path() { return _meta_index_path; } |
|
569 |
static char* get_meta_index_dir() { return _meta_index_dir; } |
|
570 |
||
571 |
// Operation modi |
|
572 |
static Mode mode() { return _mode; } |
|
573 |
||
574 |
// Utility: copies src into buf, replacing "%%" with "%" and "%p" with pid. |
|
575 |
static bool copy_expand_pid(const char* src, size_t srclen, char* buf, size_t buflen); |
|
576 |
}; |
|
7397 | 577 |
|
578 |
#endif // SHARE_VM_RUNTIME_ARGUMENTS_HPP |