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]

[RFA] _Jv_FindInterpreterMethod thinko


Hi,

This small patch rectifies a thinko in _Jv_FindInterpreterMethod by removing the check for access restrictions for a method. If the right method is found, it now return it unconditionally.

Okay?
Keith

ChangeLog
2006-09-06  Keith Seitz  <keiths@redhat.com>

        * java/lang/Class.h (_Jv_FindInterpreterMethod): Change return type
        to _Jv_MethodBase instead of _Jv_InterpMethod.
        * java/lang/natClass.cc (_Jv_FindInterpreterMethod): Likewise.
        Do not check access flags.
        Fix some minor style anomalies.

Index: java/lang/Class.h
===================================================================
--- java/lang/Class.h	(revision 116184)
+++ java/lang/Class.h	(working copy)
@@ -234,7 +234,8 @@
 
 #ifdef INTERPRETER
 // Finds a desired interpreter method in the given class or NULL if not found
-_Jv_InterpMethod* _Jv_FindInterpreterMethod (jclass, jmethodID);
+class _Jv_MethodBase;
+_Jv_MethodBase *_Jv_FindInterpreterMethod (jclass, jmethodID);
 #endif
 
 // Friend classes and functions to implement the ClassLoader
@@ -474,8 +475,8 @@
   friend jint (::JvNumMethods) (jclass);
   friend jmethodID (::JvGetFirstMethod) (jclass);
 #ifdef INTERPRETER
-  friend _Jv_InterpMethod* (::_Jv_FindInterpreterMethod) (jclass klass,
-							  jmethodID desired_method);
+  friend _Jv_MethodBase *(::_Jv_FindInterpreterMethod) (jclass klass,
+							jmethodID desired_method);
 #endif
 
   // Friends classes and functions to implement the ClassLoader
Index: java/lang/natClass.cc
===================================================================
--- java/lang/natClass.cc	(revision 116184)
+++ java/lang/natClass.cc	(working copy)
@@ -1240,25 +1240,20 @@
 }
 
 #ifdef INTERPRETER
-_Jv_InterpMethod*
+_Jv_MethodBase *
 _Jv_FindInterpreterMethod (jclass klass, jmethodID desired_method)
 {
   using namespace java::lang::reflect;
 
-  _Jv_InterpClass* iclass
-    = reinterpret_cast<_Jv_InterpClass*> (klass->aux_info);
-  _Jv_MethodBase** imethods = _Jv_GetFirstMethod (iclass);
+  _Jv_InterpClass *iclass
+    = reinterpret_cast<_Jv_InterpClass *> (klass->aux_info);
+  _Jv_MethodBase **imethods = _Jv_GetFirstMethod (iclass);
 
   for (int i = 0; i < JvNumMethods (klass); ++i)
     {
-      _Jv_MethodBase* imeth = imethods[i];
-      _Jv_ushort accflags = klass->methods[i].accflags;
-      if ((accflags & (Modifier::NATIVE | Modifier::ABSTRACT)) == 0)
-	{
-	  _Jv_InterpMethod* im = reinterpret_cast<_Jv_InterpMethod*> (imeth);
-	  if (im->get_method () == desired_method)
-	    return im;
-	}
+      _Jv_MethodBase *imeth = imethods[i];
+      if (imeth->get_method () == desired_method)
+	return imeth;
     }
 
   return NULL;

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