changeset 1388:dd20c662d463

6855180: Fix classfile version check in java_crw_demo Reviewed-by: jjg
author ohair
date Fri, 26 Jun 2009 21:52:47 -0700
parents a5f7d97c3f82
children cbb5964d97ef
files src/share/demo/jvmti/java_crw_demo/java_crw_demo.c src/share/javavm/export/classfile_constants.h
diffstat 2 files changed, 11 insertions(+), 4 deletions(-) [+]
line wrap: on
line diff
--- a/src/share/demo/jvmti/java_crw_demo/java_crw_demo.c	Fri Jun 26 18:39:45 2009 -0700
+++ b/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/src/share/javavm/export/classfile_constants.h	Fri Jun 26 18:39:45 2009 -0700
+++ b/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 {