This is the mail archive of the java-patches@gcc.gnu.org mailing list for the Java project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[ABI] Compile fix and debug_link flag


I had to make a few changes to natClass.cc so it would compile on my FC1 system. I also renamed the "foobar" flag to "debug_link" for printing out debug information. Hopefully we can extend this more in the future - it would be nice to have some command line debugging options to print out class metadata and linking tables.

Checking this in to the abi branch.

Bryce

2004-04-20  Bryce McKinlay  <mckinlay@redhat.com>

	* java/lang/Class.h (_Jv_LinkSymbolTable): Remove second arg.
	* java/lang/natClass.cc (debug_link): New static field.
	(_Jv_LinkSymbolTable): Print debugging info if debug_link is set.

Index: java/lang/Class.h
===================================================================
RCS file: /cvs/gcc/gcc/libjava/java/lang/Class.h,v
retrieving revision 1.63.12.1
diff -u -r1.63.12.1 Class.h
--- java/lang/Class.h	16 Apr 2004 12:49:55 -0000	1.63.12.1
+++ java/lang/Class.h	20 Apr 2004 20:59:46 -0000
@@ -14,7 +14,6 @@
 
 #pragma interface
 
-#include <cstddef>
 #include <java/lang/Object.h>
 #include <java/lang/String.h>
 #include <java/net/URL.h>
@@ -368,7 +367,7 @@
   friend jstring _Jv_GetMethodString(jclass, _Jv_Utf8Const *);
   friend jshort _Jv_AppendPartialITable (jclass, jclass, void **, jshort);
   friend jshort _Jv_FindIIndex (jclass *, jshort *, jshort);
-  friend void _Jv_LinkSymbolTable (jclass, const char* foo=NULL);
+  friend void _Jv_LinkSymbolTable (jclass);
   friend void _Jv_LayoutVTableMethods (jclass klass);
   friend void _Jv_SetVTableEntries (jclass, _Jv_VTable *, jboolean *);
   friend void _Jv_MakeVTable (jclass);
Index: java/lang/natClass.cc
===================================================================
RCS file: /cvs/gcc/gcc/libjava/java/lang/natClass.cc,v
retrieving revision 1.75.2.1
diff -u -r1.75.2.1 natClass.cc
--- java/lang/natClass.cc	16 Apr 2004 12:49:54 -0000	1.75.2.1
+++ java/lang/natClass.cc	20 Apr 2004 20:59:46 -0000
@@ -876,7 +876,7 @@
     _Jv_MakeVTable(this);
 
   if (otable || atable)
-    _Jv_LinkSymbolTable(this, NULL);
+    _Jv_LinkSymbolTable(this);
 
   _Jv_linkExceptionClassTable (this);
 
@@ -1592,6 +1592,9 @@
   hack_signers = s;
 }
 
+// Set this to true to enable debugging of indirect dispatch tables/linking.
+static bool debug_link = false;
+
 // Functions for indirect dispatch (symbolic virtual binding) support.
 
 // There are two tables, atable and otable.  atable is an array of
@@ -1611,7 +1614,7 @@
 // The same otable and atable may be shared by many classes.
 
 void
-_Jv_LinkSymbolTable(jclass klass, const char *foobar)
+_Jv_LinkSymbolTable(jclass klass)
 {
   //// FIXME: Need to lock the tables ////
   
@@ -1623,8 +1626,8 @@
    
   klass->otable->state = 1;
 
-  if (foobar)
-    fprintf (stderr, "Fixing up otable in %s@%p:\n", foobar, klass);
+  if (debug_link)
+    fprintf (stderr, "Fixing up otable in %s:\n", klass->name->data);
   for (index = 0; sym = klass->otable_syms[index], sym.name != NULL; index++)
     {
       jclass target_class = _Jv_FindClass (sym.class_name, klass->loader);
@@ -1656,7 +1659,7 @@
 		      && _Jv_equalUtf8Consts (signature, meth->signature))
 		    {
 		      klass->otable->offsets[index] = i + 1;
-		      if (foobar)
+		      if (debug_link)
 			fprintf (stderr, "  offsets[%d] = %d (interface %s@%p : %s(%s))\n",
 				 index,
 				 klass->otable->offsets[index],
@@ -1699,7 +1702,7 @@
 	      klass->otable->offsets[index] = 
 		_Jv_VTable::idx_to_offset (meth->index);	      
 	    }
-	  if (foobar)
+	  if (debug_link)
 	    fprintf (stderr, "  offsets[%d] = %d (class %s@%p : %s(%s))\n",
 		     index,
 		     klass->otable->offsets[index],
@@ -1801,7 +1804,7 @@
 	      if (meth->ncode) // Maybe abstract?
 		{
 		  klass->atable->addresses[index] = meth->ncode;
-		  if (foobar)
+		  if (debug_link)
 		    fprintf (stderr, "  addresses[%d] = %p (class %s@%p : %s(%s))\n",
 			     index,
 			     &klass->atable->addresses[index],
@@ -1815,7 +1818,7 @@
 		{
 		  _Jv_Defer_Resolution (target_class, meth, 
 					&klass->atable->addresses[index]);
-		  if (foobar)
+		  if (debug_link)
 		    fprintf (stderr, "  addresses[%d] = DEFERRED@%p (class %s@%p : %s(%s))\n",
 			     index,
 			     klass->atable->addresses[index],

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]