aoqi@0: /* aoqi@0: * Copyright (c) 1997, 2014, Oracle and/or its affiliates. All rights reserved. aoqi@0: * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. aoqi@0: * aoqi@0: * This code is free software; you can redistribute it and/or modify it aoqi@0: * under the terms of the GNU General Public License version 2 only, as aoqi@0: * published by the Free Software Foundation. aoqi@0: * aoqi@0: * This code is distributed in the hope that it will be useful, but WITHOUT aoqi@0: * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or aoqi@0: * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License aoqi@0: * version 2 for more details (a copy is included in the LICENSE file that aoqi@0: * accompanied this code). aoqi@0: * aoqi@0: * You should have received a copy of the GNU General Public License version aoqi@0: * 2 along with this work; if not, write to the Free Software Foundation, aoqi@0: * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. aoqi@0: * aoqi@0: * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA aoqi@0: * or visit www.oracle.com if you need additional information or have any aoqi@0: * questions. aoqi@0: * aoqi@0: */ aoqi@0: aoqi@0: #ifndef SHARE_VM_RUNTIME_ARGUMENTS_HPP aoqi@0: #define SHARE_VM_RUNTIME_ARGUMENTS_HPP aoqi@0: aoqi@0: #include "runtime/java.hpp" aoqi@0: #include "runtime/perfData.hpp" aoqi@0: #include "utilities/debug.hpp" aoqi@0: #include "utilities/top.hpp" aoqi@0: aoqi@0: // Arguments parses the command line and recognizes options aoqi@0: aoqi@0: // Invocation API hook typedefs (these should really be defined in jni.hpp) aoqi@0: extern "C" { aoqi@0: typedef void (JNICALL *abort_hook_t)(void); aoqi@0: typedef void (JNICALL *exit_hook_t)(jint code); aoqi@0: typedef jint (JNICALL *vfprintf_hook_t)(FILE *fp, const char *format, va_list args) ATTRIBUTE_PRINTF(2, 0); aoqi@0: } aoqi@0: aoqi@0: // Forward declarations aoqi@0: aoqi@0: class SysClassPath; aoqi@0: aoqi@0: // Element describing System and User (-Dkey=value flags) defined property. aoqi@0: aoqi@0: class SystemProperty: public CHeapObj { aoqi@0: private: aoqi@0: char* _key; aoqi@0: char* _value; aoqi@0: SystemProperty* _next; aoqi@0: bool _writeable; aoqi@0: bool writeable() { return _writeable; } aoqi@0: aoqi@0: public: aoqi@0: // Accessors aoqi@0: const char* key() const { return _key; } aoqi@0: char* value() const { return _value; } aoqi@0: SystemProperty* next() const { return _next; } aoqi@0: void set_next(SystemProperty* next) { _next = next; } aoqi@0: bool set_value(char *value) { aoqi@0: if (writeable()) { aoqi@0: if (_value != NULL) { aoqi@0: FreeHeap(_value); aoqi@0: } aoqi@0: _value = AllocateHeap(strlen(value)+1, mtInternal); aoqi@0: if (_value != NULL) { aoqi@0: strcpy(_value, value); aoqi@0: } aoqi@0: return true; aoqi@0: } aoqi@0: return false; aoqi@0: } aoqi@0: aoqi@0: void append_value(const char *value) { aoqi@0: char *sp; aoqi@0: size_t len = 0; aoqi@0: if (value != NULL) { aoqi@0: len = strlen(value); aoqi@0: if (_value != NULL) { aoqi@0: len += strlen(_value); aoqi@0: } aoqi@0: sp = AllocateHeap(len+2, mtInternal); aoqi@0: if (sp != NULL) { aoqi@0: if (_value != NULL) { aoqi@0: strcpy(sp, _value); aoqi@0: strcat(sp, os::path_separator()); aoqi@0: strcat(sp, value); aoqi@0: FreeHeap(_value); aoqi@0: } else { aoqi@0: strcpy(sp, value); aoqi@0: } aoqi@0: _value = sp; aoqi@0: } aoqi@0: } aoqi@0: } aoqi@0: aoqi@0: // Constructor aoqi@0: SystemProperty(const char* key, const char* value, bool writeable) { aoqi@0: if (key == NULL) { aoqi@0: _key = NULL; aoqi@0: } else { aoqi@0: _key = AllocateHeap(strlen(key)+1, mtInternal); aoqi@0: strcpy(_key, key); aoqi@0: } aoqi@0: if (value == NULL) { aoqi@0: _value = NULL; aoqi@0: } else { aoqi@0: _value = AllocateHeap(strlen(value)+1, mtInternal); aoqi@0: strcpy(_value, value); aoqi@0: } aoqi@0: _next = NULL; aoqi@0: _writeable = writeable; aoqi@0: } aoqi@0: }; aoqi@0: aoqi@0: aoqi@0: // For use by -agentlib, -agentpath and -Xrun aoqi@0: class AgentLibrary : public CHeapObj { aoqi@0: friend class AgentLibraryList; aoqi@0: public: aoqi@0: // Is this library valid or not. Don't rely on os_lib == NULL as statically aoqi@0: // linked lib could have handle of RTLD_DEFAULT which == 0 on some platforms aoqi@0: enum AgentState { aoqi@0: agent_invalid = 0, aoqi@0: agent_valid = 1 aoqi@0: }; aoqi@0: aoqi@0: private: aoqi@0: char* _name; aoqi@0: char* _options; aoqi@0: void* _os_lib; aoqi@0: bool _is_absolute_path; aoqi@0: bool _is_static_lib; aoqi@0: AgentState _state; aoqi@0: AgentLibrary* _next; aoqi@0: aoqi@0: public: aoqi@0: // Accessors aoqi@0: const char* name() const { return _name; } aoqi@0: char* options() const { return _options; } aoqi@0: bool is_absolute_path() const { return _is_absolute_path; } aoqi@0: void* os_lib() const { return _os_lib; } aoqi@0: void set_os_lib(void* os_lib) { _os_lib = os_lib; } aoqi@0: AgentLibrary* next() const { return _next; } aoqi@0: bool is_static_lib() const { return _is_static_lib; } aoqi@0: void set_static_lib(bool is_static_lib) { _is_static_lib = is_static_lib; } aoqi@0: bool valid() { return (_state == agent_valid); } aoqi@0: void set_valid() { _state = agent_valid; } aoqi@0: void set_invalid() { _state = agent_invalid; } aoqi@0: aoqi@0: // Constructor aoqi@0: AgentLibrary(const char* name, const char* options, bool is_absolute_path, void* os_lib) { aoqi@0: _name = AllocateHeap(strlen(name)+1, mtInternal); aoqi@0: strcpy(_name, name); aoqi@0: if (options == NULL) { aoqi@0: _options = NULL; aoqi@0: } else { aoqi@0: _options = AllocateHeap(strlen(options)+1, mtInternal); aoqi@0: strcpy(_options, options); aoqi@0: } aoqi@0: _is_absolute_path = is_absolute_path; aoqi@0: _os_lib = os_lib; aoqi@0: _next = NULL; aoqi@0: _state = agent_invalid; aoqi@0: _is_static_lib = false; aoqi@0: } aoqi@0: }; aoqi@0: aoqi@0: // maintain an order of entry list of AgentLibrary aoqi@0: class AgentLibraryList VALUE_OBJ_CLASS_SPEC { aoqi@0: private: aoqi@0: AgentLibrary* _first; aoqi@0: AgentLibrary* _last; aoqi@0: public: aoqi@0: bool is_empty() const { return _first == NULL; } aoqi@0: AgentLibrary* first() const { return _first; } aoqi@0: aoqi@0: // add to the end of the list aoqi@0: void add(AgentLibrary* lib) { aoqi@0: if (is_empty()) { aoqi@0: _first = _last = lib; aoqi@0: } else { aoqi@0: _last->_next = lib; aoqi@0: _last = lib; aoqi@0: } aoqi@0: lib->_next = NULL; aoqi@0: } aoqi@0: aoqi@0: // search for and remove a library known to be in the list aoqi@0: void remove(AgentLibrary* lib) { aoqi@0: AgentLibrary* curr; aoqi@0: AgentLibrary* prev = NULL; aoqi@0: for (curr = first(); curr != NULL; prev = curr, curr = curr->next()) { aoqi@0: if (curr == lib) { aoqi@0: break; aoqi@0: } aoqi@0: } aoqi@0: assert(curr != NULL, "always should be found"); aoqi@0: aoqi@0: if (curr != NULL) { aoqi@0: // it was found, by-pass this library aoqi@0: if (prev == NULL) { aoqi@0: _first = curr->_next; aoqi@0: } else { aoqi@0: prev->_next = curr->_next; aoqi@0: } aoqi@0: if (curr == _last) { aoqi@0: _last = prev; aoqi@0: } aoqi@0: curr->_next = NULL; aoqi@0: } aoqi@0: } aoqi@0: aoqi@0: AgentLibraryList() { aoqi@0: _first = NULL; aoqi@0: _last = NULL; aoqi@0: } aoqi@0: }; aoqi@0: aoqi@0: aoqi@0: class Arguments : AllStatic { aoqi@0: friend class VMStructs; aoqi@0: friend class JvmtiExport; aoqi@0: public: aoqi@0: // Operation modi aoqi@0: enum Mode { aoqi@0: _int, // corresponds to -Xint aoqi@0: _mixed, // corresponds to -Xmixed aoqi@0: _comp // corresponds to -Xcomp aoqi@0: }; aoqi@0: aoqi@0: enum ArgsRange { aoqi@0: arg_unreadable = -3, aoqi@0: arg_too_small = -2, aoqi@0: arg_too_big = -1, aoqi@0: arg_in_range = 0 aoqi@0: }; aoqi@0: aoqi@0: private: aoqi@0: aoqi@0: // an array containing all flags specified in the .hotspotrc file aoqi@0: static char** _jvm_flags_array; aoqi@0: static int _num_jvm_flags; aoqi@0: // an array containing all jvm arguments specified in the command line aoqi@0: static char** _jvm_args_array; aoqi@0: static int _num_jvm_args; aoqi@0: // string containing all java command (class/jarfile name and app args) aoqi@0: static char* _java_command; aoqi@0: aoqi@0: // Property list aoqi@0: static SystemProperty* _system_properties; aoqi@0: aoqi@0: // Quick accessor to System properties in the list: aoqi@0: static SystemProperty *_java_ext_dirs; aoqi@0: static SystemProperty *_java_endorsed_dirs; aoqi@0: static SystemProperty *_sun_boot_library_path; aoqi@0: static SystemProperty *_java_library_path; aoqi@0: static SystemProperty *_java_home; aoqi@0: static SystemProperty *_java_class_path; aoqi@0: static SystemProperty *_sun_boot_class_path; aoqi@0: aoqi@0: // Meta-index for knowing what packages are in the boot class path aoqi@0: static char* _meta_index_path; aoqi@0: static char* _meta_index_dir; aoqi@0: aoqi@0: // java.vendor.url.bug, bug reporting URL for fatal errors. aoqi@0: static const char* _java_vendor_url_bug; aoqi@0: aoqi@0: // sun.java.launcher, private property to provide information about aoqi@0: // java/gamma launcher aoqi@0: static const char* _sun_java_launcher; aoqi@0: aoqi@0: // sun.java.launcher.pid, private property aoqi@0: static int _sun_java_launcher_pid; aoqi@0: aoqi@0: // was this VM created by the gamma launcher aoqi@0: static bool _created_by_gamma_launcher; aoqi@0: aoqi@0: // Option flags aoqi@0: static bool _has_profile; aoqi@0: static const char* _gc_log_filename; aoqi@0: // Value of the conservative maximum heap alignment needed aoqi@0: static size_t _conservative_max_heap_alignment; aoqi@0: jwilhelm@7059: static uintx _min_heap_size; jwilhelm@7059: jwilhelm@7059: // Used to store original flag values jwilhelm@7059: static uintx _min_heap_free_ratio; jwilhelm@7059: static uintx _max_heap_free_ratio; aoqi@0: aoqi@0: // -Xrun arguments aoqi@0: static AgentLibraryList _libraryList; aoqi@0: static void add_init_library(const char* name, char* options) aoqi@0: { _libraryList.add(new AgentLibrary(name, options, false, NULL)); } aoqi@0: aoqi@0: // -agentlib and -agentpath arguments aoqi@0: static AgentLibraryList _agentList; aoqi@0: static void add_init_agent(const char* name, char* options, bool absolute_path) aoqi@0: { _agentList.add(new AgentLibrary(name, options, absolute_path, NULL)); } aoqi@0: aoqi@0: // Late-binding agents not started via arguments aoqi@0: static void add_loaded_agent(AgentLibrary *agentLib) aoqi@0: { _agentList.add(agentLib); } aoqi@0: static void add_loaded_agent(const char* name, char* options, bool absolute_path, void* os_lib) aoqi@0: { _agentList.add(new AgentLibrary(name, options, absolute_path, os_lib)); } aoqi@0: aoqi@0: // Operation modi aoqi@0: static Mode _mode; aoqi@0: static void set_mode_flags(Mode mode); aoqi@0: static bool _java_compiler; aoqi@0: static void set_java_compiler(bool arg) { _java_compiler = arg; } aoqi@0: static bool java_compiler() { return _java_compiler; } aoqi@0: aoqi@0: // -Xdebug flag aoqi@0: static bool _xdebug_mode; aoqi@0: static void set_xdebug_mode(bool arg) { _xdebug_mode = arg; } aoqi@0: static bool xdebug_mode() { return _xdebug_mode; } aoqi@0: aoqi@0: // Used to save default settings aoqi@0: static bool _AlwaysCompileLoopMethods; aoqi@0: static bool _UseOnStackReplacement; aoqi@0: static bool _BackgroundCompilation; aoqi@0: static bool _ClipInlining; aoqi@0: static bool _CIDynamicCompilePriority; aoqi@0: aoqi@0: // Tiered aoqi@0: static void set_tiered_flags(); anoll@7311: static int get_min_number_of_compiler_threads(); aoqi@0: // CMS/ParNew garbage collectors aoqi@0: static void set_parnew_gc_flags(); aoqi@0: static void set_cms_and_parnew_gc_flags(); aoqi@0: // UseParallel[Old]GC aoqi@0: static void set_parallel_gc_flags(); aoqi@0: // Garbage-First (UseG1GC) aoqi@0: static void set_g1_gc_flags(); aoqi@0: // GC ergonomics aoqi@0: static void set_conservative_max_heap_alignment(); aoqi@0: static void set_use_compressed_oops(); aoqi@0: static void set_use_compressed_klass_ptrs(); jcoomes@7117: static void select_gc(); aoqi@0: static void set_ergonomics_flags(); aoqi@0: static void set_shared_spaces_flags(); aoqi@0: // limits the given memory size by the maximum amount of memory this process is aoqi@0: // currently allowed to allocate or reserve. aoqi@0: static julong limit_by_allocatable_memory(julong size); aoqi@0: // Setup heap size aoqi@0: static void set_heap_size(); aoqi@0: // Based on automatic selection criteria, should the aoqi@0: // low pause collector be used. aoqi@0: static bool should_auto_select_low_pause_collector(); aoqi@0: aoqi@0: // Bytecode rewriting aoqi@0: static void set_bytecode_flags(); aoqi@0: aoqi@0: // Invocation API hooks aoqi@0: static abort_hook_t _abort_hook; aoqi@0: static exit_hook_t _exit_hook; aoqi@0: static vfprintf_hook_t _vfprintf_hook; aoqi@0: aoqi@0: // System properties aoqi@0: static bool add_property(const char* prop); aoqi@0: aoqi@0: // Aggressive optimization flags. aoqi@0: static void set_aggressive_opts_flags(); aoqi@0: aoqi@0: // Argument parsing aoqi@0: static void do_pd_flag_adjustments(); aoqi@0: static bool parse_argument(const char* arg, Flag::Flags origin); aoqi@0: static bool process_argument(const char* arg, jboolean ignore_unrecognized, Flag::Flags origin); aoqi@0: static void process_java_launcher_argument(const char*, void*); aoqi@0: static void process_java_compiler_argument(char* arg); aoqi@0: static jint parse_options_environment_variable(const char* name, SysClassPath* scp_p, bool* scp_assembly_required_p); aoqi@0: static jint parse_java_tool_options_environment_variable(SysClassPath* scp_p, bool* scp_assembly_required_p); aoqi@0: static jint parse_java_options_environment_variable(SysClassPath* scp_p, bool* scp_assembly_required_p); aoqi@0: static jint parse_vm_init_args(const JavaVMInitArgs* args); aoqi@0: static jint parse_each_vm_init_arg(const JavaVMInitArgs* args, SysClassPath* scp_p, bool* scp_assembly_required_p, Flag::Flags origin); aoqi@0: static jint finalize_vm_init_args(SysClassPath* scp_p, bool scp_assembly_required); aoqi@0: static bool is_bad_option(const JavaVMOption* option, jboolean ignore, const char* option_type); aoqi@0: aoqi@0: static bool is_bad_option(const JavaVMOption* option, jboolean ignore) { aoqi@0: return is_bad_option(option, ignore, NULL); aoqi@0: } aoqi@0: aoqi@0: static bool is_percentage(uintx val) { aoqi@0: return val <= 100; aoqi@0: } aoqi@0: aoqi@0: static bool verify_interval(uintx val, uintx min, aoqi@0: uintx max, const char* name); aoqi@0: static bool verify_min_value(intx val, intx min, const char* name); aoqi@0: static bool verify_percentage(uintx value, const char* name); aoqi@0: static void describe_range_error(ArgsRange errcode); aoqi@0: static ArgsRange check_memory_size(julong size, julong min_size); aoqi@0: static ArgsRange parse_memory_size(const char* s, julong* long_arg, aoqi@0: julong min_size); aoqi@0: // Parse a string for a unsigned integer. Returns true if value aoqi@0: // is an unsigned integer greater than or equal to the minimum aoqi@0: // parameter passed and returns the value in uintx_arg. Returns aoqi@0: // false otherwise, with uintx_arg undefined. aoqi@0: static bool parse_uintx(const char* value, uintx* uintx_arg, aoqi@0: uintx min_size); aoqi@0: aoqi@0: // methods to build strings from individual args aoqi@0: static void build_jvm_args(const char* arg); aoqi@0: static void build_jvm_flags(const char* arg); aoqi@0: static void add_string(char*** bldarray, int* count, const char* arg); aoqi@0: static const char* build_resource_string(char** args, int count); aoqi@0: aoqi@0: static bool methodExists( aoqi@0: char* className, char* methodName, aoqi@0: int classesNum, char** classes, bool* allMethods, aoqi@0: int methodsNum, char** methods, bool* allClasses aoqi@0: ); aoqi@0: aoqi@0: static void parseOnlyLine( aoqi@0: const char* line, aoqi@0: short* classesNum, short* classesMax, char*** classes, bool** allMethods, aoqi@0: short* methodsNum, short* methodsMax, char*** methods, bool** allClasses aoqi@0: ); aoqi@0: aoqi@0: // Returns true if the string s is in the list of flags that have recently aoqi@0: // been made obsolete. If we detect one of these flags on the command aoqi@0: // line, instead of failing we print a warning message and ignore the aoqi@0: // flag. This gives the user a release or so to stop using the flag. aoqi@0: static bool is_newly_obsolete(const char* s, JDK_Version* buffer); aoqi@0: aoqi@0: static short CompileOnlyClassesNum; aoqi@0: static short CompileOnlyClassesMax; aoqi@0: static char** CompileOnlyClasses; aoqi@0: static bool* CompileOnlyAllMethods; aoqi@0: aoqi@0: static short CompileOnlyMethodsNum; aoqi@0: static short CompileOnlyMethodsMax; aoqi@0: static char** CompileOnlyMethods; aoqi@0: static bool* CompileOnlyAllClasses; aoqi@0: aoqi@0: static short InterpretOnlyClassesNum; aoqi@0: static short InterpretOnlyClassesMax; aoqi@0: static char** InterpretOnlyClasses; aoqi@0: static bool* InterpretOnlyAllMethods; aoqi@0: aoqi@0: static bool CheckCompileOnly; aoqi@0: aoqi@0: static char* SharedArchivePath; aoqi@0: aoqi@0: public: aoqi@0: // Parses the arguments, first phase aoqi@0: static jint parse(const JavaVMInitArgs* args); aoqi@0: // Apply ergonomics aoqi@0: static jint apply_ergo(); aoqi@0: // Adjusts the arguments after the OS have adjusted the arguments aoqi@0: static jint adjust_after_os(); aoqi@0: jwilhelm@7369: static void set_gc_specific_flags(); jcoomes@7117: static inline bool gc_selected(); // whether a gc has been selected jcoomes@7117: static void select_gc_ergonomically(); jcoomes@7117: aoqi@0: // Verifies that the given value will fit as a MinHeapFreeRatio. If not, an error aoqi@0: // message is returned in the provided buffer. aoqi@0: static bool verify_MinHeapFreeRatio(FormatBuffer<80>& err_msg, uintx min_heap_free_ratio); aoqi@0: aoqi@0: // Verifies that the given value will fit as a MaxHeapFreeRatio. If not, an error aoqi@0: // message is returned in the provided buffer. aoqi@0: static bool verify_MaxHeapFreeRatio(FormatBuffer<80>& err_msg, uintx max_heap_free_ratio); aoqi@0: aoqi@0: // Check for consistency in the selection of the garbage collector. sjohanss@7611: static bool check_gc_consistency(); // Check user-selected gc aoqi@0: static void check_deprecated_gcs(); aoqi@0: static void check_deprecated_gc_flags(); aoqi@0: // Check consistecy or otherwise of VM argument settings aoqi@0: static bool check_vm_args_consistency(); aoqi@0: // Check stack pages settings aoqi@0: static bool check_stack_pages(); aoqi@0: // Used by os_solaris aoqi@0: static bool process_settings_file(const char* file_name, bool should_exist, jboolean ignore_unrecognized); aoqi@0: aoqi@0: static size_t conservative_max_heap_alignment() { return _conservative_max_heap_alignment; } aoqi@0: // Return the maximum size a heap with compressed oops can take aoqi@0: static size_t max_heap_for_compressed_oops(); aoqi@0: aoqi@0: // return a char* array containing all options aoqi@0: static char** jvm_flags_array() { return _jvm_flags_array; } aoqi@0: static char** jvm_args_array() { return _jvm_args_array; } aoqi@0: static int num_jvm_flags() { return _num_jvm_flags; } aoqi@0: static int num_jvm_args() { return _num_jvm_args; } aoqi@0: // return the arguments passed to the Java application aoqi@0: static const char* java_command() { return _java_command; } aoqi@0: aoqi@0: // print jvm_flags, jvm_args and java_command aoqi@0: static void print_on(outputStream* st); aoqi@0: aoqi@0: // convenient methods to obtain / print jvm_flags and jvm_args aoqi@0: static const char* jvm_flags() { return build_resource_string(_jvm_flags_array, _num_jvm_flags); } aoqi@0: static const char* jvm_args() { return build_resource_string(_jvm_args_array, _num_jvm_args); } aoqi@0: static void print_jvm_flags_on(outputStream* st); aoqi@0: static void print_jvm_args_on(outputStream* st); aoqi@0: aoqi@0: // -Dkey=value flags aoqi@0: static SystemProperty* system_properties() { return _system_properties; } aoqi@0: static const char* get_property(const char* key); aoqi@0: aoqi@0: // -Djava.vendor.url.bug aoqi@0: static const char* java_vendor_url_bug() { return _java_vendor_url_bug; } aoqi@0: aoqi@0: // -Dsun.java.launcher aoqi@0: static const char* sun_java_launcher() { return _sun_java_launcher; } aoqi@0: // Was VM created by a Java launcher? aoqi@0: static bool created_by_java_launcher(); aoqi@0: // Was VM created by the gamma Java launcher? aoqi@0: static bool created_by_gamma_launcher(); aoqi@0: // -Dsun.java.launcher.pid aoqi@0: static int sun_java_launcher_pid() { return _sun_java_launcher_pid; } aoqi@0: aoqi@0: // -Xloggc:, if not specified will be NULL aoqi@0: static const char* gc_log_filename() { return _gc_log_filename; } aoqi@0: aoqi@0: // -Xprof aoqi@0: static bool has_profile() { return _has_profile; } aoqi@0: aoqi@0: // -Xms, -Xmx aoqi@0: static uintx min_heap_size() { return _min_heap_size; } aoqi@0: static void set_min_heap_size(uintx v) { _min_heap_size = v; } aoqi@0: jwilhelm@7059: // Returns the original values of -XX:MinHeapFreeRatio and -XX:MaxHeapFreeRatio jwilhelm@7059: static uintx min_heap_free_ratio() { return _min_heap_free_ratio; } jwilhelm@7059: static uintx max_heap_free_ratio() { return _max_heap_free_ratio; } jwilhelm@7059: aoqi@0: // -Xrun aoqi@0: static AgentLibrary* libraries() { return _libraryList.first(); } aoqi@0: static bool init_libraries_at_startup() { return !_libraryList.is_empty(); } aoqi@0: static void convert_library_to_agent(AgentLibrary* lib) aoqi@0: { _libraryList.remove(lib); aoqi@0: _agentList.add(lib); } aoqi@0: aoqi@0: // -agentlib -agentpath aoqi@0: static AgentLibrary* agents() { return _agentList.first(); } aoqi@0: static bool init_agents_at_startup() { return !_agentList.is_empty(); } aoqi@0: aoqi@0: // abort, exit, vfprintf hooks aoqi@0: static abort_hook_t abort_hook() { return _abort_hook; } aoqi@0: static exit_hook_t exit_hook() { return _exit_hook; } aoqi@0: static vfprintf_hook_t vfprintf_hook() { return _vfprintf_hook; } aoqi@0: aoqi@0: static bool GetCheckCompileOnly () { return CheckCompileOnly; } aoqi@0: aoqi@0: static const char* GetSharedArchivePath() { return SharedArchivePath; } aoqi@0: aoqi@0: static bool CompileMethod(char* className, char* methodName) { aoqi@0: return aoqi@0: methodExists( aoqi@0: className, methodName, aoqi@0: CompileOnlyClassesNum, CompileOnlyClasses, CompileOnlyAllMethods, aoqi@0: CompileOnlyMethodsNum, CompileOnlyMethods, CompileOnlyAllClasses aoqi@0: ); aoqi@0: } aoqi@0: aoqi@0: // Java launcher properties aoqi@0: static void process_sun_java_launcher_properties(JavaVMInitArgs* args); aoqi@0: aoqi@0: // System properties aoqi@0: static void init_system_properties(); aoqi@0: aoqi@0: // Update/Initialize System properties after JDK version number is known aoqi@0: static void init_version_specific_system_properties(); aoqi@0: aoqi@0: // Property List manipulation aoqi@0: static void PropertyList_add(SystemProperty** plist, SystemProperty *element); aoqi@0: static void PropertyList_add(SystemProperty** plist, const char* k, char* v); aoqi@0: static void PropertyList_unique_add(SystemProperty** plist, const char* k, char* v) { aoqi@0: PropertyList_unique_add(plist, k, v, false); aoqi@0: } aoqi@0: static void PropertyList_unique_add(SystemProperty** plist, const char* k, char* v, jboolean append); aoqi@0: static const char* PropertyList_get_value(SystemProperty* plist, const char* key); aoqi@0: static int PropertyList_count(SystemProperty* pl); aoqi@0: static const char* PropertyList_get_key_at(SystemProperty* pl,int index); aoqi@0: static char* PropertyList_get_value_at(SystemProperty* pl,int index); aoqi@0: aoqi@0: // Miscellaneous System property value getter and setters. aoqi@0: static void set_dll_dir(char *value) { _sun_boot_library_path->set_value(value); } aoqi@0: static void set_java_home(char *value) { _java_home->set_value(value); } aoqi@0: static void set_library_path(char *value) { _java_library_path->set_value(value); } aoqi@0: static void set_ext_dirs(char *value) { _java_ext_dirs->set_value(value); } aoqi@0: static void set_endorsed_dirs(char *value) { _java_endorsed_dirs->set_value(value); } aoqi@0: static void set_sysclasspath(char *value) { _sun_boot_class_path->set_value(value); } aoqi@0: static void append_sysclasspath(const char *value) { _sun_boot_class_path->append_value(value); } aoqi@0: static void set_meta_index_path(char* meta_index_path, char* meta_index_dir) { aoqi@0: _meta_index_path = meta_index_path; aoqi@0: _meta_index_dir = meta_index_dir; aoqi@0: } aoqi@0: iklam@7089: static char* get_java_home() { return _java_home->value(); } iklam@7089: static char* get_dll_dir() { return _sun_boot_library_path->value(); } iklam@7089: static char* get_endorsed_dir() { return _java_endorsed_dirs->value(); } iklam@7089: static char* get_sysclasspath() { return _sun_boot_class_path->value(); } aoqi@0: static char* get_meta_index_path() { return _meta_index_path; } aoqi@0: static char* get_meta_index_dir() { return _meta_index_dir; } iklam@7089: static char* get_ext_dirs() { return _java_ext_dirs->value(); } iklam@7089: static char* get_appclasspath() { return _java_class_path->value(); } iklam@7089: static void fix_appclasspath(); aoqi@0: aoqi@0: // Operation modi iveresov@7172: static Mode mode() { return _mode; } iveresov@7172: static bool is_interpreter_only() { return mode() == _int; } iveresov@7172: aoqi@0: aoqi@0: // Utility: copies src into buf, replacing "%%" with "%" and "%p" with pid. aoqi@0: static bool copy_expand_pid(const char* src, size_t srclen, char* buf, size_t buflen); aoqi@0: }; aoqi@0: jcoomes@7117: bool Arguments::gc_selected() { jcoomes@7117: return UseConcMarkSweepGC || UseG1GC || UseParallelGC || UseParallelOldGC || jcoomes@7117: UseParNewGC || UseSerialGC; jcoomes@7117: } jcoomes@7122: aoqi@0: #endif // SHARE_VM_RUNTIME_ARGUMENTS_HPP