arguments.hpp 22.6 KB
Newer Older
D
duke 已提交
1
/*
2
 * Copyright (c) 1997, 2014, Oracle and/or its affiliates. All rights reserved.
D
duke 已提交
3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18
 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
 *
 * This code is free software; you can redistribute it and/or modify it
 * under the terms of the GNU General Public License version 2 only, as
 * published by the Free Software Foundation.
 *
 * This code is distributed in the hope that it will be useful, but WITHOUT
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
 * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
 * version 2 for more details (a copy is included in the LICENSE file that
 * accompanied this code).
 *
 * You should have received a copy of the GNU General Public License version
 * 2 along with this work; if not, write to the Free Software Foundation,
 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
 *
19 20 21
 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
 * or visit www.oracle.com if you need additional information or have any
 * questions.
D
duke 已提交
22 23 24
 *
 */

25 26 27 28 29
#ifndef SHARE_VM_RUNTIME_ARGUMENTS_HPP
#define SHARE_VM_RUNTIME_ARGUMENTS_HPP

#include "runtime/java.hpp"
#include "runtime/perfData.hpp"
30
#include "utilities/debug.hpp"
31 32
#include "utilities/top.hpp"

D
duke 已提交
33 34 35 36 37 38
// Arguments parses the command line and recognizes options

// Invocation API hook typedefs (these should really be defined in jni.hpp)
extern "C" {
  typedef void (JNICALL *abort_hook_t)(void);
  typedef void (JNICALL *exit_hook_t)(jint code);
39
  typedef jint (JNICALL *vfprintf_hook_t)(FILE *fp, const char *format, va_list args)  ATTRIBUTE_PRINTF(2, 0);
D
duke 已提交
40 41 42 43 44 45 46 47
}

// Forward declarations

class SysClassPath;

// Element describing System and User (-Dkey=value flags) defined property.

Z
zgu 已提交
48
class SystemProperty: public CHeapObj<mtInternal> {
D
duke 已提交
49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66
 private:
  char*           _key;
  char*           _value;
  SystemProperty* _next;
  bool            _writeable;
  bool writeable()   { return _writeable; }

 public:
  // Accessors
  const char* key() const                   { return _key; }
  char* value() const                       { return _value; }
  SystemProperty* next() const              { return _next; }
  void set_next(SystemProperty* next)       { _next = next; }
  bool set_value(char *value) {
    if (writeable()) {
      if (_value != NULL) {
        FreeHeap(_value);
      }
Z
zgu 已提交
67
      _value = AllocateHeap(strlen(value)+1, mtInternal);
D
duke 已提交
68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83
      if (_value != NULL) {
        strcpy(_value, value);
      }
      return true;
    }
    return false;
  }

  void append_value(const char *value) {
    char *sp;
    size_t len = 0;
    if (value != NULL) {
      len = strlen(value);
      if (_value != NULL) {
        len += strlen(_value);
      }
Z
zgu 已提交
84
      sp = AllocateHeap(len+2, mtInternal);
D
duke 已提交
85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103
      if (sp != NULL) {
        if (_value != NULL) {
          strcpy(sp, _value);
          strcat(sp, os::path_separator());
          strcat(sp, value);
          FreeHeap(_value);
        } else {
          strcpy(sp, value);
        }
        _value = sp;
      }
    }
  }

  // Constructor
  SystemProperty(const char* key, const char* value, bool writeable) {
    if (key == NULL) {
      _key = NULL;
    } else {
Z
zgu 已提交
104
      _key = AllocateHeap(strlen(key)+1, mtInternal);
D
duke 已提交
105 106 107 108 109
      strcpy(_key, key);
    }
    if (value == NULL) {
      _value = NULL;
    } else {
Z
zgu 已提交
110
      _value = AllocateHeap(strlen(value)+1, mtInternal);
D
duke 已提交
111 112 113 114 115 116 117 118 119
      strcpy(_value, value);
    }
    _next = NULL;
    _writeable = writeable;
  }
};


