[gcjx] Patch: FYI: two 1.5 fixes

Tom Tromey tromey@redhat.com
Thu Sep 15 22:12:00 GMT 2005


I'm checking this in on the gcjx branch.

We weren't emitting the 1.5 version number in class files, and we
weren't handling resolved classes in the 'ldc class' opcode
verification.

Tom

Index: ChangeLog
from  Tom Tromey  <tromey@redhat.com>

	* bytecode/classwriter.cc (write): Write 1.5 version number if
	needed.
	* bytecode/verify.cc (check_constant): Handle resolved classes as
	well.

Index: bytecode/classwriter.cc
===================================================================
RCS file: /cvs/gcc/gcc/gcjx/bytecode/Attic/classwriter.cc,v
retrieving revision 1.1.2.6
diff -u -r1.1.2.6 classwriter.cc
--- bytecode/classwriter.cc 12 Sep 2005 01:44:04 -0000 1.1.2.6
+++ bytecode/classwriter.cc 15 Sep 2005 22:10:05 -0000
@@ -181,9 +181,9 @@
     std::cout << " [writing " << outname << "]" << std::endl;
 
   writer.put4 (MAGIC);
-  // FIXME: ask the compiler what version to use.
-  writer.put2 (MINOR_1_4);
-  writer.put2 (MAJOR_1_4);
+
+  writer.put2 (target_15 ? MINOR_1_5 : MINOR_1_4);
+  writer.put2 (target_15 ? MAJOR_1_5 : MAJOR_1_4);
 
   pool = new outgoing_constant_pool (the_class, writer);
 
Index: bytecode/verify.cc
===================================================================
RCS file: /cvs/gcc/gcc/gcjx/bytecode/Attic/verify.cc,v
retrieving revision 1.1.2.9
diff -u -r1.1.2.9 verify.cc
--- bytecode/verify.cc 11 Jul 2005 16:37:08 -0000 1.1.2.9
+++ bytecode/verify.cc 15 Sep 2005 22:10:06 -0000
@@ -1967,7 +1967,8 @@
       return type (int_type);
     else if (tag == JV_CONSTANT_Float)
       return type (float_type);
-    else if (vfy_is_15 (current_method) && tag == JV_CONSTANT_Class)
+    else if (vfy_is_15 (current_method)
+	     && (tag == JV_CONSTANT_ResolvedClass || tag == JV_CONSTANT_Class))
       return type (vfy_class_type (), this);
     verify_fail ("String, int, or float constant expected", start_PC);
   }



More information about the Java-patches mailing list