public inbox for java-patches@gcc.gnu.org
 help / color / mirror / Atom feed
* [RFA/JVMTI] Thread start/end notifications
@ 2007-01-16  7:14 Keith Seitz
  2007-01-16 19:44 ` Tom Tromey
  0 siblings, 1 reply; 5+ messages in thread
From: Keith Seitz @ 2007-01-16  7:14 UTC (permalink / raw)
  To: Java Patch List

[-- Attachment #1: Type: text/plain, Size: 382 bytes --]

Hi,

The attached patch adds JVMTI event notifications for thread start and 
end. I simply put them in the same places where the JVMPI notifications 
were placed.

Ok?

Keith

ChangeLog
2007-01-15  Keith Seitz  <keiths@redhat.com>

         * java/lang/natThread.cc (finish_): Add JVMTI ThreadEnd 
notification.
         (_Jv_NotifyThreadStart): Add JVMTI ThreadStart notification.

[-- Attachment #2: thread-events.patch --]
[-- Type: text/x-patch, Size: 1405 bytes --]

Index: java/lang/natThread.cc
===================================================================
--- java/lang/natThread.cc	(revision 120674)
+++ java/lang/natThread.cc	(working copy)
@@ -1,6 +1,6 @@
 // natThread.cc - Native part of Thread class.
 
-/* Copyright (C) 1998, 1999, 2000, 2001, 2002, 2005, 2006  Free Software Foundation
+/* Copyright (C) 1998, 1999, 2000, 2001, 2002, 2005, 2006, 2007  Free Software Foundation
 
    This file is part of libgcj.
 
@@ -27,6 +27,8 @@
 #include <java/lang/NullPointerException.h>
 
 #include <jni.h>
+#include <jvmti.h>
+#include "jvmti-int.h"
 
 #ifdef ENABLE_JVMPI
 #include <jvmpi.h>
@@ -215,6 +217,12 @@
   nt->park_helper.deactivate ();
   group->removeThread (this);
 
+  if (JVMTI_REQUESTED_EVENT (ThreadEnd))
+    {
+      JNIEnv *jni_env = reinterpret_cast<JNIEnv *> (nt->jni_env);
+      _Jv_JVMTI_PostEvent (JVMTI_EVENT_THREAD_END, this, jni_env);
+    }
+
 #ifdef ENABLE_JVMPI  
   if (_Jv_JVMPI_Notify_THREAD_END)
     {
@@ -253,6 +261,13 @@
 static void
 _Jv_NotifyThreadStart (java::lang::Thread* thread)
 {
+  if (JVMTI_REQUESTED_EVENT (ThreadStart))
+    {
+      natThread *nt = reinterpret_cast<natThread *> (thread->data);
+      JNIEnv *jni_env = reinterpret_cast<JNIEnv *> (nt->jni_env);
+      _Jv_JVMTI_PostEvent (JVMTI_EVENT_THREAD_START, thread, jni_env);
+    }
+
 #ifdef ENABLE_JVMPI
       if (_Jv_JVMPI_Notify_THREAD_START)
 	{

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [RFA/JVMTI] Thread start/end notifications
  2007-01-16  7:14 [RFA/JVMTI] Thread start/end notifications Keith Seitz
@ 2007-01-16 19:44 ` Tom Tromey
  2007-01-17  1:36   ` Tom Tromey
  0 siblings, 1 reply; 5+ messages in thread
From: Tom Tromey @ 2007-01-16 19:44 UTC (permalink / raw)
  To: Keith Seitz; +Cc: Java Patch List

>>>>> "Keith" == Keith Seitz <keiths@redhat.com> writes:

Keith> The attached patch adds JVMTI event notifications for thread start and
Keith> end. I simply put them in the same places where the JVMPI
Keith> notifications were placed.

Keith> Ok?

This is ok.

Keith> +      JNIEnv *jni_env = reinterpret_cast<JNIEnv *> (nt->jni_env);

I wonder why jni_env is declared as void* and not JNIEnv*.
The latter would be cleaner.

Tom

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [RFA/JVMTI] Thread start/end notifications
  2007-01-16 19:44 ` Tom Tromey
@ 2007-01-17  1:36   ` Tom Tromey
  2007-01-17 22:06     ` Keith Seitz
  2007-01-17 22:06     ` Keith Seitz
  0 siblings, 2 replies; 5+ messages in thread
From: Tom Tromey @ 2007-01-17  1:36 UTC (permalink / raw)
  To: Keith Seitz; +Cc: Java Patch List

>>>>> "Tom" == Tom Tromey <tromey@redhat.com> writes:

Tom> I wonder why jni_env is declared as void* and not JNIEnv*.
Tom> The latter would be cleaner.

I fixed this, so if you could, remove that cast before committing.
(If not, I'll fix it.)

Tom

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [RFA/JVMTI] Thread start/end notifications
  2007-01-17  1:36   ` Tom Tromey
@ 2007-01-17 22:06     ` Keith Seitz
  2007-01-17 22:06     ` Keith Seitz
  1 sibling, 0 replies; 5+ messages in thread
From: Keith Seitz @ 2007-01-17 22:06 UTC (permalink / raw)
  To: Java Patch List

Tom Tromey wrote:

> I fixed this, so if you could, remove that cast before committing.
> (If not, I'll fix it.)

Okay, finally got my build working again, and I've committed this (with 
the cast changes).

Thanks,
Keith

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [RFA/JVMTI] Thread start/end notifications
  2007-01-17  1:36   ` Tom Tromey
  2007-01-17 22:06     ` Keith Seitz
@ 2007-01-17 22:06     ` Keith Seitz
  1 sibling, 0 replies; 5+ messages in thread
From: Keith Seitz @ 2007-01-17 22:06 UTC (permalink / raw)
  To: tromey; +Cc: Java Patch List

Tom Tromey wrote:

> I fixed this, so if you could, remove that cast before committing.
> (If not, I'll fix it.)

Okay, finally got my build working again, and I've committed this (with 
the cast changes).

Thanks,
Keith

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2007-01-17 22:06 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2007-01-16  7:14 [RFA/JVMTI] Thread start/end notifications Keith Seitz
2007-01-16 19:44 ` Tom Tromey
2007-01-17  1:36   ` Tom Tromey
2007-01-17 22:06     ` Keith Seitz
2007-01-17 22:06     ` Keith Seitz

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).