1 /*
   2  * Copyright (c) 1997, 2014, 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(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 
 224 class Arguments : AllStatic {
 225   friend class VMStructs;
 226   friend class JvmtiExport;
 227  public:
 228   // Operation modi
 229   enum Mode {
 230     _int,       // corresponds to -Xint
 231     _mixed,     // corresponds to -Xmixed
 232     _comp       // corresponds to -Xcomp
 233   };
 234 
 235   enum ArgsRange {
 236     arg_unreadable = -3,
 237     arg_too_small  = -2,
 238     arg_too_big    = -1,
 239     arg_in_range   = 0
 240   };
 241 
 242  private:
 243 
 244   // an array containing all flags specified in the .hotspotrc file
 245   static char** _jvm_flags_array;
 246   static int    _num_jvm_flags;
 247   // an array containing all jvm arguments specified in the command line
 248   static char** _jvm_args_array;
 249   static int    _num_jvm_args;
 250   // string containing all java command (class/jarfile name and app args)
 251   static char* _java_command;
 252 
 253   // Property list
 254   static SystemProperty* _system_properties;
 255 
 256   // Quick accessor to System properties in the list:
 257   static SystemProperty *_java_ext_dirs;
 258   static SystemProperty *_java_endorsed_dirs;
 259   static SystemProperty *_sun_boot_library_path;
 260   static SystemProperty *_java_library_path;
 261   static SystemProperty *_java_home;
 262   static SystemProperty *_java_class_path;
 263   static SystemProperty *_sun_boot_class_path;
 264 
 265   // Meta-index for knowing what packages are in the boot class path
 266   static char* _meta_index_path;
 267   static char* _meta_index_dir;
 268 
 269   // java.vendor.url.bug, bug reporting URL for fatal errors.
 270   static const char* _java_vendor_url_bug;
 271 
 272   // sun.java.launcher, private property to provide information about
 273   // java launcher
 274   static const char* _sun_java_launcher;
 275 
 276   // sun.java.launcher.pid, private property
 277   static int    _sun_java_launcher_pid;
 278 
 279   // was this VM created via the -XXaltjvm=<path> option
 280   static bool   _sun_java_launcher_is_altjvm;
 281 
 282   // Option flags
 283   static bool   _has_profile;
 284   static const char*  _gc_log_filename;
 285   // Value of the conservative maximum heap alignment needed
 286   static size_t  _conservative_max_heap_alignment;
 287 
 288   static uintx  _min_heap_size;
 289 
 290   // -Xrun arguments
 291   static AgentLibraryList _libraryList;
 292   static void add_init_library(const char* name, char* options)
 293     { _libraryList.add(new AgentLibrary(name, options, false, NULL)); }
 294 
 295   // -agentlib and -agentpath arguments
 296   static AgentLibraryList _agentList;
 297   static void add_init_agent(const char* name, char* options, bool absolute_path)
 298     { _agentList.add(new AgentLibrary(name, options, absolute_path, NULL)); }
 299 
 300   // Late-binding agents not started via arguments
 301   static void add_loaded_agent(AgentLibrary *agentLib)
 302     { _agentList.add(agentLib); }
 303   static void add_loaded_agent(const char* name, char* options, bool absolute_path, void* os_lib)
 304     { _agentList.add(new AgentLibrary(name, options, absolute_path, os_lib)); }
 305 
 306   // Operation modi
 307   static Mode _mode;
 308   static void set_mode_flags(Mode mode);
 309   static bool _java_compiler;
 310   static void set_java_compiler(bool arg) { _java_compiler = arg; }
 311   static bool java_compiler()   { return _java_compiler; }
 312 
 313   // -Xdebug flag
 314   static bool _xdebug_mode;
 315   static void set_xdebug_mode(bool arg) { _xdebug_mode = arg; }
 316   static bool xdebug_mode()             { return _xdebug_mode; }
 317 
 318   // Used to save default settings
 319   static bool _AlwaysCompileLoopMethods;
 320   static bool _UseOnStackReplacement;
 321   static bool _BackgroundCompilation;
 322   static bool _ClipInlining;
 323   static bool _CIDynamicCompilePriority;
 324 
 325   // Tiered
 326   static void set_tiered_flags();
 327   static int  get_min_number_of_compiler_threads();
 328   // CMS/ParNew garbage collectors
 329   static void set_parnew_gc_flags();
 330   static void set_cms_and_parnew_gc_flags();
 331   // UseParallel[Old]GC
 332   static void set_parallel_gc_flags();
 333   // Garbage-First (UseG1GC)
 334   static void set_g1_gc_flags();
 335   // GC ergonomics
 336   static void set_conservative_max_heap_alignment();
 337   static void set_use_compressed_oops();
 338   static void set_use_compressed_klass_ptrs();
 339   static void set_ergonomics_flags();
 340   static void set_shared_spaces_flags();
 341   // limits the given memory size by the maximum amount of memory this process is
 342   // currently allowed to allocate or reserve.
 343   static julong limit_by_allocatable_memory(julong size);
 344   // Setup heap size
 345   static void set_heap_size();
 346   // Based on automatic selection criteria, should the
 347   // low pause collector be used.
 348   static bool should_auto_select_low_pause_collector();
 349 
 350   // Bytecode rewriting
 351   static void set_bytecode_flags();
 352 
 353   // Invocation API hooks
 354   static abort_hook_t     _abort_hook;
 355   static exit_hook_t      _exit_hook;
 356   static vfprintf_hook_t  _vfprintf_hook;
 357 
 358   // System properties
 359   static bool add_property(const char* prop);
 360 
 361   // Aggressive optimization flags.
 362   static void set_aggressive_opts_flags();
 363 
 364   // Argument parsing
 365   static void do_pd_flag_adjustments();
 366   static bool parse_argument(const char* arg, Flag::Flags origin);
 367   static bool process_argument(const char* arg, jboolean ignore_unrecognized, Flag::Flags origin);
 368   static void process_java_launcher_argument(const char*, void*);
 369   static void process_java_compiler_argument(char* arg);
 370   static jint parse_options_environment_variable(const char* name, SysClassPath* scp_p, bool* scp_assembly_required_p);
 371   static jint parse_java_tool_options_environment_variable(SysClassPath* scp_p, bool* scp_assembly_required_p);
 372   static jint parse_java_options_environment_variable(SysClassPath* scp_p, bool* scp_assembly_required_p);
 373   static jint parse_vm_init_args(const JavaVMInitArgs* args);
 374   static jint parse_each_vm_init_arg(const JavaVMInitArgs* args, SysClassPath* scp_p, bool* scp_assembly_required_p, Flag::Flags origin);
 375   static jint finalize_vm_init_args(SysClassPath* scp_p, bool scp_assembly_required);
 376   static bool is_bad_option(const JavaVMOption* option, jboolean ignore, const char* option_type);
 377 
 378   static bool is_bad_option(const JavaVMOption* option, jboolean ignore) {
 379     return is_bad_option(option, ignore, NULL);
 380   }
 381 
 382   static bool is_percentage(uintx val) {
 383     return val <= 100;
 384   }
 385 
 386   static bool verify_interval(uintx val, uintx min,
 387                               uintx max, const char* name);
 388   static bool verify_min_value(intx val, intx min, const char* name);
 389   static bool verify_percentage(uintx value, const char* name);
 390   static void describe_range_error(ArgsRange errcode);
 391   static ArgsRange check_memory_size(julong size, julong min_size);
 392   static ArgsRange parse_memory_size(const char* s, julong* long_arg,
 393                                      julong min_size);
 394   // Parse a string for a unsigned integer.  Returns true if value
 395   // is an unsigned integer greater than or equal to the minimum
 396   // parameter passed and returns the value in uintx_arg.  Returns
 397   // false otherwise, with uintx_arg undefined.
 398   static bool parse_uintx(const char* value, uintx* uintx_arg,
 399                           uintx min_size);
 400 
 401   // methods to build strings from individual args
 402   static void build_jvm_args(const char* arg);
 403   static void build_jvm_flags(const char* arg);
 404   static void add_string(char*** bldarray, int* count, const char* arg);
 405   static const char* build_resource_string(char** args, int count);
 406 
 407   static bool methodExists(
 408     char* className, char* methodName,
 409     int classesNum, char** classes, bool* allMethods,
 410     int methodsNum, char** methods, bool* allClasses
 411   );
 412 
 413   static void parseOnlyLine(
 414     const char* line,
 415     short* classesNum, short* classesMax, char*** classes, bool** allMethods,
 416     short* methodsNum, short* methodsMax, char*** methods, bool** allClasses
 417   );
 418 
 419   // Returns true if the string s is in the list of flags that have recently
 420   // been made obsolete.  If we detect one of these flags on the command
 421   // line, instead of failing we print a warning message and ignore the
 422   // flag.  This gives the user a release or so to stop using the flag.
 423   static bool is_newly_obsolete(const char* s, JDK_Version* buffer);
 424 
 425   static short  CompileOnlyClassesNum;
 426   static short  CompileOnlyClassesMax;
 427   static char** CompileOnlyClasses;
 428   static bool*  CompileOnlyAllMethods;
 429 
 430   static short  CompileOnlyMethodsNum;
 431   static short  CompileOnlyMethodsMax;
 432   static char** CompileOnlyMethods;
 433   static bool*  CompileOnlyAllClasses;
 434 
 435   static short  InterpretOnlyClassesNum;
 436   static short  InterpretOnlyClassesMax;
 437   static char** InterpretOnlyClasses;
 438   static bool*  InterpretOnlyAllMethods;
 439 
 440   static bool   CheckCompileOnly;
 441 
 442   static char*  SharedArchivePath;
 443 
 444  public:
 445   // Parses the arguments, first phase
 446   static jint parse(const JavaVMInitArgs* args);
 447   // Apply ergonomics
 448   static jint apply_ergo();
 449   // Adjusts the arguments after the OS have adjusted the arguments
 450   static jint adjust_after_os();
 451 
 452   // Verifies that the given value will fit as a MinHeapFreeRatio. If not, an error
 453   // message is returned in the provided buffer.
 454   static bool verify_MinHeapFreeRatio(FormatBuffer<80>& err_msg, uintx min_heap_free_ratio);
 455 
 456   // Verifies that the given value will fit as a MaxHeapFreeRatio. If not, an error
 457   // message is returned in the provided buffer.
 458   static bool verify_MaxHeapFreeRatio(FormatBuffer<80>& err_msg, uintx max_heap_free_ratio);
 459 
 460   // Check for consistency in the selection of the garbage collector.
 461   static bool check_gc_consistency();
 462   static void check_deprecated_gcs();
 463   static void check_deprecated_gc_flags();
 464   // Check consistency or otherwise of VM argument settings
 465   static bool check_vm_args_consistency();
 466   static bool check_vm_args_consistency_ext();
 467   // Check stack pages settings
 468   static bool check_stack_pages();
 469   // Used by os_solaris
 470   static bool process_settings_file(const char* file_name, bool should_exist, jboolean ignore_unrecognized);
 471 
 472   static size_t conservative_max_heap_alignment() { return _conservative_max_heap_alignment; }
 473   // Return the maximum size a heap with compressed oops can take
 474   static size_t max_heap_for_compressed_oops();
 475 
 476   // return a char* array containing all options
 477   static char** jvm_flags_array()          { return _jvm_flags_array; }
 478   static char** jvm_args_array()           { return _jvm_args_array; }
 479   static int num_jvm_flags()               { return _num_jvm_flags; }
 480   static int num_jvm_args()                { return _num_jvm_args; }
 481   // return the arguments passed to the Java application
 482   static const char* java_command()        { return _java_command; }
 483 
 484   // print jvm_flags, jvm_args and java_command
 485   static void print_on(outputStream* st);
 486 
 487   // convenient methods to obtain / print jvm_flags and jvm_args
 488   static const char* jvm_flags()           { return build_resource_string(_jvm_flags_array, _num_jvm_flags); }
 489   static const char* jvm_args()            { return build_resource_string(_jvm_args_array, _num_jvm_args); }
 490   static void print_jvm_flags_on(outputStream* st);
 491   static void print_jvm_args_on(outputStream* st);
 492 
 493   // -Dkey=value flags
 494   static SystemProperty*  system_properties()   { return _system_properties; }
 495   static const char*    get_property(const char* key);
 496 
 497   // -Djava.vendor.url.bug
 498   static const char* java_vendor_url_bug()  { return _java_vendor_url_bug; }
 499 
 500   // -Dsun.java.launcher
 501   static const char* sun_java_launcher()    { return _sun_java_launcher; }
 502   // Was VM created by a Java launcher?
 503   static bool created_by_java_launcher();
 504   // -Dsun.java.launcher.is_altjvm
 505   static bool sun_java_launcher_is_altjvm();
 506   // -Dsun.java.launcher.pid
 507   static int sun_java_launcher_pid()        { return _sun_java_launcher_pid; }
 508 
 509   // -Xloggc:<file>, if not specified will be NULL
 510   static const char* gc_log_filename()      { return _gc_log_filename; }
 511 
 512   // -Xprof
 513   static bool has_profile()                 { return _has_profile; }
 514 
 515   // -Xms
 516   static uintx min_heap_size()              { return _min_heap_size; }
 517   static void  set_min_heap_size(uintx v)   { _min_heap_size = v;  }
 518 
 519   // -Xrun
 520   static AgentLibrary* libraries()          { return _libraryList.first(); }
 521   static bool init_libraries_at_startup()   { return !_libraryList.is_empty(); }
 522   static void convert_library_to_agent(AgentLibrary* lib)
 523                                             { _libraryList.remove(lib);
 524                                               _agentList.add(lib); }
 525 
 526   // -agentlib -agentpath
 527   static AgentLibrary* agents()             { return _agentList.first(); }
 528   static bool init_agents_at_startup()      { return !_agentList.is_empty(); }
 529 
 530   // abort, exit, vfprintf hooks
 531   static abort_hook_t    abort_hook()       { return _abort_hook; }
 532   static exit_hook_t     exit_hook()        { return _exit_hook; }
 533   static vfprintf_hook_t vfprintf_hook()    { return _vfprintf_hook; }
 534 
 535   static bool GetCheckCompileOnly ()        { return CheckCompileOnly; }
 536 
 537   static const char* GetSharedArchivePath() { return SharedArchivePath; }
 538 
 539   static bool CompileMethod(char* className, char* methodName) {
 540     return
 541       methodExists(
 542         className, methodName,
 543         CompileOnlyClassesNum, CompileOnlyClasses, CompileOnlyAllMethods,
 544         CompileOnlyMethodsNum, CompileOnlyMethods, CompileOnlyAllClasses
 545       );
 546   }
 547 
 548   // Java launcher properties
 549   static void process_sun_java_launcher_properties(JavaVMInitArgs* args);
 550 
 551   // System properties
 552   static void init_system_properties();
 553 
 554   // Update/Initialize System properties after JDK version number is known
 555   static void init_version_specific_system_properties();
 556 
 557   // Property List manipulation
 558   static void PropertyList_add(SystemProperty** plist, SystemProperty *element);
 559   static void PropertyList_add(SystemProperty** plist, const char* k, char* v);
 560   static void PropertyList_unique_add(SystemProperty** plist, const char* k, char* v) {
 561     PropertyList_unique_add(plist, k, v, false);
 562   }
 563   static void PropertyList_unique_add(SystemProperty** plist, const char* k, char* v, jboolean append);
 564   static const char* PropertyList_get_value(SystemProperty* plist, const char* key);
 565   static int  PropertyList_count(SystemProperty* pl);
 566   static const char* PropertyList_get_key_at(SystemProperty* pl,int index);
 567   static char* PropertyList_get_value_at(SystemProperty* pl,int index);
 568 
 569   // Miscellaneous System property value getter and setters.
 570   static void set_dll_dir(char *value) { _sun_boot_library_path->set_value(value); }
 571   static void set_java_home(char *value) { _java_home->set_value(value); }
 572   static void set_library_path(char *value) { _java_library_path->set_value(value); }
 573   static void set_ext_dirs(char *value) { _java_ext_dirs->set_value(value); }
 574   static void set_endorsed_dirs(char *value) { _java_endorsed_dirs->set_value(value); }
 575   static void set_sysclasspath(char *value) { _sun_boot_class_path->set_value(value); }
 576   static void append_sysclasspath(const char *value) { _sun_boot_class_path->append_value(value); }
 577   static void set_meta_index_path(char* meta_index_path, char* meta_index_dir) {
 578     _meta_index_path = meta_index_path;
 579     _meta_index_dir  = meta_index_dir;
 580   }
 581 
 582   static char *get_java_home() { return _java_home->value(); }
 583   static char *get_dll_dir() { return _sun_boot_library_path->value(); }
 584   static char *get_endorsed_dir() { return _java_endorsed_dirs->value(); }
 585   static char *get_sysclasspath() { return _sun_boot_class_path->value(); }
 586   static char* get_meta_index_path() { return _meta_index_path; }
 587   static char* get_meta_index_dir()  { return _meta_index_dir;  }
 588   static char* get_ext_dirs() { return _java_ext_dirs->value(); }
 589   static char* get_appclasspath() { return _java_class_path->value(); }
 590   static void fix_appclasspath();
 591 
 592   // Operation modi
 593   static Mode mode()                        { return _mode; }
 594 
 595   // Utility: copies src into buf, replacing "%%" with "%" and "%p" with pid.
 596   static bool copy_expand_pid(const char* src, size_t srclen, char* buf, size_t buflen);
 597 };
 598 
 599 #endif // SHARE_VM_RUNTIME_ARGUMENTS_HPP