// For use by -agentlib, -agentpath and -Xrun
Z
zgu 已提交
120
class AgentLibrary : public CHeapObj<mtInternal> {
D
duke 已提交
121
  friend class AgentLibraryList;
122 123 124 125 126 127 128 129
public:
  // Is this library valid or not. Don't rely on os_lib == NULL as statically
  // linked lib could have handle of RTLD_DEFAULT which == 0 on some platforms
  enum AgentState {
    agent_invalid = 0,
    agent_valid   = 1
  };

D
duke 已提交
130 131 132 133 134
 private:
  char*           _name;
  char*           _options;
  void*           _os_lib;
  bool            _is_absolute_path;
135 136
  bool            _is_static_lib;
  AgentState      _state;
D
duke 已提交
137 138 139 140 141 142 143 144 145 146
  AgentLibrary*   _next;

 public:
  // Accessors
  const char* name() const                  { return _name; }
  char* options() const                     { return _options; }
  bool is_absolute_path() const             { return _is_absolute_path; }
  void* os_lib() const                      { return _os_lib; }
  void set_os_lib(void* os_lib)             { _os_lib = os_lib; }
  AgentLibrary* next() const                { return _next; }
147
  bool is_static_lib() const                { return _is_static_lib; }
148
  void set_static_lib(bool is_static_lib)   { _is_static_lib = is_static_lib; }
149 150 151
  bool valid()                              { return (_state == agent_valid); }
  void set_valid()                          { _state = agent_valid; }
  void set_invalid()                        { _state = agent_invalid; }
D
duke 已提交
152 153 154

  // Constructor
  AgentLibrary(const char* name, const char* options, bool is_absolute_path, void* os_lib) {
Z
zgu 已提交
155
    _name = AllocateHeap(strlen(name)+1, mtInternal);
D
duke 已提交
156 157 158 159
    strcpy(_name, name);
    if (options == NULL) {
      _options = NULL;
    } else {
Z
zgu 已提交
160
      _options = AllocateHeap(strlen(options)+1, mtInternal);
D
duke 已提交
161 162 163 164 165
      strcpy(_options, options);
    }
    _is_absolute_path = is_absolute_path;
    _os_lib = os_lib;
    _next = NULL;
166 167
    _state = agent_invalid;
    _is_static_lib = false;
D
duke 已提交
168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277
  }
};

// maintain an order of entry list of AgentLibrary
class AgentLibraryList VALUE_OBJ_CLASS_SPEC {
 private:
  AgentLibrary*   _first;
  AgentLibrary*   _last;
 public:
  bool is_empty() const                     { return _first == NULL; }
  AgentLibrary* first() const               { return _first; }

  // add to the end of the list
  void add(AgentLibrary* lib) {
    if (is_empty()) {
      _first = _last = lib;
    } else {
      _last->_next = lib;
      _last = lib;
    }
    lib->_next = NULL;
  }

  // search for and remove a library known to be in the list
  void remove(AgentLibrary* lib) {
    AgentLibrary* curr;
    AgentLibrary* prev = NULL;
    for (curr = first(); curr != NULL; prev = curr, curr = curr->next()) {
      if (curr == lib) {
        break;
      }
    }
    assert(curr != NULL, "always should be found");

    if (curr != NULL) {
      // it was found, by-pass this library
      if (prev == NULL) {
        _first = curr->_next;
      } else {
        prev->_next = curr->_next;
      }
      if (curr == _last) {
        _last = prev;
      }
      curr->_next = NULL;
    }
  }

  AgentLibraryList() {
    _first = NULL;
    _last = NULL;
  }
};


class Arguments : AllStatic {
  friend class VMStructs;
  friend class JvmtiExport;
 public:
  // Operation modi
  enum Mode {
    _int,       // corresponds to -Xint
    _mixed,     // corresponds to -Xmixed
    _comp       // corresponds to -Xcomp
  };

  enum ArgsRange {
    arg_unreadable = -3,
    arg_too_small  = -2,
    arg_too_big    = -1,
    arg_in_range   = 0
  };

 private:

  // an array containing all flags specified in the .hotspotrc file
  static char** _jvm_flags_array;
  static int    _num_jvm_flags;
  // an array containing all jvm arguments specified in the command line
  static char** _jvm_args_array;
  static int    _num_jvm_args;
  // string containing all java command (class/jarfile name and app args)
  static char* _java_command;

  // Property list
  static SystemProperty* _system_properties;

  // Quick accessor to System properties in the list:
  static SystemProperty *_java_ext_dirs;
  static SystemProperty *_java_endorsed_dirs;
  static SystemProperty *_sun_boot_library_path;
  static SystemProperty *_java_library_path;
  static SystemProperty *_java_home;
  static SystemProperty *_java_class_path;
  static SystemProperty *_sun_boot_class_path;

