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


 733 };
 734 
 735 // Disable options not supported in this release, with a warning if they
 736 // were explicitly requested on the command-line
 737 #define UNSUPPORTED_OPTION(opt, description)                    \
 738 do {                                                            \
 739   if (opt) {                                                    \
 740     if (FLAG_IS_CMDLINE(opt)) {                                 \
 741       warning(description " is disabled in this release.");     \
 742     }                                                           \
 743     FLAG_SET_DEFAULT(opt, false);                               \
 744   }                                                             \
 745 } while(0)
 746 
 747 #endif // SHARE_VM_RUNTIME_ARGUMENTS_HPP
--- EOF ---