/* * Copyright (c) 1997, 2022, Oracle and/or its affiliates. All rights reserved. * 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. * * 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. *
*/
// Arguments parses the command line and recognizes options
class JVMFlag;
// Invocation API hook typedefs (these should really be defined in jni.h) extern"C" { typedefvoid (JNICALL *abort_hook_t)(void); typedefvoid (JNICALL *exit_hook_t)(jint code); typedef jint (JNICALL *vfprintf_hook_t)(FILE *fp, constchar *format, va_list args) ATTRIBUTE_PRINTF(2, 0);
}
// Obsolete or deprecated -XX flag. struct SpecialFlag { constchar* name;
JDK_Version deprecated_in; // When the deprecation warning started (or "undefined").
JDK_Version obsolete_in; // When the obsolete warning started (or "undefined").
JDK_Version expired_in; // When the option expires (or "undefined").
};
// PathString is used as: // - the underlying value for a SystemProperty // - the path portion of an --patch-module module/path pair // - the string that represents the boot class path, Arguments::_boot_class_path. class PathString : public CHeapObj<mtArguments> { protected: char* _value; public: char* value() const { return _value; }
// ModulePatchPath records the module/path pair as specified to --patch-module. class ModulePatchPath : public CHeapObj<mtInternal> { private: char* _module_name;
PathString* _path; public:
ModulePatchPath(constchar* module_name, constchar* path);
~ModulePatchPath();
// Element describing System and User (-Dkey=value flags) defined property. // // An internal SystemProperty is one that has been removed in // jdk.internal.VM.saveAndRemoveProperties, like jdk.boot.class.path.append. // class SystemProperty : public PathString { private: char* _key;
SystemProperty* _next; bool _internal; bool _writeable;
// A system property should only have its value set // via an external interface if it is a writeable property. // The internal, non-writeable property jdk.boot.class.path.append // is the only exception to this rule. It can be set externally // via -Xbootclasspath/a or JVMTI OnLoad phase call to AddToBootstrapClassLoaderSearch. // In those cases for jdk.boot.class.path.append, the base class // set_value and append_value methods are called directly. void set_writeable_value(constchar *value) { if (writeable()) {
set_value(value);
}
} void append_writeable_value(constchar *value) { if (writeable()) {
append_value(value);
}
}
// For use by -agentlib, -agentpath and -Xrun class AgentLibrary : public CHeapObj<mtArguments> { friendclass AgentLibraryList; 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
};
// maintain an order of entry list of AgentLibrary class AgentLibraryList { 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;
}
}
// a pointer to the flags file name if it is specified staticchar* _jvm_flags_file; // an array containing all flags specified in the .hotspotrc file staticchar** _jvm_flags_array; staticint _num_jvm_flags; // an array containing all jvm arguments specified in the command line staticchar** _jvm_args_array; staticint _num_jvm_args; // string containing all java command (class/jarfile name and app args) staticchar* _java_command;
// Property list static SystemProperty* _system_properties;
// Quick accessor to System properties in the list: static SystemProperty *_sun_boot_library_path; static SystemProperty *_java_library_path; static SystemProperty *_java_home; static SystemProperty *_java_class_path; static SystemProperty *_jdk_boot_class_path_append; static SystemProperty *_vm_info;
// --patch-module=module=<file>(<pathsep><file>)* // Each element contains the associated module name, path // string pair as specified to --patch-module. static GrowableArray<ModulePatchPath*>* _patch_mod_prefix;
// The constructed value of the system class path after // argument processing and JVMTI OnLoad additions via // calls to AddToBootstrapClassLoaderSearch. This is the // final form before ClassLoader::setup_bootstrap_search(). // Note: since --patch-module is a module name/path pair, the // boot class path string no longer contains the "prefix" // to the boot class path base piece as it did when // -Xbootclasspath/p was supported. static PathString* _boot_class_path;
// Set if a modular java runtime image is present vs. a build with exploded modules staticbool _has_jimage;
// temporary: to emit warning if the default ext dirs are not empty. // remove this variable when the warning is no longer needed. staticchar* _ext_dirs;
// java.vendor.url.bug, bug reporting URL for fatal errors. staticconstchar* _java_vendor_url_bug;
// sun.java.launcher, private property to provide information about // java launcher staticconstchar* _sun_java_launcher;
// was this VM created via the -XXaltjvm=<path> option staticbool _sun_java_launcher_is_altjvm;
// for legacy gc options (-verbose:gc and -Xloggc:) static LegacyGCLogging _legacyGCLogging;
// Value of the conservative maximum heap alignment needed static size_t _conservative_max_heap_alignment;
// Used to save default settings staticbool _AlwaysCompileLoopMethods; staticbool _UseOnStackReplacement; staticbool _BackgroundCompilation; staticbool _ClipInlining;
// GC ergonomics staticvoid set_conservative_max_heap_alignment(); staticvoid set_use_compressed_oops(); staticvoid set_use_compressed_klass_ptrs(); static jint set_ergonomics_flags(); staticvoid set_shared_spaces_flags_and_archive_paths(); // Limits the given heap size by the maximum amount of virtual // memory this process is currently allowed to use. It also takes // the virtual-to-physical ratio of the current GC into account. static size_t limit_heap_by_allocatable_memory(size_t size); // Setup heap size staticvoid set_heap_size();
// System properties staticbool add_property(constchar* prop, PropertyWriteable writeable=WriteableProperty,
PropertyInternal internal=ExternalProperty);
// Used for module system related properties: converted from command-line flags. // Basic properties are writeable as they operate as "last one wins" and will get overwritten. // Numbered properties are never writeable, and always internal. staticbool create_module_property(constchar* prop_name, constchar* prop_value, PropertyInternal internal); staticbool create_numbered_module_property(constchar* prop_base_name, constchar* prop_value, unsignedint count);
// methods to build strings from individual args staticvoid build_jvm_args(constchar* arg); staticvoid build_jvm_flags(constchar* arg); staticvoid add_string(char*** bldarray, int* count, constchar* arg); staticconstchar* build_resource_string(char** args, int count);
// Returns true if the flag is obsolete (and not yet expired). // In this case the 'version' buffer is filled in with // the version number when the flag became obsolete. staticbool is_obsolete_flag(constchar* flag_name, JDK_Version* version);
// Returns 1 if the flag is deprecated (and not yet obsolete or expired). // In this case the 'version' buffer is filled in with the version number when // the flag became deprecated. // Returns -1 if the flag is expired or obsolete. // Returns 0 otherwise. staticint is_deprecated_flag(constchar* flag_name, JDK_Version* version);
// Return the real name for the flag passed on the command line (either an alias name or "flag_name"). staticconstchar* real_flag_name(constchar *flag_name); static JVMFlag* find_jvm_flag(constchar* name, size_t name_length);
// Return the "real" name for option arg if arg is an alias, and print a warning if arg is deprecated. // Return NULL if the arg has expired. staticconstchar* handle_aliases_and_deprecation(constchar* arg);
staticchar* SharedArchivePath; staticchar* SharedDynamicArchivePath; static size_t _default_SharedBaseAddress; // The default value specified in globals.hpp staticvoid extract_shared_archive_paths(constchar* archive_path, char** base_archive_path, char** top_archive_path) NOT_CDS_RETURN;
public: staticint num_archives(constchar* archive_path) NOT_CDS_RETURN_(0); // Parses the arguments, first phase static jint parse(const JavaVMInitArgs* args); // 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. staticbool parse_uintx(constchar* value, uintx* uintx_arg,
uintx min_size); // Apply ergonomics static jint apply_ergo(); // Adjusts the arguments after the OS have adjusted the arguments static jint adjust_after_os();
// Check consistency or otherwise of VM argument settings staticbool check_vm_args_consistency(); // Used by os_solaris staticbool process_settings_file(constchar* file_name, bool should_exist, jboolean ignore_unrecognized);
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();
// return a char* array containing all options staticchar** jvm_flags_array() { return _jvm_flags_array; } staticchar** jvm_args_array() { return _jvm_args_array; } staticint num_jvm_flags() { return _num_jvm_flags; } staticint num_jvm_args() { return _num_jvm_args; } // return the arguments passed to the Java application staticconstchar* java_command() { return _java_command; }
// -Dsun.java.launcher staticconstchar* sun_java_launcher() { return _sun_java_launcher; } // Was VM created by a Java launcher? staticbool created_by_java_launcher(); // -Dsun.java.launcher.is_altjvm staticbool sun_java_launcher_is_altjvm();
staticvoid assert_is_dumping_archive() {
assert(Arguments::is_dumping_archive(), "dump time only");
}
// Parse diagnostic NMT switch "MallocLimit" and return the found limits. // 1) If option is not given, it will set all limits to 0 (aka "no limit"). // 2) If option is given in the global form (-XX:MallocLimit=<size>), it // will return the size in *total_limit. // 3) If option is given in its per-NMT-category form (-XX:MallocLimit=<category>:<size>[,<category>:<size>]), // it will return all found limits in the limits array. // 4) If option is malformed, it will exit the VM. // For (2) and (3), limits not affected by the switch will be set to 0. staticvoid parse_malloc_limits(size_t* total_limit, size_t limits[mt_number_of_types]);
// Disable options not supported in this release, with a warning if they // were explicitly requested on the command-line #define UNSUPPORTED_OPTION(opt) \ do { \ if (opt) { \ if (FLAG_IS_CMDLINE(opt)) { \
warning("-XX:+"#opt" not supported in this VM"); \
} \
FLAG_SET_DEFAULT(opt, false); \
} \
} while(0)
// similar to UNSUPPORTED_OPTION but sets flag to NULL #define UNSUPPORTED_OPTION_NULL(opt) \ do { \ if (opt) { \ if (FLAG_IS_CMDLINE(opt)) { \
warning("-XX flag "#opt" not supported in this VM"); \
} \
FLAG_SET_DEFAULT(opt, NULL); \
} \
} while(0)
// Initialize options not supported in this release, with a warning // if they were explicitly requested on the command-line #define UNSUPPORTED_OPTION_INIT(opt, value) \ do { \ if (FLAG_IS_CMDLINE(opt)) { \
warning("-XX flag "#opt" not supported in this VM"); \
} \
FLAG_SET_DEFAULT(opt, value); \
} while(0)
#endif// SHARE_RUNTIME_ARGUMENTS_HPP
¤ Dauer der Verarbeitung: 0.4 Sekunden
(vorverarbeitet)
¤
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung ist noch experimentell.