[BC] Patch: FYI: two verifier fixes

Tom Tromey tromey@redhat.com
Wed Oct 20 17:47:00 GMT 2004


I'm checking this in on the BC branch.

The new verifier didn't understand that sometimes gcj will "resolve"
constant pool entries other than strings and classes.

Also, there was a buglet in merge_refs.

Tom

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

	* verify-impl.c (merge_refs): Compare reference against iterator,
	not ref2.

	* verify-glue.c (vfy_tag): Mask off resolved flag.

Index: verify-glue.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/java/Attic/verify-glue.c,v
retrieving revision 1.1.2.7
diff -u -r1.1.2.7 verify-glue.c
--- verify-glue.c 20 Oct 2004 00:02:43 -0000 1.1.2.7
+++ verify-glue.c 20 Oct 2004 17:46:47 -0000
@@ -164,7 +164,15 @@
 int
 vfy_tag (vfy_constants *pool, int index)
 {
-  return JPOOL_TAG (pool, index);
+  int result = JPOOL_TAG (pool, index);
+  /* gcj will resolve constant pool entries other than string and
+     class references.  The verifier doesn't care about the values, so
+     we just strip off the resolved flag.  */
+  if ((result & CONSTANT_ResolvedFlag) != 0
+      && result != CONSTANT_ResolvedString
+      && result != CONSTANT_ResolvedClass)
+    result &= ~ CONSTANT_ResolvedFlag;
+  return result;
 }
 
 void
Index: verify-impl.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/java/Attic/verify-impl.c,v
retrieving revision 1.1.2.10
diff -u -r1.1.2.10 verify-impl.c
--- verify-impl.c 20 Oct 2004 00:02:43 -0000 1.1.2.10
+++ verify-impl.c 20 Oct 2004 17:46:48 -0000
@@ -369,7 +369,7 @@
       ref_intersection *iter;
       for (iter = ref2; iter != NULL; iter = iter->ref_next)
 	{
-	  if (refs_equal (ref1, ref2))
+	  if (refs_equal (ref1, iter))
 	    {
 	      add = false;
 	      break;



More information about the Java-patches mailing list