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]

Re: Recognize obsoleted options


Aaron Luchko wrote:

The only real documentation of any of these I could find is an oreilly
book. Although the sun vm accepts all these options I don't believe
they implement them since it's obsoleted, also looking at the size of
diffs of straces of runs with and without the option there wasn't much
of a difference with the -noverify. The only mention of any of these options on the sun site I could find is
this bug report which seems to suggest none of them are implemented
http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=4337532



Actually, -noverify is still supported, even if they don't document it.


If it's easy enough it could do as an optimization, I took a glimpse at
links.cc and think it may be possible to do easily but I don't know the
code that well.



It is easy and I think we should implement it - occasionally it can come in useful when running bytecode produced by old, buggy compilers. I'm going to check in the following patch. Note that with this patch, -noverify also disables "type assertion" verification for BC-ABI compiled code.


Bryce


2005-05-12  Aaron Luchko <aluchko@redhat.com>

        * gcj.texi: Add '-verify', '-noverify', and '-verifyremote'.

2005-05-12  Aaron Luchko  <aluchko@redhat.com>

        * gij.cc (main): Recognize '-verify', '-noverify', and
        '-verifyremote'

2005-05-12  Bryce McKinlay  <mckinlay@redhat.com>

	* include/jvm.h (gcj::verifyClasses): Declare.
	* link.cc (gcj::verbose_class_flag): Moved.
	* prims.cc (gcj::verifyClasses): Define here.
	(gcj::verbose_class_flag): Move definition here.
	(_Jv_Linker::wait_for_state): Don't call verify_class
	if gcj::verifyClasses is not set.
	* gij.cc (main): Set gcj::verifyClasses when '-noverify' is given.	


Index: gcc/java/gcj.texi
===================================================================
RCS file: /cvs/gcc/gcc/gcc/java/gcj.texi,v
retrieving revision 1.85
diff -u -r1.85 gcj.texi
--- gcc/java/gcj.texi	12 May 2005 01:26:50 -0000	1.85
+++ gcc/java/gcj.texi	12 May 2005 23:27:50 -0000
@@ -1095,6 +1095,11 @@
 @item -mx=@var{number}
 Equivalent to @code{-Xmx}.
 
+@item -noverify
+Do not verify compliance of bytecode with the VM specification. In addition,
+this option disables type verification which is otherwise performed on BC-ABI
+compiled code.
+
 @item -X
 @itemx -X@var{argument}
 Supplying @code{-X} by itself will cause @code{gij} to list all the
@@ -1137,7 +1142,8 @@
 compatibility with existing application launch scripts:
 @code{-client}, @code{-server}, @code{-hotspot}, @code{-jrockit},
 @code{-agentlib}, @code{-agentpath}, @code{-debug}, @code{-d32},
-@code{-d64}, @code{-javaagent} and @code{-noclassgc}.
+@code{-d64}, @code{-javaagent}, @code{-noclassgc}, @code{-verify},
+and @code{-verifyremote}.
 
 @c man end
 
Index: libjava/include/jvm.h
===================================================================
RCS file: /cvs/gcc/gcc/libjava/include/jvm.h,v
retrieving revision 1.84
diff -u -r1.84 jvm.h
--- libjava/include/jvm.h	29 Apr 2005 18:35:36 -0000	1.84
+++ libjava/include/jvm.h	12 May 2005 23:27:50 -0000
@@ -230,6 +230,9 @@
 
   /* Print out class names as they are initialized. */
   extern bool verbose_class_flag;
+  
+  /* When true, enable the bytecode verifier and BC-ABI verification. */
+  extern bool verifyClasses;
 }
 
 // This class handles all aspects of class preparation and linking.

Index: libjava/prims.cc
===================================================================
RCS file: /cvs/gcc/gcc/libjava/prims.cc,v
retrieving revision 1.111
diff -u -r1.111 prims.cc
--- libjava/prims.cc	29 Apr 2005 18:35:27 -0000	1.111
+++ libjava/prims.cc	12 May 2005 23:27:50 -0000
@@ -953,6 +953,12 @@
   _Jv_Utf8Const *finit_name;
   
   bool runtimeInitialized = false;
+  
+  // When true, print debugging information about class loading.
+  bool verbose_class_flag;
+  
+  // When true, enable the bytecode verifier and BC-ABI type verification. 
+  bool verifyClasses = true;
 }
 
 // We accept all non-standard options accepted by Sun's java command,
Index: libjava/link.cc
===================================================================
RCS file: /cvs/gcc/gcc/libjava/link.cc,v
retrieving revision 1.14
diff -u -r1.14 link.cc
--- libjava/link.cc	29 Apr 2005 18:35:27 -0000	1.14
+++ libjava/link.cc	12 May 2005 23:27:50 -0000
@@ -44,9 +44,6 @@
 
 using namespace gcj;
 
-// When true, print debugging information about class loading.
-bool gcj::verbose_class_flag;
-
 typedef unsigned int uaddr __attribute__ ((mode (pointer)));
 
 template<typename T>
@@ -1728,7 +1725,8 @@
 
       if (state >= JV_STATE_LINKED && klass->state < JV_STATE_LINKED)
 	{
-	  verify_class (klass);
+	  if (gcj::verifyClasses)
+	    verify_class (klass);
 
 	  ensure_class_linked (klass);
 	  link_exception_table (klass);
Index: libjava/gij.cc
===================================================================
RCS file: /cvs/gcc/gcc/libjava/gij.cc,v
retrieving revision 1.27
diff -u -r1.27 gij.cc
--- libjava/gij.cc	15 Apr 2005 02:40:02 -0000	1.27
+++ libjava/gij.cc	12 May 2005 23:27:51 -0000
@@ -296,6 +296,14 @@
         nonstandard_opts_help ();
       else if (! strncmp (arg, "-X", 2))
         add_option (vm_args, arg, NULL);
+      // Obsolete options recognized for backwards-compatibility.
+      else if (! strcmp (arg, "-verify")
+               || ! strcmp (arg, "-verifyremote"))
+	continue;
+      else if (! strcmp (arg, "-noverify"))
+        {
+	  gcj::verifyClasses = false;
+	}
       else
 	{
 	  fprintf (stderr, "gij: unrecognized option -- `%s'\n", argv[i]);

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