This is the mail archive of the
java-patches@gcc.gnu.org
mailing list for the Java project.
[RFA] _Jv_ThreadGetData?
- From: Keith Seitz <keiths at redhat dot com>
- To: Java Patch List <java-patches at gcc dot gnu dot org>
- Date: Fri, 21 Jul 2006 07:50:39 -0700
- Subject: [RFA] _Jv_ThreadGetData?
Hi,
This patch would add a little helper function to java.lang.Thread to
allow external access to the _Jv_Thread_t contained in the Thread's
native data. This is needed to implement JVMTI and JDWP thread suspension.
As an alternative to making this data public, I could add another
wrapper for _Jv_SuspendThread and _Jv_ResumeThread (which wrap GC thread
suspension functions) to natThread.cc, but that seems like it might be
more confusing than not. In order to keep it cleaner, I would probably
rename _Jv_{Suspend,Resume}Thread to _Jv_{Suspend,Resume}GCThread and
reserve _Jv_{Suspend,Resume}Thread (Thread*) for natThread.cc
I don't know if _Jv_ThreadGetData would be useful for any other purpose.
Anyone have a preference?
Keith
ChangeLog
2006-07-21 Keith Seitz <keiths@redhat.com>
* java/lang/natThread.cc (_Jv_ThreadGetData): New function.
* Makefile.am (java/lang/Thread.h): Add friend function
_Jv_ThreadGetData.
* Makefile.in: Regenerate.
Index: Makefile.am
===================================================================
--- Makefile.am (revision 115629)
+++ Makefile.am (working copy)
@@ -380,6 +380,7 @@
java/lang/Thread.h: classpath/lib/java/lang/Thread.class
$(GCJH) -classpath '' -bootclasspath classpath/lib \
-prepend 'class _Jv_JNIEnv;' \
+ -prepend 'class _Jv_Thread_t;' \
-prepend '#define _JV_NOT_OWNER 1' \
-prepend '#define _JV_INTERRUPTED 2' \
-prepend '_Jv_JNIEnv * _Jv_GetCurrentJNIEnv ();' \
@@ -389,6 +390,7 @@
-prepend 'java::lang::Thread* _Jv_AttachCurrentThread (jstring name, java::lang::ThreadGroup* group);' \
-prepend 'java::lang::Thread* _Jv_AttachCurrentThreadAsDaemon (jstring name, java::lang::ThreadGroup* group);' \
-prepend 'jint _Jv_DetachCurrentThread ();' \
+ -prepend '_Jv_Thread_t* _Jv_ThreadGetData (java::lang::Thread* thread);' \
-friend '_Jv_JNIEnv * ::_Jv_GetCurrentJNIEnv ();' \
-friend 'void ::_Jv_SetCurrentJNIEnv (_Jv_JNIEnv *env);' \
-friend 'void ::_Jv_ThreadRun (java::lang::Thread* thread);' \
@@ -396,6 +398,7 @@
-friend 'java::lang::Thread* ::_Jv_AttachCurrentThread (jstring name, java::lang::ThreadGroup* group);' \
-friend 'java::lang::Thread* ::_Jv_AttachCurrentThreadAsDaemon (jstring name, java::lang::ThreadGroup* group);' \
-friend 'jint (::_Jv_DetachCurrentThread) ();' \
+ -friend '_Jv_Thread_t* ::_Jv_ThreadGetData (java::lang::Thread* thread);' \
java/lang/Thread
java/lang/String.h: classpath/lib/java/lang/String.class
Index: java/lang/natThread.cc
===================================================================
--- java/lang/natThread.cc (revision 115627)
+++ java/lang/natThread.cc (working copy)
@@ -318,6 +318,13 @@
thread->finish_ ();
}
+_Jv_Thread_t*
+_Jv_ThreadGetData (java::lang::Thread* thread)
+{
+ natThread* nt = (natThread*) thread->data;
+ return nt->thread;
+}
+
void
java::lang::Thread::start (void)
{