harmony-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From gshiman...@apache.org
Subject svn commit: r486680 - in /harmony/enhanced/drlvm/trunk/vm: thread/src/thread_java_basic.c vmcore/src/jvmti/jvmti_event.cpp vmcore/src/jvmti/jvmti_roots.cpp vmcore/src/jvmti/jvmti_stack.cpp vmcore/src/thread/thread_generic.cpp
Date Wed, 13 Dec 2006 15:01:40 GMT
Author: gshimansky
Date: Wed Dec 13 07:01:39 2006
New Revision: 486680

URL: http://svn.apache.org/viewvc?view=rev&rev=486680
Log:
Applied HARMONY-2377 [drlvm][jvmti] TI events are generated by VM in the incorrect order

Tests passed on Ubuntu6 x86, Windows 2003 server and SuSE9 x86_64


Modified:
    harmony/enhanced/drlvm/trunk/vm/thread/src/thread_java_basic.c
    harmony/enhanced/drlvm/trunk/vm/vmcore/src/jvmti/jvmti_event.cpp
    harmony/enhanced/drlvm/trunk/vm/vmcore/src/jvmti/jvmti_roots.cpp
    harmony/enhanced/drlvm/trunk/vm/vmcore/src/jvmti/jvmti_stack.cpp
    harmony/enhanced/drlvm/trunk/vm/vmcore/src/thread/thread_generic.cpp

Modified: harmony/enhanced/drlvm/trunk/vm/thread/src/thread_java_basic.c
URL: http://svn.apache.org/viewvc/harmony/enhanced/drlvm/trunk/vm/thread/src/thread_java_basic.c?view=diff&rev=486680&r1=486679&r2=486680
==============================================================================
--- harmony/enhanced/drlvm/trunk/vm/thread/src/thread_java_basic.c (original)
+++ harmony/enhanced/drlvm/trunk/vm/thread/src/thread_java_basic.c Wed Dec 13 07:01:39 2006
@@ -277,9 +277,6 @@
         countdown_nondaemon_threads(tm_native_thread);
     }
 
-    // Send Thread End event
-    jvmti_send_thread_start_end_event(0);
-
     // Detach from VM.
     status = vm_detach(java_thread);
     if (status != JNI_OK) return TM_ERROR_INTERNAL;

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=486680&r1=486679&r2=486680
==============================================================================
--- harmony/enhanced/drlvm/trunk/vm/vmcore/src/jvmti/jvmti_event.cpp (original)
+++ harmony/enhanced/drlvm/trunk/vm/vmcore/src/jvmti/jvmti_event.cpp Wed Dec 13 07:01:39 2006
@@ -427,7 +427,7 @@
     ti->nextPhase(JVMTI_PHASE_LIVE);
     tmn_suspend_disable();
     ObjectHandle hThread = oh_allocate_local_handle();
-    hThread->object = (Java_java_lang_Thread *)jthread_get_java_thread(hythread_self())->object;
+    hThread->object = (Java_java_lang_Thread *)jthread_self()->object;
     tmn_suspend_enable();
     // Send VM_INIT TI events
     TIEnv *ti_env = ti->getEnvironments();
@@ -1403,7 +1403,7 @@
     exn_object->object = exn;
 
     ObjectHandle hThread = oh_allocate_local_handle();
-    hThread->object = (Java_java_lang_Thread *)jthread_get_java_thread(hythread_self())->object;
+    hThread->object = (Java_java_lang_Thread *)jthread_self()->object;
 
     TIEnv *ti_env = ti->getEnvironments();
     TIEnv *next_env;
@@ -1520,7 +1520,7 @@
     // Create local handles frame
     NativeObjectHandles lhs;
     ObjectHandle hThread = oh_allocate_local_handle();
-    hThread->object = (Java_java_lang_Thread *)jthread_get_java_thread(hythread_self())->object;
+    hThread->object = (Java_java_lang_Thread *)jthread_self()->object;
     tmn_suspend_enable();
 
     TIEnv *ti_env = ti->getEnvironments();
