aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKeith Seitz <keiths@redhat.com>2006-01-23 18:44:43 +0000
committerKeith Seitz <kseitz@gcc.gnu.org>2006-01-23 18:44:43 +0000
commit8a0092c83488d75b6733d741804b5d961d5f9289 (patch)
tree851ca1946e5e0ce049a3eb008b9ffc2fd099513e
parent192a50ad41ca1582d3d7f75981681506b0615fe3 (diff)
downloadgcc-8a0092c83488d75b6733d741804b5d961d5f9289.zip
gcc-8a0092c83488d75b6733d741804b5d961d5f9289.tar.gz
gcc-8a0092c83488d75b6733d741804b5d961d5f9289.tar.bz2
Class.h (_Jv_FindInterpreterMethod): Add new declaration.
* java/lang/Class.h (_Jv_FindInterpreterMethod): Add new declaration. * java/lang/natClass.cc (_Jv_FindInterpreterMethod): New function. From-SVN: r110142
-rw-r--r--libjava/ChangeLog5
-rw-r--r--libjava/java/lang/Class.h19
-rw-r--r--libjava/java/lang/natClass.cc28
3 files changed, 47 insertions, 5 deletions
diff --git a/libjava/ChangeLog b/libjava/ChangeLog
index abe7989..d13425b 100644
--- a/libjava/ChangeLog
+++ b/libjava/ChangeLog
@@ -1,3 +1,8 @@
+2006-01-23 Keith Seitz <keiths@redhat.com>
+
+ * java/lang/Class.h (_Jv_FindInterpreterMethod): Add new declaration.
+ * java/lang/natClass.cc (_Jv_FindInterpreterMethod): New function.
+
2006-01-23 David Daney <ddaney@avtrex.com>
* configure.host (disable_dladdr): Remove variable and its
diff --git a/libjava/java/lang/Class.h b/libjava/java/lang/Class.h
index 1c14df3..fe31fa2 100644
--- a/libjava/java/lang/Class.h
+++ b/libjava/java/lang/Class.h
@@ -81,6 +81,12 @@ class _Jv_ExecutionEngine;
class _Jv_CompiledEngine;
class _Jv_InterpreterEngine;
+#ifdef INTERPRETER
+class _Jv_ClassReader;
+class _Jv_InterpClass;
+class _Jv_InterpMethod;
+#endif
+
struct _Jv_Constants
{
jint size;
@@ -217,6 +223,11 @@ jmethodID _Jv_FromReflectedConstructor (java::lang::reflect::Constructor *);
jint JvNumMethods (jclass);
jmethodID JvGetFirstMethod (jclass);
+#ifdef INTERPRETER
+// Finds a desired interpreter method in the given class or NULL if not found
+_Jv_InterpMethod* _Jv_FindInterpreterMethod (jclass, jmethodID);
+#endif
+
// Friend classes and functions to implement the ClassLoader
class java::lang::ClassLoader;
class java::lang::VMClassLoader;
@@ -256,10 +267,6 @@ void _Jv_CopyClassesToSystemLoader (gnu::gcj::runtime::SystemClassLoader *);
#ifdef INTERPRETER
void _Jv_InitField (jobject, jclass, int);
-
-class _Jv_ClassReader;
-class _Jv_InterpClass;
-class _Jv_InterpMethod;
#endif
class _Jv_StackTrace;
@@ -442,6 +449,10 @@ private:
friend jmethodID (::_Jv_FromReflectedConstructor) (java::lang::reflect::Constructor *);
friend jint (::JvNumMethods) (jclass);
friend jmethodID (::JvGetFirstMethod) (jclass);
+#ifdef INTERPRETER
+ friend _Jv_InterpMethod* (::_Jv_FindInterpreterMethod) (jclass klass,
+ jmethodID desired_method);
+#endif
// Friends classes and functions to implement the ClassLoader
friend class java::lang::ClassLoader;
diff --git a/libjava/java/lang/natClass.cc b/libjava/java/lang/natClass.cc
index bd68eb2..951bab9 100644
--- a/libjava/java/lang/natClass.cc
+++ b/libjava/java/lang/natClass.cc
@@ -1,6 +1,6 @@
// natClass.cc - Implementation of java.lang.Class native methods.
-/* Copyright (C) 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005
+/* Copyright (C) 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006
Free Software Foundation
This file is part of libgcj.
@@ -1220,3 +1220,29 @@ _Jv_getInterfaceMethod (jclass search_class, jclass &found_class, int &index,
return false;
}
+
+#ifdef INTERPRETER
+_Jv_InterpMethod*
+_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);
+
+ 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;
+ }
+ }
+
+ return NULL;
+}
+#endif