/* * 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. *
*/
void* JVMFlagLimit::constraint_func() const { int i = _constraint_func;
assert(0 <= i && i < NUM_JVMFlagConstraintsEnum, "sanity"); return flagConstraintTable[i];
}
template <typename T> class LimitGetter { public: // These functions return NULL for develop flags in a PRODUCT build static constexpr const JVMFlagLimit* no_limit(...) { return NULL;
}
// This is for flags that have neither range no constraint. We don't need the JVMFlagLimit struct. static constexpr const JVMFlagLimit* get_limit(const JVMTypedFlagLimit<T>* p, int dummy) { return NULL;
}
static constexpr const JVMFlagLimit* get_limit(const JVMTypedFlagLimit<T>* p, int dummy, T min, T max) { return p;
} static constexpr const JVMFlagLimit* get_limit(const JVMTypedFlagLimit<T>* p, int dummy, ConstraintMarker dummy2, short func, int phase) { return p;
} static constexpr const JVMFlagLimit* get_limit(const JVMTypedFlagLimit<T>* p, int dummy, T min, T max, ConstraintMarker dummy2, short func, int phase) { return p;
} static constexpr const JVMFlagLimit* get_limit(const JVMTypedFlagLimit<T>* p, int dummy, ConstraintMarker dummy2, short func, int phase, T min, T max) { return p;
}
};
static constexpr const JVMFlagLimit* const flagLimitTable[1 + NUM_JVMFlagsEnum] = { // Because FLAG_LIMIT_PTR must start with an "),", we have to place a dummy element here.
LimitGetter<int>::get_limit(NULL, 0
bool JVMFlagLimit::check_all_ranges() { bool status = true; for (int i = 0; i < NUM_JVMFlagsEnum; i++) {
JVMFlagsEnum flag_enum = static_cast<JVMFlagsEnum>(i); if (get_range_at(flag_enum) != NULL &&
JVMFlagAccess::check_range(JVMFlag::flag_from_enum(flag_enum), true) != JVMFlag::SUCCESS) {
status = false;
}
} return status;
}
// Check constraints for specific constraint phase. bool JVMFlagLimit::check_all_constraints(JVMFlagConstraintPhase phase) {
guarantee(phase > _validating_phase, "Constraint check is out of order.");
_validating_phase = phase;
bool status = true; for (int i = 0; i < NUM_JVMFlagsEnum; i++) {
JVMFlagsEnum flag_enum = static_cast<JVMFlagsEnum>(i); const JVMFlagLimit* constraint = get_constraint_at(flag_enum); if (constraint != NULL && constraint->phase() == static_cast<int>(phase) &&
JVMFlagAccess::check_constraint(JVMFlag::flag_from_enum(flag_enum),
constraint->constraint_func(), true) != JVMFlag::SUCCESS) {
status = false;
}
} return status;
}
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.