@@ -1576,7 +1576,7 @@
 
     tmn_suspend_disable();
     ObjectHandle hThread = oh_allocate_local_handle();
-    hThread->object = (Java_java_lang_Thread *)jthread_get_java_thread(hythread_self())->object;
+    hThread->object = (Java_java_lang_Thread *)jthread_self()->object;
     tmn_suspend_enable();
 
     TIEnv *ti_env = ti->getEnvironments();
@@ -1719,7 +1719,7 @@
     ObjectHandle hClass = struct_Class_to_jclass(clss);
     tmn_suspend_disable(); // -----------vv
     ObjectHandle hThread = oh_allocate_local_handle();
-    hThread->object = (Java_java_lang_Thread *)jthread_get_java_thread(hythread_self())->object;
+    hThread->object = (Java_java_lang_Thread *)jthread_self()->object;
     tmn_suspend_enable();   // -----------^^
 
     TIEnv *ti_env = ti->getEnvironments();
@@ -1748,7 +1748,7 @@
                     TRACE2("jvmti.class.cp", "Class prepare event, class name = " <<
clss->get_name()->bytes);
                     tmn_suspend_disable(); // -------------------------------vv
                     ObjectHandle hThreadLocal = oh_allocate_local_handle();
-                    hThreadLocal->object = (Java_java_lang_Thread *)jthread_get_java_thread(hythread_self())->object;
+                    hThreadLocal->object = (Java_java_lang_Thread *)jthread_self()->object;
                     tmn_suspend_enable(); // --------------------------------^^
                     func((jvmtiEnv *)ti_env, jni_env, (jthread)hThreadLocal, (jclass)hClass);
                     oh_discard_local_handle( hThreadLocal );
@@ -1768,14 +1768,14 @@
         case JVMTI_EVENT_THREAD_START:
         case JVMTI_EVENT_THREAD_END: {
             ((jvmtiEventThreadStart)callback_func)((jvmtiEnv*)ti_env, jni_env, 
-                    jthread_get_java_thread(hythread_self()));
+                    jthread_self());
             break;
         }
         case JVMTI_EVENT_MONITOR_CONTENDED_ENTER: 
         case JVMTI_EVENT_MONITOR_CONTENDED_ENTERED: {
             jobject monitor = va_arg(args, jobject);
             ((jvmtiEventMonitorContendedEnter) callback_func)((jvmtiEnv*)ti_env, 
-                    jni_env, jthread_get_java_thread(hythread_self()), monitor);
+                    jni_env, jthread_self(), monitor);
 
             break;
         }
@@ -1784,7 +1784,7 @@
             jobject monitor = va_arg(args, jobject);
             jlong timeout   = va_arg(args, jlong);
             ((jvmtiEventMonitorWait)callback_func)((jvmtiEnv*)ti_env, jni_env, 
-                    jthread_get_java_thread(hythread_self()), monitor, timeout);
+                    jthread_self(), monitor, timeout);
             break;
         }
 
@@ -1792,7 +1792,7 @@
             jobject monitor = va_arg(args, jobject);
             jboolean is_timed_out   = va_arg(args, jint);
             ((jvmtiEventMonitorWaited)callback_func)((jvmtiEnv*)ti_env, jni_env, 
-                    jthread_get_java_thread(hythread_self()), monitor, is_timed_out);
+                    jthread_self(), monitor, is_timed_out);
             break;
         }
         default: 
