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]

[RFA/JVMTI] Fix a couple of thinkos


Hi,

My bad. These are probably pretty obvious to most people, but it looks like I goofed two things in JVMTI-land. First, the JVMTI namespace I introduced to jvmti-int.h for event processing must have all the members declared extern (and subsequently defined in one place).

Second, we cannot simply lock the environment list in _Jv_JVMTI_PostEvent. It would prevent another event from posting an event because the lock would still be held by the suspended thread.

Keith

ChangeLog
        * include/jvmti-int.h (JVMTI): Declare all members "extern".
        * jvmti.cc (JVMTI): Define.

        * jvmti.cc (_Jv_JVMTI_PostEvent): Don't lock the environment list.
        (check_enabled_event): Likewise.
Index: include/jvmti-int.h
===================================================================
--- include/jvmti-int.h	(revision 117594)
+++ include/jvmti-int.h	(working copy)
@@ -37,41 +37,41 @@
    False means no JVMTI environment requested that event type. */
 namespace JVMTI
 {
-  bool VMInit;
-  bool VMDeath;
-  bool ThreadStart;
-  bool ThreadEnd;
-  bool ClassFileLoadHook;
-  bool ClassLoad;
-  bool ClassPrepare;
-  bool VMStart;
-  bool Exception;
-  bool ExceptionCatch;
-  bool SingleStep;
-  bool FramePop;
-  bool Breakpoint;
-  bool FieldAccess;
-  bool FieldModification;
-  bool MethodEntry;
-  bool MethodExit;
-  bool NativeMethodBind;
-  bool CompiledMethodLoad;
-  bool CompiledMethodUnload;
-  bool DynamicCodeGenerated;
-  bool DataDumpRequest;
-  bool reserved72;
-  bool MonitorWait;
-  bool MonitorWaited;
-  bool MonitorContendedEnter;
-  bool MonitorContendedEntered;
-  bool reserved77;
-  bool reserved78;
-  bool reserved79;
-  bool reserved80;
-  bool GarbageCollectionStart;
-  bool GarbageCollectionFinish;
-  bool ObjectFree;
-  bool VMObjectAlloc;
+  extern bool VMInit;
+  extern bool VMDeath;
+  extern bool ThreadStart;
+  extern bool ThreadEnd;
+  extern bool ClassFileLoadHook;
+  extern bool ClassLoad;
+  extern bool ClassPrepare;
+  extern bool VMStart;
+  extern bool Exception;
+  extern bool ExceptionCatch;
+  extern bool SingleStep;
+  extern bool FramePop;
+  extern bool Breakpoint;
+  extern bool FieldAccess;
+  extern bool FieldModification;
+  extern bool MethodEntry;
+  extern bool MethodExit;
+  extern bool NativeMethodBind;
+  extern bool CompiledMethodLoad;
+  extern bool CompiledMethodUnload;
+  extern bool DynamicCodeGenerated;
+  extern bool DataDumpRequest;
+  extern bool reserved72;
+  extern bool MonitorWait;
+  extern bool MonitorWaited;
+  extern bool MonitorContendedEnter;
+  extern bool MonitorContendedEntered;
+  extern bool reserved77;
+  extern bool reserved78;
+  extern bool reserved79;
+  extern bool reserved80;
+  extern bool GarbageCollectionStart;
+  extern bool GarbageCollectionFinish;
+  extern bool ObjectFree;
+  extern bool VMObjectAlloc;
 };
 
 /* A macro to test whether an event should be posted to JVMTI.*/
Index: jvmti.cc
===================================================================
--- jvmti.cc	(revision 117333)
+++ jvmti.cc	(working copy)
@@ -36,6 +36,45 @@
 static void check_enabled_events (void);
 static void check_enabled_event (jvmtiEvent);
 
+namespace JVMTI
+{
+  bool VMInit = false;
+  bool VMDeath = false;
+  bool ThreadStart = false;
+  bool ThreadEnd = false;
+  bool ClassFileLoadHook = false;
+  bool ClassLoad = false;
+  bool ClassPrepare = false;
+  bool VMStart = false;
+  bool Exception = false;
+  bool ExceptionCatch = false;
+  bool SingleStep = false;
+  bool FramePop = false;
+  bool Breakpoint = false;
+  bool FieldAccess = false;
+  bool FieldModification = false;
+  bool MethodEntry = false;
+  bool MethodExit = false;
+  bool NativeMethodBind = false;
+  bool CompiledMethodLoad = false;
+  bool CompiledMethodUnload = false;
+  bool DynamicCodeGenerated = false;
+  bool DataDumpRequest = false;
+  bool reserved72 = false;
+  bool MonitorWait = false;
+  bool MonitorWaited = false;
+  bool MonitorContendedEnter = false;
+  bool MonitorContendedEntered = false;
+  bool reserved77 = false;
+  bool reserved78 = false;
+  bool reserved79 = false;
+  bool reserved80 = false;
+  bool GarbageCollectionStart = false;
+  bool GarbageCollectionFinish = false;
+  bool ObjectFree = false;
+  bool VMObjectAlloc = false;
+};
+
 extern struct JNINativeInterface _Jv_JNIFunctions;
 
 struct _Jv_rawMonitorID
@@ -820,7 +859,6 @@
 
   int index = EVENT_INDEX (type); // safe since caller checks this
 
-  JvSynchronize dummy (_envListLock);
   struct jvmti_env_list *e;
   FOREACH_ENVIRONMENT (e)
     {
@@ -1736,7 +1774,9 @@
   va_list args;
   va_start (args, event_thread);
 
-  JvSynchronize dummy (_envListLock);
+  /* Don't even think about locking the env list here. It will prevent
+     any events from being posted if some thread suspended as a result
+     of a previous event. */
   struct jvmti_env_list *e;
   FOREACH_ENVIRONMENT (e)
     {

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