  // Meta-index for knowing what packages are in the boot class path
  static char* _meta_index_path;
  static char* _meta_index_dir;

  // java.vendor.url.bug, bug reporting URL for fatal errors.
  static const char* _java_vendor_url_bug;

  // sun.java.launcher, private property to provide information about
  // java/gamma launcher
  static const char* _sun_java_launcher;

  // sun.java.launcher.pid, private property
  static int    _sun_java_launcher_pid;

278 279 280
  // was this VM created by the gamma launcher
  static bool   _created_by_gamma_launcher;

D
duke 已提交
281 282 283
  // Option flags
  static bool   _has_profile;
  static const char*  _gc_log_filename;
284 285 286
  // Value of the conservative maximum heap alignment needed
  static size_t  _conservative_max_heap_alignment;

287 288 289 290 291
  static uintx _min_heap_size;

  // Used to store original flag values
  static uintx _min_heap_free_ratio;
  static uintx _max_heap_free_ratio;
D
duke 已提交
292 293 294 295 296 297 298 299 300 301 302 303

  // -Xrun arguments
  static AgentLibraryList _libraryList;
  static void add_init_library(const char* name, char* options)
    { _libraryList.add(new AgentLibrary(name, options, false, NULL)); }

  // -agentlib and -agentpath arguments
  static AgentLibraryList _agentList;
  static void add_init_agent(const char* name, char* options, bool absolute_path)
    { _agentList.add(new AgentLibrary(name, options, absolute_path, NULL)); }

  // Late-binding agents not started via arguments
304 305
  static void add_loaded_agent(AgentLibrary *agentLib)
    { _agentList.add(agentLib); }
D
duke 已提交
306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327
  static void add_loaded_agent(const char* name, char* options, bool absolute_path, void* os_lib)
    { _agentList.add(new AgentLibrary(name, options, absolute_path, os_lib)); }

  // Operation modi
  static Mode _mode;
  static void set_mode_flags(Mode mode);
  static bool _java_compiler;
  static void set_java_compiler(bool arg) { _java_compiler = arg; }
  static bool java_compiler()   { return _java_compiler; }

  // -Xdebug flag
  static bool _xdebug_mode;
  static void set_xdebug_mode(bool arg) { _xdebug_mode = arg; }
  static bool xdebug_mode()             { return _xdebug_mode; }

  // Used to save default settings
  static bool _AlwaysCompileLoopMethods;
  static bool _UseOnStackReplacement;
  static bool _BackgroundCompilation;
  static bool _ClipInlining;
  static bool _CIDynamicCompilePriority;

I
iveresov 已提交
328 329
  // Tiered
  static void set_tiered_flags();
330
  static int  get_min_number_of_compiler_threads();
D
duke 已提交
331 332 333
  // CMS/ParNew garbage collectors
  static void set_parnew_gc_flags();
  static void set_cms_and_parnew_gc_flags();
334
  // UseParallel[Old]GC
D
duke 已提交
335
  static void set_parallel_gc_flags();
336 337
  // Garbage-First (UseG1GC)
  static void set_g1_gc_flags();
D
duke 已提交
338
  // GC ergonomics
339
  static void set_conservative_max_heap_alignment();
340
  static void set_use_compressed_oops();
341
  static void set_use_compressed_klass_ptrs();
342
  static void select_gc();
D
duke 已提交
343
  static void set_ergonomics_flags();
344
  static void set_shared_spaces_flags();
345 346 347
  // limits the given memory size by the maximum amount of memory this process is
  // currently allowed to allocate or reserve.
  static julong limit_by_allocatable_memory(julong size);
P
phh 已提交
348 349
  // Setup heap size
  static void set_heap_size();
D
duke 已提交
350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369
  // Based on automatic selection criteria, should the
  // low pause collector be used.
  static bool should_auto_select_low_pause_collector();

  // Bytecode rewriting
  static void set_bytecode_flags();

  // Invocation API hooks
  static abort_hook_t     _abort_hook;
  static exit_hook_t      _exit_hook;
  static vfprintf_hook_t  _vfprintf_hook;

  // System properties
  static bool add_property(const char* prop);

  // Aggressive optimization flags.
  static void set_aggressive_opts_flags();

