提交 d9d8f184 编写于 作者: K kamg

6705523: Fix for 6695506 will violate spec when used in JDK6

Summary: Make max classfile version number dependent on JDK version
Reviewed-by: acorn, never
上级 528bd45c
......@@ -2721,7 +2721,8 @@ nmethod *SharedRuntime::generate_dtrace_nmethod(
#endif /* ASSERT */
VMRegPair zero;
zero.set2(G0->as_VMReg());
const Register g0 = G0; // without this we get a compiler warning (why??)
zero.set2(g0->as_VMReg());
int c_arg, j_arg;
......
......@@ -44,6 +44,7 @@
// Used for backward compatibility reasons:
// - to check for javac bug fixes that happened after 1.5
// - also used as the max version when running in jdk6
#define JAVA_6_VERSION 50
......@@ -3516,9 +3517,11 @@ bool ClassFileParser::has_illegal_visibility(jint flags) {
}
bool ClassFileParser::is_supported_version(u2 major, u2 minor) {
u2 max_version = JDK_Version::is_gte_jdk17x_version() ?
JAVA_MAX_SUPPORTED_VERSION : JAVA_6_VERSION;
return (major >= JAVA_MIN_SUPPORTED_VERSION) &&
(major <= JAVA_MAX_SUPPORTED_VERSION) &&
((major != JAVA_MAX_SUPPORTED_VERSION) ||
(major <= max_version) &&
((major != max_version) ||
(minor <= JAVA_MAX_SUPPORTED_MINOR_VERSION));
}
......
......@@ -68,8 +68,24 @@ class JDK_Version : AllStatic {
static bool is_jdk13x_version() { assert(is_jdk_version_initialized(), "must have been initialized"); return _jdk_version == 3; }
static bool is_jdk14x_version() { assert(is_jdk_version_initialized(), "must have been initialized"); return _jdk_version == 4; }
static bool is_jdk15x_version() { assert(is_jdk_version_initialized(), "must have been initialized"); return _jdk_version == 5; }
static bool is_jdk16x_version() { assert(is_jdk_version_initialized(), "must have been initialized"); return _jdk_version == 6; }
static bool is_jdk17x_version() { assert(is_jdk_version_initialized(), "must have been initialized"); return _jdk_version == 7; }
static bool is_jdk16x_version() {
if (is_jdk_version_initialized()) {
return _jdk_version == 6;
} else {
assert(is_pre_jdk16_version(), "must have been initialized");
return false;
}
}
static bool is_jdk17x_version() {
if (is_jdk_version_initialized()) {
return _jdk_version == 7;
} else {
assert(is_pre_jdk16_version(), "must have been initialized");
return false;
}
}
static bool supports_thread_park_blocker() { return _version_info.thread_park_blocker; }
......@@ -85,14 +101,22 @@ class JDK_Version : AllStatic {
}
static bool is_gte_jdk16x_version() {
// Keep the semantics of this that the version number is >= 1.6
assert(is_jdk_version_initialized(), "Not initialized");
return _jdk_version >= 6;
if (is_jdk_version_initialized()) {
return _jdk_version >= 6;
} else {
assert(is_pre_jdk16_version(), "Not initialized");
return false;
}
}
static bool is_gte_jdk17x_version() {
// Keep the semantics of this that the version number is >= 1.7
assert(is_jdk_version_initialized(), "Not initialized");
return _jdk_version >= 7;
if (is_jdk_version_initialized()) {
return _jdk_version >= 7;
} else {
assert(is_pre_jdk16_version(), "Not initialized");
return false;
}
}
static bool is_jdk_version_initialized() {
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册