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