harmony-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From gshiman...@apache.org
Subject svn commit: r572698 - in /harmony/enhanced/drlvm/trunk/vm/vmcore: include/Class.h src/class_support/Class_File_Loader.cpp src/init/vm_properties.cpp
Date Tue, 04 Sep 2007 14:53:25 GMT
Author: gshimansky
Date: Tue Sep  4 07:53:24 2007
New Revision: 572698

URL: http://svn.apache.org/viewvc?rev=572698&view=rev
Log:
Enable DRLVM to accept Java6 classes 50.0. Also this commit fixes HARMONY-976


Modified:
    harmony/enhanced/drlvm/trunk/vm/vmcore/include/Class.h
    harmony/enhanced/drlvm/trunk/vm/vmcore/src/class_support/Class_File_Loader.cpp
    harmony/enhanced/drlvm/trunk/vm/vmcore/src/init/vm_properties.cpp

Modified: harmony/enhanced/drlvm/trunk/vm/vmcore/include/Class.h
URL: http://svn.apache.org/viewvc/harmony/enhanced/drlvm/trunk/vm/vmcore/include/Class.h?rev=572698&r1=572697&r2=572698&view=diff
==============================================================================
--- harmony/enhanced/drlvm/trunk/vm/vmcore/include/Class.h (original)
+++ harmony/enhanced/drlvm/trunk/vm/vmcore/include/Class.h Tue Sep  4 07:53:24 2007
@@ -35,6 +35,15 @@
 
 #include <vector>
 
+//
+// magic number, and major/minor version numbers of class file
+//
+#define CLASSFILE_MAGIC 0xCAFEBABE
+#define CLASSFILE_MAJOR_MIN 45
+// Supported class files up to this version
+#define CLASSFILE_MAJOR_MAX 50
+#define CLASSFILE_MINOR_MAX 0
+
 // forward declarations
 struct Class;
 

Modified: harmony/enhanced/drlvm/trunk/vm/vmcore/src/class_support/Class_File_Loader.cpp
URL: http://svn.apache.org/viewvc/harmony/enhanced/drlvm/trunk/vm/vmcore/src/class_support/Class_File_Loader.cpp?rev=572698&r1=572697&r2=572698&view=diff
==============================================================================
--- harmony/enhanced/drlvm/trunk/vm/vmcore/src/class_support/Class_File_Loader.cpp (original)
+++ harmony/enhanced/drlvm/trunk/vm/vmcore/src/class_support/Class_File_Loader.cpp Tue Sep
 4 07:53:24 2007
@@ -716,6 +716,7 @@
 
 //define constant for class file version 
 static const uint16 JAVA5_CLASS_FILE_VERSION = 49;
+static const uint16 JAVA6_CLASS_FILE_VERSION = 50;
 
 bool Field::parse(Global_Env& env, Class *clss, ByteReader &cfs, bool is_trusted_cl)
 {
@@ -2709,15 +2710,6 @@
 } // Class::parse_interfaces
 
 
-//
-// magic number, and major/minor version numbers of class file
-//
-#define CLASSFILE_MAGIC 0xCAFEBABE
-#define CLASSFILE_MAJOR 45
-// Supported class files up to this version
-#define CLASSFILE_MAJOR_MAX 49
-#define CLASSFILE_MINOR 3
-
 /*
  *  Parses and verifies the classfile. Format is (from JVM spec):
  *
@@ -2780,7 +2772,7 @@
         return false;
     }
     //See comment in specification 4.2 about supported versions.
-    if (!(m_version >= CLASSFILE_MAJOR
+    if (!(m_version >= CLASSFILE_MAJOR_MIN
         && m_version <= CLASSFILE_MAJOR_MAX))
     {
         REPORT_FAILED_CLASS_CLASS(m_class_loader, this, "java/lang/UnsupportedClassVersionError",
@@ -2833,13 +2825,19 @@
         REPORT_FAILED_CLASS_FORMAT(this, "interface cannot be final");
         return false;
     }
-    //not only ACC_FINAL flag is prohibited if is_interface, also ACC_SYNTHETIC and ACC_ENUM.
-    if(is_interface() && (is_synthetic() || is_enum()))
+    // not only ACC_FINAL flag is prohibited if is_interface, also
+    // ACC_SYNTHETIC and ACC_ENUM. But in Java6 there appears to be an
+    // exception to this rule, the package annotation interfaces
+    // package-info can be interfaces with synthetic flag. So the
+    // check is different for different class file versions
+    if ((m_version <= JAVA5_CLASS_FILE_VERSION && is_interface() && (is_synthetic()
|| is_enum())) ||
+        (m_version == JAVA6_CLASS_FILE_VERSION && is_interface() && is_enum()))
     {
         REPORT_FAILED_CLASS_FORMAT(this,
-        "if class is interface, no flags except ACC_ABSTRACT or ACC_PUBLIC can be set");
+            "if class is interface, no flags except ACC_ABSTRACT or ACC_PUBLIC can be set");
         return false;
     }
+
     if(is_final() && is_abstract()) {
         REPORT_FAILED_CLASS_FORMAT(this, "abstract class cannot be final");
         return false;

Modified: harmony/enhanced/drlvm/trunk/vm/vmcore/src/init/vm_properties.cpp
URL: http://svn.apache.org/viewvc/harmony/enhanced/drlvm/trunk/vm/vmcore/src/init/vm_properties.cpp?rev=572698&r1=572697&r2=572698&view=diff
==============================================================================
--- harmony/enhanced/drlvm/trunk/vm/vmcore/src/init/vm_properties.cpp (original)
+++ harmony/enhanced/drlvm/trunk/vm/vmcore/src/init/vm_properties.cpp Tue Sep  4 07:53:24
2007
@@ -157,7 +157,8 @@
     properties.set_new("java.specification.version", "1.5");
     properties.set_new("java.specification.vendor", "Sun Microsystems Inc.");
     properties.set_new("java.specification.name", "Java Platform API Specification");
-    properties.set_new("java.class.version", "49.0");
+    properties.set_new("java.class.version", EXPAND(CLASSFILE_MAJOR_MAX) "."
+        EXPAND(CLASSFILE_MINOR_MAX));
     properties.set_new("java.class.path", ".");
 
     /*



Mime
View raw message