Patch: PR 8415

Tom Tromey tromey@redhat.com
Fri Nov 1 13:15:00 GMT 2002


This patch fixes PR 8415.

Generating different `throws' data in the compiler seemed like the
best option.  The interpreter already has data available in this
format, so changing to this approach means less runtime allocation
than the alternatives.  Also this approach saves some tiny amount of
space in the output (2 bytes per `throws').

I have a test case which I'll check in.

Ok to commit?

Tom

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

	* class.c (make_method_value): Put class name, not signature, into
	`throws' field.  For PR java/8415.

Index: gcc/java/class.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/java/class.c,v
retrieving revision 1.136
diff -u -r1.136 class.c
--- gcc/java/class.c 11 Oct 2002 01:28:28 -0000 1.136
+++ gcc/java/class.c 1 Nov 2002 21:12:07 -0000
@@ -1285,7 +1285,7 @@
 	     iter != NULL_TREE;
 	     iter = TREE_CHAIN (iter))
 	  {
-	    tree sig = build_java_signature (TREE_VALUE (iter));
+	    tree sig = DECL_NAME (TYPE_NAME (TREE_VALUE (iter)));
 	    tree utf8
 	      = build_utf8_ref (unmangle_classname (IDENTIFIER_POINTER (sig),
 						    IDENTIFIER_LENGTH (sig)));
Index: libjava/ChangeLog
from  Tom Tromey  <tromey@redhat.com>

	For PR java/8415:
	* java/lang/reflect/natMethod.cc (getType): Use _Jv_FindClass.
	* prims.cc (_Jv_FindClassFromSignature): Indentation fix.

Index: libjava/prims.cc
===================================================================
RCS file: /cvs/gcc/gcc/libjava/prims.cc,v
retrieving revision 1.73
diff -u -r1.73 prims.cc
--- libjava/prims.cc 24 Aug 2002 22:46:18 -0000 1.73
+++ libjava/prims.cc 1 Nov 2002 21:12:12 -0000
@@ -657,7 +657,6 @@
 	  ;
 	_Jv_Utf8Const *name = _Jv_makeUtf8Const (&sig[1], i - 1);
 	return _Jv_FindClass (name, loader);
-
       }
     case '[':
       {
Index: libjava/java/lang/reflect/natMethod.cc
===================================================================
RCS file: /cvs/gcc/gcc/libjava/java/lang/reflect/natMethod.cc,v
retrieving revision 1.29
diff -u -r1.29 natMethod.cc
--- libjava/java/lang/reflect/natMethod.cc 27 Aug 2002 23:57:17 -0000 1.29
+++ libjava/java/lang/reflect/natMethod.cc 1 Nov 2002 21:12:14 -0000
@@ -202,13 +202,12 @@
     }
 
   exception_types
-    = (JArray<jclass> *) JvNewObjectArray (count,
-					   &java::lang::Class::class$,
+    = (JArray<jclass> *) JvNewObjectArray (count, &java::lang::Class::class$,
 					   NULL);
   jclass *elts = elements (exception_types);
   for (int i = 0; i < count; ++i)
-    elts[i] = _Jv_FindClassFromSignature (method->throws[i]->data,
-					  declaringClass->getClassLoader ());
+    elts[i] = _Jv_FindClass (method->throws[i],
+			     declaringClass->getClassLoader ());
 }
 
 void



More information about the Java-patches mailing list