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
--- a/hotspot/src/cpu/sparc/vm/sharedRuntime_sparc.cpp Wed May 14 15:01:08 2008 -0700
+++ b/hotspot/src/cpu/sparc/vm/sharedRuntime_sparc.cpp Thu May 22 13:03:52 2008 -0400
@@ -2721,7 +2721,8 @@
#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;
--- a/hotspot/src/share/vm/classfile/classFileParser.cpp Wed May 14 15:01:08 2008 -0700
+++ b/hotspot/src/share/vm/classfile/classFileParser.cpp Thu May 22 13:03:52 2008 -0400
@@ -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::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));
}
--- a/hotspot/src/share/vm/runtime/java.hpp Wed May 14 15:01:08 2008 -0700
+++ b/hotspot/src/share/vm/runtime/java.hpp Thu May 22 13:03:52 2008 -0400
@@ -68,8 +68,24 @@
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 @@
}
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() {