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]

[RFC] JVMTI CLASS_PREPARE event


Hi,

If anyone was wondering when the patches were going require serious review, your wait is over. I've not generated a "proper" diff using "svn diff" for this "patch" because it is way too verbose with whitespace changes. Instead, I've simply used "diff -uw" on it. It's much more readable for purposes of this discussion.

The patch adds the JVMTI event notification for CLASS_PREPARE. This is now the third or fourth place I've put this notification (at least), and I know this is still not quite right. It's awfully close, but not perfect.

I welcome suggestions, advice, comments, etc.

Keith
--- .svn/text-base/link.cc.svn-base	2007-01-10 18:35:41.000000000 -0800
+++ link.cc	2007-01-24 13:09:11.000000000 -0800
@@ -33,6 +33,8 @@
 #include <limits.h>
 #include <java-cpool.h>
 #include <execution.h>
+#include <jvmti.h>
+#include "jvmti-int.h"
 #include <java/lang/Class.h>
 #include <java/lang/String.h>
 #include <java/lang/StringBuffer.h>
@@ -1941,6 +1943,7 @@
   if (klass->state >= state)
     return;
 
+  {
   JvSynchronize sync (klass);
 
   // This is similar to the strategy for class initialization.  If we
@@ -2027,3 +2030,15 @@
   if (klass->state == JV_STATE_ERROR)
     throw new java::lang::LinkageError;
 }
+
+  if (klass->state == JV_STATE_LINKED)
+    {
+      if (JVMTI_REQUESTED_EVENT (ClassPrepare))
+	{
+	  java::lang::Thread *thread = java::lang::Thread::currentThread ();
+	  JNIEnv *jni_env = _Jv_GetCurrentJNIEnv ();
+	  _Jv_JVMTI_PostEvent (JVMTI_EVENT_CLASS_PREPARE, thread, jni_env,
+			       klass);
+	}
+    }
+}

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