  // Argument parsing
  static void do_pd_flag_adjustments();
370 371
  static bool parse_argument(const char* arg, Flag::Flags origin);
  static bool process_argument(const char* arg, jboolean ignore_unrecognized, Flag::Flags origin);
D
duke 已提交
372 373 374 375 376 377
  static void process_java_launcher_argument(const char*, void*);
  static void process_java_compiler_argument(char* arg);
  static jint parse_options_environment_variable(const char* name, SysClassPath* scp_p, bool* scp_assembly_required_p);
  static jint parse_java_tool_options_environment_variable(SysClassPath* scp_p, bool* scp_assembly_required_p);
  static jint parse_java_options_environment_variable(SysClassPath* scp_p, bool* scp_assembly_required_p);
  static jint parse_vm_init_args(const JavaVMInitArgs* args);
378
  static jint parse_each_vm_init_arg(const JavaVMInitArgs* args, SysClassPath* scp_p, bool* scp_assembly_required_p, Flag::Flags origin);
D
duke 已提交
379
  static jint finalize_vm_init_args(SysClassPath* scp_p, bool scp_assembly_required);
380 381
  static bool is_bad_option(const JavaVMOption* option, jboolean ignore, const char* option_type);

D
duke 已提交
382 383 384
  static bool is_bad_option(const JavaVMOption* option, jboolean ignore) {
    return is_bad_option(option, ignore, NULL);
  }
385 386 387 388 389

  static bool is_percentage(uintx val) {
    return val <= 100;
  }

390 391
  static bool verify_interval(uintx val, uintx min,
                              uintx max, const char* name);
392
  static bool verify_min_value(intx val, intx min, const char* name);
D
duke 已提交
393 394
  static bool verify_percentage(uintx value, const char* name);
  static void describe_range_error(ArgsRange errcode);
395 396 397
  static ArgsRange check_memory_size(julong size, julong min_size);
  static ArgsRange parse_memory_size(const char* s, julong* long_arg,
                                     julong min_size);
398 399 400 401 402 403
  // Parse a string for a unsigned integer.  Returns true if value
  // is an unsigned integer greater than or equal to the minimum
  // parameter passed and returns the value in uintx_arg.  Returns
  // false otherwise, with uintx_arg undefined.
  static bool parse_uintx(const char* value, uintx* uintx_arg,
                          uintx min_size);
D
duke 已提交
404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422

  // methods to build strings from individual args
  static void build_jvm_args(const char* arg);
  static void build_jvm_flags(const char* arg);
  static void add_string(char*** bldarray, int* count, const char* arg);
  static const char* build_resource_string(char** args, int count);

  static bool methodExists(
    char* className, char* methodName,
    int classesNum, char** classes, bool* allMethods,
    int methodsNum, char** methods, bool* allClasses
  );

  static void parseOnlyLine(
    const char* line,
    short* classesNum, short* classesMax, char*** classes, bool** allMethods,
    short* methodsNum, short* methodsMax, char*** methods, bool** allClasses
  );

K
kamg 已提交
423 424 425 426 427
  // Returns true if the string s is in the list of flags that have recently
  // been made obsolete.  If we detect one of these flags on the command
  // line, instead of failing we print a warning message and ignore the
  // flag.  This gives the user a release or so to stop using the flag.
  static bool is_newly_obsolete(const char* s, JDK_Version* buffer);
D
duke 已提交
428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448

  static short  CompileOnlyClassesNum;
  static short  CompileOnlyClassesMax;
  static char** CompileOnlyClasses;
  static bool*  CompileOnlyAllMethods;

  static short  CompileOnlyMethodsNum;
  static short  CompileOnlyMethodsMax;
  static char** CompileOnlyMethods;
  static bool*  CompileOnlyAllClasses;

  static short  InterpretOnlyClassesNum;
  static short  InterpretOnlyClassesMax;
  static char** InterpretOnlyClasses;
  static bool*  InterpretOnlyAllMethods;

  static bool   CheckCompileOnly;

  static char*  SharedArchivePath;

