register2.java: New file.

* testsuite/libjava.jni/register2.java: New file.
	* testsuite/libjava.jni/register2.out: New file.
	* testsuite/libjava.jni/register2.c: New file.
	* java/lang/natClass.cc (_Jv_GetClassNameUtf8): New function.
	* java/lang/Class.h (_Jv_GetClassNameUtf8): Declare.
	* jni.cc (struct NativeMethodCacheEntry): New struct.
	(nathash): Changed type.
	(hash): Updated.
	(nathash_find_slot): Likewise.
	(nathash_find): Likewise.
	(natrehash): Likewise.
	(nathash_add): Likewise.
	(_Jv_JNI_RegisterNatives): Likewise.
	(_Jv_LookupJNIMethod): Likewise.
	Idea from Juerg Lehni <juerg@scratchdisk.com>

Co-Authored-By: Bryce McKinlay <mckinlay@redhat.com>

From-SVN: r117867
This commit is contained in:
Tom Tromey 2006-10-18 23:17:04 +00:00 committed by Tom Tromey
parent 9e7fc6b946
commit e7f7d23387
7 changed files with 140 additions and 19 deletions

View file

@ -231,6 +231,7 @@ jmethodID _Jv_FromReflectedMethod (java::lang::reflect::Method *);
jmethodID _Jv_FromReflectedConstructor (java::lang::reflect::Constructor *);
jint JvNumMethods (jclass);
jmethodID JvGetFirstMethod (jclass);
_Jv_Utf8Const *_Jv_GetClassNameUtf8 (jclass);
#ifdef INTERPRETER
// Finds a desired interpreter method in the given class or NULL if not found
@ -474,6 +475,7 @@ private:
friend jmethodID (::_Jv_FromReflectedConstructor) (java::lang::reflect::Constructor *);
friend jint (::JvNumMethods) (jclass);
friend jmethodID (::JvGetFirstMethod) (jclass);
friend _Jv_Utf8Const *::_Jv_GetClassNameUtf8 (jclass);
#ifdef INTERPRETER
friend _Jv_MethodBase *(::_Jv_FindInterpreterMethod) (jclass klass,
jmethodID desired_method);

View file

@ -1259,3 +1259,11 @@ _Jv_FindInterpreterMethod (jclass klass, jmethodID desired_method)
return NULL;
}
#endif
// Return Utf8 name of a class. This function is here for code that
// can't access klass->name directly.
_Jv_Utf8Const*
_Jv_GetClassNameUtf8 (jclass klass)
{
return klass->name;
}