6855180: Fix classfile version check in java_crw_demo
authorohair
Fri, 26 Jun 2009 21:52:47 -0700
changeset 3067 503964947e9f
parent 3063 a3fd491f7754
child 3068 f024ac2a48d1
6855180: Fix classfile version check in java_crw_demo Reviewed-by: jjg
jdk/src/share/demo/jvmti/java_crw_demo/java_crw_demo.c
jdk/src/share/javavm/export/classfile_constants.h
--- a/jdk/src/share/demo/jvmti/java_crw_demo/java_crw_demo.c	Fri Jun 26 18:39:45 2009 -0700
+++ b/jdk/src/share/demo/jvmti/java_crw_demo/java_crw_demo.c	Fri Jun 26 21:52:47 2009 -0700
@@ -2227,7 +2227,8 @@
     CrwCpoolIndex               this_class;
     CrwCpoolIndex               super_class;
     unsigned                    magic;
-    unsigned                    classfileVersion;
+    unsigned                    classfileMajorVersion;
+    unsigned                    classfileMinorVersion;
     unsigned                    interface_count;
 
     CRW_ASSERT_CI(ci);
@@ -2258,10 +2259,12 @@
     }
 
     /* minor version number not used */
-    (void)copyU2(ci);
+    classfileMinorVersion = copyU2(ci);
     /* major version number not used */
-    classfileVersion = copyU2(ci);
-    CRW_ASSERT(ci, classfileVersion <= 50); /* Mustang class files or less */
+    classfileMajorVersion = copyU2(ci);
+    CRW_ASSERT(ci,  (classfileMajorVersion <= JVM_CLASSFILE_MAJOR_VERSION) ||
+                   ((classfileMajorVersion == JVM_CLASSFILE_MAJOR_VERSION) &&
+                    (classfileMinorVersion <= JVM_CLASSFILE_MINOR_VERSION)));
 
     cpool_setup(ci);
 
--- a/jdk/src/share/javavm/export/classfile_constants.h	Fri Jun 26 18:39:45 2009 -0700
+++ b/jdk/src/share/javavm/export/classfile_constants.h	Fri Jun 26 21:52:47 2009 -0700
@@ -30,6 +30,10 @@
 extern "C" {
 #endif
 
+/* Classfile version number for this information */
+#define JVM_CLASSFILE_MAJOR_VERSION 51
+#define JVM_CLASSFILE_MINOR_VERSION 0
+
 /* Flags */
 
 enum {