 public:
449
  // Parses the arguments, first phase
D
duke 已提交
450
  static jint parse(const JavaVMInitArgs* args);
451 452
  // Apply ergonomics
  static jint apply_ergo();
453 454
  // Adjusts the arguments after the OS have adjusted the arguments
  static jint adjust_after_os();
455

456
  static void set_gc_specific_flags();
457 458 459
  static inline bool gc_selected(); // whether a gc has been selected
  static void select_gc_ergonomically();

460 461 462 463 464 465 466 467
  // Verifies that the given value will fit as a MinHeapFreeRatio. If not, an error
  // message is returned in the provided buffer.
  static bool verify_MinHeapFreeRatio(FormatBuffer<80>& err_msg, uintx min_heap_free_ratio);

  // Verifies that the given value will fit as a MaxHeapFreeRatio. If not, an error
  // message is returned in the provided buffer.
  static bool verify_MaxHeapFreeRatio(FormatBuffer<80>& err_msg, uintx max_heap_free_ratio);

468
  // Check for consistency in the selection of the garbage collector.
469 470
  static bool check_gc_consistency_user();        // Check user-selected gc
  static inline bool check_gc_consistency_ergo(); // Check ergonomic-selected gc
471
  static void check_deprecated_gcs();
T
tamao 已提交
472
  static void check_deprecated_gc_flags();
D
duke 已提交
473 474
  // Check consistecy or otherwise of VM argument settings
  static bool check_vm_args_consistency();
475 476
  // Check stack pages settings
  static bool check_stack_pages();
D
duke 已提交
477 478 479
  // Used by os_solaris
  static bool process_settings_file(const char* file_name, bool should_exist, jboolean ignore_unrecognized);

480 481 482 483
  static size_t conservative_max_heap_alignment() { return _conservative_max_heap_alignment; }
  // Return the maximum size a heap with compressed oops can take
  static size_t max_heap_for_compressed_oops();

D
duke 已提交
484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511
  // return a char* array containing all options
  static char** jvm_flags_array()          { return _jvm_flags_array; }
  static char** jvm_args_array()           { return _jvm_args_array; }
  static int num_jvm_flags()               { return _num_jvm_flags; }
  static int num_jvm_args()                { return _num_jvm_args; }
  // return the arguments passed to the Java application
  static const char* java_command()        { return _java_command; }

  // print jvm_flags, jvm_args and java_command
  static void print_on(outputStream* st);

  // convenient methods to obtain / print jvm_flags and jvm_args
  static const char* jvm_flags()           { return build_resource_string(_jvm_flags_array, _num_jvm_flags); }
  static const char* jvm_args()            { return build_resource_string(_jvm_args_array, _num_jvm_args); }
  static void print_jvm_flags_on(outputStream* st);
  static void print_jvm_args_on(outputStream* st);

  // -Dkey=value flags
  static SystemProperty*  system_properties()   { return _system_properties; }
  static const char*    get_property(const char* key);

  // -Djava.vendor.url.bug
  static const char* java_vendor_url_bug()  { return _java_vendor_url_bug; }

  // -Dsun.java.launcher
  static const char* sun_java_launcher()    { return _sun_java_launcher; }
  // Was VM created by a Java launcher?
  static bool created_by_java_launcher();
512 513
  // Was VM created by the gamma Java launcher?
  static bool created_by_gamma_launcher();
D
duke 已提交
514 515 516 517 518 519
  // -Dsun.java.launcher.pid
  static int sun_java_launcher_pid()        { return _sun_java_launcher_pid; }

  // -Xloggc:<file>, if not specified will be NULL
  static const char* gc_log_filename()      { return _gc_log_filename; }

520
  // -Xprof
D
duke 已提交
521 522
  static bool has_profile()                 { return _has_profile; }

P
phh 已提交
523
  // -Xms, -Xmx
D
duke 已提交
524 525 526
  static uintx min_heap_size()              { return _min_heap_size; }
  static void  set_min_heap_size(uintx v)   { _min_heap_size = v;  }

527 528 529 530
  // Returns the original values of -XX:MinHeapFreeRatio and -XX:MaxHeapFreeRatio
  static uintx min_heap_free_ratio()        { return _min_heap_free_ratio; }
  static uintx max_heap_free_ratio()        { return _max_heap_free_ratio; }

D
duke 已提交
531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565
  // -Xrun
  static AgentLibrary* libraries()          { return _libraryList.first(); }
  static bool init_libraries_at_startup()   { return !_libraryList.is_empty(); }
  static void convert_library_to_agent(AgentLibrary* lib)
                                            { _libraryList.remove(lib);
                                              _agentList.add(lib); }

