mirror of
https://github.com/openjdk/jdk.git
synced 2025-08-27 06:45:07 +02:00
8224878: Use JVMFlag parameters instead of name strings
Reviewed-by: gziemski, dholmes, jrose
This commit is contained in:
parent
e1aca70a1c
commit
04ef527ede
15 changed files with 355 additions and 464 deletions
|
@ -205,7 +205,7 @@ C2V_VMENTRY_NULL(jobject, getFlagValue, (JNIEnv* env, jobject c2vm, jobject name
|
||||||
JVMCI_THROW_NULL(NullPointerException);
|
JVMCI_THROW_NULL(NullPointerException);
|
||||||
}
|
}
|
||||||
const char* cstring = JVMCIENV->as_utf8_string(name);
|
const char* cstring = JVMCIENV->as_utf8_string(name);
|
||||||
JVMFlag* flag = JVMFlag::find_flag(cstring, strlen(cstring), /* allow_locked */ true, /* return_flag */ true);
|
const JVMFlag* flag = JVMFlag::find_declared_flag(cstring);
|
||||||
if (flag == NULL) {
|
if (flag == NULL) {
|
||||||
return c2vm;
|
return c2vm;
|
||||||
}
|
}
|
||||||
|
|
|
@ -369,7 +369,7 @@ jobjectArray readConfiguration0(JNIEnv *env, JVMCI_TRAPS) {
|
||||||
#define COUNT_FLAG(ignore) +1
|
#define COUNT_FLAG(ignore) +1
|
||||||
#ifdef ASSERT
|
#ifdef ASSERT
|
||||||
#define CHECK_FLAG(type, name) { \
|
#define CHECK_FLAG(type, name) { \
|
||||||
JVMFlag* flag = JVMFlag::find_flag(#name, strlen(#name), /*allow_locked*/ true, /* return_flag */ true); \
|
const JVMFlag* flag = JVMFlag::find_declared_flag(#name); \
|
||||||
assert(flag != NULL, "No such flag named " #name); \
|
assert(flag != NULL, "No such flag named " #name); \
|
||||||
assert(flag->is_##type(), "JVMFlag " #name " is not of type " #type); \
|
assert(flag->is_##type(), "JVMFlag " #name " is not of type " #type); \
|
||||||
}
|
}
|
||||||
|
|
|
@ -1137,27 +1137,29 @@ WB_ENTRY(void, WB_ClearMethodState(JNIEnv* env, jobject o, jobject method))
|
||||||
WB_END
|
WB_END
|
||||||
|
|
||||||
template <typename T>
|
template <typename T>
|
||||||
static bool GetVMFlag(JavaThread* thread, JNIEnv* env, jstring name, T* value, JVMFlag::Error (*TAt)(const char*, T*, bool, bool)) {
|
static bool GetVMFlag(JavaThread* thread, JNIEnv* env, jstring name, T* value, JVMFlag::Error (*TAt)(const JVMFlag*, T*)) {
|
||||||
if (name == NULL) {
|
if (name == NULL) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
ThreadToNativeFromVM ttnfv(thread); // can't be in VM when we call JNI
|
ThreadToNativeFromVM ttnfv(thread); // can't be in VM when we call JNI
|
||||||
const char* flag_name = env->GetStringUTFChars(name, NULL);
|
const char* flag_name = env->GetStringUTFChars(name, NULL);
|
||||||
CHECK_JNI_EXCEPTION_(env, false);
|
CHECK_JNI_EXCEPTION_(env, false);
|
||||||
JVMFlag::Error result = (*TAt)(flag_name, value, true, true);
|
const JVMFlag* flag = JVMFlag::find_declared_flag(flag_name);
|
||||||
|
JVMFlag::Error result = (*TAt)(flag, value);
|
||||||
env->ReleaseStringUTFChars(name, flag_name);
|
env->ReleaseStringUTFChars(name, flag_name);
|
||||||
return (result == JVMFlag::SUCCESS);
|
return (result == JVMFlag::SUCCESS);
|
||||||
}
|
}
|
||||||
|
|
||||||
template <typename T>
|
template <typename T>
|
||||||
static bool SetVMFlag(JavaThread* thread, JNIEnv* env, jstring name, T* value, JVMFlag::Error (*TAtPut)(const char*, T*, JVMFlag::Flags)) {
|
static bool SetVMFlag(JavaThread* thread, JNIEnv* env, jstring name, T* value, JVMFlag::Error (*TAtPut)(JVMFlag* flag, T*, JVMFlag::Flags)) {
|
||||||
if (name == NULL) {
|
if (name == NULL) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
ThreadToNativeFromVM ttnfv(thread); // can't be in VM when we call JNI
|
ThreadToNativeFromVM ttnfv(thread); // can't be in VM when we call JNI
|
||||||
const char* flag_name = env->GetStringUTFChars(name, NULL);
|
const char* flag_name = env->GetStringUTFChars(name, NULL);
|
||||||
CHECK_JNI_EXCEPTION_(env, false);
|
CHECK_JNI_EXCEPTION_(env, false);
|
||||||
JVMFlag::Error result = (*TAtPut)(flag_name, value, JVMFlag::INTERNAL);
|
JVMFlag* flag = JVMFlag::find_flag(flag_name);
|
||||||
|
JVMFlag::Error result = (*TAtPut)(flag, value, JVMFlag::INTERNAL);
|
||||||
env->ReleaseStringUTFChars(name, flag_name);
|
env->ReleaseStringUTFChars(name, flag_name);
|
||||||
return (result == JVMFlag::SUCCESS);
|
return (result == JVMFlag::SUCCESS);
|
||||||
}
|
}
|
||||||
|
@ -1192,22 +1194,22 @@ static jobject doubleBox(JavaThread* thread, JNIEnv* env, jdouble value) {
|
||||||
return box(thread, env, vmSymbols::java_lang_Double(), vmSymbols::Double_valueOf_signature(), value);
|
return box(thread, env, vmSymbols::java_lang_Double(), vmSymbols::Double_valueOf_signature(), value);
|
||||||
}
|
}
|
||||||
|
|
||||||
static JVMFlag* getVMFlag(JavaThread* thread, JNIEnv* env, jstring name) {
|
static const JVMFlag* getVMFlag(JavaThread* thread, JNIEnv* env, jstring name) {
|
||||||
ThreadToNativeFromVM ttnfv(thread); // can't be in VM when we call JNI
|
ThreadToNativeFromVM ttnfv(thread); // can't be in VM when we call JNI
|
||||||
const char* flag_name = env->GetStringUTFChars(name, NULL);
|
const char* flag_name = env->GetStringUTFChars(name, NULL);
|
||||||
CHECK_JNI_EXCEPTION_(env, NULL);
|
CHECK_JNI_EXCEPTION_(env, NULL);
|
||||||
JVMFlag* result = JVMFlag::find_flag(flag_name, strlen(flag_name), true, true);
|
const JVMFlag* result = JVMFlag::find_declared_flag(flag_name);
|
||||||
env->ReleaseStringUTFChars(name, flag_name);
|
env->ReleaseStringUTFChars(name, flag_name);
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
WB_ENTRY(jboolean, WB_IsConstantVMFlag(JNIEnv* env, jobject o, jstring name))
|
WB_ENTRY(jboolean, WB_IsConstantVMFlag(JNIEnv* env, jobject o, jstring name))
|
||||||
JVMFlag* flag = getVMFlag(thread, env, name);
|
const JVMFlag* flag = getVMFlag(thread, env, name);
|
||||||
return (flag != NULL) && flag->is_constant_in_binary();
|
return (flag != NULL) && flag->is_constant_in_binary();
|
||||||
WB_END
|
WB_END
|
||||||
|
|
||||||
WB_ENTRY(jboolean, WB_IsLockedVMFlag(JNIEnv* env, jobject o, jstring name))
|
WB_ENTRY(jboolean, WB_IsLockedVMFlag(JNIEnv* env, jobject o, jstring name))
|
||||||
JVMFlag* flag = getVMFlag(thread, env, name);
|
const JVMFlag* flag = getVMFlag(thread, env, name);
|
||||||
return (flag != NULL) && !(flag->is_unlocked() || flag->is_unlocker());
|
return (flag != NULL) && !(flag->is_unlocked() || flag->is_unlocker());
|
||||||
WB_END
|
WB_END
|
||||||
|
|
||||||
|
|
|
@ -750,7 +750,7 @@ static bool verify_special_jvm_flags() {
|
||||||
|
|
||||||
// if flag has become obsolete it should not have a "globals" flag defined anymore.
|
// if flag has become obsolete it should not have a "globals" flag defined anymore.
|
||||||
if (!version_less_than(JDK_Version::current(), flag.obsolete_in)) {
|
if (!version_less_than(JDK_Version::current(), flag.obsolete_in)) {
|
||||||
if (JVMFlag::find_flag(flag.name) != NULL) {
|
if (JVMFlag::find_declared_flag(flag.name) != NULL) {
|
||||||
// Temporarily disable the warning: 8196739
|
// Temporarily disable the warning: 8196739
|
||||||
// warning("Global variable for obsolete special flag entry \"%s\" should be removed", flag.name);
|
// warning("Global variable for obsolete special flag entry \"%s\" should be removed", flag.name);
|
||||||
}
|
}
|
||||||
|
@ -760,7 +760,7 @@ static bool verify_special_jvm_flags() {
|
||||||
if (!flag.expired_in.is_undefined()) {
|
if (!flag.expired_in.is_undefined()) {
|
||||||
// if flag has become expired it should not have a "globals" flag defined anymore.
|
// if flag has become expired it should not have a "globals" flag defined anymore.
|
||||||
if (!version_less_than(JDK_Version::current(), flag.expired_in)) {
|
if (!version_less_than(JDK_Version::current(), flag.expired_in)) {
|
||||||
if (JVMFlag::find_flag(flag.name) != NULL) {
|
if (JVMFlag::find_declared_flag(flag.name) != NULL) {
|
||||||
// Temporarily disable the warning: 8196739
|
// Temporarily disable the warning: 8196739
|
||||||
// warning("Global variable for expired flag entry \"%s\" should be removed", flag.name);
|
// warning("Global variable for expired flag entry \"%s\" should be removed", flag.name);
|
||||||
}
|
}
|
||||||
|
@ -844,15 +844,15 @@ void Arguments::describe_range_error(ArgsRange errcode) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static bool set_bool_flag(const char* name, bool value, JVMFlag::Flags origin) {
|
static bool set_bool_flag(JVMFlag* flag, bool value, JVMFlag::Flags origin) {
|
||||||
if (JVMFlag::boolAtPut(name, &value, origin) == JVMFlag::SUCCESS) {
|
if (JVMFlag::boolAtPut(flag, &value, origin) == JVMFlag::SUCCESS) {
|
||||||
return true;
|
return true;
|
||||||
} else {
|
} else {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static bool set_fp_numeric_flag(const char* name, char* value, JVMFlag::Flags origin) {
|
static bool set_fp_numeric_flag(JVMFlag* flag, char* value, JVMFlag::Flags origin) {
|
||||||
char* end;
|
char* end;
|
||||||
errno = 0;
|
errno = 0;
|
||||||
double v = strtod(value, &end);
|
double v = strtod(value, &end);
|
||||||
|
@ -860,26 +860,25 @@ static bool set_fp_numeric_flag(const char* name, char* value, JVMFlag::Flags or
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (JVMFlag::doubleAtPut(name, &v, origin) == JVMFlag::SUCCESS) {
|
if (JVMFlag::doubleAtPut(flag, &v, origin) == JVMFlag::SUCCESS) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
static bool set_numeric_flag(const char* name, char* value, JVMFlag::Flags origin) {
|
static bool set_numeric_flag(JVMFlag* flag, char* value, JVMFlag::Flags origin) {
|
||||||
julong v;
|
julong v;
|
||||||
int int_v;
|
int int_v;
|
||||||
intx intx_v;
|
intx intx_v;
|
||||||
bool is_neg = false;
|
bool is_neg = false;
|
||||||
JVMFlag* result = JVMFlag::find_flag(name, strlen(name));
|
|
||||||
|
|
||||||
if (result == NULL) {
|
if (flag == NULL) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Check the sign first since atojulong() parses only unsigned values.
|
// Check the sign first since atojulong() parses only unsigned values.
|
||||||
if (*value == '-') {
|
if (*value == '-') {
|
||||||
if (!result->is_intx() && !result->is_int()) {
|
if (!flag->is_intx() && !flag->is_int()) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
value++;
|
value++;
|
||||||
|
@ -888,48 +887,48 @@ static bool set_numeric_flag(const char* name, char* value, JVMFlag::Flags origi
|
||||||
if (!Arguments::atojulong(value, &v)) {
|
if (!Arguments::atojulong(value, &v)) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
if (result->is_int()) {
|
if (flag->is_int()) {
|
||||||
int_v = (int) v;
|
int_v = (int) v;
|
||||||
if (is_neg) {
|
if (is_neg) {
|
||||||
int_v = -int_v;
|
int_v = -int_v;
|
||||||
}
|
}
|
||||||
return JVMFlag::intAtPut(result, &int_v, origin) == JVMFlag::SUCCESS;
|
return JVMFlag::intAtPut(flag, &int_v, origin) == JVMFlag::SUCCESS;
|
||||||
} else if (result->is_uint()) {
|
} else if (flag->is_uint()) {
|
||||||
uint uint_v = (uint) v;
|
uint uint_v = (uint) v;
|
||||||
return JVMFlag::uintAtPut(result, &uint_v, origin) == JVMFlag::SUCCESS;
|
return JVMFlag::uintAtPut(flag, &uint_v, origin) == JVMFlag::SUCCESS;
|
||||||
} else if (result->is_intx()) {
|
} else if (flag->is_intx()) {
|
||||||
intx_v = (intx) v;
|
intx_v = (intx) v;
|
||||||
if (is_neg) {
|
if (is_neg) {
|
||||||
intx_v = -intx_v;
|
intx_v = -intx_v;
|
||||||
}
|
}
|
||||||
return JVMFlag::intxAtPut(result, &intx_v, origin) == JVMFlag::SUCCESS;
|
return JVMFlag::intxAtPut(flag, &intx_v, origin) == JVMFlag::SUCCESS;
|
||||||
} else if (result->is_uintx()) {
|
} else if (flag->is_uintx()) {
|
||||||
uintx uintx_v = (uintx) v;
|
uintx uintx_v = (uintx) v;
|
||||||
return JVMFlag::uintxAtPut(result, &uintx_v, origin) == JVMFlag::SUCCESS;
|
return JVMFlag::uintxAtPut(flag, &uintx_v, origin) == JVMFlag::SUCCESS;
|
||||||
} else if (result->is_uint64_t()) {
|
} else if (flag->is_uint64_t()) {
|
||||||
uint64_t uint64_t_v = (uint64_t) v;
|
uint64_t uint64_t_v = (uint64_t) v;
|
||||||
return JVMFlag::uint64_tAtPut(result, &uint64_t_v, origin) == JVMFlag::SUCCESS;
|
return JVMFlag::uint64_tAtPut(flag, &uint64_t_v, origin) == JVMFlag::SUCCESS;
|
||||||
} else if (result->is_size_t()) {
|
} else if (flag->is_size_t()) {
|
||||||
size_t size_t_v = (size_t) v;
|
size_t size_t_v = (size_t) v;
|
||||||
return JVMFlag::size_tAtPut(result, &size_t_v, origin) == JVMFlag::SUCCESS;
|
return JVMFlag::size_tAtPut(flag, &size_t_v, origin) == JVMFlag::SUCCESS;
|
||||||
} else if (result->is_double()) {
|
} else if (flag->is_double()) {
|
||||||
double double_v = (double) v;
|
double double_v = (double) v;
|
||||||
return JVMFlag::doubleAtPut(result, &double_v, origin) == JVMFlag::SUCCESS;
|
return JVMFlag::doubleAtPut(flag, &double_v, origin) == JVMFlag::SUCCESS;
|
||||||
} else {
|
} else {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static bool set_string_flag(const char* name, const char* value, JVMFlag::Flags origin) {
|
static bool set_string_flag(JVMFlag* flag, const char* value, JVMFlag::Flags origin) {
|
||||||
if (JVMFlag::ccstrAtPut(name, &value, origin) != JVMFlag::SUCCESS) return false;
|
if (JVMFlag::ccstrAtPut(flag, &value, origin) != JVMFlag::SUCCESS) return false;
|
||||||
// Contract: JVMFlag always returns a pointer that needs freeing.
|
// Contract: JVMFlag always returns a pointer that needs freeing.
|
||||||
FREE_C_HEAP_ARRAY(char, value);
|
FREE_C_HEAP_ARRAY(char, value);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
static bool append_to_string_flag(const char* name, const char* new_value, JVMFlag::Flags origin) {
|
static bool append_to_string_flag(JVMFlag* flag, const char* new_value, JVMFlag::Flags origin) {
|
||||||
const char* old_value = "";
|
const char* old_value = "";
|
||||||
if (JVMFlag::ccstrAt(name, &old_value) != JVMFlag::SUCCESS) return false;
|
if (JVMFlag::ccstrAt(flag, &old_value) != JVMFlag::SUCCESS) return false;
|
||||||
size_t old_len = old_value != NULL ? strlen(old_value) : 0;
|
size_t old_len = old_value != NULL ? strlen(old_value) : 0;
|
||||||
size_t new_len = strlen(new_value);
|
size_t new_len = strlen(new_value);
|
||||||
const char* value;
|
const char* value;
|
||||||
|
@ -946,7 +945,7 @@ static bool append_to_string_flag(const char* name, const char* new_value, JVMFl
|
||||||
value = buf;
|
value = buf;
|
||||||
free_this_too = buf;
|
free_this_too = buf;
|
||||||
}
|
}
|
||||||
(void) JVMFlag::ccstrAtPut(name, &value, origin);
|
(void) JVMFlag::ccstrAtPut(flag, &value, origin);
|
||||||
// JVMFlag always returns a pointer that needs freeing.
|
// JVMFlag always returns a pointer that needs freeing.
|
||||||
FREE_C_HEAP_ARRAY(char, value);
|
FREE_C_HEAP_ARRAY(char, value);
|
||||||
if (free_this_too != NULL) {
|
if (free_this_too != NULL) {
|
||||||
|
@ -1041,7 +1040,8 @@ bool Arguments::parse_argument(const char* arg, JVMFlag::Flags origin) {
|
||||||
if (real_name == NULL) {
|
if (real_name == NULL) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
return set_bool_flag(real_name, false, origin);
|
JVMFlag* flag = JVMFlag::find_flag(real_name);
|
||||||
|
return set_bool_flag(flag, false, origin);
|
||||||
}
|
}
|
||||||
if (sscanf(arg, "+%" XSTR(BUFLEN) NAME_RANGE "%c", name, &dummy) == 1) {
|
if (sscanf(arg, "+%" XSTR(BUFLEN) NAME_RANGE "%c", name, &dummy) == 1) {
|
||||||
AliasedLoggingFlag alf = catch_logging_aliases(name, true);
|
AliasedLoggingFlag alf = catch_logging_aliases(name, true);
|
||||||
|
@ -1053,13 +1053,13 @@ bool Arguments::parse_argument(const char* arg, JVMFlag::Flags origin) {
|
||||||
if (real_name == NULL) {
|
if (real_name == NULL) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
return set_bool_flag(real_name, true, origin);
|
JVMFlag* flag = JVMFlag::find_flag(real_name);
|
||||||
|
return set_bool_flag(flag, true, origin);
|
||||||
}
|
}
|
||||||
|
|
||||||
char punct;
|
char punct;
|
||||||
if (sscanf(arg, "%" XSTR(BUFLEN) NAME_RANGE "%c", name, &punct) == 2 && punct == '=') {
|
if (sscanf(arg, "%" XSTR(BUFLEN) NAME_RANGE "%c", name, &punct) == 2 && punct == '=') {
|
||||||
const char* value = strchr(arg, '=') + 1;
|
const char* value = strchr(arg, '=') + 1;
|
||||||
JVMFlag* flag;
|
|
||||||
|
|
||||||
// this scanf pattern matches both strings (handled here) and numbers (handled later))
|
// this scanf pattern matches both strings (handled here) and numbers (handled later))
|
||||||
AliasedLoggingFlag alf = catch_logging_aliases(name, true);
|
AliasedLoggingFlag alf = catch_logging_aliases(name, true);
|
||||||
|
@ -1071,15 +1071,15 @@ bool Arguments::parse_argument(const char* arg, JVMFlag::Flags origin) {
|
||||||
if (real_name == NULL) {
|
if (real_name == NULL) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
flag = JVMFlag::find_flag(real_name);
|
JVMFlag* flag = JVMFlag::find_flag(real_name);
|
||||||
if (flag != NULL && flag->is_ccstr()) {
|
if (flag != NULL && flag->is_ccstr()) {
|
||||||
if (flag->ccstr_accumulates()) {
|
if (flag->ccstr_accumulates()) {
|
||||||
return append_to_string_flag(real_name, value, origin);
|
return append_to_string_flag(flag, value, origin);
|
||||||
} else {
|
} else {
|
||||||
if (value[0] == '\0') {
|
if (value[0] == '\0') {
|
||||||
value = NULL;
|
value = NULL;
|
||||||
}
|
}
|
||||||
return set_string_flag(real_name, value, origin);
|
return set_string_flag(flag, value, origin);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
warn_if_deprecated = false; // if arg is deprecated, we've already done warning...
|
warn_if_deprecated = false; // if arg is deprecated, we've already done warning...
|
||||||
|
@ -1096,7 +1096,8 @@ bool Arguments::parse_argument(const char* arg, JVMFlag::Flags origin) {
|
||||||
if (real_name == NULL) {
|
if (real_name == NULL) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
return set_string_flag(real_name, value, origin);
|
JVMFlag* flag = JVMFlag::find_flag(real_name);
|
||||||
|
return set_string_flag(flag, value, origin);
|
||||||
}
|
}
|
||||||
|
|
||||||
#define SIGNED_FP_NUMBER_RANGE "[-0123456789.eE+]"
|
#define SIGNED_FP_NUMBER_RANGE "[-0123456789.eE+]"
|
||||||
|
@ -1111,7 +1112,8 @@ bool Arguments::parse_argument(const char* arg, JVMFlag::Flags origin) {
|
||||||
if (real_name == NULL) {
|
if (real_name == NULL) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
return set_fp_numeric_flag(real_name, value, origin);
|
JVMFlag* flag = JVMFlag::find_flag(real_name);
|
||||||
|
return set_fp_numeric_flag(flag, value, origin);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1121,7 +1123,8 @@ bool Arguments::parse_argument(const char* arg, JVMFlag::Flags origin) {
|
||||||
if (real_name == NULL) {
|
if (real_name == NULL) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
return set_numeric_flag(real_name, value, origin);
|
JVMFlag* flag = JVMFlag::find_flag(real_name);
|
||||||
|
return set_numeric_flag(flag, value, origin);
|
||||||
}
|
}
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
|
@ -1277,7 +1280,7 @@ bool Arguments::process_argument(const char* arg,
|
||||||
|
|
||||||
// For locked flags, report a custom error message if available.
|
// For locked flags, report a custom error message if available.
|
||||||
// Otherwise, report the standard unrecognized VM option.
|
// Otherwise, report the standard unrecognized VM option.
|
||||||
JVMFlag* found_flag = JVMFlag::find_flag((const char*)argname, arg_len, true, true);
|
const JVMFlag* found_flag = JVMFlag::find_declared_flag((const char*)argname, arg_len);
|
||||||
if (found_flag != NULL) {
|
if (found_flag != NULL) {
|
||||||
char locked_message_buf[BUFLEN];
|
char locked_message_buf[BUFLEN];
|
||||||
JVMFlag::MsgType msg_type = found_flag->get_locked_message(locked_message_buf, BUFLEN);
|
JVMFlag::MsgType msg_type = found_flag->get_locked_message(locked_message_buf, BUFLEN);
|
||||||
|
|
|
@ -604,7 +604,7 @@ void JVMFlag::print_on(outputStream* st, bool withComments, bool printRanges) {
|
||||||
st->cr();
|
st->cr();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
JVMFlagRangeList::print(st, _name, func);
|
JVMFlagRangeList::print(st, this, func);
|
||||||
|
|
||||||
fill_to_pos(st, col5_pos);
|
fill_to_pos(st, col5_pos);
|
||||||
print_kind(st, col5_width);
|
print_kind(st, col5_width);
|
||||||
|
@ -957,103 +957,82 @@ JVMFlag* JVMFlag::fuzzy_match(const char* name, size_t length, bool allow_locked
|
||||||
}
|
}
|
||||||
|
|
||||||
// Returns the address of the index'th element
|
// Returns the address of the index'th element
|
||||||
static JVMFlag* address_of_flag(JVMFlagsEnum flag) {
|
JVMFlag* JVMFlagEx::flag_from_enum(JVMFlagsEnum flag) {
|
||||||
assert((size_t)flag < JVMFlag::numFlags, "bad command line flag index");
|
assert((size_t)flag < JVMFlag::numFlags, "bad command line flag index");
|
||||||
return &JVMFlag::flags[flag];
|
return &JVMFlag::flags[flag];
|
||||||
}
|
}
|
||||||
|
|
||||||
bool JVMFlagEx::is_default(JVMFlagsEnum flag) {
|
bool JVMFlagEx::is_default(JVMFlagsEnum flag) {
|
||||||
assert((size_t)flag < JVMFlag::numFlags, "bad command line flag index");
|
return flag_from_enum(flag)->is_default();
|
||||||
JVMFlag* f = &JVMFlag::flags[flag];
|
|
||||||
return f->is_default();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
bool JVMFlagEx::is_ergo(JVMFlagsEnum flag) {
|
bool JVMFlagEx::is_ergo(JVMFlagsEnum flag) {
|
||||||
assert((size_t)flag < JVMFlag::numFlags, "bad command line flag index");
|
return flag_from_enum(flag)->is_ergonomic();
|
||||||
JVMFlag* f = &JVMFlag::flags[flag];
|
|
||||||
return f->is_ergonomic();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
bool JVMFlagEx::is_cmdline(JVMFlagsEnum flag) {
|
bool JVMFlagEx::is_cmdline(JVMFlagsEnum flag) {
|
||||||
assert((size_t)flag < JVMFlag::numFlags, "bad command line flag index");
|
return flag_from_enum(flag)->is_command_line();
|
||||||
JVMFlag* f = &JVMFlag::flags[flag];
|
|
||||||
return f->is_command_line();
|
|
||||||
}
|
|
||||||
|
|
||||||
bool JVMFlag::wasSetOnCmdline(const char* name, bool* value) {
|
|
||||||
JVMFlag* result = JVMFlag::find_flag((char*)name, strlen(name));
|
|
||||||
if (result == NULL) return false;
|
|
||||||
*value = result->is_command_line();
|
|
||||||
return true;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void JVMFlagEx::setOnCmdLine(JVMFlagsEnum flag) {
|
void JVMFlagEx::setOnCmdLine(JVMFlagsEnum flag) {
|
||||||
JVMFlag* faddr = address_of_flag(flag);
|
JVMFlag* faddr = flag_from_enum(flag);
|
||||||
assert(faddr != NULL, "Unknown flag");
|
assert(faddr != NULL, "Unknown flag");
|
||||||
faddr->set_command_line();
|
faddr->set_command_line();
|
||||||
}
|
}
|
||||||
|
|
||||||
template<class E, class T>
|
template<class E, class T>
|
||||||
static void trace_flag_changed(const char* name, const T old_value, const T new_value, const JVMFlag::Flags origin) {
|
static void trace_flag_changed(const JVMFlag* flag, const T old_value, const T new_value, const JVMFlag::Flags origin) {
|
||||||
E e;
|
E e;
|
||||||
e.set_name(name);
|
e.set_name(flag->_name);
|
||||||
e.set_oldValue(old_value);
|
e.set_oldValue(old_value);
|
||||||
e.set_newValue(new_value);
|
e.set_newValue(new_value);
|
||||||
e.set_origin(origin);
|
e.set_origin(origin);
|
||||||
e.commit();
|
e.commit();
|
||||||
}
|
}
|
||||||
|
|
||||||
static JVMFlag::Error apply_constraint_and_check_range_bool(const char* name, bool new_value, bool verbose) {
|
static JVMFlag::Error apply_constraint_and_check_range_bool(const JVMFlag* flag, bool new_value, bool verbose) {
|
||||||
JVMFlag::Error status = JVMFlag::SUCCESS;
|
JVMFlag::Error status = JVMFlag::SUCCESS;
|
||||||
JVMFlagConstraint* constraint = JVMFlagConstraintList::find_if_needs_check(name);
|
JVMFlagConstraint* constraint = JVMFlagConstraintList::find_if_needs_check(flag);
|
||||||
if (constraint != NULL) {
|
if (constraint != NULL) {
|
||||||
status = constraint->apply_bool(new_value, verbose);
|
status = constraint->apply_bool(new_value, verbose);
|
||||||
}
|
}
|
||||||
return status;
|
return status;
|
||||||
}
|
}
|
||||||
|
|
||||||
JVMFlag::Error JVMFlag::boolAt(const char* name, size_t len, bool* value, bool allow_locked, bool return_flag) {
|
JVMFlag::Error JVMFlag::boolAt(const JVMFlag* flag, bool* value) {
|
||||||
JVMFlag* result = JVMFlag::find_flag(name, len, allow_locked, return_flag);
|
if (flag == NULL) return JVMFlag::INVALID_FLAG;
|
||||||
if (result == NULL) return JVMFlag::INVALID_FLAG;
|
if (!flag->is_bool()) return JVMFlag::WRONG_FORMAT;
|
||||||
if (!result->is_bool()) return JVMFlag::WRONG_FORMAT;
|
*value = flag->get_bool();
|
||||||
*value = result->get_bool();
|
|
||||||
return JVMFlag::SUCCESS;
|
return JVMFlag::SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
JVMFlag::Error JVMFlag::boolAtPut(JVMFlag* flag, bool* value, JVMFlag::Flags origin) {
|
JVMFlag::Error JVMFlag::boolAtPut(JVMFlag* flag, bool* value, JVMFlag::Flags origin) {
|
||||||
const char* name;
|
|
||||||
if (flag == NULL) return JVMFlag::INVALID_FLAG;
|
if (flag == NULL) return JVMFlag::INVALID_FLAG;
|
||||||
if (!flag->is_bool()) return JVMFlag::WRONG_FORMAT;
|
if (!flag->is_bool()) return JVMFlag::WRONG_FORMAT;
|
||||||
name = flag->_name;
|
JVMFlag::Error check = apply_constraint_and_check_range_bool(flag, *value, !JVMFlagConstraintList::validated_after_ergo());
|
||||||
JVMFlag::Error check = apply_constraint_and_check_range_bool(name, *value, !JVMFlagConstraintList::validated_after_ergo());
|
|
||||||
if (check != JVMFlag::SUCCESS) return check;
|
if (check != JVMFlag::SUCCESS) return check;
|
||||||
bool old_value = flag->get_bool();
|
bool old_value = flag->get_bool();
|
||||||
trace_flag_changed<EventBooleanFlagChanged, bool>(name, old_value, *value, origin);
|
trace_flag_changed<EventBooleanFlagChanged, bool>(flag, old_value, *value, origin);
|
||||||
check = flag->set_bool(*value);
|
check = flag->set_bool(*value);
|
||||||
*value = old_value;
|
*value = old_value;
|
||||||
flag->set_origin(origin);
|
flag->set_origin(origin);
|
||||||
return check;
|
return check;
|
||||||
}
|
}
|
||||||
|
|
||||||
JVMFlag::Error JVMFlag::boolAtPut(const char* name, size_t len, bool* value, JVMFlag::Flags origin) {
|
|
||||||
JVMFlag* result = JVMFlag::find_flag(name, len);
|
|
||||||
return boolAtPut(result, value, origin);
|
|
||||||
}
|
|
||||||
|
|
||||||
JVMFlag::Error JVMFlagEx::boolAtPut(JVMFlagsEnum flag, bool value, JVMFlag::Flags origin) {
|
JVMFlag::Error JVMFlagEx::boolAtPut(JVMFlagsEnum flag, bool value, JVMFlag::Flags origin) {
|
||||||
JVMFlag* faddr = address_of_flag(flag);
|
JVMFlag* faddr = flag_from_enum(flag);
|
||||||
guarantee(faddr != NULL && faddr->is_bool(), "wrong flag type");
|
guarantee(faddr != NULL && faddr->is_bool(), "wrong flag type");
|
||||||
return JVMFlag::boolAtPut(faddr, &value, origin);
|
return JVMFlag::boolAtPut(faddr, &value, origin);
|
||||||
}
|
}
|
||||||
|
|
||||||
static JVMFlag::Error apply_constraint_and_check_range_int(const char* name, int new_value, bool verbose) {
|
static JVMFlag::Error apply_constraint_and_check_range_int(const JVMFlag* flag, int new_value, bool verbose) {
|
||||||
JVMFlag::Error status = JVMFlag::SUCCESS;
|
JVMFlag::Error status = JVMFlag::SUCCESS;
|
||||||
JVMFlagRange* range = JVMFlagRangeList::find(name);
|
JVMFlagRange* range = JVMFlagRangeList::find(flag);
|
||||||
if (range != NULL) {
|
if (range != NULL) {
|
||||||
status = range->check_int(new_value, verbose);
|
status = range->check_int(new_value, verbose);
|
||||||
}
|
}
|
||||||
if (status == JVMFlag::SUCCESS) {
|
if (status == JVMFlag::SUCCESS) {
|
||||||
JVMFlagConstraint* constraint = JVMFlagConstraintList::find_if_needs_check(name);
|
JVMFlagConstraint* constraint = JVMFlagConstraintList::find_if_needs_check(flag);
|
||||||
if (constraint != NULL) {
|
if (constraint != NULL) {
|
||||||
status = constraint->apply_int(new_value, verbose);
|
status = constraint->apply_int(new_value, verbose);
|
||||||
}
|
}
|
||||||
|
@ -1061,48 +1040,40 @@ static JVMFlag::Error apply_constraint_and_check_range_int(const char* name, int
|
||||||
return status;
|
return status;
|
||||||
}
|
}
|
||||||
|
|
||||||
JVMFlag::Error JVMFlag::intAt(const char* name, size_t len, int* value, bool allow_locked, bool return_flag) {
|
JVMFlag::Error JVMFlag::intAt(const JVMFlag* flag, int* value) {
|
||||||
JVMFlag* result = JVMFlag::find_flag(name, len, allow_locked, return_flag);
|
if (flag == NULL) return JVMFlag::INVALID_FLAG;
|
||||||
if (result == NULL) return JVMFlag::INVALID_FLAG;
|
if (!flag->is_int()) return JVMFlag::WRONG_FORMAT;
|
||||||
if (!result->is_int()) return JVMFlag::WRONG_FORMAT;
|
*value = flag->get_int();
|
||||||
*value = result->get_int();
|
|
||||||
return JVMFlag::SUCCESS;
|
return JVMFlag::SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
JVMFlag::Error JVMFlag::intAtPut(JVMFlag* flag, int* value, JVMFlag::Flags origin) {
|
JVMFlag::Error JVMFlag::intAtPut(JVMFlag* flag, int* value, JVMFlag::Flags origin) {
|
||||||
const char* name;
|
|
||||||
if (flag == NULL) return JVMFlag::INVALID_FLAG;
|
if (flag == NULL) return JVMFlag::INVALID_FLAG;
|
||||||
if (!flag->is_int()) return JVMFlag::WRONG_FORMAT;
|
if (!flag->is_int()) return JVMFlag::WRONG_FORMAT;
|
||||||
name = flag->_name;
|
JVMFlag::Error check = apply_constraint_and_check_range_int(flag, *value, !JVMFlagConstraintList::validated_after_ergo());
|
||||||
JVMFlag::Error check = apply_constraint_and_check_range_int(name, *value, !JVMFlagConstraintList::validated_after_ergo());
|
|
||||||
if (check != JVMFlag::SUCCESS) return check;
|
if (check != JVMFlag::SUCCESS) return check;
|
||||||
int old_value = flag->get_int();
|
int old_value = flag->get_int();
|
||||||
trace_flag_changed<EventIntFlagChanged, s4>(name, old_value, *value, origin);
|
trace_flag_changed<EventIntFlagChanged, s4>(flag, old_value, *value, origin);
|
||||||
check = flag->set_int(*value);
|
check = flag->set_int(*value);
|
||||||
*value = old_value;
|
*value = old_value;
|
||||||
flag->set_origin(origin);
|
flag->set_origin(origin);
|
||||||
return check;
|
return check;
|
||||||
}
|
}
|
||||||
|
|
||||||
JVMFlag::Error JVMFlag::intAtPut(const char* name, size_t len, int* value, JVMFlag::Flags origin) {
|
|
||||||
JVMFlag* result = JVMFlag::find_flag(name, len);
|
|
||||||
return intAtPut(result, value, origin);
|
|
||||||
}
|
|
||||||
|
|
||||||
JVMFlag::Error JVMFlagEx::intAtPut(JVMFlagsEnum flag, int value, JVMFlag::Flags origin) {
|
JVMFlag::Error JVMFlagEx::intAtPut(JVMFlagsEnum flag, int value, JVMFlag::Flags origin) {
|
||||||
JVMFlag* faddr = address_of_flag(flag);
|
JVMFlag* faddr = flag_from_enum(flag);
|
||||||
guarantee(faddr != NULL && faddr->is_int(), "wrong flag type");
|
guarantee(faddr != NULL && faddr->is_int(), "wrong flag type");
|
||||||
return JVMFlag::intAtPut(faddr, &value, origin);
|
return JVMFlag::intAtPut(faddr, &value, origin);
|
||||||
}
|
}
|
||||||
|
|
||||||
static JVMFlag::Error apply_constraint_and_check_range_uint(const char* name, uint new_value, bool verbose) {
|
static JVMFlag::Error apply_constraint_and_check_range_uint(const JVMFlag* flag, uint new_value, bool verbose) {
|
||||||
JVMFlag::Error status = JVMFlag::SUCCESS;
|
JVMFlag::Error status = JVMFlag::SUCCESS;
|
||||||
JVMFlagRange* range = JVMFlagRangeList::find(name);
|
JVMFlagRange* range = JVMFlagRangeList::find(flag);
|
||||||
if (range != NULL) {
|
if (range != NULL) {
|
||||||
status = range->check_uint(new_value, verbose);
|
status = range->check_uint(new_value, verbose);
|
||||||
}
|
}
|
||||||
if (status == JVMFlag::SUCCESS) {
|
if (status == JVMFlag::SUCCESS) {
|
||||||
JVMFlagConstraint* constraint = JVMFlagConstraintList::find_if_needs_check(name);
|
JVMFlagConstraint* constraint = JVMFlagConstraintList::find_if_needs_check(flag);
|
||||||
if (constraint != NULL) {
|
if (constraint != NULL) {
|
||||||
status = constraint->apply_uint(new_value, verbose);
|
status = constraint->apply_uint(new_value, verbose);
|
||||||
}
|
}
|
||||||
|
@ -1110,56 +1081,47 @@ static JVMFlag::Error apply_constraint_and_check_range_uint(const char* name, ui
|
||||||
return status;
|
return status;
|
||||||
}
|
}
|
||||||
|
|
||||||
JVMFlag::Error JVMFlag::uintAt(const char* name, size_t len, uint* value, bool allow_locked, bool return_flag) {
|
JVMFlag::Error JVMFlag::uintAt(const JVMFlag* flag, uint* value) {
|
||||||
JVMFlag* result = JVMFlag::find_flag(name, len, allow_locked, return_flag);
|
if (flag == NULL) return JVMFlag::INVALID_FLAG;
|
||||||
if (result == NULL) return JVMFlag::INVALID_FLAG;
|
if (!flag->is_uint()) return JVMFlag::WRONG_FORMAT;
|
||||||
if (!result->is_uint()) return JVMFlag::WRONG_FORMAT;
|
*value = flag->get_uint();
|
||||||
*value = result->get_uint();
|
|
||||||
return JVMFlag::SUCCESS;
|
return JVMFlag::SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
JVMFlag::Error JVMFlag::uintAtPut(JVMFlag* flag, uint* value, JVMFlag::Flags origin) {
|
JVMFlag::Error JVMFlag::uintAtPut(JVMFlag* flag, uint* value, JVMFlag::Flags origin) {
|
||||||
const char* name;
|
|
||||||
if (flag == NULL) return JVMFlag::INVALID_FLAG;
|
if (flag == NULL) return JVMFlag::INVALID_FLAG;
|
||||||
if (!flag->is_uint()) return JVMFlag::WRONG_FORMAT;
|
if (!flag->is_uint()) return JVMFlag::WRONG_FORMAT;
|
||||||
name = flag->_name;
|
JVMFlag::Error check = apply_constraint_and_check_range_uint(flag, *value, !JVMFlagConstraintList::validated_after_ergo());
|
||||||
JVMFlag::Error check = apply_constraint_and_check_range_uint(name, *value, !JVMFlagConstraintList::validated_after_ergo());
|
|
||||||
if (check != JVMFlag::SUCCESS) return check;
|
if (check != JVMFlag::SUCCESS) return check;
|
||||||
uint old_value = flag->get_uint();
|
uint old_value = flag->get_uint();
|
||||||
trace_flag_changed<EventUnsignedIntFlagChanged, u4>(name, old_value, *value, origin);
|
trace_flag_changed<EventUnsignedIntFlagChanged, u4>(flag, old_value, *value, origin);
|
||||||
check = flag->set_uint(*value);
|
check = flag->set_uint(*value);
|
||||||
*value = old_value;
|
*value = old_value;
|
||||||
flag->set_origin(origin);
|
flag->set_origin(origin);
|
||||||
return check;
|
return check;
|
||||||
}
|
}
|
||||||
|
|
||||||
JVMFlag::Error JVMFlag::uintAtPut(const char* name, size_t len, uint* value, JVMFlag::Flags origin) {
|
|
||||||
JVMFlag* result = JVMFlag::find_flag(name, len);
|
|
||||||
return uintAtPut(result, value, origin);
|
|
||||||
}
|
|
||||||
|
|
||||||
JVMFlag::Error JVMFlagEx::uintAtPut(JVMFlagsEnum flag, uint value, JVMFlag::Flags origin) {
|
JVMFlag::Error JVMFlagEx::uintAtPut(JVMFlagsEnum flag, uint value, JVMFlag::Flags origin) {
|
||||||
JVMFlag* faddr = address_of_flag(flag);
|
JVMFlag* faddr = flag_from_enum(flag);
|
||||||
guarantee(faddr != NULL && faddr->is_uint(), "wrong flag type");
|
guarantee(faddr != NULL && faddr->is_uint(), "wrong flag type");
|
||||||
return JVMFlag::uintAtPut(faddr, &value, origin);
|
return JVMFlag::uintAtPut(faddr, &value, origin);
|
||||||
}
|
}
|
||||||
|
|
||||||
JVMFlag::Error JVMFlag::intxAt(const char* name, size_t len, intx* value, bool allow_locked, bool return_flag) {
|
JVMFlag::Error JVMFlag::intxAt(const JVMFlag* flag, intx* value) {
|
||||||
JVMFlag* result = JVMFlag::find_flag(name, len, allow_locked, return_flag);
|
if (flag == NULL) return JVMFlag::INVALID_FLAG;
|
||||||
if (result == NULL) return JVMFlag::INVALID_FLAG;
|
if (!flag->is_intx()) return JVMFlag::WRONG_FORMAT;
|
||||||
if (!result->is_intx()) return JVMFlag::WRONG_FORMAT;
|
*value = flag->get_intx();
|
||||||
*value = result->get_intx();
|
|
||||||
return JVMFlag::SUCCESS;
|
return JVMFlag::SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
static JVMFlag::Error apply_constraint_and_check_range_intx(const char* name, intx new_value, bool verbose) {
|
static JVMFlag::Error apply_constraint_and_check_range_intx(const JVMFlag* flag, intx new_value, bool verbose) {
|
||||||
JVMFlag::Error status = JVMFlag::SUCCESS;
|
JVMFlag::Error status = JVMFlag::SUCCESS;
|
||||||
JVMFlagRange* range = JVMFlagRangeList::find(name);
|
JVMFlagRange* range = JVMFlagRangeList::find(flag);
|
||||||
if (range != NULL) {
|
if (range != NULL) {
|
||||||
status = range->check_intx(new_value, verbose);
|
status = range->check_intx(new_value, verbose);
|
||||||
}
|
}
|
||||||
if (status == JVMFlag::SUCCESS) {
|
if (status == JVMFlag::SUCCESS) {
|
||||||
JVMFlagConstraint* constraint = JVMFlagConstraintList::find_if_needs_check(name);
|
JVMFlagConstraint* constraint = JVMFlagConstraintList::find_if_needs_check(flag);
|
||||||
if (constraint != NULL) {
|
if (constraint != NULL) {
|
||||||
status = constraint->apply_intx(new_value, verbose);
|
status = constraint->apply_intx(new_value, verbose);
|
||||||
}
|
}
|
||||||
|
@ -1168,47 +1130,39 @@ static JVMFlag::Error apply_constraint_and_check_range_intx(const char* name, in
|
||||||
}
|
}
|
||||||
|
|
||||||
JVMFlag::Error JVMFlag::intxAtPut(JVMFlag* flag, intx* value, JVMFlag::Flags origin) {
|
JVMFlag::Error JVMFlag::intxAtPut(JVMFlag* flag, intx* value, JVMFlag::Flags origin) {
|
||||||
const char* name;
|
|
||||||
if (flag == NULL) return JVMFlag::INVALID_FLAG;
|
if (flag == NULL) return JVMFlag::INVALID_FLAG;
|
||||||
if (!flag->is_intx()) return JVMFlag::WRONG_FORMAT;
|
if (!flag->is_intx()) return JVMFlag::WRONG_FORMAT;
|
||||||
name = flag->_name;
|
JVMFlag::Error check = apply_constraint_and_check_range_intx(flag, *value, !JVMFlagConstraintList::validated_after_ergo());
|
||||||
JVMFlag::Error check = apply_constraint_and_check_range_intx(name, *value, !JVMFlagConstraintList::validated_after_ergo());
|
|
||||||
if (check != JVMFlag::SUCCESS) return check;
|
if (check != JVMFlag::SUCCESS) return check;
|
||||||
intx old_value = flag->get_intx();
|
intx old_value = flag->get_intx();
|
||||||
trace_flag_changed<EventLongFlagChanged, intx>(name, old_value, *value, origin);
|
trace_flag_changed<EventLongFlagChanged, intx>(flag, old_value, *value, origin);
|
||||||
check = flag->set_intx(*value);
|
check = flag->set_intx(*value);
|
||||||
*value = old_value;
|
*value = old_value;
|
||||||
flag->set_origin(origin);
|
flag->set_origin(origin);
|
||||||
return check;
|
return check;
|
||||||
}
|
}
|
||||||
|
|
||||||
JVMFlag::Error JVMFlag::intxAtPut(const char* name, size_t len, intx* value, JVMFlag::Flags origin) {
|
|
||||||
JVMFlag* result = JVMFlag::find_flag(name, len);
|
|
||||||
return intxAtPut(result, value, origin);
|
|
||||||
}
|
|
||||||
|
|
||||||
JVMFlag::Error JVMFlagEx::intxAtPut(JVMFlagsEnum flag, intx value, JVMFlag::Flags origin) {
|
JVMFlag::Error JVMFlagEx::intxAtPut(JVMFlagsEnum flag, intx value, JVMFlag::Flags origin) {
|
||||||
JVMFlag* faddr = address_of_flag(flag);
|
JVMFlag* faddr = flag_from_enum(flag);
|
||||||
guarantee(faddr != NULL && faddr->is_intx(), "wrong flag type");
|
guarantee(faddr != NULL && faddr->is_intx(), "wrong flag type");
|
||||||
return JVMFlag::intxAtPut(faddr, &value, origin);
|
return JVMFlag::intxAtPut(faddr, &value, origin);
|
||||||
}
|
}
|
||||||
|
|
||||||
JVMFlag::Error JVMFlag::uintxAt(const char* name, size_t len, uintx* value, bool allow_locked, bool return_flag) {
|
JVMFlag::Error JVMFlag::uintxAt(const JVMFlag* flag, uintx* value) {
|
||||||
JVMFlag* result = JVMFlag::find_flag(name, len, allow_locked, return_flag);
|
if (flag == NULL) return JVMFlag::INVALID_FLAG;
|
||||||
if (result == NULL) return JVMFlag::INVALID_FLAG;
|
if (!flag->is_uintx()) return JVMFlag::WRONG_FORMAT;
|
||||||
if (!result->is_uintx()) return JVMFlag::WRONG_FORMAT;
|
*value = flag->get_uintx();
|
||||||
*value = result->get_uintx();
|
|
||||||
return JVMFlag::SUCCESS;
|
return JVMFlag::SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
static JVMFlag::Error apply_constraint_and_check_range_uintx(const char* name, uintx new_value, bool verbose) {
|
static JVMFlag::Error apply_constraint_and_check_range_uintx(const JVMFlag* flag, uintx new_value, bool verbose) {
|
||||||
JVMFlag::Error status = JVMFlag::SUCCESS;
|
JVMFlag::Error status = JVMFlag::SUCCESS;
|
||||||
JVMFlagRange* range = JVMFlagRangeList::find(name);
|
JVMFlagRange* range = JVMFlagRangeList::find(flag);
|
||||||
if (range != NULL) {
|
if (range != NULL) {
|
||||||
status = range->check_uintx(new_value, verbose);
|
status = range->check_uintx(new_value, verbose);
|
||||||
}
|
}
|
||||||
if (status == JVMFlag::SUCCESS) {
|
if (status == JVMFlag::SUCCESS) {
|
||||||
JVMFlagConstraint* constraint = JVMFlagConstraintList::find_if_needs_check(name);
|
JVMFlagConstraint* constraint = JVMFlagConstraintList::find_if_needs_check(flag);
|
||||||
if (constraint != NULL) {
|
if (constraint != NULL) {
|
||||||
status = constraint->apply_uintx(new_value, verbose);
|
status = constraint->apply_uintx(new_value, verbose);
|
||||||
}
|
}
|
||||||
|
@ -1217,47 +1171,39 @@ static JVMFlag::Error apply_constraint_and_check_range_uintx(const char* name, u
|
||||||
}
|
}
|
||||||
|
|
||||||
JVMFlag::Error JVMFlag::uintxAtPut(JVMFlag* flag, uintx* value, JVMFlag::Flags origin) {
|
JVMFlag::Error JVMFlag::uintxAtPut(JVMFlag* flag, uintx* value, JVMFlag::Flags origin) {
|
||||||
const char* name;
|
|
||||||
if (flag == NULL) return JVMFlag::INVALID_FLAG;
|
if (flag == NULL) return JVMFlag::INVALID_FLAG;
|
||||||
if (!flag->is_uintx()) return JVMFlag::WRONG_FORMAT;
|
if (!flag->is_uintx()) return JVMFlag::WRONG_FORMAT;
|
||||||
name = flag->_name;
|
JVMFlag::Error check = apply_constraint_and_check_range_uintx(flag, *value, !JVMFlagConstraintList::validated_after_ergo());
|
||||||
JVMFlag::Error check = apply_constraint_and_check_range_uintx(name, *value, !JVMFlagConstraintList::validated_after_ergo());
|
|
||||||
if (check != JVMFlag::SUCCESS) return check;
|
if (check != JVMFlag::SUCCESS) return check;
|
||||||
uintx old_value = flag->get_uintx();
|
uintx old_value = flag->get_uintx();
|
||||||
trace_flag_changed<EventUnsignedLongFlagChanged, u8>(name, old_value, *value, origin);
|
trace_flag_changed<EventUnsignedLongFlagChanged, u8>(flag, old_value, *value, origin);
|
||||||
check = flag->set_uintx(*value);
|
check = flag->set_uintx(*value);
|
||||||
*value = old_value;
|
*value = old_value;
|
||||||
flag->set_origin(origin);
|
flag->set_origin(origin);
|
||||||
return check;
|
return check;
|
||||||
}
|
}
|
||||||
|
|
||||||
JVMFlag::Error JVMFlag::uintxAtPut(const char* name, size_t len, uintx* value, JVMFlag::Flags origin) {
|
|
||||||
JVMFlag* result = JVMFlag::find_flag(name, len);
|
|
||||||
return uintxAtPut(result, value, origin);
|
|
||||||
}
|
|
||||||
|
|
||||||
JVMFlag::Error JVMFlagEx::uintxAtPut(JVMFlagsEnum flag, uintx value, JVMFlag::Flags origin) {
|
JVMFlag::Error JVMFlagEx::uintxAtPut(JVMFlagsEnum flag, uintx value, JVMFlag::Flags origin) {
|
||||||
JVMFlag* faddr = address_of_flag(flag);
|
JVMFlag* faddr = flag_from_enum(flag);
|
||||||
guarantee(faddr != NULL && faddr->is_uintx(), "wrong flag type");
|
guarantee(faddr != NULL && faddr->is_uintx(), "wrong flag type");
|
||||||
return JVMFlag::uintxAtPut(faddr, &value, origin);
|
return JVMFlag::uintxAtPut(faddr, &value, origin);
|
||||||
}
|
}
|
||||||
|
|
||||||
JVMFlag::Error JVMFlag::uint64_tAt(const char* name, size_t len, uint64_t* value, bool allow_locked, bool return_flag) {
|
JVMFlag::Error JVMFlag::uint64_tAt(const JVMFlag* flag, uint64_t* value) {
|
||||||
JVMFlag* result = JVMFlag::find_flag(name, len, allow_locked, return_flag);
|
if (flag == NULL) return JVMFlag::INVALID_FLAG;
|
||||||
if (result == NULL) return JVMFlag::INVALID_FLAG;
|
if (!flag->is_uint64_t()) return JVMFlag::WRONG_FORMAT;
|
||||||
if (!result->is_uint64_t()) return JVMFlag::WRONG_FORMAT;
|
*value = flag->get_uint64_t();
|
||||||
*value = result->get_uint64_t();
|
|
||||||
return JVMFlag::SUCCESS;
|
return JVMFlag::SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
static JVMFlag::Error apply_constraint_and_check_range_uint64_t(const char* name, uint64_t new_value, bool verbose) {
|
static JVMFlag::Error apply_constraint_and_check_range_uint64_t(const JVMFlag* flag, uint64_t new_value, bool verbose) {
|
||||||
JVMFlag::Error status = JVMFlag::SUCCESS;
|
JVMFlag::Error status = JVMFlag::SUCCESS;
|
||||||
JVMFlagRange* range = JVMFlagRangeList::find(name);
|
JVMFlagRange* range = JVMFlagRangeList::find(flag);
|
||||||
if (range != NULL) {
|
if (range != NULL) {
|
||||||
status = range->check_uint64_t(new_value, verbose);
|
status = range->check_uint64_t(new_value, verbose);
|
||||||
}
|
}
|
||||||
if (status == JVMFlag::SUCCESS) {
|
if (status == JVMFlag::SUCCESS) {
|
||||||
JVMFlagConstraint* constraint = JVMFlagConstraintList::find_if_needs_check(name);
|
JVMFlagConstraint* constraint = JVMFlagConstraintList::find_if_needs_check(flag);
|
||||||
if (constraint != NULL) {
|
if (constraint != NULL) {
|
||||||
status = constraint->apply_uint64_t(new_value, verbose);
|
status = constraint->apply_uint64_t(new_value, verbose);
|
||||||
}
|
}
|
||||||
|
@ -1266,47 +1212,39 @@ static JVMFlag::Error apply_constraint_and_check_range_uint64_t(const char* name
|
||||||
}
|
}
|
||||||
|
|
||||||
JVMFlag::Error JVMFlag::uint64_tAtPut(JVMFlag* flag, uint64_t* value, JVMFlag::Flags origin) {
|
JVMFlag::Error JVMFlag::uint64_tAtPut(JVMFlag* flag, uint64_t* value, JVMFlag::Flags origin) {
|
||||||
const char* name;
|
|
||||||
if (flag == NULL) return JVMFlag::INVALID_FLAG;
|
if (flag == NULL) return JVMFlag::INVALID_FLAG;
|
||||||
if (!flag->is_uint64_t()) return JVMFlag::WRONG_FORMAT;
|
if (!flag->is_uint64_t()) return JVMFlag::WRONG_FORMAT;
|
||||||
name = flag->_name;
|
JVMFlag::Error check = apply_constraint_and_check_range_uint64_t(flag, *value, !JVMFlagConstraintList::validated_after_ergo());
|
||||||
JVMFlag::Error check = apply_constraint_and_check_range_uint64_t(name, *value, !JVMFlagConstraintList::validated_after_ergo());
|
|
||||||
if (check != JVMFlag::SUCCESS) return check;
|
if (check != JVMFlag::SUCCESS) return check;
|
||||||
uint64_t old_value = flag->get_uint64_t();
|
uint64_t old_value = flag->get_uint64_t();
|
||||||
trace_flag_changed<EventUnsignedLongFlagChanged, u8>(name, old_value, *value, origin);
|
trace_flag_changed<EventUnsignedLongFlagChanged, u8>(flag, old_value, *value, origin);
|
||||||
check = flag->set_uint64_t(*value);
|
check = flag->set_uint64_t(*value);
|
||||||
*value = old_value;
|
*value = old_value;
|
||||||
flag->set_origin(origin);
|
flag->set_origin(origin);
|
||||||
return check;
|
return check;
|
||||||
}
|
}
|
||||||
|
|
||||||
JVMFlag::Error JVMFlag::uint64_tAtPut(const char* name, size_t len, uint64_t* value, JVMFlag::Flags origin) {
|
|
||||||
JVMFlag* result = JVMFlag::find_flag(name, len);
|
|
||||||
return uint64_tAtPut(result, value, origin);
|
|
||||||
}
|
|
||||||
|
|
||||||
JVMFlag::Error JVMFlagEx::uint64_tAtPut(JVMFlagsEnum flag, uint64_t value, JVMFlag::Flags origin) {
|
JVMFlag::Error JVMFlagEx::uint64_tAtPut(JVMFlagsEnum flag, uint64_t value, JVMFlag::Flags origin) {
|
||||||
JVMFlag* faddr = address_of_flag(flag);
|
JVMFlag* faddr = flag_from_enum(flag);
|
||||||
guarantee(faddr != NULL && faddr->is_uint64_t(), "wrong flag type");
|
guarantee(faddr != NULL && faddr->is_uint64_t(), "wrong flag type");
|
||||||
return JVMFlag::uint64_tAtPut(faddr, &value, origin);
|
return JVMFlag::uint64_tAtPut(faddr, &value, origin);
|
||||||
}
|
}
|
||||||
|
|
||||||
JVMFlag::Error JVMFlag::size_tAt(const char* name, size_t len, size_t* value, bool allow_locked, bool return_flag) {
|
JVMFlag::Error JVMFlag::size_tAt(const JVMFlag* flag, size_t* value) {
|
||||||
JVMFlag* result = JVMFlag::find_flag(name, len, allow_locked, return_flag);
|
if (flag == NULL) return JVMFlag::INVALID_FLAG;
|
||||||
if (result == NULL) return JVMFlag::INVALID_FLAG;
|
if (!flag->is_size_t()) return JVMFlag::WRONG_FORMAT;
|
||||||
if (!result->is_size_t()) return JVMFlag::WRONG_FORMAT;
|
*value = flag->get_size_t();
|
||||||
*value = result->get_size_t();
|
|
||||||
return JVMFlag::SUCCESS;
|
return JVMFlag::SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
static JVMFlag::Error apply_constraint_and_check_range_size_t(const char* name, size_t new_value, bool verbose) {
|
static JVMFlag::Error apply_constraint_and_check_range_size_t(const JVMFlag* flag, size_t new_value, bool verbose) {
|
||||||
JVMFlag::Error status = JVMFlag::SUCCESS;
|
JVMFlag::Error status = JVMFlag::SUCCESS;
|
||||||
JVMFlagRange* range = JVMFlagRangeList::find(name);
|
JVMFlagRange* range = JVMFlagRangeList::find(flag);
|
||||||
if (range != NULL) {
|
if (range != NULL) {
|
||||||
status = range->check_size_t(new_value, verbose);
|
status = range->check_size_t(new_value, verbose);
|
||||||
}
|
}
|
||||||
if (status == JVMFlag::SUCCESS) {
|
if (status == JVMFlag::SUCCESS) {
|
||||||
JVMFlagConstraint* constraint = JVMFlagConstraintList::find_if_needs_check(name);
|
JVMFlagConstraint* constraint = JVMFlagConstraintList::find_if_needs_check(flag);
|
||||||
if (constraint != NULL) {
|
if (constraint != NULL) {
|
||||||
status = constraint->apply_size_t(new_value, verbose);
|
status = constraint->apply_size_t(new_value, verbose);
|
||||||
}
|
}
|
||||||
|
@ -1316,47 +1254,39 @@ static JVMFlag::Error apply_constraint_and_check_range_size_t(const char* name,
|
||||||
|
|
||||||
|
|
||||||
JVMFlag::Error JVMFlag::size_tAtPut(JVMFlag* flag, size_t* value, JVMFlag::Flags origin) {
|
JVMFlag::Error JVMFlag::size_tAtPut(JVMFlag* flag, size_t* value, JVMFlag::Flags origin) {
|
||||||
const char* name;
|
|
||||||
if (flag == NULL) return JVMFlag::INVALID_FLAG;
|
if (flag == NULL) return JVMFlag::INVALID_FLAG;
|
||||||
if (!flag->is_size_t()) return JVMFlag::WRONG_FORMAT;
|
if (!flag->is_size_t()) return JVMFlag::WRONG_FORMAT;
|
||||||
name = flag->_name;
|
JVMFlag::Error check = apply_constraint_and_check_range_size_t(flag, *value, !JVMFlagConstraintList::validated_after_ergo());
|
||||||
JVMFlag::Error check = apply_constraint_and_check_range_size_t(name, *value, !JVMFlagConstraintList::validated_after_ergo());
|
|
||||||
if (check != JVMFlag::SUCCESS) return check;
|
if (check != JVMFlag::SUCCESS) return check;
|
||||||
size_t old_value = flag->get_size_t();
|
size_t old_value = flag->get_size_t();
|
||||||
trace_flag_changed<EventUnsignedLongFlagChanged, u8>(name, old_value, *value, origin);
|
trace_flag_changed<EventUnsignedLongFlagChanged, u8>(flag, old_value, *value, origin);
|
||||||
check = flag->set_size_t(*value);
|
check = flag->set_size_t(*value);
|
||||||
*value = old_value;
|
*value = old_value;
|
||||||
flag->set_origin(origin);
|
flag->set_origin(origin);
|
||||||
return check;
|
return check;
|
||||||
}
|
}
|
||||||
|
|
||||||
JVMFlag::Error JVMFlag::size_tAtPut(const char* name, size_t len, size_t* value, JVMFlag::Flags origin) {
|
|
||||||
JVMFlag* result = JVMFlag::find_flag(name, len);
|
|
||||||
return size_tAtPut(result, value, origin);
|
|
||||||
}
|
|
||||||
|
|
||||||
JVMFlag::Error JVMFlagEx::size_tAtPut(JVMFlagsEnum flag, size_t value, JVMFlag::Flags origin) {
|
JVMFlag::Error JVMFlagEx::size_tAtPut(JVMFlagsEnum flag, size_t value, JVMFlag::Flags origin) {
|
||||||
JVMFlag* faddr = address_of_flag(flag);
|
JVMFlag* faddr = flag_from_enum(flag);
|
||||||
guarantee(faddr != NULL && faddr->is_size_t(), "wrong flag type");
|
guarantee(faddr != NULL && faddr->is_size_t(), "wrong flag type");
|
||||||
return JVMFlag::size_tAtPut(faddr, &value, origin);
|
return JVMFlag::size_tAtPut(faddr, &value, origin);
|
||||||
}
|
}
|
||||||
|
|
||||||
JVMFlag::Error JVMFlag::doubleAt(const char* name, size_t len, double* value, bool allow_locked, bool return_flag) {
|
JVMFlag::Error JVMFlag::doubleAt(const JVMFlag* flag, double* value) {
|
||||||
JVMFlag* result = JVMFlag::find_flag(name, len, allow_locked, return_flag);
|
if (flag == NULL) return JVMFlag::INVALID_FLAG;
|
||||||
if (result == NULL) return JVMFlag::INVALID_FLAG;
|
if (!flag->is_double()) return JVMFlag::WRONG_FORMAT;
|
||||||
if (!result->is_double()) return JVMFlag::WRONG_FORMAT;
|
*value = flag->get_double();
|
||||||
*value = result->get_double();
|
|
||||||
return JVMFlag::SUCCESS;
|
return JVMFlag::SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
static JVMFlag::Error apply_constraint_and_check_range_double(const char* name, double new_value, bool verbose) {
|
static JVMFlag::Error apply_constraint_and_check_range_double(const JVMFlag* flag, double new_value, bool verbose) {
|
||||||
JVMFlag::Error status = JVMFlag::SUCCESS;
|
JVMFlag::Error status = JVMFlag::SUCCESS;
|
||||||
JVMFlagRange* range = JVMFlagRangeList::find(name);
|
JVMFlagRange* range = JVMFlagRangeList::find(flag);
|
||||||
if (range != NULL) {
|
if (range != NULL) {
|
||||||
status = range->check_double(new_value, verbose);
|
status = range->check_double(new_value, verbose);
|
||||||
}
|
}
|
||||||
if (status == JVMFlag::SUCCESS) {
|
if (status == JVMFlag::SUCCESS) {
|
||||||
JVMFlagConstraint* constraint = JVMFlagConstraintList::find_if_needs_check(name);
|
JVMFlagConstraint* constraint = JVMFlagConstraintList::find_if_needs_check(flag);
|
||||||
if (constraint != NULL) {
|
if (constraint != NULL) {
|
||||||
status = constraint->apply_double(new_value, verbose);
|
status = constraint->apply_double(new_value, verbose);
|
||||||
}
|
}
|
||||||
|
@ -1365,64 +1295,55 @@ static JVMFlag::Error apply_constraint_and_check_range_double(const char* name,
|
||||||
}
|
}
|
||||||
|
|
||||||
JVMFlag::Error JVMFlag::doubleAtPut(JVMFlag* flag, double* value, JVMFlag::Flags origin) {
|
JVMFlag::Error JVMFlag::doubleAtPut(JVMFlag* flag, double* value, JVMFlag::Flags origin) {
|
||||||
const char* name;
|
|
||||||
if (flag == NULL) return JVMFlag::INVALID_FLAG;
|
if (flag == NULL) return JVMFlag::INVALID_FLAG;
|
||||||
if (!flag->is_double()) return JVMFlag::WRONG_FORMAT;
|
if (!flag->is_double()) return JVMFlag::WRONG_FORMAT;
|
||||||
name = flag->_name;
|
JVMFlag::Error check = apply_constraint_and_check_range_double(flag, *value, !JVMFlagConstraintList::validated_after_ergo());
|
||||||
JVMFlag::Error check = apply_constraint_and_check_range_double(name, *value, !JVMFlagConstraintList::validated_after_ergo());
|
|
||||||
if (check != JVMFlag::SUCCESS) return check;
|
if (check != JVMFlag::SUCCESS) return check;
|
||||||
double old_value = flag->get_double();
|
double old_value = flag->get_double();
|
||||||
trace_flag_changed<EventDoubleFlagChanged, double>(name, old_value, *value, origin);
|
trace_flag_changed<EventDoubleFlagChanged, double>(flag, old_value, *value, origin);
|
||||||
check = flag->set_double(*value);
|
check = flag->set_double(*value);
|
||||||
*value = old_value;
|
*value = old_value;
|
||||||
flag->set_origin(origin);
|
flag->set_origin(origin);
|
||||||
return check;
|
return check;
|
||||||
}
|
}
|
||||||
|
|
||||||
JVMFlag::Error JVMFlag::doubleAtPut(const char* name, size_t len, double* value, JVMFlag::Flags origin) {
|
|
||||||
JVMFlag* result = JVMFlag::find_flag(name, len);
|
|
||||||
return doubleAtPut(result, value, origin);
|
|
||||||
}
|
|
||||||
|
|
||||||
JVMFlag::Error JVMFlagEx::doubleAtPut(JVMFlagsEnum flag, double value, JVMFlag::Flags origin) {
|
JVMFlag::Error JVMFlagEx::doubleAtPut(JVMFlagsEnum flag, double value, JVMFlag::Flags origin) {
|
||||||
JVMFlag* faddr = address_of_flag(flag);
|
JVMFlag* faddr = flag_from_enum(flag);
|
||||||
guarantee(faddr != NULL && faddr->is_double(), "wrong flag type");
|
guarantee(faddr != NULL && faddr->is_double(), "wrong flag type");
|
||||||
return JVMFlag::doubleAtPut(faddr, &value, origin);
|
return JVMFlag::doubleAtPut(faddr, &value, origin);
|
||||||
}
|
}
|
||||||
|
|
||||||
JVMFlag::Error JVMFlag::ccstrAt(const char* name, size_t len, ccstr* value, bool allow_locked, bool return_flag) {
|
JVMFlag::Error JVMFlag::ccstrAt(const JVMFlag* flag, ccstr* value) {
|
||||||
JVMFlag* result = JVMFlag::find_flag(name, len, allow_locked, return_flag);
|
if (flag == NULL) return JVMFlag::INVALID_FLAG;
|
||||||
if (result == NULL) return JVMFlag::INVALID_FLAG;
|
if (!flag->is_ccstr()) return JVMFlag::WRONG_FORMAT;
|
||||||
if (!result->is_ccstr()) return JVMFlag::WRONG_FORMAT;
|
*value = flag->get_ccstr();
|
||||||
*value = result->get_ccstr();
|
|
||||||
return JVMFlag::SUCCESS;
|
return JVMFlag::SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
JVMFlag::Error JVMFlag::ccstrAtPut(const char* name, size_t len, ccstr* value, JVMFlag::Flags origin) {
|
JVMFlag::Error JVMFlag::ccstrAtPut(JVMFlag* flag, ccstr* value, JVMFlag::Flags origin) {
|
||||||
JVMFlag* result = JVMFlag::find_flag(name, len);
|
if (flag == NULL) return JVMFlag::INVALID_FLAG;
|
||||||
if (result == NULL) return JVMFlag::INVALID_FLAG;
|
if (!flag->is_ccstr()) return JVMFlag::WRONG_FORMAT;
|
||||||
if (!result->is_ccstr()) return JVMFlag::WRONG_FORMAT;
|
ccstr old_value = flag->get_ccstr();
|
||||||
ccstr old_value = result->get_ccstr();
|
trace_flag_changed<EventStringFlagChanged, const char*>(flag, old_value, *value, origin);
|
||||||
trace_flag_changed<EventStringFlagChanged, const char*>(name, old_value, *value, origin);
|
|
||||||
char* new_value = NULL;
|
char* new_value = NULL;
|
||||||
if (*value != NULL) {
|
if (*value != NULL) {
|
||||||
new_value = os::strdup_check_oom(*value);
|
new_value = os::strdup_check_oom(*value);
|
||||||
}
|
}
|
||||||
JVMFlag::Error check = result->set_ccstr(new_value);
|
JVMFlag::Error check = flag->set_ccstr(new_value);
|
||||||
if (result->is_default() && old_value != NULL) {
|
if (flag->is_default() && old_value != NULL) {
|
||||||
// Prior value is NOT heap allocated, but was a literal constant.
|
// Prior value is NOT heap allocated, but was a literal constant.
|
||||||
old_value = os::strdup_check_oom(old_value);
|
old_value = os::strdup_check_oom(old_value);
|
||||||
}
|
}
|
||||||
*value = old_value;
|
*value = old_value;
|
||||||
result->set_origin(origin);
|
flag->set_origin(origin);
|
||||||
return check;
|
return check;
|
||||||
}
|
}
|
||||||
|
|
||||||
JVMFlag::Error JVMFlagEx::ccstrAtPut(JVMFlagsEnum flag, ccstr value, JVMFlag::Flags origin) {
|
JVMFlag::Error JVMFlagEx::ccstrAtPut(JVMFlagsEnum flag, ccstr value, JVMFlag::Flags origin) {
|
||||||
JVMFlag* faddr = address_of_flag(flag);
|
JVMFlag* faddr = flag_from_enum(flag);
|
||||||
guarantee(faddr != NULL && faddr->is_ccstr(), "wrong flag type");
|
guarantee(faddr != NULL && faddr->is_ccstr(), "wrong flag type");
|
||||||
ccstr old_value = faddr->get_ccstr();
|
ccstr old_value = faddr->get_ccstr();
|
||||||
trace_flag_changed<EventStringFlagChanged, const char*>(faddr->_name, old_value, value, origin);
|
trace_flag_changed<EventStringFlagChanged, const char*>(faddr, old_value, value, origin);
|
||||||
char* new_value = os::strdup_check_oom(value);
|
char* new_value = os::strdup_check_oom(value);
|
||||||
JVMFlag::Error check = faddr->set_ccstr(new_value);
|
JVMFlag::Error check = faddr->set_ccstr(new_value);
|
||||||
if (!faddr->is_default() && old_value != NULL) {
|
if (!faddr->is_default() && old_value != NULL) {
|
||||||
|
|
|
@ -118,8 +118,20 @@ struct JVMFlag {
|
||||||
// number of flags
|
// number of flags
|
||||||
static size_t numFlags;
|
static size_t numFlags;
|
||||||
|
|
||||||
static JVMFlag* find_flag(const char* name) { return find_flag(name, strlen(name), true, true); };
|
private:
|
||||||
static JVMFlag* find_flag(const char* name, size_t length, bool allow_locked = false, bool return_flag = false);
|
static JVMFlag* find_flag(const char* name, size_t length, bool allow_locked, bool return_flag);
|
||||||
|
|
||||||
|
public:
|
||||||
|
static JVMFlag* find_flag(const char* name) {
|
||||||
|
return find_flag(name, strlen(name), false, false);
|
||||||
|
}
|
||||||
|
static const JVMFlag* find_declared_flag(const char* name, size_t length) {
|
||||||
|
return find_flag(name, length, true, true);
|
||||||
|
}
|
||||||
|
static const JVMFlag* find_declared_flag(const char* name) {
|
||||||
|
return find_declared_flag(name, strlen(name));
|
||||||
|
}
|
||||||
|
|
||||||
static JVMFlag* fuzzy_match(const char* name, size_t length, bool allow_locked = false);
|
static JVMFlag* fuzzy_match(const char* name, size_t length, bool allow_locked = false);
|
||||||
|
|
||||||
static const char* get_int_default_range_str();
|
static const char* get_int_default_range_str();
|
||||||
|
@ -213,63 +225,35 @@ struct JVMFlag {
|
||||||
static const char* flag_error_str(JVMFlag::Error error);
|
static const char* flag_error_str(JVMFlag::Error error);
|
||||||
|
|
||||||
public:
|
public:
|
||||||
static JVMFlag::Error boolAt(const char* name, size_t len, bool* value, bool allow_locked = false, bool return_flag = false);
|
static JVMFlag::Error boolAt(const JVMFlag* flag, bool* value);
|
||||||
static JVMFlag::Error boolAt(const char* name, bool* value, bool allow_locked = false, bool return_flag = false) { return boolAt(name, strlen(name), value, allow_locked, return_flag); }
|
|
||||||
static JVMFlag::Error boolAtPut(JVMFlag* flag, bool* value, JVMFlag::Flags origin);
|
static JVMFlag::Error boolAtPut(JVMFlag* flag, bool* value, JVMFlag::Flags origin);
|
||||||
static JVMFlag::Error boolAtPut(const char* name, size_t len, bool* value, JVMFlag::Flags origin);
|
|
||||||
static JVMFlag::Error boolAtPut(const char* name, bool* value, JVMFlag::Flags origin) { return boolAtPut(name, strlen(name), value, origin); }
|
|
||||||
|
|
||||||
static JVMFlag::Error intAt(const char* name, size_t len, int* value, bool allow_locked = false, bool return_flag = false);
|
static JVMFlag::Error intAt(const JVMFlag* flag, int* value);
|
||||||
static JVMFlag::Error intAt(const char* name, int* value, bool allow_locked = false, bool return_flag = false) { return intAt(name, strlen(name), value, allow_locked, return_flag); }
|
|
||||||
static JVMFlag::Error intAtPut(JVMFlag* flag, int* value, JVMFlag::Flags origin);
|
static JVMFlag::Error intAtPut(JVMFlag* flag, int* value, JVMFlag::Flags origin);
|
||||||
static JVMFlag::Error intAtPut(const char* name, size_t len, int* value, JVMFlag::Flags origin);
|
|
||||||
static JVMFlag::Error intAtPut(const char* name, int* value, JVMFlag::Flags origin) { return intAtPut(name, strlen(name), value, origin); }
|
|
||||||
|
|
||||||
static JVMFlag::Error uintAt(const char* name, size_t len, uint* value, bool allow_locked = false, bool return_flag = false);
|
static JVMFlag::Error uintAt(const JVMFlag* flag, uint* value);
|
||||||
static JVMFlag::Error uintAt(const char* name, uint* value, bool allow_locked = false, bool return_flag = false) { return uintAt(name, strlen(name), value, allow_locked, return_flag); }
|
|
||||||
static JVMFlag::Error uintAtPut(JVMFlag* flag, uint* value, JVMFlag::Flags origin);
|
static JVMFlag::Error uintAtPut(JVMFlag* flag, uint* value, JVMFlag::Flags origin);
|
||||||
static JVMFlag::Error uintAtPut(const char* name, size_t len, uint* value, JVMFlag::Flags origin);
|
|
||||||
static JVMFlag::Error uintAtPut(const char* name, uint* value, JVMFlag::Flags origin) { return uintAtPut(name, strlen(name), value, origin); }
|
|
||||||
|
|
||||||
static JVMFlag::Error intxAt(const char* name, size_t len, intx* value, bool allow_locked = false, bool return_flag = false);
|
static JVMFlag::Error intxAt(const JVMFlag* flag, intx* value);
|
||||||
static JVMFlag::Error intxAt(const char* name, intx* value, bool allow_locked = false, bool return_flag = false) { return intxAt(name, strlen(name), value, allow_locked, return_flag); }
|
|
||||||
static JVMFlag::Error intxAtPut(JVMFlag* flag, intx* value, JVMFlag::Flags origin);
|
static JVMFlag::Error intxAtPut(JVMFlag* flag, intx* value, JVMFlag::Flags origin);
|
||||||
static JVMFlag::Error intxAtPut(const char* name, size_t len, intx* value, JVMFlag::Flags origin);
|
|
||||||
static JVMFlag::Error intxAtPut(const char* name, intx* value, JVMFlag::Flags origin) { return intxAtPut(name, strlen(name), value, origin); }
|
|
||||||
|
|
||||||
static JVMFlag::Error uintxAt(const char* name, size_t len, uintx* value, bool allow_locked = false, bool return_flag = false);
|
static JVMFlag::Error uintxAt(const JVMFlag* flag, uintx* value);
|
||||||
static JVMFlag::Error uintxAt(const char* name, uintx* value, bool allow_locked = false, bool return_flag = false) { return uintxAt(name, strlen(name), value, allow_locked, return_flag); }
|
|
||||||
static JVMFlag::Error uintxAtPut(JVMFlag* flag, uintx* value, JVMFlag::Flags origin);
|
static JVMFlag::Error uintxAtPut(JVMFlag* flag, uintx* value, JVMFlag::Flags origin);
|
||||||
static JVMFlag::Error uintxAtPut(const char* name, size_t len, uintx* value, JVMFlag::Flags origin);
|
|
||||||
static JVMFlag::Error uintxAtPut(const char* name, uintx* value, JVMFlag::Flags origin) { return uintxAtPut(name, strlen(name), value, origin); }
|
|
||||||
|
|
||||||
static JVMFlag::Error size_tAt(const char* name, size_t len, size_t* value, bool allow_locked = false, bool return_flag = false);
|
static JVMFlag::Error size_tAt(const JVMFlag* flag, size_t* value);
|
||||||
static JVMFlag::Error size_tAt(const char* name, size_t* value, bool allow_locked = false, bool return_flag = false) { return size_tAt(name, strlen(name), value, allow_locked, return_flag); }
|
|
||||||
static JVMFlag::Error size_tAtPut(JVMFlag* flag, size_t* value, JVMFlag::Flags origin);
|
static JVMFlag::Error size_tAtPut(JVMFlag* flag, size_t* value, JVMFlag::Flags origin);
|
||||||
static JVMFlag::Error size_tAtPut(const char* name, size_t len, size_t* value, JVMFlag::Flags origin);
|
|
||||||
static JVMFlag::Error size_tAtPut(const char* name, size_t* value, JVMFlag::Flags origin) { return size_tAtPut(name, strlen(name), value, origin); }
|
|
||||||
|
|
||||||
static JVMFlag::Error uint64_tAt(const char* name, size_t len, uint64_t* value, bool allow_locked = false, bool return_flag = false);
|
static JVMFlag::Error uint64_tAt(const JVMFlag* flag, uint64_t* value);
|
||||||
static JVMFlag::Error uint64_tAt(const char* name, uint64_t* value, bool allow_locked = false, bool return_flag = false) { return uint64_tAt(name, strlen(name), value, allow_locked, return_flag); }
|
|
||||||
static JVMFlag::Error uint64_tAtPut(JVMFlag* flag, uint64_t* value, JVMFlag::Flags origin);
|
static JVMFlag::Error uint64_tAtPut(JVMFlag* flag, uint64_t* value, JVMFlag::Flags origin);
|
||||||
static JVMFlag::Error uint64_tAtPut(const char* name, size_t len, uint64_t* value, JVMFlag::Flags origin);
|
|
||||||
static JVMFlag::Error uint64_tAtPut(const char* name, uint64_t* value, JVMFlag::Flags origin) { return uint64_tAtPut(name, strlen(name), value, origin); }
|
|
||||||
|
|
||||||
static JVMFlag::Error doubleAt(const char* name, size_t len, double* value, bool allow_locked = false, bool return_flag = false);
|
static JVMFlag::Error doubleAt(const JVMFlag* flag, double* value);
|
||||||
static JVMFlag::Error doubleAt(const char* name, double* value, bool allow_locked = false, bool return_flag = false) { return doubleAt(name, strlen(name), value, allow_locked, return_flag); }
|
|
||||||
static JVMFlag::Error doubleAtPut(JVMFlag* flag, double* value, JVMFlag::Flags origin);
|
static JVMFlag::Error doubleAtPut(JVMFlag* flag, double* value, JVMFlag::Flags origin);
|
||||||
static JVMFlag::Error doubleAtPut(const char* name, size_t len, double* value, JVMFlag::Flags origin);
|
|
||||||
static JVMFlag::Error doubleAtPut(const char* name, double* value, JVMFlag::Flags origin) { return doubleAtPut(name, strlen(name), value, origin); }
|
|
||||||
|
|
||||||
static JVMFlag::Error ccstrAt(const char* name, size_t len, ccstr* value, bool allow_locked = false, bool return_flag = false);
|
static JVMFlag::Error ccstrAt(const JVMFlag* flag, ccstr* value);
|
||||||
static JVMFlag::Error ccstrAt(const char* name, ccstr* value, bool allow_locked = false, bool return_flag = false) { return ccstrAt(name, strlen(name), value, allow_locked, return_flag); }
|
|
||||||
// Contract: JVMFlag will make private copy of the incoming value.
|
// Contract: JVMFlag will make private copy of the incoming value.
|
||||||
// Outgoing value is always malloc-ed, and caller MUST call free.
|
// Outgoing value is always malloc-ed, and caller MUST call free.
|
||||||
static JVMFlag::Error ccstrAtPut(const char* name, size_t len, ccstr* value, JVMFlag::Flags origin);
|
static JVMFlag::Error ccstrAtPut(JVMFlag* flag, ccstr* value, JVMFlag::Flags origin);
|
||||||
static JVMFlag::Error ccstrAtPut(const char* name, ccstr* value, JVMFlag::Flags origin) { return ccstrAtPut(name, strlen(name), value, origin); }
|
|
||||||
|
|
||||||
// Returns false if name is not a command line flag.
|
|
||||||
static bool wasSetOnCmdline(const char* name, bool* value);
|
|
||||||
static void printSetFlags(outputStream* out);
|
static void printSetFlags(outputStream* out);
|
||||||
|
|
||||||
// printRanges will print out flags type, name and range values as expected by -XX:+PrintFlagsRanges
|
// printRanges will print out flags type, name and range values as expected by -XX:+PrintFlagsRanges
|
||||||
|
|
|
@ -32,22 +32,20 @@
|
||||||
#include "runtime/flags/jvmFlagConstraintsCompiler.hpp"
|
#include "runtime/flags/jvmFlagConstraintsCompiler.hpp"
|
||||||
#include "runtime/flags/jvmFlagConstraintsRuntime.hpp"
|
#include "runtime/flags/jvmFlagConstraintsRuntime.hpp"
|
||||||
#include "runtime/globals.hpp"
|
#include "runtime/globals.hpp"
|
||||||
|
#include "runtime/globals_extension.hpp"
|
||||||
#include "runtime/os.hpp"
|
#include "runtime/os.hpp"
|
||||||
#include "utilities/macros.hpp"
|
#include "utilities/macros.hpp"
|
||||||
|
|
||||||
class JVMFlagConstraint_bool : public JVMFlagConstraint {
|
class JVMFlagConstraint_bool : public JVMFlagConstraint {
|
||||||
JVMFlagConstraintFunc_bool _constraint;
|
JVMFlagConstraintFunc_bool _constraint;
|
||||||
const bool* _ptr;
|
|
||||||
|
|
||||||
public:
|
public:
|
||||||
// the "name" argument must be a string literal
|
JVMFlagConstraint_bool(const JVMFlag* flag,
|
||||||
JVMFlagConstraint_bool(const char* name, const bool* ptr,
|
JVMFlagConstraintFunc_bool func,
|
||||||
JVMFlagConstraintFunc_bool func,
|
ConstraintType type) : JVMFlagConstraint(flag, type), _constraint(func) {}
|
||||||
ConstraintType type) : JVMFlagConstraint(name, type), _constraint(func), _ptr(ptr) {}
|
|
||||||
|
|
||||||
JVMFlag::Error apply(bool verbose) {
|
JVMFlag::Error apply(bool verbose) {
|
||||||
bool value = *_ptr;
|
return _constraint(_flag->get_bool(), verbose);
|
||||||
return _constraint(value, verbose);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
JVMFlag::Error apply_bool(bool value, bool verbose) {
|
JVMFlag::Error apply_bool(bool value, bool verbose) {
|
||||||
|
@ -57,17 +55,14 @@ public:
|
||||||
|
|
||||||
class JVMFlagConstraint_int : public JVMFlagConstraint {
|
class JVMFlagConstraint_int : public JVMFlagConstraint {
|
||||||
JVMFlagConstraintFunc_int _constraint;
|
JVMFlagConstraintFunc_int _constraint;
|
||||||
const int* _ptr;
|
|
||||||
|
|
||||||
public:
|
public:
|
||||||
// the "name" argument must be a string literal
|
JVMFlagConstraint_int(const JVMFlag* flag,
|
||||||
JVMFlagConstraint_int(const char* name, const int* ptr,
|
JVMFlagConstraintFunc_int func,
|
||||||
JVMFlagConstraintFunc_int func,
|
ConstraintType type) : JVMFlagConstraint(flag, type), _constraint(func) {}
|
||||||
ConstraintType type) : JVMFlagConstraint(name, type), _constraint(func), _ptr(ptr) {}
|
|
||||||
|
|
||||||
JVMFlag::Error apply(bool verbose) {
|
JVMFlag::Error apply(bool verbose) {
|
||||||
int value = *_ptr;
|
return _constraint(_flag->get_int(), verbose);
|
||||||
return _constraint(value, verbose);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
JVMFlag::Error apply_int(int value, bool verbose) {
|
JVMFlag::Error apply_int(int value, bool verbose) {
|
||||||
|
@ -77,17 +72,14 @@ public:
|
||||||
|
|
||||||
class JVMFlagConstraint_intx : public JVMFlagConstraint {
|
class JVMFlagConstraint_intx : public JVMFlagConstraint {
|
||||||
JVMFlagConstraintFunc_intx _constraint;
|
JVMFlagConstraintFunc_intx _constraint;
|
||||||
const intx* _ptr;
|
|
||||||
|
|
||||||
public:
|
public:
|
||||||
// the "name" argument must be a string literal
|
JVMFlagConstraint_intx(const JVMFlag* flag,
|
||||||
JVMFlagConstraint_intx(const char* name, const intx* ptr,
|
JVMFlagConstraintFunc_intx func,
|
||||||
JVMFlagConstraintFunc_intx func,
|
ConstraintType type) : JVMFlagConstraint(flag, type), _constraint(func) {}
|
||||||
ConstraintType type) : JVMFlagConstraint(name, type), _constraint(func), _ptr(ptr) {}
|
|
||||||
|
|
||||||
JVMFlag::Error apply(bool verbose) {
|
JVMFlag::Error apply(bool verbose) {
|
||||||
intx value = *_ptr;
|
return _constraint(_flag->get_intx(), verbose);
|
||||||
return _constraint(value, verbose);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
JVMFlag::Error apply_intx(intx value, bool verbose) {
|
JVMFlag::Error apply_intx(intx value, bool verbose) {
|
||||||
|
@ -97,17 +89,14 @@ public:
|
||||||
|
|
||||||
class JVMFlagConstraint_uint : public JVMFlagConstraint {
|
class JVMFlagConstraint_uint : public JVMFlagConstraint {
|
||||||
JVMFlagConstraintFunc_uint _constraint;
|
JVMFlagConstraintFunc_uint _constraint;
|
||||||
const uint* _ptr;
|
|
||||||
|
|
||||||
public:
|
public:
|
||||||
// the "name" argument must be a string literal
|
JVMFlagConstraint_uint(const JVMFlag* flag,
|
||||||
JVMFlagConstraint_uint(const char* name, const uint* ptr,
|
JVMFlagConstraintFunc_uint func,
|
||||||
JVMFlagConstraintFunc_uint func,
|
ConstraintType type) : JVMFlagConstraint(flag, type), _constraint(func) {}
|
||||||
ConstraintType type) : JVMFlagConstraint(name, type), _constraint(func), _ptr(ptr) {}
|
|
||||||
|
|
||||||
JVMFlag::Error apply(bool verbose) {
|
JVMFlag::Error apply(bool verbose) {
|
||||||
uint value = *_ptr;
|
return _constraint(_flag->get_uint(), verbose);
|
||||||
return _constraint(value, verbose);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
JVMFlag::Error apply_uint(uint value, bool verbose) {
|
JVMFlag::Error apply_uint(uint value, bool verbose) {
|
||||||
|
@ -117,17 +106,14 @@ public:
|
||||||
|
|
||||||
class JVMFlagConstraint_uintx : public JVMFlagConstraint {
|
class JVMFlagConstraint_uintx : public JVMFlagConstraint {
|
||||||
JVMFlagConstraintFunc_uintx _constraint;
|
JVMFlagConstraintFunc_uintx _constraint;
|
||||||
const uintx* _ptr;
|
|
||||||
|
|
||||||
public:
|
public:
|
||||||
// the "name" argument must be a string literal
|
JVMFlagConstraint_uintx(const JVMFlag* flag,
|
||||||
JVMFlagConstraint_uintx(const char* name, const uintx* ptr,
|
JVMFlagConstraintFunc_uintx func,
|
||||||
JVMFlagConstraintFunc_uintx func,
|
ConstraintType type) : JVMFlagConstraint(flag, type), _constraint(func) {}
|
||||||
ConstraintType type) : JVMFlagConstraint(name, type), _constraint(func), _ptr(ptr) {}
|
|
||||||
|
|
||||||
JVMFlag::Error apply(bool verbose) {
|
JVMFlag::Error apply(bool verbose) {
|
||||||
uintx value = *_ptr;
|
return _constraint(_flag->get_uintx(), verbose);
|
||||||
return _constraint(value, verbose);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
JVMFlag::Error apply_uintx(uintx value, bool verbose) {
|
JVMFlag::Error apply_uintx(uintx value, bool verbose) {
|
||||||
|
@ -137,17 +123,14 @@ public:
|
||||||
|
|
||||||
class JVMFlagConstraint_uint64_t : public JVMFlagConstraint {
|
class JVMFlagConstraint_uint64_t : public JVMFlagConstraint {
|
||||||
JVMFlagConstraintFunc_uint64_t _constraint;
|
JVMFlagConstraintFunc_uint64_t _constraint;
|
||||||
const uint64_t* _ptr;
|
|
||||||
|
|
||||||
public:
|
public:
|
||||||
// the "name" argument must be a string literal
|
JVMFlagConstraint_uint64_t(const JVMFlag* flag,
|
||||||
JVMFlagConstraint_uint64_t(const char* name, const uint64_t* ptr,
|
JVMFlagConstraintFunc_uint64_t func,
|
||||||
JVMFlagConstraintFunc_uint64_t func,
|
ConstraintType type) : JVMFlagConstraint(flag, type), _constraint(func) {}
|
||||||
ConstraintType type) : JVMFlagConstraint(name, type), _constraint(func), _ptr(ptr) {}
|
|
||||||
|
|
||||||
JVMFlag::Error apply(bool verbose) {
|
JVMFlag::Error apply(bool verbose) {
|
||||||
uint64_t value = *_ptr;
|
return _constraint(_flag->get_uint64_t(), verbose);
|
||||||
return _constraint(value, verbose);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
JVMFlag::Error apply_uint64_t(uint64_t value, bool verbose) {
|
JVMFlag::Error apply_uint64_t(uint64_t value, bool verbose) {
|
||||||
|
@ -157,16 +140,14 @@ public:
|
||||||
|
|
||||||
class JVMFlagConstraint_size_t : public JVMFlagConstraint {
|
class JVMFlagConstraint_size_t : public JVMFlagConstraint {
|
||||||
JVMFlagConstraintFunc_size_t _constraint;
|
JVMFlagConstraintFunc_size_t _constraint;
|
||||||
const size_t* _ptr;
|
|
||||||
public:
|
public:
|
||||||
// the "name" argument must be a string literal
|
JVMFlagConstraint_size_t(const JVMFlag* flag,
|
||||||
JVMFlagConstraint_size_t(const char* name, const size_t* ptr,
|
JVMFlagConstraintFunc_size_t func,
|
||||||
JVMFlagConstraintFunc_size_t func,
|
ConstraintType type) : JVMFlagConstraint(flag, type), _constraint(func) {}
|
||||||
ConstraintType type) : JVMFlagConstraint(name, type), _constraint(func), _ptr(ptr) {}
|
|
||||||
|
|
||||||
JVMFlag::Error apply(bool verbose) {
|
JVMFlag::Error apply(bool verbose) {
|
||||||
size_t value = *_ptr;
|
return _constraint(_flag->get_size_t(), verbose);
|
||||||
return _constraint(value, verbose);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
JVMFlag::Error apply_size_t(size_t value, bool verbose) {
|
JVMFlag::Error apply_size_t(size_t value, bool verbose) {
|
||||||
|
@ -176,17 +157,14 @@ public:
|
||||||
|
|
||||||
class JVMFlagConstraint_double : public JVMFlagConstraint {
|
class JVMFlagConstraint_double : public JVMFlagConstraint {
|
||||||
JVMFlagConstraintFunc_double _constraint;
|
JVMFlagConstraintFunc_double _constraint;
|
||||||
const double* _ptr;
|
|
||||||
|
|
||||||
public:
|
public:
|
||||||
// the "name" argument must be a string literal
|
JVMFlagConstraint_double(const JVMFlag* flag,
|
||||||
JVMFlagConstraint_double(const char* name, const double* ptr,
|
JVMFlagConstraintFunc_double func,
|
||||||
JVMFlagConstraintFunc_double func,
|
ConstraintType type) : JVMFlagConstraint(flag, type), _constraint(func) {}
|
||||||
ConstraintType type) : JVMFlagConstraint(name, type), _constraint(func), _ptr(ptr) {}
|
|
||||||
|
|
||||||
JVMFlag::Error apply(bool verbose) {
|
JVMFlag::Error apply(bool verbose) {
|
||||||
double value = *_ptr;
|
return _constraint(_flag->get_double(), verbose);
|
||||||
return _constraint(value, verbose);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
JVMFlag::Error apply_double(double value, bool verbose) {
|
JVMFlag::Error apply_double(double value, bool verbose) {
|
||||||
|
@ -195,49 +173,49 @@ public:
|
||||||
};
|
};
|
||||||
|
|
||||||
// No constraint emitting
|
// No constraint emitting
|
||||||
void emit_constraint_no(...) { /* NOP */ }
|
void emit_constraint_no(...) { /* NOP */ }
|
||||||
|
|
||||||
// No constraint emitting if function argument is NOT provided
|
// No constraint emitting if function argument is NOT provided
|
||||||
void emit_constraint_bool(const char* /*name*/, const bool* /*value*/) { /* NOP */ }
|
void emit_constraint_bool(const JVMFlag* /*flag*/) { /* NOP */ }
|
||||||
void emit_constraint_ccstr(const char* /*name*/, const ccstr* /*value*/) { /* NOP */ }
|
void emit_constraint_ccstr(const JVMFlag* /*flag*/) { /* NOP */ }
|
||||||
void emit_constraint_ccstrlist(const char* /*name*/, const ccstrlist* /*value*/) { /* NOP */ }
|
void emit_constraint_ccstrlist(const JVMFlag* /*flag*/) { /* NOP */ }
|
||||||
void emit_constraint_int(const char* /*name*/, const int* /*value*/) { /* NOP */ }
|
void emit_constraint_int(const JVMFlag* /*flag*/) { /* NOP */ }
|
||||||
void emit_constraint_intx(const char* /*name*/, const intx* /*value*/) { /* NOP */ }
|
void emit_constraint_intx(const JVMFlag* /*flag*/) { /* NOP */ }
|
||||||
void emit_constraint_uint(const char* /*name*/, const uint* /*value*/) { /* NOP */ }
|
void emit_constraint_uint(const JVMFlag* /*flag*/) { /* NOP */ }
|
||||||
void emit_constraint_uintx(const char* /*name*/, const uintx* /*value*/) { /* NOP */ }
|
void emit_constraint_uintx(const JVMFlag* /*flag*/) { /* NOP */ }
|
||||||
void emit_constraint_uint64_t(const char* /*name*/, const uint64_t* /*value*/) { /* NOP */ }
|
void emit_constraint_uint64_t(const JVMFlag* /*flag*/) { /* NOP */ }
|
||||||
void emit_constraint_size_t(const char* /*name*/, const size_t* /*value*/) { /* NOP */ }
|
void emit_constraint_size_t(const JVMFlag* /*flag*/) { /* NOP */ }
|
||||||
void emit_constraint_double(const char* /*name*/, const double* /*value*/) { /* NOP */ }
|
void emit_constraint_double(const JVMFlag* /*flag*/) { /* NOP */ }
|
||||||
|
|
||||||
// JVMFlagConstraint emitting code functions if function argument is provided
|
// JVMFlagConstraint emitting code functions if function argument is provided
|
||||||
void emit_constraint_bool(const char* name, const bool* ptr, JVMFlagConstraintFunc_bool func, JVMFlagConstraint::ConstraintType type) {
|
void emit_constraint_bool(const JVMFlag* flag, JVMFlagConstraintFunc_bool func, JVMFlagConstraint::ConstraintType type) {
|
||||||
JVMFlagConstraintList::add(new JVMFlagConstraint_bool(name, ptr, func, type));
|
JVMFlagConstraintList::add(new JVMFlagConstraint_bool(flag, func, type));
|
||||||
}
|
}
|
||||||
void emit_constraint_int(const char* name, const int* ptr, JVMFlagConstraintFunc_int func, JVMFlagConstraint::ConstraintType type) {
|
void emit_constraint_int(const JVMFlag* flag, JVMFlagConstraintFunc_int func, JVMFlagConstraint::ConstraintType type) {
|
||||||
JVMFlagConstraintList::add(new JVMFlagConstraint_int(name, ptr, func, type));
|
JVMFlagConstraintList::add(new JVMFlagConstraint_int(flag, func, type));
|
||||||
}
|
}
|
||||||
void emit_constraint_intx(const char* name, const intx* ptr, JVMFlagConstraintFunc_intx func, JVMFlagConstraint::ConstraintType type) {
|
void emit_constraint_intx(const JVMFlag* flag, JVMFlagConstraintFunc_intx func, JVMFlagConstraint::ConstraintType type) {
|
||||||
JVMFlagConstraintList::add(new JVMFlagConstraint_intx(name, ptr, func, type));
|
JVMFlagConstraintList::add(new JVMFlagConstraint_intx(flag, func, type));
|
||||||
}
|
}
|
||||||
void emit_constraint_uint(const char* name, const uint* ptr, JVMFlagConstraintFunc_uint func, JVMFlagConstraint::ConstraintType type) {
|
void emit_constraint_uint(const JVMFlag* flag, JVMFlagConstraintFunc_uint func, JVMFlagConstraint::ConstraintType type) {
|
||||||
JVMFlagConstraintList::add(new JVMFlagConstraint_uint(name, ptr, func, type));
|
JVMFlagConstraintList::add(new JVMFlagConstraint_uint(flag, func, type));
|
||||||
}
|
}
|
||||||
void emit_constraint_uintx(const char* name, const uintx* ptr, JVMFlagConstraintFunc_uintx func, JVMFlagConstraint::ConstraintType type) {
|
void emit_constraint_uintx(const JVMFlag* flag, JVMFlagConstraintFunc_uintx func, JVMFlagConstraint::ConstraintType type) {
|
||||||
JVMFlagConstraintList::add(new JVMFlagConstraint_uintx(name, ptr, func, type));
|
JVMFlagConstraintList::add(new JVMFlagConstraint_uintx(flag, func, type));
|
||||||
}
|
}
|
||||||
void emit_constraint_uint64_t(const char* name, const uint64_t* ptr, JVMFlagConstraintFunc_uint64_t func, JVMFlagConstraint::ConstraintType type) {
|
void emit_constraint_uint64_t(const JVMFlag* flag, JVMFlagConstraintFunc_uint64_t func, JVMFlagConstraint::ConstraintType type) {
|
||||||
JVMFlagConstraintList::add(new JVMFlagConstraint_uint64_t(name, ptr, func, type));
|
JVMFlagConstraintList::add(new JVMFlagConstraint_uint64_t(flag, func, type));
|
||||||
}
|
}
|
||||||
void emit_constraint_size_t(const char* name, const size_t* ptr, JVMFlagConstraintFunc_size_t func, JVMFlagConstraint::ConstraintType type) {
|
void emit_constraint_size_t(const JVMFlag* flag, JVMFlagConstraintFunc_size_t func, JVMFlagConstraint::ConstraintType type) {
|
||||||
JVMFlagConstraintList::add(new JVMFlagConstraint_size_t(name, ptr, func, type));
|
JVMFlagConstraintList::add(new JVMFlagConstraint_size_t(flag, func, type));
|
||||||
}
|
}
|
||||||
void emit_constraint_double(const char* name, const double* ptr, JVMFlagConstraintFunc_double func, JVMFlagConstraint::ConstraintType type) {
|
void emit_constraint_double(const JVMFlag* flag, JVMFlagConstraintFunc_double func, JVMFlagConstraint::ConstraintType type) {
|
||||||
JVMFlagConstraintList::add(new JVMFlagConstraint_double(name, ptr, func, type));
|
JVMFlagConstraintList::add(new JVMFlagConstraint_double(flag, func, type));
|
||||||
}
|
}
|
||||||
|
|
||||||
// Generate code to call emit_constraint_xxx function
|
// Generate code to call emit_constraint_xxx function
|
||||||
#define EMIT_CONSTRAINT_START (void)(0
|
#define EMIT_CONSTRAINT_START (void)(0
|
||||||
#define EMIT_CONSTRAINT(type, name) ); emit_constraint_##type(#name, &name
|
#define EMIT_CONSTRAINT(type, name) ); emit_constraint_##type(JVMFlagEx::flag_from_enum(FLAG_MEMBER_ENUM(name))
|
||||||
#define EMIT_CONSTRAINT_NO ); emit_constraint_no(0
|
#define EMIT_CONSTRAINT_NO ); emit_constraint_no(0
|
||||||
#define EMIT_CONSTRAINT_PRODUCT_FLAG(type, name, value, doc) EMIT_CONSTRAINT(type, name)
|
#define EMIT_CONSTRAINT_PRODUCT_FLAG(type, name, value, doc) EMIT_CONSTRAINT(type, name)
|
||||||
#define EMIT_CONSTRAINT_DIAGNOSTIC_FLAG(type, name, value, doc) EMIT_CONSTRAINT(type, name)
|
#define EMIT_CONSTRAINT_DIAGNOSTIC_FLAG(type, name, value, doc) EMIT_CONSTRAINT(type, name)
|
||||||
|
@ -296,11 +274,11 @@ void JVMFlagConstraintList::init(void) {
|
||||||
EMIT_CONSTRAINT_END
|
EMIT_CONSTRAINT_END
|
||||||
}
|
}
|
||||||
|
|
||||||
JVMFlagConstraint* JVMFlagConstraintList::find(const char* name) {
|
JVMFlagConstraint* JVMFlagConstraintList::find(const JVMFlag* flag) {
|
||||||
JVMFlagConstraint* found = NULL;
|
JVMFlagConstraint* found = NULL;
|
||||||
for (int i=0; i<length(); i++) {
|
for (int i=0; i<length(); i++) {
|
||||||
JVMFlagConstraint* constraint = at(i);
|
JVMFlagConstraint* constraint = at(i);
|
||||||
if (strcmp(constraint->name(), name) == 0) {
|
if (constraint->flag() == flag) {
|
||||||
found = constraint;
|
found = constraint;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -308,11 +286,11 @@ JVMFlagConstraint* JVMFlagConstraintList::find(const char* name) {
|
||||||
return found;
|
return found;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Find constraints by name and return only if found constraint's type is equal or lower than current validating type.
|
// Find constraints and return only if found constraint's type is equal or lower than current validating type.
|
||||||
JVMFlagConstraint* JVMFlagConstraintList::find_if_needs_check(const char* name) {
|
JVMFlagConstraint* JVMFlagConstraintList::find_if_needs_check(const JVMFlag* flag) {
|
||||||
JVMFlagConstraint* found = NULL;
|
JVMFlagConstraint* found = NULL;
|
||||||
JVMFlagConstraint* constraint = find(name);
|
JVMFlagConstraint* constraint = find(flag);
|
||||||
if (constraint && (constraint->type() <= _validating_type)) {
|
if (constraint != NULL && (constraint->type() <= _validating_type)) {
|
||||||
found = constraint;
|
found = constraint;
|
||||||
}
|
}
|
||||||
return found;
|
return found;
|
||||||
|
|
|
@ -60,15 +60,17 @@ public:
|
||||||
AfterMemoryInit = 2
|
AfterMemoryInit = 2
|
||||||
};
|
};
|
||||||
|
|
||||||
|
protected:
|
||||||
|
const JVMFlag* const _flag;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
const char* _name;
|
|
||||||
ConstraintType _validate_type;
|
ConstraintType _validate_type;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
// the "name" argument must be a string literal
|
// the "name" argument must be a string literal
|
||||||
JVMFlagConstraint(const char* name, ConstraintType type) { _name=name; _validate_type=type; };
|
JVMFlagConstraint(const JVMFlag* flag, ConstraintType type) : _flag(flag), _validate_type(type) {}
|
||||||
~JVMFlagConstraint() {};
|
~JVMFlagConstraint() {}
|
||||||
const char* name() const { return _name; }
|
const JVMFlag* flag() const { return _flag; }
|
||||||
ConstraintType type() const { return _validate_type; }
|
ConstraintType type() const { return _validate_type; }
|
||||||
virtual JVMFlag::Error apply(bool verbose = true) { ShouldNotReachHere(); return JVMFlag::ERR_OTHER; };
|
virtual JVMFlag::Error apply(bool verbose = true) { ShouldNotReachHere(); return JVMFlag::ERR_OTHER; };
|
||||||
virtual JVMFlag::Error apply_bool(bool value, bool verbose = true) { ShouldNotReachHere(); return JVMFlag::ERR_OTHER; };
|
virtual JVMFlag::Error apply_bool(bool value, bool verbose = true) { ShouldNotReachHere(); return JVMFlag::ERR_OTHER; };
|
||||||
|
@ -90,8 +92,8 @@ public:
|
||||||
static void init();
|
static void init();
|
||||||
static int length() { return (_constraints != NULL) ? _constraints->length() : 0; }
|
static int length() { return (_constraints != NULL) ? _constraints->length() : 0; }
|
||||||
static JVMFlagConstraint* at(int i) { return (_constraints != NULL) ? _constraints->at(i) : NULL; }
|
static JVMFlagConstraint* at(int i) { return (_constraints != NULL) ? _constraints->at(i) : NULL; }
|
||||||
static JVMFlagConstraint* find(const char* name);
|
static JVMFlagConstraint* find(const JVMFlag* flag);
|
||||||
static JVMFlagConstraint* find_if_needs_check(const char* name);
|
static JVMFlagConstraint* find_if_needs_check(const JVMFlag* flag);
|
||||||
static void add(JVMFlagConstraint* constraint) { _constraints->append(constraint); }
|
static void add(JVMFlagConstraint* constraint) { _constraints->append(constraint); }
|
||||||
// True if 'AfterErgo' or later constraint functions are validated.
|
// True if 'AfterErgo' or later constraint functions are validated.
|
||||||
static bool validated_after_ergo() { return _validating_type >= JVMFlagConstraint::AfterErgo; };
|
static bool validated_after_ergo() { return _validating_type >= JVMFlagConstraint::AfterErgo; };
|
||||||
|
|
|
@ -33,6 +33,7 @@
|
||||||
#include "runtime/flags/jvmFlagConstraintList.hpp"
|
#include "runtime/flags/jvmFlagConstraintList.hpp"
|
||||||
#include "runtime/flags/jvmFlagRangeList.hpp"
|
#include "runtime/flags/jvmFlagRangeList.hpp"
|
||||||
#include "runtime/globals.hpp"
|
#include "runtime/globals.hpp"
|
||||||
|
#include "runtime/globals_extension.hpp"
|
||||||
#include "runtime/os.hpp"
|
#include "runtime/os.hpp"
|
||||||
#include "runtime/task.hpp"
|
#include "runtime/task.hpp"
|
||||||
#include "utilities/macros.hpp"
|
#include "utilities/macros.hpp"
|
||||||
|
@ -40,15 +41,13 @@
|
||||||
class JVMFlagRange_int : public JVMFlagRange {
|
class JVMFlagRange_int : public JVMFlagRange {
|
||||||
int _min;
|
int _min;
|
||||||
int _max;
|
int _max;
|
||||||
const int* _ptr;
|
|
||||||
|
|
||||||
public:
|
public:
|
||||||
// the "name" argument must be a string literal
|
JVMFlagRange_int(const JVMFlag* flag, int min, int max)
|
||||||
JVMFlagRange_int(const char* name, const int* ptr, int min, int max)
|
: JVMFlagRange(flag), _min(min), _max(max) {}
|
||||||
: JVMFlagRange(name), _min(min), _max(max), _ptr(ptr) {}
|
|
||||||
|
|
||||||
JVMFlag::Error check(bool verbose = true) {
|
JVMFlag::Error check(bool verbose = true) {
|
||||||
return check_int(*_ptr, verbose);
|
return check_int(_flag->get_int(), verbose);
|
||||||
}
|
}
|
||||||
|
|
||||||
JVMFlag::Error check_int(int value, bool verbose = true) {
|
JVMFlag::Error check_int(int value, bool verbose = true) {
|
||||||
|
@ -71,14 +70,13 @@ public:
|
||||||
class JVMFlagRange_intx : public JVMFlagRange {
|
class JVMFlagRange_intx : public JVMFlagRange {
|
||||||
intx _min;
|
intx _min;
|
||||||
intx _max;
|
intx _max;
|
||||||
const intx* _ptr;
|
|
||||||
public:
|
public:
|
||||||
// the "name" argument must be a string literal
|
JVMFlagRange_intx(const JVMFlag* flag, intx min, intx max)
|
||||||
JVMFlagRange_intx(const char* name, const intx* ptr, intx min, intx max)
|
: JVMFlagRange(flag), _min(min), _max(max) {}
|
||||||
: JVMFlagRange(name), _min(min), _max(max), _ptr(ptr) {}
|
|
||||||
|
|
||||||
JVMFlag::Error check(bool verbose = true) {
|
JVMFlag::Error check(bool verbose = true) {
|
||||||
return check_intx(*_ptr, verbose);
|
return check_intx(_flag->get_intx(), verbose);
|
||||||
}
|
}
|
||||||
|
|
||||||
JVMFlag::Error check_intx(intx value, bool verbose = true) {
|
JVMFlag::Error check_intx(intx value, bool verbose = true) {
|
||||||
|
@ -101,15 +99,13 @@ public:
|
||||||
class JVMFlagRange_uint : public JVMFlagRange {
|
class JVMFlagRange_uint : public JVMFlagRange {
|
||||||
uint _min;
|
uint _min;
|
||||||
uint _max;
|
uint _max;
|
||||||
const uint* _ptr;
|
|
||||||
|
|
||||||
public:
|
public:
|
||||||
// the "name" argument must be a string literal
|
JVMFlagRange_uint(const JVMFlag* flag, uint min, uint max)
|
||||||
JVMFlagRange_uint(const char* name, const uint* ptr, uint min, uint max)
|
: JVMFlagRange(flag), _min(min), _max(max) {}
|
||||||
: JVMFlagRange(name), _min(min), _max(max), _ptr(ptr) {}
|
|
||||||
|
|
||||||
JVMFlag::Error check(bool verbose = true) {
|
JVMFlag::Error check(bool verbose = true) {
|
||||||
return check_uint(*_ptr, verbose);
|
return check_uint(_flag->get_uint(), verbose);
|
||||||
}
|
}
|
||||||
|
|
||||||
JVMFlag::Error check_uint(uint value, bool verbose = true) {
|
JVMFlag::Error check_uint(uint value, bool verbose = true) {
|
||||||
|
@ -132,15 +128,13 @@ public:
|
||||||
class JVMFlagRange_uintx : public JVMFlagRange {
|
class JVMFlagRange_uintx : public JVMFlagRange {
|
||||||
uintx _min;
|
uintx _min;
|
||||||
uintx _max;
|
uintx _max;
|
||||||
const uintx* _ptr;
|
|
||||||
|
|
||||||
public:
|
public:
|
||||||
// the "name" argument must be a string literal
|
JVMFlagRange_uintx(const JVMFlag* flag, uintx min, uintx max)
|
||||||
JVMFlagRange_uintx(const char* name, const uintx* ptr, uintx min, uintx max)
|
: JVMFlagRange(flag), _min(min), _max(max) {}
|
||||||
: JVMFlagRange(name), _min(min), _max(max), _ptr(ptr) {}
|
|
||||||
|
|
||||||
JVMFlag::Error check(bool verbose = true) {
|
JVMFlag::Error check(bool verbose = true) {
|
||||||
return check_uintx(*_ptr, verbose);
|
return check_uintx(_flag->get_uintx(), verbose);
|
||||||
}
|
}
|
||||||
|
|
||||||
JVMFlag::Error check_uintx(uintx value, bool verbose = true) {
|
JVMFlag::Error check_uintx(uintx value, bool verbose = true) {
|
||||||
|
@ -163,15 +157,13 @@ public:
|
||||||
class JVMFlagRange_uint64_t : public JVMFlagRange {
|
class JVMFlagRange_uint64_t : public JVMFlagRange {
|
||||||
uint64_t _min;
|
uint64_t _min;
|
||||||
uint64_t _max;
|
uint64_t _max;
|
||||||
const uint64_t* _ptr;
|
|
||||||
|
|
||||||
public:
|
public:
|
||||||
// the "name" argument must be a string literal
|
JVMFlagRange_uint64_t(const JVMFlag* flag, uint64_t min, uint64_t max)
|
||||||
JVMFlagRange_uint64_t(const char* name, const uint64_t* ptr, uint64_t min, uint64_t max)
|
: JVMFlagRange(flag), _min(min), _max(max) {}
|
||||||
: JVMFlagRange(name), _min(min), _max(max), _ptr(ptr) {}
|
|
||||||
|
|
||||||
JVMFlag::Error check(bool verbose = true) {
|
JVMFlag::Error check(bool verbose = true) {
|
||||||
return check_uint64_t(*_ptr, verbose);
|
return check_uint64_t(_flag->get_uintx(), verbose);
|
||||||
}
|
}
|
||||||
|
|
||||||
JVMFlag::Error check_uint64_t(uint64_t value, bool verbose = true) {
|
JVMFlag::Error check_uint64_t(uint64_t value, bool verbose = true) {
|
||||||
|
@ -194,15 +186,13 @@ public:
|
||||||
class JVMFlagRange_size_t : public JVMFlagRange {
|
class JVMFlagRange_size_t : public JVMFlagRange {
|
||||||
size_t _min;
|
size_t _min;
|
||||||
size_t _max;
|
size_t _max;
|
||||||
const size_t* _ptr;
|
|
||||||
|
|
||||||
public:
|
public:
|
||||||
// the "name" argument must be a string literal
|
JVMFlagRange_size_t(const JVMFlag* flag, size_t min, size_t max)
|
||||||
JVMFlagRange_size_t(const char* name, const size_t* ptr, size_t min, size_t max)
|
: JVMFlagRange(flag), _min(min), _max(max) {}
|
||||||
: JVMFlagRange(name), _min(min), _max(max), _ptr(ptr) {}
|
|
||||||
|
|
||||||
JVMFlag::Error check(bool verbose = true) {
|
JVMFlag::Error check(bool verbose = true) {
|
||||||
return check_size_t(*_ptr, verbose);
|
return check_size_t(_flag->get_size_t(), verbose);
|
||||||
}
|
}
|
||||||
|
|
||||||
JVMFlag::Error check_size_t(size_t value, bool verbose = true) {
|
JVMFlag::Error check_size_t(size_t value, bool verbose = true) {
|
||||||
|
@ -225,15 +215,13 @@ public:
|
||||||
class JVMFlagRange_double : public JVMFlagRange {
|
class JVMFlagRange_double : public JVMFlagRange {
|
||||||
double _min;
|
double _min;
|
||||||
double _max;
|
double _max;
|
||||||
const double* _ptr;
|
|
||||||
|
|
||||||
public:
|
public:
|
||||||
// the "name" argument must be a string literal
|
JVMFlagRange_double(const JVMFlag* flag, double min, double max)
|
||||||
JVMFlagRange_double(const char* name, const double* ptr, double min, double max)
|
: JVMFlagRange(flag), _min(min), _max(max) {}
|
||||||
: JVMFlagRange(name), _min(min), _max(max), _ptr(ptr) {}
|
|
||||||
|
|
||||||
JVMFlag::Error check(bool verbose = true) {
|
JVMFlag::Error check(bool verbose = true) {
|
||||||
return check_double(*_ptr, verbose);
|
return check_double(_flag->get_double(), verbose);
|
||||||
}
|
}
|
||||||
|
|
||||||
JVMFlag::Error check_double(double value, bool verbose = true) {
|
JVMFlag::Error check_double(double value, bool verbose = true) {
|
||||||
|
@ -257,43 +245,43 @@ public:
|
||||||
void emit_range_no(...) { /* NOP */ }
|
void emit_range_no(...) { /* NOP */ }
|
||||||
|
|
||||||
// No constraint emitting if function argument is NOT provided
|
// No constraint emitting if function argument is NOT provided
|
||||||
void emit_range_bool(const char* /*name*/, const bool* /*value*/) { /* NOP */ }
|
void emit_range_bool(const JVMFlag* /*flag*/) { /* NOP */ }
|
||||||
void emit_range_ccstr(const char* /*name*/, const ccstr* /*value*/) { /* NOP */ }
|
void emit_range_ccstr(const JVMFlag* /*flag*/) { /* NOP */ }
|
||||||
void emit_range_ccstrlist(const char* /*name*/, const ccstrlist* /*value*/) { /* NOP */ }
|
void emit_range_ccstrlist(const JVMFlag* /*flag*/) { /* NOP */ }
|
||||||
void emit_range_int(const char* /*name*/, const int* /*value*/) { /* NOP */ }
|
void emit_range_int(const JVMFlag* /*flag*/) { /* NOP */ }
|
||||||
void emit_range_intx(const char* /*name*/, const intx* /*value*/) { /* NOP */ }
|
void emit_range_intx(const JVMFlag* /*flag*/) { /* NOP */ }
|
||||||
void emit_range_uint(const char* /*name*/, const uint* /*value*/) { /* NOP */ }
|
void emit_range_uint(const JVMFlag* /*flag*/) { /* NOP */ }
|
||||||
void emit_range_uintx(const char* /*name*/, const uintx* /*value*/) { /* NOP */ }
|
void emit_range_uintx(const JVMFlag* /*flag*/) { /* NOP */ }
|
||||||
void emit_range_uint64_t(const char* /*name*/, const uint64_t* /*value*/) { /* NOP */ }
|
void emit_range_uint64_t(const JVMFlag* /*flag*/) { /* NOP */ }
|
||||||
void emit_range_size_t(const char* /*name*/, const size_t* /*value*/) { /* NOP */ }
|
void emit_range_size_t(const JVMFlag* /*flag*/) { /* NOP */ }
|
||||||
void emit_range_double(const char* /*name*/, const double* /*value*/) { /* NOP */ }
|
void emit_range_double(const JVMFlag* /*flag*/) { /* NOP */ }
|
||||||
|
|
||||||
// JVMFlagRange emitting code functions if range arguments are provided
|
// JVMFlagRange emitting code functions if range arguments are provided
|
||||||
void emit_range_int(const char* name, const int* ptr, int min, int max) {
|
void emit_range_int(const JVMFlag* flag, int min, int max) {
|
||||||
JVMFlagRangeList::add(new JVMFlagRange_int(name, ptr, min, max));
|
JVMFlagRangeList::add(new JVMFlagRange_int(flag, min, max));
|
||||||
}
|
}
|
||||||
void emit_range_intx(const char* name, const intx* ptr, intx min, intx max) {
|
void emit_range_intx(const JVMFlag* flag, intx min, intx max) {
|
||||||
JVMFlagRangeList::add(new JVMFlagRange_intx(name, ptr, min, max));
|
JVMFlagRangeList::add(new JVMFlagRange_intx(flag, min, max));
|
||||||
}
|
}
|
||||||
void emit_range_uint(const char* name, const uint* ptr, uint min, uint max) {
|
void emit_range_uint(const JVMFlag* flag, uint min, uint max) {
|
||||||
JVMFlagRangeList::add(new JVMFlagRange_uint(name, ptr, min, max));
|
JVMFlagRangeList::add(new JVMFlagRange_uint(flag, min, max));
|
||||||
}
|
}
|
||||||
void emit_range_uintx(const char* name, const uintx* ptr, uintx min, uintx max) {
|
void emit_range_uintx(const JVMFlag* flag, uintx min, uintx max) {
|
||||||
JVMFlagRangeList::add(new JVMFlagRange_uintx(name, ptr, min, max));
|
JVMFlagRangeList::add(new JVMFlagRange_uintx(flag, min, max));
|
||||||
}
|
}
|
||||||
void emit_range_uint64_t(const char* name, const uint64_t* ptr, uint64_t min, uint64_t max) {
|
void emit_range_uint64_t(const JVMFlag* flag, uint64_t min, uint64_t max) {
|
||||||
JVMFlagRangeList::add(new JVMFlagRange_uint64_t(name, ptr, min, max));
|
JVMFlagRangeList::add(new JVMFlagRange_uint64_t(flag, min, max));
|
||||||
}
|
}
|
||||||
void emit_range_size_t(const char* name, const size_t* ptr, size_t min, size_t max) {
|
void emit_range_size_t(const JVMFlag* flag, size_t min, size_t max) {
|
||||||
JVMFlagRangeList::add(new JVMFlagRange_size_t(name, ptr, min, max));
|
JVMFlagRangeList::add(new JVMFlagRange_size_t(flag, min, max));
|
||||||
}
|
}
|
||||||
void emit_range_double(const char* name, const double* ptr, double min, double max) {
|
void emit_range_double(const JVMFlag* flag, double min, double max) {
|
||||||
JVMFlagRangeList::add(new JVMFlagRange_double(name, ptr, min, max));
|
JVMFlagRangeList::add(new JVMFlagRange_double(flag, min, max));
|
||||||
}
|
}
|
||||||
|
|
||||||
// Generate code to call emit_range_xxx function
|
// Generate code to call emit_range_xxx function
|
||||||
#define EMIT_RANGE_START (void)(0
|
#define EMIT_RANGE_START (void)(0
|
||||||
#define EMIT_RANGE(type, name) ); emit_range_##type(#name, &name
|
#define EMIT_RANGE(type, name) ); emit_range_##type(JVMFlagEx::flag_from_enum(FLAG_MEMBER_ENUM(name))
|
||||||
#define EMIT_RANGE_NO ); emit_range_no(0
|
#define EMIT_RANGE_NO ); emit_range_no(0
|
||||||
#define EMIT_RANGE_PRODUCT_FLAG(type, name, value, doc) EMIT_RANGE(type, name)
|
#define EMIT_RANGE_PRODUCT_FLAG(type, name, value, doc) EMIT_RANGE(type, name)
|
||||||
#define EMIT_RANGE_DIAGNOSTIC_FLAG(type, name, value, doc) EMIT_RANGE(type, name)
|
#define EMIT_RANGE_DIAGNOSTIC_FLAG(type, name, value, doc) EMIT_RANGE(type, name)
|
||||||
|
@ -351,11 +339,11 @@ void JVMFlagRangeList::init(void) {
|
||||||
EMIT_RANGE_END
|
EMIT_RANGE_END
|
||||||
}
|
}
|
||||||
|
|
||||||
JVMFlagRange* JVMFlagRangeList::find(const char* name) {
|
JVMFlagRange* JVMFlagRangeList::find(const JVMFlag* flag) {
|
||||||
JVMFlagRange* found = NULL;
|
JVMFlagRange* found = NULL;
|
||||||
for (int i=0; i<length(); i++) {
|
for (int i=0; i<length(); i++) {
|
||||||
JVMFlagRange* range = at(i);
|
JVMFlagRange* range = at(i);
|
||||||
if (strcmp(range->name(), name) == 0) {
|
if (range->flag() == flag) {
|
||||||
found = range;
|
found = range;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -363,12 +351,12 @@ JVMFlagRange* JVMFlagRangeList::find(const char* name) {
|
||||||
return found;
|
return found;
|
||||||
}
|
}
|
||||||
|
|
||||||
void JVMFlagRangeList::print(outputStream* st, const char* name, RangeStrFunc default_range_str_func) {
|
void JVMFlagRangeList::print(outputStream* st, const JVMFlag* flag, RangeStrFunc default_range_str_func) {
|
||||||
JVMFlagRange* range = JVMFlagRangeList::find(name);
|
JVMFlagRange* range = JVMFlagRangeList::find(flag);
|
||||||
if (range != NULL) {
|
if (range != NULL) {
|
||||||
range->print(st);
|
range->print(st);
|
||||||
} else {
|
} else {
|
||||||
JVMFlagConstraint* constraint = JVMFlagConstraintList::find(name);
|
JVMFlagConstraint* constraint = JVMFlagConstraintList::find(flag);
|
||||||
if (constraint != NULL) {
|
if (constraint != NULL) {
|
||||||
assert(default_range_str_func!=NULL, "default_range_str_func must be provided");
|
assert(default_range_str_func!=NULL, "default_range_str_func must be provided");
|
||||||
st->print("%s", default_range_str_func());
|
st->print("%s", default_range_str_func());
|
||||||
|
|
|
@ -39,13 +39,14 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
class JVMFlagRange : public CHeapObj<mtArguments> {
|
class JVMFlagRange : public CHeapObj<mtArguments> {
|
||||||
private:
|
protected:
|
||||||
const char* _name;
|
const JVMFlag* const _flag;
|
||||||
public:
|
public:
|
||||||
// the "name" argument must be a string literal
|
// the "name" argument must be a string literal
|
||||||
JVMFlagRange(const char* name) { _name=name; }
|
JVMFlagRange(const JVMFlag* flag) : _flag(flag) {}
|
||||||
~JVMFlagRange() {}
|
~JVMFlagRange() {}
|
||||||
const char* name() { return _name; }
|
const JVMFlag* flag() const { return _flag; }
|
||||||
|
const char* name() const { return _flag->_name; }
|
||||||
virtual JVMFlag::Error check(bool verbose = true) { ShouldNotReachHere(); return JVMFlag::ERR_OTHER; }
|
virtual JVMFlag::Error check(bool verbose = true) { ShouldNotReachHere(); return JVMFlag::ERR_OTHER; }
|
||||||
virtual JVMFlag::Error check_int(int value, bool verbose = true) { ShouldNotReachHere(); return JVMFlag::ERR_OTHER; }
|
virtual JVMFlag::Error check_int(int value, bool verbose = true) { ShouldNotReachHere(); return JVMFlag::ERR_OTHER; }
|
||||||
virtual JVMFlag::Error check_intx(intx value, bool verbose = true) { ShouldNotReachHere(); return JVMFlag::ERR_OTHER; }
|
virtual JVMFlag::Error check_intx(intx value, bool verbose = true) { ShouldNotReachHere(); return JVMFlag::ERR_OTHER; }
|
||||||
|
@ -63,9 +64,9 @@ public:
|
||||||
static void init();
|
static void init();
|
||||||
static int length() { return (_ranges != NULL) ? _ranges->length() : 0; }
|
static int length() { return (_ranges != NULL) ? _ranges->length() : 0; }
|
||||||
static JVMFlagRange* at(int i) { return (_ranges != NULL) ? _ranges->at(i) : NULL; }
|
static JVMFlagRange* at(int i) { return (_ranges != NULL) ? _ranges->at(i) : NULL; }
|
||||||
static JVMFlagRange* find(const char* name);
|
static JVMFlagRange* find(const JVMFlag* flag);
|
||||||
static void add(JVMFlagRange* range) { _ranges->append(range); }
|
static void add(JVMFlagRange* range) { _ranges->append(range); }
|
||||||
static void print(outputStream* st, const char* name, RangeStrFunc default_range_str_func);
|
static void print(outputStream* st, const JVMFlag* flag, RangeStrFunc default_range_str_func);
|
||||||
// Check the final values of all flags for ranges.
|
// Check the final values of all flags for ranges.
|
||||||
static bool check_ranges();
|
static bool check_ranges();
|
||||||
};
|
};
|
||||||
|
|
|
@ -91,6 +91,8 @@ class JVMFlagEx : JVMFlag {
|
||||||
static bool is_cmdline(JVMFlagsEnum flag);
|
static bool is_cmdline(JVMFlagsEnum flag);
|
||||||
|
|
||||||
static void setOnCmdLine(JVMFlagsEnum flag);
|
static void setOnCmdLine(JVMFlagsEnum flag);
|
||||||
|
|
||||||
|
static JVMFlag* flag_from_enum(JVMFlagsEnum flag);
|
||||||
};
|
};
|
||||||
|
|
||||||
// Construct set functions for all flags
|
// Construct set functions for all flags
|
||||||
|
|
|
@ -331,7 +331,7 @@ static jint print_flag(AttachOperation* op, outputStream* out) {
|
||||||
out->print_cr("flag name is missing");
|
out->print_cr("flag name is missing");
|
||||||
return JNI_ERR;
|
return JNI_ERR;
|
||||||
}
|
}
|
||||||
JVMFlag* f = JVMFlag::find_flag((char*)name, strlen(name));
|
JVMFlag* f = JVMFlag::find_flag(name);
|
||||||
if (f) {
|
if (f) {
|
||||||
f->print_as_flag(out);
|
f->print_as_flag(out);
|
||||||
out->cr();
|
out->cr();
|
||||||
|
|
|
@ -50,9 +50,9 @@ class VM_DeoptimizeTheWorld : public VM_Operation {
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
static void set_bool_flag(const char* flag, bool value) {
|
static void set_bool_flag(const char* name, bool value) {
|
||||||
JVMFlag::boolAtPut((char*)flag, strlen(flag), &value,
|
JVMFlag* flag = JVMFlag::find_flag(name);
|
||||||
JVMFlag::ATTACH_ON_DEMAND);
|
JVMFlag::boolAtPut(flag, &value, JVMFlag::ATTACH_ON_DEMAND);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Enable only the "fine grained" flags. Do *not* touch
|
// Enable only the "fine grained" flags. Do *not* touch
|
||||||
|
|
|
@ -1546,7 +1546,7 @@ JVM_ENTRY(jint, jmm_GetVMGlobals(JNIEnv *env,
|
||||||
|
|
||||||
Handle sh(THREAD, s);
|
Handle sh(THREAD, s);
|
||||||
char* str = java_lang_String::as_utf8_string(s);
|
char* str = java_lang_String::as_utf8_string(s);
|
||||||
JVMFlag* flag = JVMFlag::find_flag(str, strlen(str));
|
JVMFlag* flag = JVMFlag::find_flag(str);
|
||||||
if (flag != NULL &&
|
if (flag != NULL &&
|
||||||
add_global_entry(env, sh, &globals[i], flag, THREAD)) {
|
add_global_entry(env, sh, &globals[i], flag, THREAD)) {
|
||||||
num_entries++;
|
num_entries++;
|
||||||
|
|
|
@ -38,8 +38,8 @@ static void buffer_concat(char* buffer, const char* src) {
|
||||||
strncat(buffer, src, TEMP_BUF_SIZE - 1 - strlen(buffer));
|
strncat(buffer, src, TEMP_BUF_SIZE - 1 - strlen(buffer));
|
||||||
}
|
}
|
||||||
|
|
||||||
static void print_flag_error_message_bounds(const char* name, char* buffer) {
|
static void print_flag_error_message_bounds(const JVMFlag* flag, char* buffer) {
|
||||||
JVMFlagRange* range = JVMFlagRangeList::find(name);
|
JVMFlagRange* range = JVMFlagRangeList::find(flag);
|
||||||
if (range != NULL) {
|
if (range != NULL) {
|
||||||
buffer_concat(buffer, "must have value in range ");
|
buffer_concat(buffer, "must have value in range ");
|
||||||
|
|
||||||
|
@ -59,11 +59,12 @@ static void print_flag_error_message_bounds(const char* name, char* buffer) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static void print_flag_error_message_if_needed(JVMFlag::Error error, const char* name, FormatBuffer<80>& err_msg) {
|
static void print_flag_error_message_if_needed(JVMFlag::Error error, const JVMFlag* flag, FormatBuffer<80>& err_msg) {
|
||||||
if (error == JVMFlag::SUCCESS) {
|
if (error == JVMFlag::SUCCESS) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const char* name = flag->_name;
|
||||||
char buffer[TEMP_BUF_SIZE] = {'\0'};
|
char buffer[TEMP_BUF_SIZE] = {'\0'};
|
||||||
if ((error != JVMFlag::MISSING_NAME) && (name != NULL)) {
|
if ((error != JVMFlag::MISSING_NAME) && (name != NULL)) {
|
||||||
buffer_concat(buffer, name);
|
buffer_concat(buffer, name);
|
||||||
|
@ -79,7 +80,7 @@ static void print_flag_error_message_if_needed(JVMFlag::Error error, const char*
|
||||||
case JVMFlag::NON_WRITABLE:
|
case JVMFlag::NON_WRITABLE:
|
||||||
buffer_concat(buffer, "flag is not writeable."); break;
|
buffer_concat(buffer, "flag is not writeable."); break;
|
||||||
case JVMFlag::OUT_OF_BOUNDS:
|
case JVMFlag::OUT_OF_BOUNDS:
|
||||||
if (name != NULL) { print_flag_error_message_bounds(name, buffer); } break;
|
if (name != NULL) { print_flag_error_message_bounds(flag, buffer); } break;
|
||||||
case JVMFlag::VIOLATES_CONSTRAINT:
|
case JVMFlag::VIOLATES_CONSTRAINT:
|
||||||
buffer_concat(buffer, "value violates its flag's constraint."); break;
|
buffer_concat(buffer, "value violates its flag's constraint."); break;
|
||||||
case JVMFlag::INVALID_FLAG:
|
case JVMFlag::INVALID_FLAG:
|
||||||
|
@ -107,8 +108,9 @@ JVMFlag::Error WriteableFlags::set_bool_flag(const char* name, const char* arg,
|
||||||
}
|
}
|
||||||
|
|
||||||
JVMFlag::Error WriteableFlags::set_bool_flag(const char* name, bool value, JVMFlag::Flags origin, FormatBuffer<80>& err_msg) {
|
JVMFlag::Error WriteableFlags::set_bool_flag(const char* name, bool value, JVMFlag::Flags origin, FormatBuffer<80>& err_msg) {
|
||||||
JVMFlag::Error err = JVMFlag::boolAtPut(name, &value, origin);
|
JVMFlag* flag = JVMFlag::find_flag(name);
|
||||||
print_flag_error_message_if_needed(err, name, err_msg);
|
JVMFlag::Error err = JVMFlag::boolAtPut(flag, &value, origin);
|
||||||
|
print_flag_error_message_if_needed(err, flag, err_msg);
|
||||||
return err;
|
return err;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -124,8 +126,9 @@ JVMFlag::Error WriteableFlags::set_int_flag(const char* name, const char* arg, J
|
||||||
}
|
}
|
||||||
|
|
||||||
JVMFlag::Error WriteableFlags::set_int_flag(const char* name, int value, JVMFlag::Flags origin, FormatBuffer<80>& err_msg) {
|
JVMFlag::Error WriteableFlags::set_int_flag(const char* name, int value, JVMFlag::Flags origin, FormatBuffer<80>& err_msg) {
|
||||||
JVMFlag::Error err = JVMFlag::intAtPut(name, &value, origin);
|
JVMFlag* flag = JVMFlag::find_flag(name);
|
||||||
print_flag_error_message_if_needed(err, name, err_msg);
|
JVMFlag::Error err = JVMFlag::intAtPut(flag, &value, origin);
|
||||||
|
print_flag_error_message_if_needed(err, flag, err_msg);
|
||||||
return err;
|
return err;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -141,8 +144,9 @@ JVMFlag::Error WriteableFlags::set_uint_flag(const char* name, const char* arg,
|
||||||
}
|
}
|
||||||
|
|
||||||
JVMFlag::Error WriteableFlags::set_uint_flag(const char* name, uint value, JVMFlag::Flags origin, FormatBuffer<80>& err_msg) {
|
JVMFlag::Error WriteableFlags::set_uint_flag(const char* name, uint value, JVMFlag::Flags origin, FormatBuffer<80>& err_msg) {
|
||||||
JVMFlag::Error err = JVMFlag::uintAtPut(name, &value, origin);
|
JVMFlag* flag = JVMFlag::find_flag(name);
|
||||||
print_flag_error_message_if_needed(err, name, err_msg);
|
JVMFlag::Error err = JVMFlag::uintAtPut(flag, &value, origin);
|
||||||
|
print_flag_error_message_if_needed(err, flag, err_msg);
|
||||||
return err;
|
return err;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -158,8 +162,9 @@ JVMFlag::Error WriteableFlags::set_intx_flag(const char* name, const char* arg,
|
||||||
}
|
}
|
||||||
|
|
||||||
JVMFlag::Error WriteableFlags::set_intx_flag(const char* name, intx value, JVMFlag::Flags origin, FormatBuffer<80>& err_msg) {
|
JVMFlag::Error WriteableFlags::set_intx_flag(const char* name, intx value, JVMFlag::Flags origin, FormatBuffer<80>& err_msg) {
|
||||||
JVMFlag::Error err = JVMFlag::intxAtPut(name, &value, origin);
|
JVMFlag* flag = JVMFlag::find_flag(name);
|
||||||
print_flag_error_message_if_needed(err, name, err_msg);
|
JVMFlag::Error err = JVMFlag::intxAtPut(flag, &value, origin);
|
||||||
|
print_flag_error_message_if_needed(err, flag, err_msg);
|
||||||
return err;
|
return err;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -175,8 +180,9 @@ JVMFlag::Error WriteableFlags::set_uintx_flag(const char* name, const char* arg,
|
||||||
}
|
}
|
||||||
|
|
||||||
JVMFlag::Error WriteableFlags::set_uintx_flag(const char* name, uintx value, JVMFlag::Flags origin, FormatBuffer<80>& err_msg) {
|
JVMFlag::Error WriteableFlags::set_uintx_flag(const char* name, uintx value, JVMFlag::Flags origin, FormatBuffer<80>& err_msg) {
|
||||||
JVMFlag::Error err = JVMFlag::uintxAtPut(name, &value, origin);
|
JVMFlag* flag = JVMFlag::find_flag(name);
|
||||||
print_flag_error_message_if_needed(err, name, err_msg);
|
JVMFlag::Error err = JVMFlag::uintxAtPut(flag, &value, origin);
|
||||||
|
print_flag_error_message_if_needed(err, flag, err_msg);
|
||||||
return err;
|
return err;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -192,8 +198,9 @@ JVMFlag::Error WriteableFlags::set_uint64_t_flag(const char* name, const char* a
|
||||||
}
|
}
|
||||||
|
|
||||||
JVMFlag::Error WriteableFlags::set_uint64_t_flag(const char* name, uint64_t value, JVMFlag::Flags origin, FormatBuffer<80>& err_msg) {
|
JVMFlag::Error WriteableFlags::set_uint64_t_flag(const char* name, uint64_t value, JVMFlag::Flags origin, FormatBuffer<80>& err_msg) {
|
||||||
JVMFlag::Error err = JVMFlag::uint64_tAtPut(name, &value, origin);
|
JVMFlag* flag = JVMFlag::find_flag(name);
|
||||||
print_flag_error_message_if_needed(err, name, err_msg);
|
JVMFlag::Error err = JVMFlag::uint64_tAtPut(flag, &value, origin);
|
||||||
|
print_flag_error_message_if_needed(err, flag, err_msg);
|
||||||
return err;
|
return err;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -209,8 +216,9 @@ JVMFlag::Error WriteableFlags::set_size_t_flag(const char* name, const char* arg
|
||||||
}
|
}
|
||||||
|
|
||||||
JVMFlag::Error WriteableFlags::set_size_t_flag(const char* name, size_t value, JVMFlag::Flags origin, FormatBuffer<80>& err_msg) {
|
JVMFlag::Error WriteableFlags::set_size_t_flag(const char* name, size_t value, JVMFlag::Flags origin, FormatBuffer<80>& err_msg) {
|
||||||
JVMFlag::Error err = JVMFlag::size_tAtPut(name, &value, origin);
|
JVMFlag* flag = JVMFlag::find_flag(name);
|
||||||
print_flag_error_message_if_needed(err, name, err_msg);
|
JVMFlag::Error err = JVMFlag::size_tAtPut(flag, &value, origin);
|
||||||
|
print_flag_error_message_if_needed(err, flag, err_msg);
|
||||||
return err;
|
return err;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -226,15 +234,17 @@ JVMFlag::Error WriteableFlags::set_double_flag(const char* name, const char* arg
|
||||||
}
|
}
|
||||||
|
|
||||||
JVMFlag::Error WriteableFlags::set_double_flag(const char* name, double value, JVMFlag::Flags origin, FormatBuffer<80>& err_msg) {
|
JVMFlag::Error WriteableFlags::set_double_flag(const char* name, double value, JVMFlag::Flags origin, FormatBuffer<80>& err_msg) {
|
||||||
JVMFlag::Error err = JVMFlag::doubleAtPut(name, &value, origin);
|
JVMFlag* flag = JVMFlag::find_flag(name);
|
||||||
print_flag_error_message_if_needed(err, name, err_msg);
|
JVMFlag::Error err = JVMFlag::doubleAtPut(flag, &value, origin);
|
||||||
|
print_flag_error_message_if_needed(err, flag, err_msg);
|
||||||
return err;
|
return err;
|
||||||
}
|
}
|
||||||
|
|
||||||
// set a string global flag using value from AttachOperation
|
// set a string global flag using value from AttachOperation
|
||||||
JVMFlag::Error WriteableFlags::set_ccstr_flag(const char* name, const char* value, JVMFlag::Flags origin, FormatBuffer<80>& err_msg) {
|
JVMFlag::Error WriteableFlags::set_ccstr_flag(const char* name, const char* value, JVMFlag::Flags origin, FormatBuffer<80>& err_msg) {
|
||||||
JVMFlag::Error err = JVMFlag::ccstrAtPut((char*)name, &value, origin);
|
JVMFlag* flag = JVMFlag::find_flag(name);
|
||||||
print_flag_error_message_if_needed(err, name, err_msg);
|
JVMFlag::Error err = JVMFlag::ccstrAtPut(flag, &value, origin);
|
||||||
|
print_flag_error_message_if_needed(err, flag, err_msg);
|
||||||
return err;
|
return err;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -267,7 +277,7 @@ JVMFlag::Error WriteableFlags::set_flag(const char* name, const void* value, JVM
|
||||||
return JVMFlag::MISSING_VALUE;
|
return JVMFlag::MISSING_VALUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
JVMFlag* f = JVMFlag::find_flag((char*)name, strlen(name));
|
JVMFlag* f = JVMFlag::find_flag(name);
|
||||||
if (f) {
|
if (f) {
|
||||||
// only writeable flags are allowed to be set
|
// only writeable flags are allowed to be set
|
||||||
if (f->is_writeable()) {
|
if (f->is_writeable()) {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue