6721093: -XX:AppendRatio=N not supported

Add mechanism to ignore unsupported flags for a set period of time

Reviewed-by: acorn, never, coleenp
This commit is contained in:
Keith McGuigan 2008-07-28 14:07:44 -04:00
parent 20dba03e99
commit 74faacc945
18 changed files with 432 additions and 158 deletions

View file

@ -563,32 +563,104 @@ void vm_shutdown_during_initialization(const char* error, const char* message) {
vm_shutdown();
}
jdk_version_info JDK_Version::_version_info = {0};
bool JDK_Version::_pre_jdk16_version = false;
int JDK_Version::_jdk_version = 0;
JDK_Version JDK_Version::_current;
void JDK_Version::initialize() {
jdk_version_info info;
assert(!_current.is_valid(), "Don't initialize twice");
void *lib_handle = os::native_java_library();
jdk_version_info_fn_t func =
CAST_TO_FN_PTR(jdk_version_info_fn_t, hpi::dll_lookup(lib_handle, "JDK_GetVersionInfo0"));
jdk_version_info_fn_t func = CAST_TO_FN_PTR(jdk_version_info_fn_t,
os::dll_lookup(lib_handle, "JDK_GetVersionInfo0"));
if (func == NULL) {
// JDK older than 1.6
_pre_jdk16_version = true;
return;
}
if (func != NULL) {
(*func)(&_version_info, sizeof(_version_info));
}
if (jdk_major_version() == 1) {
_jdk_version = jdk_minor_version();
_current._partially_initialized = true;
} else {
// If the release version string is changed to n.x.x (e.g. 7.0.0) in a future release
_jdk_version = jdk_major_version();
(*func)(&info, sizeof(info));
int major = JDK_VERSION_MAJOR(info.jdk_version);
int minor = JDK_VERSION_MINOR(info.jdk_version);
int micro = JDK_VERSION_MICRO(info.jdk_version);
int build = JDK_VERSION_BUILD(info.jdk_version);
if (major == 1 && minor > 4) {
// We represent "1.5.0" as "5.0", but 1.4.2 as itself.
major = minor;
minor = micro;
micro = 0;
}
_current = JDK_Version(major, minor, micro, info.update_version,
info.special_update_version, build,
info.thread_park_blocker == 1);
}
}
void JDK_Version::fully_initialize(
uint8_t major, uint8_t minor, uint8_t micro, uint8_t update) {
// This is only called when current is less than 1.6 and we've gotten
// far enough in the initialization to determine the exact version.
assert(major < 6, "not needed for JDK version >= 6");
assert(is_partially_initialized(), "must not initialize");
if (major < 5) {
// JDK verison sequence: 1.2.x, 1.3.x, 1.4.x, 5.0.x, 6.0.x, etc.
micro = minor;
minor = major;
major = 1;
}
_current = JDK_Version(major, minor, micro, update);
}
void JDK_Version_init() {
JDK_Version::initialize();
}
static int64_t encode_jdk_version(const JDK_Version& v) {
return
((int64_t)v.major_version() << (BitsPerByte * 5)) |
((int64_t)v.minor_version() << (BitsPerByte * 4)) |
((int64_t)v.micro_version() << (BitsPerByte * 3)) |
((int64_t)v.update_version() << (BitsPerByte * 2)) |
((int64_t)v.special_update_version() << (BitsPerByte * 1)) |
((int64_t)v.build_number() << (BitsPerByte * 0));
}
int JDK_Version::compare(const JDK_Version& other) const {
assert(is_valid() && other.is_valid(), "Invalid version (uninitialized?)");
if (!is_partially_initialized() && other.is_partially_initialized()) {
return -(other.compare(*this)); // flip the comparators
}
assert(!other.is_partially_initialized(), "Not initialized yet");
if (is_partially_initialized()) {
assert(other.major_version() >= 6,
"Invalid JDK version comparison during initialization");
return -1;
} else {
uint64_t e = encode_jdk_version(*this);
uint64_t o = encode_jdk_version(other);
return (e > o) ? 1 : ((e == o) ? 0 : -1);
}
}
void JDK_Version::to_string(char* buffer, size_t buflen) const {
size_t index = 0;
if (!is_valid()) {
jio_snprintf(buffer, buflen, "%s", "(uninitialized)");
} else if (is_partially_initialized()) {
jio_snprintf(buffer, buflen, "%s", "(uninitialized) pre-1.6.0");
} else {
index += jio_snprintf(
&buffer[index], buflen - index, "%d.%d", _major, _minor);
if (_micro > 0) {
index += jio_snprintf(&buffer[index], buflen - index, ".%d", _micro);
}
if (_update > 0) {
index += jio_snprintf(&buffer[index], buflen - index, "_%02d", _update);
}
if (_special > 0) {
index += jio_snprintf(&buffer[index], buflen - index, "%c", _special);
}
if (_build > 0) {
index += jio_snprintf(&buffer[index], buflen - index, "-b%02d", _build);
}
}
}