  // -agentlib -agentpath
  static AgentLibrary* agents()             { return _agentList.first(); }
  static bool init_agents_at_startup()      { return !_agentList.is_empty(); }

  // abort, exit, vfprintf hooks
  static abort_hook_t    abort_hook()       { return _abort_hook; }
  static exit_hook_t     exit_hook()        { return _exit_hook; }
  static vfprintf_hook_t vfprintf_hook()    { return _vfprintf_hook; }

  static bool GetCheckCompileOnly ()        { return CheckCompileOnly; }

  static const char* GetSharedArchivePath() { return SharedArchivePath; }

  static bool CompileMethod(char* className, char* methodName) {
    return
      methodExists(
        className, methodName,
        CompileOnlyClassesNum, CompileOnlyClasses, CompileOnlyAllMethods,
        CompileOnlyMethodsNum, CompileOnlyMethods, CompileOnlyAllClasses
      );
  }

  // Java launcher properties
  static void process_sun_java_launcher_properties(JavaVMInitArgs* args);

  // System properties
  static void init_system_properties();

566 567 568
  // Update/Initialize System properties after JDK version number is known
  static void init_version_specific_system_properties();

P
phh 已提交
569
  // Property List manipulation
D
duke 已提交
570 571
  static void PropertyList_add(SystemProperty** plist, SystemProperty *element);
  static void PropertyList_add(SystemProperty** plist, const char* k, char* v);
P
phh 已提交
572 573 574 575
  static void PropertyList_unique_add(SystemProperty** plist, const char* k, char* v) {
    PropertyList_unique_add(plist, k, v, false);
  }
  static void PropertyList_unique_add(SystemProperty** plist, const char* k, char* v, jboolean append);
D
duke 已提交
576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593
  static const char* PropertyList_get_value(SystemProperty* plist, const char* key);
  static int  PropertyList_count(SystemProperty* pl);
  static const char* PropertyList_get_key_at(SystemProperty* pl,int index);
  static char* PropertyList_get_value_at(SystemProperty* pl,int index);

  // Miscellaneous System property value getter and setters.
  static void set_dll_dir(char *value) { _sun_boot_library_path->set_value(value); }
  static void set_java_home(char *value) { _java_home->set_value(value); }
  static void set_library_path(char *value) { _java_library_path->set_value(value); }
  static void set_ext_dirs(char *value) { _java_ext_dirs->set_value(value); }
  static void set_endorsed_dirs(char *value) { _java_endorsed_dirs->set_value(value); }
  static void set_sysclasspath(char *value) { _sun_boot_class_path->set_value(value); }
  static void append_sysclasspath(const char *value) { _sun_boot_class_path->append_value(value); }
  static void set_meta_index_path(char* meta_index_path, char* meta_index_dir) {
    _meta_index_path = meta_index_path;
    _meta_index_dir  = meta_index_dir;
  }

594 595 596 597
  static char* get_java_home() { return _java_home->value(); }
  static char* get_dll_dir() { return _sun_boot_library_path->value(); }
  static char* get_endorsed_dir() { return _java_endorsed_dirs->value(); }
  static char* get_sysclasspath() { return _sun_boot_class_path->value(); }
D
duke 已提交
598 599
  static char* get_meta_index_path() { return _meta_index_path; }
  static char* get_meta_index_dir()  { return _meta_index_dir;  }
600 601 602
  static char* get_ext_dirs() { return _java_ext_dirs->value(); }
  static char* get_appclasspath() { return _java_class_path->value(); }
  static void  fix_appclasspath();
D
duke 已提交
603 604

  // Operation modi
605 606 607
  static Mode mode()                { return _mode; }
  static bool is_interpreter_only() { return mode() == _int; }

D
duke 已提交
608 609 610 611

  // Utility: copies src into buf, replacing "%%" with "%" and "%p" with pid.
  static bool copy_expand_pid(const char* src, size_t srclen, char* buf, size_t buflen);
};
612

613 614 615 616
bool Arguments::gc_selected() {
  return UseConcMarkSweepGC || UseG1GC || UseParallelGC || UseParallelOldGC ||
    UseParNewGC || UseSerialGC;
}
617 618 619 620 621

bool Arguments::check_gc_consistency_ergo() {
  return check_gc_consistency_user();
}

622
#endif // SHARE_VM_RUNTIME_ARGUMENTS_HPP