1 /*
   2  * Copyright (c) 1997, 2016, Oracle and/or its affiliates. All rights reserved.
   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  *
  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 "logging/logLevel.hpp"
  29 #include "logging/logTag.hpp"
  30 #include "runtime/java.hpp"
  31 #include "runtime/os.hpp"
  32 #include "runtime/perfData.hpp"
  33 #include "utilities/debug.hpp"
  34 #include "utilities/top.hpp"
  35 
  36 // Arguments parses the command line and recognizes options
  37 
  38 // Invocation API hook typedefs (these should really be defined in jni.hpp)
  39 extern "C" {
  40   typedef void (JNICALL *abort_hook_t)(void);
  41   typedef void (JNICALL *exit_hook_t)(jint code);
  42   typedef jint (JNICALL *vfprintf_hook_t)(FILE *fp, const char *format, va_list args)  ATTRIBUTE_PRINTF(2, 0);
  43 }
  44 
  45 // Forward declarations
  46 
  47 class SysClassPath;
  48 
  49 // Element describing System and User (-Dkey=value flags) defined property.
  50 
  51 class SystemProperty: public CHeapObj<mtInternal> {
  52  private:
  53   char*           _key;
  54   char*           _value;
  55   SystemProperty* _next;
  56   bool            _writeable;
  57   bool writeable()   { return _writeable; }
  58 
  59  public:
  60   // Accessors
  61   const char* key() const                   { return _key; }
  62   char* value() const                       { return _value; }
  63   SystemProperty* next() const              { return _next; }
  64   void set_next(SystemProperty* next)       { _next = next; }
  65   bool set_value(const char *value) {
  66     if (writeable()) {
  67       if (_value != NULL) {
  68         FreeHeap(_value);
  69       }
  70       _value = AllocateHeap(strlen(value)+1, mtInternal);
  71       if (_value != NULL) {
  72         strcpy(_value, value);
  73       }
  74       return true;
  75     }
  76     return false;
  77   }
  78 
  79   void append_value(const char *value) {
  80     char *sp;
  81     size_t len = 0;
  82     if (value != NULL) {
  83       len = strlen(value);
  84       if (_value != NULL) {
  85         len += strlen(_value);
  86       }
  87       sp = AllocateHeap(len+2, mtInternal);
  88       if (sp != NULL) {
  89         if (_value != NULL) {
  90           strcpy(sp, _value);
  91           strcat(sp, os::path_separator());
  92           strcat(sp, value);
  93           FreeHeap(_value);
  94         } else {
  95           strcpy(sp, value);
  96         }
  97         _value = sp;
  98       }
  99     }
 100   }
 101 
 102   // Constructor
 103   SystemProperty(const char* key, const char* value, bool writeable) {
 104     if (key == NULL) {
 105       _key = NULL;
 106     } else {
 107       _key = AllocateHeap(strlen(key)+1, mtInternal);
 108       strcpy(_key, key);
 109     }
 110     if (value == NULL) {
 111       _value = NULL;
 112     } else {
 113       _value = AllocateHeap(strlen(value)+1, mtInternal);
 114       strcpy(_value, value);
 115     }
 116     _next = NULL;
 117     _writeable = writeable;
 118   }
 119 };
 120 
 121 
 122 // For use by -agentlib, -agentpath and -Xrun
 123 class AgentLibrary : public CHeapObj<mtInternal> {
 124   friend class AgentLibraryList;
 125 public:
 126   // Is this library valid or not. Don't rely on os_lib == NULL as statically
 127   // linked lib could have handle of RTLD_DEFAULT which == 0 on some platforms
 128   enum AgentState {
 129     agent_invalid = 0,
 130     agent_valid   = 1
 131   };
 132 
 133  private:
 134   char*           _name;
 135   char*           _options;
 136   void*           _os_lib;
 137   bool            _is_absolute_path;
 138   bool            _is_static_lib;
 139   AgentState      _state;
 140   AgentLibrary*   _next;
 141 
 142  public:
 143   // Accessors
 144   const char* name() const                  { return _name; }
 145   char* options() const                     { return _options; }
 146   bool is_absolute_path() const             { return _is_absolute_path; }
 147   void* os_lib() const                      { return _os_lib; }
 148   void set_os_lib(void* os_lib)             { _os_lib = os_lib; }
 149   AgentLibrary* next() const                { return _next; }
 150   bool is_static_lib() const                { return _is_static_lib; }
 151   void set_static_lib(bool is_static_lib)   { _is_static_lib = is_static_lib; }
 152   bool valid()                              { return (_state == agent_valid); }
 153   void set_valid()                          { _state = agent_valid; }
 154   void set_invalid()                        { _state = agent_invalid; }
 155 
 156   // Constructor
 157   AgentLibrary(const char* name, const char* options, bool is_absolute_path, void* os_lib) {
 158     _name = AllocateHeap(strlen(name)+1, mtInternal);
 159     strcpy(_name, name);
 160     if (options == NULL) {
 161       _options = NULL;
 162     } else {
 163       _options = AllocateHeap(strlen(options)+1, mtInternal);
 164       strcpy(_options, options);
 165     }
 166     _is_absolute_path = is_absolute_path;
 167     _os_lib = os_lib;
 168     _next = NULL;
 169     _state = agent_invalid;
 170     _is_static_lib = false;
 171   }
 172 };
 173 
 174 // maintain an order of entry list of AgentLibrary
 175 class AgentLibraryList VALUE_OBJ_CLASS_SPEC {
 176  private:
 177   AgentLibrary*   _first;
 178   AgentLibrary*   _last;
 179  public:
 180   bool is_empty() const                     { return _first == NULL; }
 181   AgentLibrary* first() const               { return _first; }
 182 
 183   // add to the end of the list
 184   void add(AgentLibrary* lib) {
 185     if (is_empty()) {
 186       _first = _last = lib;
 187     } else {
 188       _last->_next = lib;
 189       _last = lib;
 190     }
 191     lib->_next = NULL;
 192   }
 193 
 194   // search for and remove a library known to be in the list
 195   void remove(AgentLibrary* lib) {
 196     AgentLibrary* curr;
 197     AgentLibrary* prev = NULL;
 198     for (curr = first(); curr != NULL; prev = curr, curr = curr->next()) {
 199       if (curr == lib) {
 200         break;
 201       }
 202     }
 203     assert(curr != NULL, "always should be found");
 204 
 205     if (curr != NULL) {
 206       // it was found, by-pass this library
 207       if (prev == NULL) {
 208         _first = curr->_next;
 209       } else {
 210         prev->_next = curr->_next;
 211       }
 212       if (curr == _last) {
 213         _last = prev;
 214       }
 215       curr->_next = NULL;
 216     }
 217   }
 218 
 219   AgentLibraryList() {
 220     _first = NULL;
 221     _last = NULL;
 222   }
 223 };
 224 
 225 // Helper class for controlling the lifetime of JavaVMInitArgs objects.
 226 class ScopedVMInitArgs;
 227 
 228 // Most logging functions require 5 tags. Some of them may be _NO_TAG.
 229 typedef struct {
 230   const char* alias_name;
 231   LogLevelType level;
 232   bool exactMatch;
 233   LogTagType tag;
 234 } AliasedLoggingFlag;
 235 
 236 class Arguments : AllStatic {
 237   friend class VMStructs;
 238   friend class JvmtiExport;
 239   friend class CodeCacheExtensions;
 240  public:
 241   // Operation modi
 242   enum Mode {
 243     _int,       // corresponds to -Xint
 244     _mixed,     // corresponds to -Xmixed
 245     _comp       // corresponds to -Xcomp
 246   };
 247 
 248   enum ArgsRange {
 249     arg_unreadable = -3,
 250     arg_too_small  = -2,
 251     arg_too_big    = -1,
 252     arg_in_range   = 0
 253   };
 254 
 255  private:
 256 
 257   // a pointer to the flags file name if it is specified
 258   static char*  _jvm_flags_file;
 259   // an array containing all flags specified in the .hotspotrc file
 260   static char** _jvm_flags_array;
 261   static int    _num_jvm_flags;
 262   // an array containing all jvm arguments specified in the command line
 263   static char** _jvm_args_array;
 264   static int    _num_jvm_args;
 265   // string containing all java command (class/jarfile name and app args)
 266   static char* _java_command;
 267 
 268   // Property list
 269   static SystemProperty* _system_properties;
 270 
 271   // Quick accessor to System properties in the list:
 272   static SystemProperty *_sun_boot_library_path;
 273   static SystemProperty *_java_library_path;
 274   static SystemProperty *_java_home;
 275   static SystemProperty *_java_class_path;
 276   static SystemProperty *_sun_boot_class_path;
 277 
 278   // temporary: to emit warning if the default ext dirs are not empty.
 279   // remove this variable when the warning is no longer needed.
 280   static char* _ext_dirs;
 281 
 282   // java.vendor.url.bug, bug reporting URL for fatal errors.
 283   static const char* _java_vendor_url_bug;
 284 
 285   // sun.java.launcher, private property to provide information about
 286   // java launcher
 287   static const char* _sun_java_launcher;
 288 
 289   // sun.java.launcher.pid, private property
 290   static int    _sun_java_launcher_pid;
 291 
 292   // was this VM created via the -XXaltjvm=<path> option
 293   static bool   _sun_java_launcher_is_altjvm;
 294 
 295   // Option flags
 296   static bool   _has_profile;
 297   static const char*  _gc_log_filename;
 298   // Value of the conservative maximum heap alignment needed
 299   static size_t  _conservative_max_heap_alignment;
 300 
 301   static uintx _min_heap_size;
 302 
 303   // -Xrun arguments
 304   static AgentLibraryList _libraryList;
 305   static void add_init_library(const char* name, char* options)
 306     { _libraryList.add(new AgentLibrary(name, options, false, NULL)); }
 307 
 308   // -agentlib and -agentpath arguments
 309   static AgentLibraryList _agentList;
 310   static void add_init_agent(const char* name, char* options, bool absolute_path)
 311     { _agentList.add(new AgentLibrary(name, options, absolute_path, NULL)); }
 312 
 313   // Late-binding agents not started via arguments
 314   static void add_loaded_agent(AgentLibrary *agentLib)
 315     { _agentList.add(agentLib); }
 316   static void add_loaded_agent(const char* name, char* options, bool absolute_path, void* os_lib)
 317     { _agentList.add(new AgentLibrary(name, options, absolute_path, os_lib)); }
 318 
 319   // Operation modi
 320   static Mode _mode;
 321   static void set_mode_flags(Mode mode);
 322   static bool _java_compiler;
 323   static void set_java_compiler(bool arg) { _java_compiler = arg; }
 324   static bool java_compiler()   { return _java_compiler; }
 325 
 326   // -Xdebug flag
 327   static bool _xdebug_mode;
 328   static void set_xdebug_mode(bool arg) { _xdebug_mode = arg; }
 329   static bool xdebug_mode()             { return _xdebug_mode; }
 330 
 331   // Used to save default settings
 332   static bool _AlwaysCompileLoopMethods;
 333   static bool _UseOnStackReplacement;
 334   static bool _BackgroundCompilation;
 335   static bool _ClipInlining;
 336   static bool _CIDynamicCompilePriority;
 337   static intx _Tier3InvokeNotifyFreqLog;
 338   static intx _Tier4InvocationThreshold;
 339 
 340   // Tiered
 341   static void set_tiered_flags();
 342   // CMS/ParNew garbage collectors
 343   static void set_parnew_gc_flags();
 344   static void set_cms_and_parnew_gc_flags();
 345   // UseParallel[Old]GC
 346   static void set_parallel_gc_flags();
 347   // Garbage-First (UseG1GC)
 348   static void set_g1_gc_flags();
 349   // GC ergonomics
 350   static void set_conservative_max_heap_alignment();
 351   static void set_use_compressed_oops();
 352   static void set_use_compressed_klass_ptrs();
 353   static void select_gc();
 354   static void set_ergonomics_flags();
 355   static void set_shared_spaces_flags();
 356   // limits the given memory size by the maximum amount of memory this process is
 357   // currently allowed to allocate or reserve.
 358   static julong limit_by_allocatable_memory(julong size);
 359   // Setup heap size
 360   static void set_heap_size();
 361   // Based on automatic selection criteria, should the
 362   // low pause collector be used.
 363   static bool should_auto_select_low_pause_collector();
 364 
 365   // Bytecode rewriting
 366   static void set_bytecode_flags();
 367 
 368   // Invocation API hooks
 369   static abort_hook_t     _abort_hook;
 370   static exit_hook_t      _exit_hook;
 371   static vfprintf_hook_t  _vfprintf_hook;
 372 
 373   // System properties
 374   static bool add_property(const char* prop);
 375 
 376   // Aggressive optimization flags.
 377   static jint set_aggressive_opts_flags();
 378 
 379   static jint set_aggressive_heap_flags();
 380 
 381   // Argument parsing
 382   static void do_pd_flag_adjustments();
 383   static bool parse_argument(const char* arg, Flag::Flags origin);
 384   static bool process_argument(const char* arg, jboolean ignore_unrecognized, Flag::Flags origin);
 385   static void process_java_launcher_argument(const char*, void*);
 386   static void process_java_compiler_argument(const char* arg);
 387   static jint parse_options_environment_variable(const char* name, ScopedVMInitArgs* vm_args);
 388   static jint parse_java_tool_options_environment_variable(ScopedVMInitArgs* vm_args);
 389   static jint parse_java_options_environment_variable(ScopedVMInitArgs* vm_args);
 390   static jint parse_vm_options_file(const char* file_name, ScopedVMInitArgs* vm_args);
 391   static jint parse_options_buffer(const char* name, char* buffer, const size_t buf_len, ScopedVMInitArgs* vm_args);
 392   static jint insert_vm_options_file(const JavaVMInitArgs* args,
 393                                      const char* vm_options_file,
 394                                      const int vm_options_file_pos,
 395                                      ScopedVMInitArgs* vm_options_file_args,
 396                                      ScopedVMInitArgs* args_out);
 397   static bool args_contains_vm_options_file_arg(const JavaVMInitArgs* args);
 398   static jint expand_vm_options_as_needed(const JavaVMInitArgs* args_in,
 399                                           ScopedVMInitArgs* mod_args,
 400                                           JavaVMInitArgs** args_out);
 401   static jint match_special_option_and_act(const JavaVMInitArgs* args,
 402                                            ScopedVMInitArgs* args_out);
 403 
 404   static bool handle_deprecated_print_gc_flags();
 405 
 406   static jint parse_vm_init_args(const JavaVMInitArgs *java_tool_options_args,
 407                                  const JavaVMInitArgs *java_options_args,
 408                                  const JavaVMInitArgs *cmd_line_args);
 409   static jint parse_each_vm_init_arg(const JavaVMInitArgs* args, SysClassPath* scp_p, bool* scp_assembly_required_p, Flag::Flags origin);
 410   static jint finalize_vm_init_args(SysClassPath* scp_p, bool scp_assembly_required);
 411   static bool is_bad_option(const JavaVMOption* option, jboolean ignore, const char* option_type);
 412 
 413   static bool is_bad_option(const JavaVMOption* option, jboolean ignore) {
 414     return is_bad_option(option, ignore, NULL);
 415   }
 416 
 417   static void describe_range_error(ArgsRange errcode);
 418   static ArgsRange check_memory_size(julong size, julong min_size);
 419   static ArgsRange parse_memory_size(const char* s, julong* long_arg,
 420                                      julong min_size);
 421   // Parse a string for a unsigned integer.  Returns true if value
 422   // is an unsigned integer greater than or equal to the minimum
 423   // parameter passed and returns the value in uintx_arg.  Returns
 424   // false otherwise, with uintx_arg undefined.
 425   static bool parse_uintx(const char* value, uintx* uintx_arg,
 426                           uintx min_size);
 427 
 428   // methods to build strings from individual args
 429   static void build_jvm_args(const char* arg);
 430   static void build_jvm_flags(const char* arg);
 431   static void add_string(char*** bldarray, int* count, const char* arg);
 432   static const char* build_resource_string(char** args, int count);
 433 
 434   static bool methodExists(
 435     char* className, char* methodName,
 436     int classesNum, char** classes, bool* allMethods,
 437     int methodsNum, char** methods, bool* allClasses
 438   );
 439 
 440   static void parseOnlyLine(
 441     const char* line,
 442     short* classesNum, short* classesMax, char*** classes, bool** allMethods,
 443     short* methodsNum, short* methodsMax, char*** methods, bool** allClasses
 444   );
 445 
 446   // Returns true if the flag is obsolete (and not yet expired).
 447   // In this case the 'version' buffer is filled in with
 448   // the version number when the flag became obsolete.
 449   static bool is_obsolete_flag(const char* flag_name, JDK_Version* version);
 450 
 451   // Returns 1 if the flag is deprecated (and not yet obsolete or expired).
 452   //     In this case the 'version' buffer is filled in with the version number when
 453   //     the flag became deprecated.
 454   // Returns -1 if the flag is expired or obsolete.
 455   // Returns 0 otherwise.
 456   static int is_deprecated_flag(const char* flag_name, JDK_Version* version);
 457 
 458   // Return the real name for the flag passed on the command line (either an alias name or "flag_name").
 459   static const char* real_flag_name(const char *flag_name);
 460 
 461   // Return the "real" name for option arg if arg is an alias, and print a warning if arg is deprecated.
 462   // Return NULL if the arg has expired.
 463   static const char* handle_aliases_and_deprecation(const char* arg, bool warn);
 464   static bool lookup_logging_aliases(const char* arg, char* buffer);
 465   static AliasedLoggingFlag catch_logging_aliases(const char* name);
 466   static short  CompileOnlyClassesNum;
 467   static short  CompileOnlyClassesMax;
 468   static char** CompileOnlyClasses;
 469   static bool*  CompileOnlyAllMethods;
 470 
 471   static short  CompileOnlyMethodsNum;
 472   static short  CompileOnlyMethodsMax;
 473   static char** CompileOnlyMethods;
 474   static bool*  CompileOnlyAllClasses;
 475 
 476   static short  InterpretOnlyClassesNum;
 477   static short  InterpretOnlyClassesMax;
 478   static char** InterpretOnlyClasses;
 479   static bool*  InterpretOnlyAllMethods;
 480 
 481   static bool   CheckCompileOnly;
 482 
 483   static char*  SharedArchivePath;
 484 
 485  public:
 486   // Scale compile thresholds
 487   // Returns threshold scaled with CompileThresholdScaling
 488   static intx scaled_compile_threshold(intx threshold, double scale);
 489   static intx scaled_compile_threshold(intx threshold) {
 490     return scaled_compile_threshold(threshold, CompileThresholdScaling);
 491   }
 492   // Returns freq_log scaled with CompileThresholdScaling
 493   static intx scaled_freq_log(intx freq_log, double scale);
 494   static intx scaled_freq_log(intx freq_log) {
 495     return scaled_freq_log(freq_log, CompileThresholdScaling);
 496   }
 497 
 498   // Parses the arguments, first phase
 499   static jint parse(const JavaVMInitArgs* args);
 500   // Apply ergonomics
 501   static jint apply_ergo();
 502   // Adjusts the arguments after the OS have adjusted the arguments
 503   static jint adjust_after_os();
 504 
 505   static void set_gc_specific_flags();
 506   static inline bool gc_selected(); // whether a gc has been selected
 507   static void select_gc_ergonomically();
 508 
 509   // Check for consistency in the selection of the garbage collector.
 510   static bool check_gc_consistency();        // Check user-selected gc
 511   // Check consistency or otherwise of VM argument settings
 512   static bool check_vm_args_consistency();
 513   // Used by os_solaris
 514   static bool process_settings_file(const char* file_name, bool should_exist, jboolean ignore_unrecognized);
 515 
 516   static size_t conservative_max_heap_alignment() { return _conservative_max_heap_alignment; }
 517   // Return the maximum size a heap with compressed oops can take
 518   static size_t max_heap_for_compressed_oops();
 519 
 520   // return a char* array containing all options
 521   static char** jvm_flags_array()          { return _jvm_flags_array; }
 522   static char** jvm_args_array()           { return _jvm_args_array; }
 523   static int num_jvm_flags()               { return _num_jvm_flags; }
 524   static int num_jvm_args()                { return _num_jvm_args; }
 525   // return the arguments passed to the Java application
 526   static const char* java_command()        { return _java_command; }
 527 
 528   // print jvm_flags, jvm_args and java_command
 529   static void print_on(outputStream* st);
 530   static void print_summary_on(outputStream* st);
 531 
 532   // convenient methods to get and set jvm_flags_file
 533   static const char* get_jvm_flags_file()  { return _jvm_flags_file; }
 534   static void set_jvm_flags_file(const char *value) {
 535     if (_jvm_flags_file != NULL) {
 536       os::free(_jvm_flags_file);
 537     }
 538     _jvm_flags_file = os::strdup_check_oom(value);
 539   }
 540   // convenient methods to obtain / print jvm_flags and jvm_args
 541   static const char* jvm_flags()           { return build_resource_string(_jvm_flags_array, _num_jvm_flags); }
 542   static const char* jvm_args()            { return build_resource_string(_jvm_args_array, _num_jvm_args); }
 543   static void print_jvm_flags_on(outputStream* st);
 544   static void print_jvm_args_on(outputStream* st);
 545 
 546   // -Dkey=value flags
 547   static SystemProperty*  system_properties()   { return _system_properties; }
 548   static const char*    get_property(const char* key);
 549 
 550   // -Djava.vendor.url.bug
 551   static const char* java_vendor_url_bug()  { return _java_vendor_url_bug; }
 552 
 553   // -Dsun.java.launcher
 554   static const char* sun_java_launcher()    { return _sun_java_launcher; }
 555   // Was VM created by a Java launcher?
 556   static bool created_by_java_launcher();
 557   // -Dsun.java.launcher.is_altjvm
 558   static bool sun_java_launcher_is_altjvm();
 559   // -Dsun.java.launcher.pid
 560   static int sun_java_launcher_pid()        { return _sun_java_launcher_pid; }
 561 
 562   // -Xprof
 563   static bool has_profile()                 { return _has_profile; }
 564 
 565   // -Xms
 566   static size_t min_heap_size()             { return _min_heap_size; }
 567   static void  set_min_heap_size(size_t v)  { _min_heap_size = v;  }
 568 
 569   // -Xrun
 570   static AgentLibrary* libraries()          { return _libraryList.first(); }
 571   static bool init_libraries_at_startup()   { return !_libraryList.is_empty(); }
 572   static void convert_library_to_agent(AgentLibrary* lib)
 573                                             { _libraryList.remove(lib);
 574                                               _agentList.add(lib); }
 575 
 576   // -agentlib -agentpath
 577   static AgentLibrary* agents()             { return _agentList.first(); }
 578   static bool init_agents_at_startup()      { return !_agentList.is_empty(); }
 579 
 580   // abort, exit, vfprintf hooks
 581   static abort_hook_t    abort_hook()       { return _abort_hook; }
 582   static exit_hook_t     exit_hook()        { return _exit_hook; }
 583   static vfprintf_hook_t vfprintf_hook()    { return _vfprintf_hook; }
 584 
 585   static bool GetCheckCompileOnly ()        { return CheckCompileOnly; }
 586 
 587   static const char* GetSharedArchivePath() { return SharedArchivePath; }
 588 
 589   static bool CompileMethod(char* className, char* methodName) {
 590     return
 591       methodExists(
 592         className, methodName,
 593         CompileOnlyClassesNum, CompileOnlyClasses, CompileOnlyAllMethods,
 594         CompileOnlyMethodsNum, CompileOnlyMethods, CompileOnlyAllClasses
 595       );
 596   }
 597 
 598   // Java launcher properties
 599   static void process_sun_java_launcher_properties(JavaVMInitArgs* args);
 600 
 601   // System properties
 602   static void init_system_properties();
 603 
 604   // Update/Initialize System properties after JDK version number is known
 605   static void init_version_specific_system_properties();
 606 
 607   // Property List manipulation
 608   static void PropertyList_add(SystemProperty *element);
 609   static void PropertyList_add(SystemProperty** plist, SystemProperty *element);
 610   static void PropertyList_add(SystemProperty** plist, const char* k, const char* v);
 611   static void PropertyList_unique_add(SystemProperty** plist, const char* k, const char* v) {
 612     PropertyList_unique_add(plist, k, v, false);
 613   }
 614   static void PropertyList_unique_add(SystemProperty** plist, const char* k, const char* v, jboolean append);
 615   static const char* PropertyList_get_value(SystemProperty* plist, const char* key);
 616   static int  PropertyList_count(SystemProperty* pl);
 617   static const char* PropertyList_get_key_at(SystemProperty* pl,int index);
 618   static char* PropertyList_get_value_at(SystemProperty* pl,int index);
 619 
 620   // Miscellaneous System property value getter and setters.
 621   static void set_dll_dir(const char *value) { _sun_boot_library_path->set_value(value); }
 622   static void set_java_home(const char *value) { _java_home->set_value(value); }
 623   static void set_library_path(const char *value) { _java_library_path->set_value(value); }
 624   static void set_ext_dirs(char *value)     { _ext_dirs = os::strdup_check_oom(value); }
 625   static void set_sysclasspath(const char *value) { _sun_boot_class_path->set_value(value); }
 626   static void append_sysclasspath(const char *value) { _sun_boot_class_path->append_value(value); }
 627 
 628   static char* get_java_home() { return _java_home->value(); }
 629   static char* get_dll_dir() { return _sun_boot_library_path->value(); }
 630   static char* get_sysclasspath() { return _sun_boot_class_path->value(); }
 631   static char* get_ext_dirs()        { return _ext_dirs;  }
 632   static char* get_appclasspath() { return _java_class_path->value(); }
 633   static void  fix_appclasspath();
 634 
 635 
 636   // Operation modi
 637   static Mode mode()                { return _mode; }
 638   static bool is_interpreter_only() { return mode() == _int; }
 639 
 640 
 641   // Utility: copies src into buf, replacing "%%" with "%" and "%p" with pid.
 642   static bool copy_expand_pid(const char* src, size_t srclen, char* buf, size_t buflen);
 643 };
 644 
 645 bool Arguments::gc_selected() {
 646   return UseConcMarkSweepGC || UseG1GC || UseParallelGC || UseParallelOldGC || UseSerialGC;
 647 }
 648 
 649 // Disable options not supported in this release, with a warning if they
 650 // were explicitly requested on the command-line
 651 #define UNSUPPORTED_OPTION(opt, description)                    \
 652 do {                                                            \
 653   if (opt) {                                                    \
 654     if (FLAG_IS_CMDLINE(opt)) {                                 \
 655       warning(description " is disabled in this release.");     \
 656     }                                                           \
 657     FLAG_SET_DEFAULT(opt, false);                               \
 658   }                                                             \
 659 } while(0)
 660 
 661 #endif // SHARE_VM_RUNTIME_ARGUMENTS_HPP