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