/* * Copyright (c) 1997, 2021, 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. *
*/
enumclass JVMFlagOrigin : int { // This is the value returned by JVMFlag::get_origin(). It records who // has most recently changed the value of a JVMFlag. DEFAULT means that the // flag was never changed, or was most recently changed by FLAG_SET_DEFAULT. DEFAULT = 0,
COMMAND_LINE = 1,
ENVIRON_VAR = 2,
CONFIG_FILE = 3,
MANAGEMENT = 4,
ERGONOMIC = 5,
ATTACH_ON_DEMAND = 6,
INTERNAL = 7,
JIMAGE_RESOURCE = 8,
};
// Note the difference: // f->get_origin() == COMMAND_LINE // f was mostly recently set by the command-line // f->_flags & WAS_SET_ON_COMMAND_LINE // f was specified on the command-line (but may have since been updated by // someone else like FLAG_SET_ERGO)
WAS_SET_ON_COMMAND_LINE = 1 << 17,
enum Error { // no error
SUCCESS = 0, // flag name is missing
MISSING_NAME, // flag value is missing
MISSING_VALUE, // error parsing the textual form of the value
WRONG_FORMAT, // flag is not writable
NON_WRITABLE, // flag value is outside of its bounds
OUT_OF_BOUNDS, // flag value violates its constraint
VIOLATES_CONSTRAINT, // there is no flag with the given name
INVALID_FLAG, // the flag can only be set only on command line during invocation of the VM
COMMAND_LINE_ONLY, // the flag may only be set once
SET_ONLY_ONCE, // the flag is not writable in this combination of product/debug build
CONSTANT, // other, unspecified error related to setting the flag
ERR_OTHER
};
enum FlagType : int {
JVM_FLAG_NON_STRING_TYPES_DO(JVM_FLAG_TYPE_DECLARE) // The two string types are a bit irregular: is_ccstr() returns true for both types.
TYPE_ccstr,
TYPE_ccstrlist,
NUM_FLAG_TYPES
};
private: void* _addr; constchar* _name;
Flags _flags; int _type;
NOT_PRODUCT(constchar* _doc;)
public: // points to all Flags static array static JVMFlag* flags;
// Do not use JVMFlag::read() or JVMFlag::write() directly unless you know // what you're doing. Use FLAG_SET_XXX macros or JVMFlagAccess instead. template <typename T> T read() const {
assert_compatible_type<T>(_type); return *static_cast<T*>(_addr);
}
// Only manageable flags can be accessed by writeableFlags.cpp bool is_writeable() const { return is_manageable(); } // All flags except "manageable" are assumed to be internal flags. bool is_external() const { return is_manageable(); }
// The following computation is not universal, but should be correct // for the limited number of types that can be stored inside a JVMFlag. template <typename T> static constexpr int type_signature() { returnint(sizeof(T)) |
(((std::is_integral<T>::value) ? 1 : 0) << 8) |
(((std::is_signed<T>::value) ? 1 : 0) << 9) |
(((std::is_pointer<T>::value) ? 1 : 0) << 10);
}
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 und die Messung sind noch experimentell.