Patch: FYI: minor interpreter-related cleanup

Tom Tromey tromey@redhat.com
Thu Mar 17 00:43:00 GMT 2005


I'm checking this in on the trunk and the 4.0 branch.

This removes some '#ifdef INTERPRETER' code by defining
_Jv_IsInterpretedClass unconditionally.

Note that there are still some instances of this in boehm.cc.

Tom

Index: ChangeLog
from  Tom Tromey  <tromey@redhat.com>
	* link.cc (ensure_class_linked): Removed #ifdef.
	(print_class_loaded): Likewise.
	(wait_for_state): Likewise.
	* java/lang/Class.h (_Jv_IsInterpretedClass): Always declare.
	* include/jvm.h (_Jv_IsInterpretedClass): Moved from...
	* include/java-interp.h: ... here.

Index: link.cc
===================================================================
RCS file: /cvs/gcc/gcc/libjava/link.cc,v
retrieving revision 1.10.2.1
diff -u -r1.10.2.1 link.cc
--- link.cc 7 Mar 2005 17:11:28 -0000 1.10.2.1
+++ link.cc 16 Mar 2005 23:57:48 -0000
@@ -1395,9 +1395,7 @@
       // a reference to a class we can't access.  This can validly
       // occur in an obscure case involving the InnerClasses
       // attribute.
-#ifdef INTERPRETER
       if (! _Jv_IsInterpretedClass (klass))
-#endif
 	{
 	  // Resolve class constants first, since other constant pool
 	  // entries may rely on these.
@@ -1652,11 +1650,7 @@
 
   // We use a somewhat bogus test for the ABI here.
   char *abi;
-#ifdef INTERPRETER
   if (_Jv_IsInterpretedClass (klass))
-#else
-  if (false)
-#endif
     abi = "bytecode";
   else if (klass->state == JV_STATE_PRELOADING)
     abi = "BC-compiled";
@@ -1693,10 +1687,7 @@
   if (gcj::verbose_class_flag
       && (klass->state == JV_STATE_COMPILED
 	  || klass->state == JV_STATE_PRELOADING)
-#ifdef INTERPRETER
-      && ! _Jv_IsInterpretedClass (klass)
-#endif
-      )
+      && ! _Jv_IsInterpretedClass (klass))
     print_class_loaded (klass);
 
   try
Index: java/lang/Class.h
===================================================================
RCS file: /cvs/gcc/gcc/libjava/java/lang/Class.h,v
retrieving revision 1.78
diff -u -r1.78 Class.h
--- java/lang/Class.h 17 Feb 2005 19:17:08 -0000 1.78
+++ java/lang/Class.h 16 Mar 2005 23:57:48 -0000
@@ -234,8 +234,9 @@
 			  jint flags);
 jclass _Jv_GetArrayClass (jclass klass, java::lang::ClassLoader *loader);
 
-#ifdef INTERPRETER
 jboolean _Jv_IsInterpretedClass (jclass);
+
+#ifdef INTERPRETER
 void _Jv_InitField (jobject, jclass, int);
 
 class _Jv_ClassReader;	
@@ -466,8 +467,9 @@
   friend jclass (::_Jv_GetArrayClass) (jclass klass,
 				       java::lang::ClassLoader *loader);
 
-#ifdef INTERPRETER
   friend jboolean (::_Jv_IsInterpretedClass) (jclass);
+
+#ifdef INTERPRETER
   friend void ::_Jv_InitField (jobject, jclass, int);
 
   friend class ::_Jv_ClassReader;	
Index: include/jvm.h
===================================================================
RCS file: /cvs/gcc/gcc/libjava/include/jvm.h,v
retrieving revision 1.77.2.1
diff -u -r1.77.2.1 jvm.h
--- include/jvm.h 7 Mar 2005 17:11:28 -0000 1.77.2.1
+++ include/jvm.h 16 Mar 2005 23:57:48 -0000
@@ -586,4 +586,13 @@
 	  || value == (GCJ_VERSION + GCJ_BINARYCOMPAT_ADDITION));
 }
 
+// It makes the source cleaner if we simply always define this
+// function.  If the interpreter is not built, it will never return
+// 'true'.
+extern inline jboolean
+_Jv_IsInterpretedClass (jclass c)
+{
+  return (c->accflags & java::lang::reflect::Modifier::INTERPRETED) != 0;
+}
+
 #endif /* __JAVA_JVM_H__ */
Index: include/java-interp.h
===================================================================
RCS file: /cvs/gcc/gcc/libjava/include/java-interp.h,v
retrieving revision 1.27
diff -u -r1.27 java-interp.h
--- include/java-interp.h 27 Nov 2004 12:37:32 -0000 1.27
+++ include/java-interp.h 16 Mar 2005 23:57:48 -0000
@@ -1,6 +1,6 @@
 // java-interp.h - Header file for the bytecode interpreter.  -*- c++ -*-
 
-/* Copyright (C) 1999, 2000, 2001, 2002, 2003, 2004  Free Software Foundation
+/* Copyright (C) 1999, 2000, 2001, 2002, 2003, 2004, 2005  Free Software Foundation
 
    This file is part of libgcj.
 
@@ -27,12 +27,6 @@
 #include <ffi.h>
 }
 
-extern inline jboolean
-_Jv_IsInterpretedClass (jclass c)
-{
-  return (c->accflags & java::lang::reflect::Modifier::INTERPRETED) != 0;
-}
-
 struct _Jv_ResolvedMethod;
 
 void _Jv_InitInterpreter ();



More information about the Java-patches mailing list