harmony-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From gshiman...@apache.org
Subject svn commit: r519954 - in /harmony/enhanced/drlvm/trunk/vm/vmcore/src: init/vm_shutdown.cpp jvmti/jvmti_event.cpp
Date Mon, 19 Mar 2007 14:24:22 GMT
Author: gshimansky
Date: Mon Mar 19 07:24:21 2007
New Revision: 519954

URL: http://svn.apache.org/viewvc?view=rev&rev=519954
Log:
Applied HARMONY-3412 [drlvm][jvmti] Agent daemon threads are terminamted before VM_DEATH event.


Modified:
    harmony/enhanced/drlvm/trunk/vm/vmcore/src/init/vm_shutdown.cpp
    harmony/enhanced/drlvm/trunk/vm/vmcore/src/jvmti/jvmti_event.cpp

Modified: harmony/enhanced/drlvm/trunk/vm/vmcore/src/init/vm_shutdown.cpp
URL: http://svn.apache.org/viewvc/harmony/enhanced/drlvm/trunk/vm/vmcore/src/init/vm_shutdown.cpp?view=diff&rev=519954&r1=519953&r2=519954
==============================================================================
--- harmony/enhanced/drlvm/trunk/vm/vmcore/src/init/vm_shutdown.cpp (original)
+++ harmony/enhanced/drlvm/trunk/vm/vmcore/src/init/vm_shutdown.cpp Mon Mar 19 07:24:21 2007
@@ -190,19 +190,17 @@
         exn_raise_object(uncaught_exception);
     }
 
-    // Stop all (except current) java and native threads
-    // before destroying VM-wide data.
+    // Send VM_Death event and switch to DEAD phase.
+    // This should be the last event sent by VM.
+    // This event should be sent before Agent_OnUnload called.
+    jvmti_send_vm_death_event();
 
-    // Stop java threads
+    // Stop all (except current) java threads
+    // before destroying VM-wide data.
     vm_shutdown_stop_java_threads(java_vm->vm_env);
 
     // TODO: ups we don't stop native threads as well :-((
     // We are lucky! Currently, there are no such threads.
-
-    // Send VM_Death event and switch to DEAD phase.
-    // This should be the last event sent by VM.
-    // This event should be sent before Agent_OnUnload called.
-    jvmti_send_vm_death_event();
 
     // Detach current thread.
     status = jthread_detach(java_thread);

Modified: harmony/enhanced/drlvm/trunk/vm/vmcore/src/jvmti/jvmti_event.cpp
URL: http://svn.apache.org/viewvc/harmony/enhanced/drlvm/trunk/vm/vmcore/src/jvmti/jvmti_event.cpp?view=diff&rev=519954&r1=519953&r2=519954
==============================================================================
--- harmony/enhanced/drlvm/trunk/vm/vmcore/src/jvmti/jvmti_event.cpp (original)
+++ harmony/enhanced/drlvm/trunk/vm/vmcore/src/jvmti/jvmti_event.cpp Mon Mar 19 07:24:21 2007
@@ -148,6 +148,33 @@
     p_env->global_events[event_type - JVMTI_MIN_EVENT_TYPE_VAL] = false;
 }
 
+// disable all events except VM_DEATH
+static void disable_all_events(TIEnv* p_env)
+{
+    for (jvmtiEvent event_type = JVMTI_MIN_EVENT_TYPE_VAL; 
+            event_type <= JVMTI_MAX_EVENT_TYPE_VAL ; 
+            event_type = (jvmtiEvent) (event_type + 1)) {
+        // skip VM_DEATH
+        if (JVMTI_EVENT_VM_DEATH == event_type)
+            continue;
+
+        // disable environment global events
+        p_env->global_events[event_type - JVMTI_MIN_EVENT_TYPE_VAL] = false;
+
+        // disable thread specific events
+        TIEventThread* et = p_env->event_threads[event_type - JVMTI_MIN_EVENT_TYPE_VAL];
+        p_env->event_threads[event_type - JVMTI_MIN_EVENT_TYPE_VAL] = NULL;
+
+        while (NULL != et) {
+            TIEventThread* next_et = et->next;
+
+            _deallocate((unsigned char*) et);
+
+            et = next_et;
+        }
+    }
+}
+
 /**
  * Return true if event is enabled in any of TI environments even for one
  * thread.
@@ -2073,6 +2100,10 @@
     TIEnv *next_env;
     while (NULL != ti_env)
     {
+        // VM_DEATH must be the latest event.
+        // Disable all events except VM_DEATH
+        disable_all_events(ti_env);
+
         next_env = ti_env->next;
         if (ti_env->global_events[JVMTI_EVENT_VM_DEATH - JVMTI_MIN_EVENT_TYPE_VAL])
         {



Mime
View raw message