@@ -1905,18 +1905,30 @@
 }
 
 void jvmti_send_wait_monitor_event(jobject monitor, jlong timeout) {
+    if (JVMTI_PHASE_LIVE != VM_Global_State::loader_env->TI->getPhase())
+        return;
+
     TRACE2("jvmti.monitor.wait", "Monitor wait event, monitor = " << monitor);
+
     process_jvmti_event(JVMTI_EVENT_MONITOR_WAIT, 1, monitor, timeout);
-        }
+}
 
 void jvmti_send_waited_monitor_event(jobject monitor, jboolean is_timed_out) {
+    if (JVMTI_PHASE_LIVE != VM_Global_State::loader_env->TI->getPhase())
+        return;
+
     TRACE2("jvmti.monitor.waited", "Monitor wait event, monitor = " << monitor);
+
     process_jvmti_event(JVMTI_EVENT_MONITOR_WAITED, 1, monitor, is_timed_out);
-    }
+}
 
 void jvmti_send_contended_enter_or_entered_monitor_event(jobject monitor,
-    int isEnter) {
+        int isEnter) {
+    if (JVMTI_PHASE_LIVE != VM_Global_State::loader_env->TI->getPhase())
+        return;
+
     TRACE2("jvmti.monitor.enter", "Monitor enter event, monitor = " << monitor <<
" is enter= " << isEnter);
+
     (isEnter)?process_jvmti_event(JVMTI_EVENT_MONITOR_CONTENDED_ENTER, 1, monitor)
             :process_jvmti_event(JVMTI_EVENT_MONITOR_CONTENDED_ENTERED, 1, monitor);
 }

Modified: harmony/enhanced/drlvm/trunk/vm/vmcore/src/jvmti/jvmti_roots.cpp
URL: http://svn.apache.org/viewvc/harmony/enhanced/drlvm/trunk/vm/vmcore/src/jvmti/jvmti_roots.cpp?view=diff&rev=486680&r1=486679&r2=486680
==============================================================================
--- harmony/enhanced/drlvm/trunk/vm/vmcore/src/jvmti/jvmti_roots.cpp (original)
+++ harmony/enhanced/drlvm/trunk/vm/vmcore/src/jvmti/jvmti_roots.cpp Wed Dec 13 07:01:39 2006
@@ -323,7 +323,7 @@
     state->root_kind = JVMTI_HEAP_ROOT_THREAD;
     state->thread_tag = ti_env->tags->get(
             (Managed_Object_Handle)
-            jthread_get_java_thread(hythread_self())->object);
+            jthread_self()->object);
 
     if (interpreter_enabled()) {
         interpreter.interpreter_ti_enumerate_thread((jvmtiEnv*)ti_env, thread);

Modified: harmony/enhanced/drlvm/trunk/vm/vmcore/src/jvmti/jvmti_stack.cpp
URL: http://svn.apache.org/viewvc/harmony/enhanced/drlvm/trunk/vm/vmcore/src/jvmti/jvmti_stack.cpp?view=diff&rev=486680&r1=486679&r2=486680
==============================================================================
--- harmony/enhanced/drlvm/trunk/vm/vmcore/src/jvmti/jvmti_stack.cpp (original)
+++ harmony/enhanced/drlvm/trunk/vm/vmcore/src/jvmti/jvmti_stack.cpp Wed Dec 13 07:01:39 2006
@@ -43,7 +43,7 @@
 jthread getCurrentThread() {
     tmn_suspend_disable();
     ObjectHandle hThread = oh_allocate_local_handle();
-    jthread thread = jthread_get_java_thread(hythread_self());
+    jthread thread = jthread_self();
     if(thread) {
         hThread->object = (Java_java_lang_Thread *)thread->object;
     } else {

Modified: harmony/enhanced/drlvm/trunk/vm/vmcore/src/thread/thread_generic.cpp
URL: http://svn.apache.org/viewvc/harmony/enhanced/drlvm/trunk/vm/vmcore/src/thread/thread_generic.cpp?view=diff&rev=486680&r1=486679&r2=486680
==============================================================================
--- harmony/enhanced/drlvm/trunk/vm/vmcore/src/thread/thread_generic.cpp (original)
+++ harmony/enhanced/drlvm/trunk/vm/vmcore/src/thread/thread_generic.cpp Wed Dec 13 07:01:39
2006
@@ -213,6 +213,9 @@
     status = run_java_detach(java_thread);
     if (status != JNI_OK) return status;
 
+    // Send Thread End event
+    jvmti_send_thread_start_end_event(0);
+
     hythread_suspend_disable();
 
     p_vm_thread = get_thread_ptr();



Mime
View raw message