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