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]

PATCH to add -verbose:class flag


This provides a basic implementtaion of the -verbose:class
flag (available on JDK).

It is arguable that the declaration of verbose_class_flag should go
into some header file, but I don't know which is preferred.

I'll check this into mainline in a day or two, unless I hear objections.
--
	--Per Bothner
per@bothner.com   http://per.bothner.com/

2004-06-24  Per Bothner  <per@bothner.com>

	* java/lang/natClass.cc (verbose_class_flag):  New global.
	(initializeClass):  If verbose_class_flag, emit message.
	* gij.cc (main):  Set verbose_class_flag from -verbose:class flag.

Index: gij.cc
===================================================================
RCS file: /cvs/gcc/gcc/libjava/gij.cc,v
retrieving revision 1.22
diff -u -p -r1.22 gij.cc
--- gij.cc	13 Aug 2003 17:20:08 -0000	1.22
+++ gij.cc	24 Jun 2004 16:38:24 -0000
@@ -21,6 +21,8 @@ details.  */
 #include <java/lang/System.h>
 #include <java/util/Properties.h>
 
+extern bool verbose_class_flag;
+
 static void
 help ()
 {
@@ -133,6 +135,8 @@ main (int argc, const char **argv)
 	  // correct behavior.
 	  _Jv_Jar_Class_Path = argv[++i];
 	}
+      else if (! strcmp (arg, "-verbose:class"))
+	verbose_class_flag = true;
       else if (arg[1] == 'X')
 	{
 	  if (arg[2] == '\0')
Index: java/lang/natClass.cc
===================================================================
RCS file: /cvs/gcc/gcc/libjava/java/lang/natClass.cc,v
retrieving revision 1.78
diff -u -p -r1.78 natClass.cc
--- java/lang/natClass.cc	21 May 2004 16:08:50 -0000	1.78
+++ java/lang/natClass.cc	24 Jun 2004 16:38:25 -0000
@@ -59,6 +59,9 @@ details.  */
 
 #include <java-cpool.h>
 #include <java-interp.h>
+
+bool verbose_class_flag;
+
 
 
 using namespace gcj;
@@ -828,6 +831,9 @@ java::lang::Class::initializeClass (void
       throw except;
     }
 
+  if (verbose_class_flag)
+    fprintf (stderr, "[Loaded %s]\n", (const char*)(name->data));
+
   _Jv_MonitorEnter (this);
   state = JV_STATE_DONE;
   notifyAll ();

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