204
205 class Arguments : AllStatic {
206 friend class VMStructs;
207 friend class JvmtiExport;
208 public:
209 // Operation modi
210 enum Mode {
211 _int, // corresponds to -Xint
212 _mixed, // corresponds to -Xmixed
213 _comp // corresponds to -Xcomp
214 };
215
216 enum ArgsRange {
217 arg_unreadable = -3,
218 arg_too_small = -2,
219 arg_too_big = -1,
220 arg_in_range = 0
221 };
222
223 private:
224
225 // an array containing all flags specified in the .hotspotrc file
226 static char** _jvm_flags_array;
227 static int _num_jvm_flags;
228 // an array containing all jvm arguments specified in the command line
229 static char** _jvm_args_array;
230 static int _num_jvm_args;
231 // string containing all java command (class/jarfile name and app args)
232 static char* _java_command;
233
234 // Property list
235 static SystemProperty* _system_properties;
236
237 // Quick accessor to System properties in the list:
238 static SystemProperty *_java_ext_dirs;
239 static SystemProperty *_java_endorsed_dirs;
240 static SystemProperty *_sun_boot_library_path;
241 static SystemProperty *_java_library_path;
242 static SystemProperty *_java_home;
243 static SystemProperty *_java_class_path;
247 static char* _meta_index_path;
248 static char* _meta_index_dir;
249
250 // java.vendor.url.bug, bug reporting URL for fatal errors.
251 static const char* _java_vendor_url_bug;
252
253 // sun.java.launcher, private property to provide information about
254 // java/gamma launcher
255 static const char* _sun_java_launcher;
256
257 // sun.java.launcher.pid, private property
258 static int _sun_java_launcher_pid;
259
260 // was this VM created by the gamma launcher
261 static bool _created_by_gamma_launcher;
262
263 // Option flags
264 static bool _has_profile;
265 static bool _has_alloc_profile;
266 static const char* _gc_log_filename;
267 static uintx _min_heap_size;
268
269 // -Xrun arguments
270 static AgentLibraryList _libraryList;
271 static void add_init_library(const char* name, char* options)
272 { _libraryList.add(new AgentLibrary(name, options, false, NULL)); }
273
274 // -agentlib and -agentpath arguments
275 static AgentLibraryList _agentList;
276 static void add_init_agent(const char* name, char* options, bool absolute_path)
277 { _agentList.add(new AgentLibrary(name, options, absolute_path, NULL)); }
278
279 // Late-binding agents not started via arguments
280 static void add_loaded_agent(const char* name, char* options, bool absolute_path, void* os_lib)
281 { _agentList.add(new AgentLibrary(name, options, absolute_path, os_lib)); }
282
283 // Operation modi
284 static Mode _mode;
285 static void set_mode_flags(Mode mode);
286 static bool _java_compiler;
292 static void set_xdebug_mode(bool arg) { _xdebug_mode = arg; }
293 static bool xdebug_mode() { return _xdebug_mode; }
294
295 // Used to save default settings
296 static bool _AlwaysCompileLoopMethods;
297 static bool _UseOnStackReplacement;
298 static bool _BackgroundCompilation;
299 static bool _ClipInlining;
300 static bool _CIDynamicCompilePriority;
301
302 // Tiered
303 static void set_tiered_flags();
304 // CMS/ParNew garbage collectors
305 static void set_parnew_gc_flags();
306 static void set_cms_and_parnew_gc_flags();
307 // UseParallel[Old]GC
308 static void set_parallel_gc_flags();
309 // Garbage-First (UseG1GC)
310 static void set_g1_gc_flags();
311 // GC ergonomics
312 static void set_use_compressed_oops();
313 static void set_ergonomics_flags();
314 static void set_shared_spaces_flags();
315 // limits the given memory size by the maximum amount of memory this process is
316 // currently allowed to allocate or reserve.
317 static julong limit_by_allocatable_memory(julong size);
318 // Setup heap size
319 static void set_heap_size();
320 // Based on automatic selection criteria, should the
321 // low pause collector be used.
322 static bool should_auto_select_low_pause_collector();
323
324 // Bytecode rewriting
325 static void set_bytecode_flags();
326
327 // Invocation API hooks
328 static abort_hook_t _abort_hook;
329 static exit_hook_t _exit_hook;
330 static vfprintf_hook_t _vfprintf_hook;
331
408
409 static bool CheckCompileOnly;
410
411 static char* SharedArchivePath;
412
413 public:
414 // Parses the arguments
415 static jint parse(const JavaVMInitArgs* args);
416 // Adjusts the arguments after the OS have adjusted the arguments
417 static jint adjust_after_os();
418 // Check for consistency in the selection of the garbage collector.
419 static bool check_gc_consistency();
420 static void check_deprecated_gcs();
421 static void check_deprecated_gc_flags();
422 // Check consistecy or otherwise of VM argument settings
423 static bool check_vm_args_consistency();
424 // Check stack pages settings
425 static bool check_stack_pages();
426 // Used by os_solaris
427 static bool process_settings_file(const char* file_name, bool should_exist, jboolean ignore_unrecognized);
428
429 // return a char* array containing all options
430 static char** jvm_flags_array() { return _jvm_flags_array; }
431 static char** jvm_args_array() { return _jvm_args_array; }
432 static int num_jvm_flags() { return _num_jvm_flags; }
433 static int num_jvm_args() { return _num_jvm_args; }
434 // return the arguments passed to the Java application
435 static const char* java_command() { return _java_command; }
436
437 // print jvm_flags, jvm_args and java_command
438 static void print_on(outputStream* st);
439
440 // convenient methods to obtain / print jvm_flags and jvm_args
441 static const char* jvm_flags() { return build_resource_string(_jvm_flags_array, _num_jvm_flags); }
442 static const char* jvm_args() { return build_resource_string(_jvm_args_array, _num_jvm_args); }
443 static void print_jvm_flags_on(outputStream* st);
444 static void print_jvm_args_on(outputStream* st);
445
446 // -Dkey=value flags
447 static SystemProperty* system_properties() { return _system_properties; }
|
204
205 class Arguments : AllStatic {
206 friend class VMStructs;
207 friend class JvmtiExport;
208 public:
209 // Operation modi
210 enum Mode {
211 _int, // corresponds to -Xint
212 _mixed, // corresponds to -Xmixed
213 _comp // corresponds to -Xcomp
214 };
215
216 enum ArgsRange {
217 arg_unreadable = -3,
218 arg_too_small = -2,
219 arg_too_big = -1,
220 arg_in_range = 0
221 };
222
223 private:
224 // should ergenomics be applied to the ClassMetaspaceSize?
225 static bool apply_ergonomics_on_classmetaspacesize();
226
227 // Value of the ergonomically determined ClassMetaspaceSize
228 // 100,000 classes seems like a good size, so 100M assumes around 1K
229 // per klass. The vtable and oopMap is embedded so we don't have a fixed
230 // size per klass. Eventually, this will be parameterized because it
231 // would also be useful to determine the optimal size of the
232 // systemDictionary.
233 // Round up to a power of two to avoid losses due to alignment.
234 static const size_t ErgoClassMetaspaceSize = 128 * M;
235
236 // an array containing all flags specified in the .hotspotrc file
237 static char** _jvm_flags_array;
238 static int _num_jvm_flags;
239 // an array containing all jvm arguments specified in the command line
240 static char** _jvm_args_array;
241 static int _num_jvm_args;
242 // string containing all java command (class/jarfile name and app args)
243 static char* _java_command;
244
245 // Property list
246 static SystemProperty* _system_properties;
247
248 // Quick accessor to System properties in the list:
249 static SystemProperty *_java_ext_dirs;
250 static SystemProperty *_java_endorsed_dirs;
251 static SystemProperty *_sun_boot_library_path;
252 static SystemProperty *_java_library_path;
253 static SystemProperty *_java_home;
254 static SystemProperty *_java_class_path;
258 static char* _meta_index_path;
259 static char* _meta_index_dir;
260
261 // java.vendor.url.bug, bug reporting URL for fatal errors.
262 static const char* _java_vendor_url_bug;
263
264 // sun.java.launcher, private property to provide information about
265 // java/gamma launcher
266 static const char* _sun_java_launcher;
267
268 // sun.java.launcher.pid, private property
269 static int _sun_java_launcher_pid;
270
271 // was this VM created by the gamma launcher
272 static bool _created_by_gamma_launcher;
273
274 // Option flags
275 static bool _has_profile;
276 static bool _has_alloc_profile;
277 static const char* _gc_log_filename;
278 // computed value for the maximum heap alignment
279 static size_t _max_heap_alignment;
280
281 static uintx _min_heap_size;
282
283 // -Xrun arguments
284 static AgentLibraryList _libraryList;
285 static void add_init_library(const char* name, char* options)
286 { _libraryList.add(new AgentLibrary(name, options, false, NULL)); }
287
288 // -agentlib and -agentpath arguments
289 static AgentLibraryList _agentList;
290 static void add_init_agent(const char* name, char* options, bool absolute_path)
291 { _agentList.add(new AgentLibrary(name, options, absolute_path, NULL)); }
292
293 // Late-binding agents not started via arguments
294 static void add_loaded_agent(const char* name, char* options, bool absolute_path, void* os_lib)
295 { _agentList.add(new AgentLibrary(name, options, absolute_path, os_lib)); }
296
297 // Operation modi
298 static Mode _mode;
299 static void set_mode_flags(Mode mode);
300 static bool _java_compiler;
306 static void set_xdebug_mode(bool arg) { _xdebug_mode = arg; }
307 static bool xdebug_mode() { return _xdebug_mode; }
308
309 // Used to save default settings
310 static bool _AlwaysCompileLoopMethods;
311 static bool _UseOnStackReplacement;
312 static bool _BackgroundCompilation;
313 static bool _ClipInlining;
314 static bool _CIDynamicCompilePriority;
315
316 // Tiered
317 static void set_tiered_flags();
318 // CMS/ParNew garbage collectors
319 static void set_parnew_gc_flags();
320 static void set_cms_and_parnew_gc_flags();
321 // UseParallel[Old]GC
322 static void set_parallel_gc_flags();
323 // Garbage-First (UseG1GC)
324 static void set_g1_gc_flags();
325 // GC ergonomics
326 static void set_max_heap_alignment();
327 static void set_use_compressed_oops();
328 static void set_ergonomics_flags();
329 static void set_shared_spaces_flags();
330 // limits the given memory size by the maximum amount of memory this process is
331 // currently allowed to allocate or reserve.
332 static julong limit_by_allocatable_memory(julong size);
333 // Setup heap size
334 static void set_heap_size();
335 // Based on automatic selection criteria, should the
336 // low pause collector be used.
337 static bool should_auto_select_low_pause_collector();
338
339 // Bytecode rewriting
340 static void set_bytecode_flags();
341
342 // Invocation API hooks
343 static abort_hook_t _abort_hook;
344 static exit_hook_t _exit_hook;
345 static vfprintf_hook_t _vfprintf_hook;
346
423
424 static bool CheckCompileOnly;
425
426 static char* SharedArchivePath;
427
428 public:
429 // Parses the arguments
430 static jint parse(const JavaVMInitArgs* args);
431 // Adjusts the arguments after the OS have adjusted the arguments
432 static jint adjust_after_os();
433 // Check for consistency in the selection of the garbage collector.
434 static bool check_gc_consistency();
435 static void check_deprecated_gcs();
436 static void check_deprecated_gc_flags();
437 // Check consistecy or otherwise of VM argument settings
438 static bool check_vm_args_consistency();
439 // Check stack pages settings
440 static bool check_stack_pages();
441 // Used by os_solaris
442 static bool process_settings_file(const char* file_name, bool should_exist, jboolean ignore_unrecognized);
443
444 static size_t max_heap_alignment() { return _max_heap_alignment; }
445 // return the maximum size a heap with compressed oops can take
446 static size_t max_heap_for_compressed_oops();
447
448 // return a char* array containing all options
449 static char** jvm_flags_array() { return _jvm_flags_array; }
450 static char** jvm_args_array() { return _jvm_args_array; }
451 static int num_jvm_flags() { return _num_jvm_flags; }
452 static int num_jvm_args() { return _num_jvm_args; }
453 // return the arguments passed to the Java application
454 static const char* java_command() { return _java_command; }
455
456 // print jvm_flags, jvm_args and java_command
457 static void print_on(outputStream* st);
458
459 // convenient methods to obtain / print jvm_flags and jvm_args
460 static const char* jvm_flags() { return build_resource_string(_jvm_flags_array, _num_jvm_flags); }
461 static const char* jvm_args() { return build_resource_string(_jvm_args_array, _num_jvm_args); }
462 static void print_jvm_flags_on(outputStream* st);
463 static void print_jvm_args_on(outputStream* st);
464
465 // -Dkey=value flags
466 static SystemProperty* system_properties() { return _system_properties; }
|