src/share/vm/runtime/arguments.hpp

Thu, 24 May 2018 19:24:53 +0800

author
aoqi
date
Thu, 24 May 2018 19:24:53 +0800
changeset 8861
2a33b32dd03c
parent 7994
04ff2f6cd0eb
child 9448
73d689add964
permissions
-rw-r--r--

#7046 Disable the compilation when branch offset is beyond short branch
Contributed-by: fujie, aoqi

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

mercurial