src/share/vm/runtime/arguments.hpp
Index Unified diffs Context diffs Sdiffs Patch New Old Previous File Next File hotspot Sdiff src/share/vm/runtime

src/share/vm/runtime/arguments.hpp

Print this page
rev 5803 : 8028391: Make the Min/MaxHeapFreeRatio flags manageable
Summary: Made the flags Min- and MaxHeapFreeRatio manageable, and implemented support for these flags in ParallalGC.
Reviewed-by: sla, mgerdin, brutisso


  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  *
  19  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  20  * or visit www.oracle.com if you need additional information or have any
  21  * questions.
  22  *
  23  */
  24 
  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 
  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 
  47 class SystemProperty: public CHeapObj<mtInternal> {
  48  private:
  49   char*           _key;


 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, Flag::Flags origin);
 364   static bool process_argument(const char* arg, jboolean ignore_unrecognized, Flag::Flags 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, Flag::Flags 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   }





 378   static bool verify_interval(uintx val, uintx min,
 379                               uintx max, const char* name);
 380   static bool verify_min_value(intx val, intx min, const char* name);
 381   static bool verify_percentage(uintx value, const char* name);
 382   static void describe_range_error(ArgsRange errcode);
 383   static ArgsRange check_memory_size(julong size, julong min_size);
 384   static ArgsRange parse_memory_size(const char* s, julong* long_arg,
 385                                      julong min_size);
 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);
 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);


 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:
 437   // Parses the arguments, first phase
 438   static jint parse(const JavaVMInitArgs* args);
 439   // Apply ergonomics
 440   static jint apply_ergo();
 441   // Adjusts the arguments after the OS have adjusted the arguments
 442   static jint adjust_after_os();









 443   // Check for consistency in the selection of the garbage collector.
 444   static bool check_gc_consistency();
 445   static void check_deprecated_gcs();
 446   static void check_deprecated_gc_flags();
 447   // Check consistecy or otherwise of VM argument settings
 448   static bool check_vm_args_consistency();
 449   // Check stack pages settings
 450   static bool check_stack_pages();
 451   // Used by os_solaris
 452   static bool process_settings_file(const char* file_name, bool should_exist, jboolean ignore_unrecognized);
 453 
 454   static size_t conservative_max_heap_alignment() { return _conservative_max_heap_alignment; }
 455   // Return the maximum size a heap with compressed oops can take
 456   static size_t max_heap_for_compressed_oops();
 457 
 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; }




  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  *
  19  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  20  * or visit www.oracle.com if you need additional information or have any
  21  * questions.
  22  *
  23  */
  24 
  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/debug.hpp"
  31 #include "utilities/top.hpp"
  32 
  33 // Arguments parses the command line and recognizes options
  34 
  35 // Invocation API hook typedefs (these should really be defined in jni.hpp)
  36 extern "C" {
  37   typedef void (JNICALL *abort_hook_t)(void);
  38   typedef void (JNICALL *exit_hook_t)(jint code);
  39   typedef jint (JNICALL *vfprintf_hook_t)(FILE *fp, const char *format, va_list args);
  40 }
  41 
  42 // Forward declarations
  43 
  44 class SysClassPath;
  45 
  46 // Element describing System and User (-Dkey=value flags) defined property.
  47 
  48 class SystemProperty: public CHeapObj<mtInternal> {
  49  private:
  50   char*           _key;


 354   static vfprintf_hook_t  _vfprintf_hook;
 355 
 356   // System properties
 357   static bool add_property(const char* prop);
 358 
 359   // Aggressive optimization flags.
 360   static void set_aggressive_opts_flags();
 361 
 362   // Argument parsing
 363   static void do_pd_flag_adjustments();
 364   static bool parse_argument(const char* arg, Flag::Flags origin);
 365   static bool process_argument(const char* arg, jboolean ignore_unrecognized, Flag::Flags origin);
 366   static void process_java_launcher_argument(const char*, void*);
 367   static void process_java_compiler_argument(char* arg);
 368   static jint parse_options_environment_variable(const char* name, SysClassPath* scp_p, bool* scp_assembly_required_p);
 369   static jint parse_java_tool_options_environment_variable(SysClassPath* scp_p, bool* scp_assembly_required_p);
 370   static jint parse_java_options_environment_variable(SysClassPath* scp_p, bool* scp_assembly_required_p);
 371   static jint parse_vm_init_args(const JavaVMInitArgs* args);
 372   static jint parse_each_vm_init_arg(const JavaVMInitArgs* args, SysClassPath* scp_p, bool* scp_assembly_required_p, Flag::Flags origin);
 373   static jint finalize_vm_init_args(SysClassPath* scp_p, bool scp_assembly_required);
 374   static bool is_bad_option(const JavaVMOption* option, jboolean ignore, const char* option_type);
 375 
 376   static bool is_bad_option(const JavaVMOption* option, jboolean ignore) {
 377     return is_bad_option(option, ignore, NULL);
 378   }
 379 
 380   static bool is_percentage(uintx val) {
 381     return val <= 100;
 382   }
 383 
 384   static bool verify_interval(uintx val, uintx min,
 385                               uintx max, const char* name);
 386   static bool verify_min_value(intx val, intx min, const char* name);
 387   static bool verify_percentage(uintx value, const char* name);
 388   static void describe_range_error(ArgsRange errcode);
 389   static ArgsRange check_memory_size(julong size, julong min_size);
 390   static ArgsRange parse_memory_size(const char* s, julong* long_arg,
 391                                      julong min_size);
 392   // Parse a string for a unsigned integer.  Returns true if value
 393   // is an unsigned integer greater than or equal to the minimum
 394   // parameter passed and returns the value in uintx_arg.  Returns
 395   // false otherwise, with uintx_arg undefined.
 396   static bool parse_uintx(const char* value, uintx* uintx_arg,
 397                           uintx min_size);
 398 
 399   // methods to build strings from individual args
 400   static void build_jvm_args(const char* arg);
 401   static void build_jvm_flags(const char* arg);
 402   static void add_string(char*** bldarray, int* count, const char* arg);
 403   static const char* build_resource_string(char** args, int count);


 429   static short  CompileOnlyMethodsMax;
 430   static char** CompileOnlyMethods;
 431   static bool*  CompileOnlyAllClasses;
 432 
 433   static short  InterpretOnlyClassesNum;
 434   static short  InterpretOnlyClassesMax;
 435   static char** InterpretOnlyClasses;
 436   static bool*  InterpretOnlyAllMethods;
 437 
 438   static bool   CheckCompileOnly;
 439 
 440   static char*  SharedArchivePath;
 441 
 442  public:
 443   // Parses the arguments, first phase
 444   static jint parse(const JavaVMInitArgs* args);
 445   // Apply ergonomics
 446   static jint apply_ergo();
 447   // Adjusts the arguments after the OS have adjusted the arguments
 448   static jint adjust_after_os();
 449 
 450   // Verifies that the given value will fit as a MinHeapFreeRatio. If not, an error
 451   // message is returned in the provided buffer.
 452   static bool verify_MinHeapFreeRatio(FormatBuffer<80>& err_msg, uintx min_heap_free_ratio);
 453 
 454   // Verifies that the given value will fit as a MaxHeapFreeRatio. If not, an error
 455   // message is returned in the provided buffer.
 456   static bool verify_MaxHeapFreeRatio(FormatBuffer<80>& err_msg, uintx max_heap_free_ratio);
 457 
 458   // Check for consistency in the selection of the garbage collector.
 459   static bool check_gc_consistency();
 460   static void check_deprecated_gcs();
 461   static void check_deprecated_gc_flags();
 462   // Check consistecy or otherwise of VM argument settings
 463   static bool check_vm_args_consistency();
 464   // Check stack pages settings
 465   static bool check_stack_pages();
 466   // Used by os_solaris
 467   static bool process_settings_file(const char* file_name, bool should_exist, jboolean ignore_unrecognized);
 468 
 469   static size_t conservative_max_heap_alignment() { return _conservative_max_heap_alignment; }
 470   // Return the maximum size a heap with compressed oops can take
 471   static size_t max_heap_for_compressed_oops();
 472 
 473   // return a char* array containing all options
 474   static char** jvm_flags_array()          { return _jvm_flags_array; }
 475   static char** jvm_args_array()           { return _jvm_args_array; }
 476   static int num_jvm_flags()               { return _num_jvm_flags; }
 477   static int num_jvm_args()                { return _num_jvm_args; }


src/share/vm/runtime/arguments.hpp
Index Unified diffs Context diffs Sdiffs Patch New Old Previous File Next File