432 ScopedVMInitArgs* args_out); 433 434 static bool handle_deprecated_print_gc_flags(); 435 436 static jint parse_vm_init_args(const JavaVMInitArgs *vm_options_args, 437 const JavaVMInitArgs *java_tool_options_args, 438 const JavaVMInitArgs *java_options_args, 439 const JavaVMInitArgs *cmd_line_args); 440 static jint parse_each_vm_init_arg(const JavaVMInitArgs* args, bool* patch_mod_javabase, JVMFlag::Flags origin); 441 static jint finalize_vm_init_args(bool patch_mod_javabase); 442 static bool is_bad_option(const JavaVMOption* option, jboolean ignore, const char* option_type); 443 444 static bool is_bad_option(const JavaVMOption* option, jboolean ignore) { 445 return is_bad_option(option, ignore, NULL); 446 } 447 448 static void describe_range_error(ArgsRange errcode); 449 static ArgsRange check_memory_size(julong size, julong min_size, julong max_size); 450 static ArgsRange parse_memory_size(const char* s, julong* long_arg, 451 julong min_size, julong max_size = max_uintx); 452 // Parse a string for a unsigned integer. Returns true if value 453 // is an unsigned integer greater than or equal to the minimum 454 // parameter passed and returns the value in uintx_arg. Returns 455 // false otherwise, with uintx_arg undefined. 456 static bool parse_uintx(const char* value, uintx* uintx_arg, 457 uintx min_size); 458 459 // methods to build strings from individual args 460 static void build_jvm_args(const char* arg); 461 static void build_jvm_flags(const char* arg); 462 static void add_string(char*** bldarray, int* count, const char* arg); 463 static const char* build_resource_string(char** args, int count); 464 465 // Returns true if the flag is obsolete (and not yet expired). 466 // In this case the 'version' buffer is filled in with 467 // the version number when the flag became obsolete. 468 static bool is_obsolete_flag(const char* flag_name, JDK_Version* version); 469 470 #ifndef PRODUCT 471 static const char* removed_develop_logging_flag_name(const char* name); 472 #endif // PRODUCT 473 474 // Returns 1 if the flag is deprecated (and not yet obsolete or expired). 475 // In this case the 'version' buffer is filled in with the version number when 476 // the flag became deprecated. 477 // Returns -1 if the flag is expired or obsolete. 481 // Return the real name for the flag passed on the command line (either an alias name or "flag_name"). 482 static const char* real_flag_name(const char *flag_name); 483 484 // Return the "real" name for option arg if arg is an alias, and print a warning if arg is deprecated. 485 // Return NULL if the arg has expired. 486 static const char* handle_aliases_and_deprecation(const char* arg, bool warn); 487 static bool lookup_logging_aliases(const char* arg, char* buffer); 488 static AliasedLoggingFlag catch_logging_aliases(const char* name, bool on); 489 490 static char* SharedArchivePath; 491 static char* SharedDynamicArchivePath; 492 static size_t _default_SharedBaseAddress; // The default value specified in globals.hpp 493 static int num_archives(const char* archive_path) NOT_CDS_RETURN_(0); 494 static void extract_shared_archive_paths(const char* archive_path, 495 char** base_archive_path, 496 char** top_archive_path) NOT_CDS_RETURN; 497 498 public: 499 // Parses the arguments, first phase 500 static jint parse(const JavaVMInitArgs* args); 501 // Apply ergonomics 502 static jint apply_ergo(); 503 // Adjusts the arguments after the OS have adjusted the arguments 504 static jint adjust_after_os(); 505 506 // Check for consistency in the selection of the garbage collector. 507 static bool check_gc_consistency(); // Check user-selected gc 508 // Check consistency or otherwise of VM argument settings 509 static bool check_vm_args_consistency(); 510 // Used by os_solaris 511 static bool process_settings_file(const char* file_name, bool should_exist, jboolean ignore_unrecognized); 512 513 static size_t conservative_max_heap_alignment() { return _conservative_max_heap_alignment; } 514 // Return the maximum size a heap with compressed oops can take 515 static size_t max_heap_for_compressed_oops(); 516 517 // return a char* array containing all options 518 static char** jvm_flags_array() { return _jvm_flags_array; } 519 static char** jvm_args_array() { return _jvm_args_array; } 520 static int num_jvm_flags() { return _num_jvm_flags; } | 432 ScopedVMInitArgs* args_out); 433 434 static bool handle_deprecated_print_gc_flags(); 435 436 static jint parse_vm_init_args(const JavaVMInitArgs *vm_options_args, 437 const JavaVMInitArgs *java_tool_options_args, 438 const JavaVMInitArgs *java_options_args, 439 const JavaVMInitArgs *cmd_line_args); 440 static jint parse_each_vm_init_arg(const JavaVMInitArgs* args, bool* patch_mod_javabase, JVMFlag::Flags origin); 441 static jint finalize_vm_init_args(bool patch_mod_javabase); 442 static bool is_bad_option(const JavaVMOption* option, jboolean ignore, const char* option_type); 443 444 static bool is_bad_option(const JavaVMOption* option, jboolean ignore) { 445 return is_bad_option(option, ignore, NULL); 446 } 447 448 static void describe_range_error(ArgsRange errcode); 449 static ArgsRange check_memory_size(julong size, julong min_size, julong max_size); 450 static ArgsRange parse_memory_size(const char* s, julong* long_arg, 451 julong min_size, julong max_size = max_uintx); 452 453 // methods to build strings from individual args 454 static void build_jvm_args(const char* arg); 455 static void build_jvm_flags(const char* arg); 456 static void add_string(char*** bldarray, int* count, const char* arg); 457 static const char* build_resource_string(char** args, int count); 458 459 // Returns true if the flag is obsolete (and not yet expired). 460 // In this case the 'version' buffer is filled in with 461 // the version number when the flag became obsolete. 462 static bool is_obsolete_flag(const char* flag_name, JDK_Version* version); 463 464 #ifndef PRODUCT 465 static const char* removed_develop_logging_flag_name(const char* name); 466 #endif // PRODUCT 467 468 // Returns 1 if the flag is deprecated (and not yet obsolete or expired). 469 // In this case the 'version' buffer is filled in with the version number when 470 // the flag became deprecated. 471 // Returns -1 if the flag is expired or obsolete. 475 // Return the real name for the flag passed on the command line (either an alias name or "flag_name"). 476 static const char* real_flag_name(const char *flag_name); 477 478 // Return the "real" name for option arg if arg is an alias, and print a warning if arg is deprecated. 479 // Return NULL if the arg has expired. 480 static const char* handle_aliases_and_deprecation(const char* arg, bool warn); 481 static bool lookup_logging_aliases(const char* arg, char* buffer); 482 static AliasedLoggingFlag catch_logging_aliases(const char* name, bool on); 483 484 static char* SharedArchivePath; 485 static char* SharedDynamicArchivePath; 486 static size_t _default_SharedBaseAddress; // The default value specified in globals.hpp 487 static int num_archives(const char* archive_path) NOT_CDS_RETURN_(0); 488 static void extract_shared_archive_paths(const char* archive_path, 489 char** base_archive_path, 490 char** top_archive_path) NOT_CDS_RETURN; 491 492 public: 493 // Parses the arguments, first phase 494 static jint parse(const JavaVMInitArgs* args); 495 // Parse a string for a unsigned integer. Returns true if value 496 // is an unsigned integer greater than or equal to the minimum 497 // parameter passed and returns the value in uintx_arg. Returns 498 // false otherwise, with uintx_arg undefined. 499 static bool parse_uintx(const char* value, uintx* uintx_arg, 500 uintx min_size); 501 // Apply ergonomics 502 static jint apply_ergo(); 503 // Adjusts the arguments after the OS have adjusted the arguments 504 static jint adjust_after_os(); 505 506 // Check for consistency in the selection of the garbage collector. 507 static bool check_gc_consistency(); // Check user-selected gc 508 // Check consistency or otherwise of VM argument settings 509 static bool check_vm_args_consistency(); 510 // Used by os_solaris 511 static bool process_settings_file(const char* file_name, bool should_exist, jboolean ignore_unrecognized); 512 513 static size_t conservative_max_heap_alignment() { return _conservative_max_heap_alignment; } 514 // Return the maximum size a heap with compressed oops can take 515 static size_t max_heap_for_compressed_oops(); 516 517 // return a char* array containing all options 518 static char** jvm_flags_array() { return _jvm_flags_array; } 519 static char** jvm_args_array() { return _jvm_args_array; } 520 static int num_jvm_flags() { return _num_jvm_flags; } |