harmony-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ge...@apache.org
Subject svn commit: r448645 - in /incubator/harmony/enhanced/drlvm/trunk/vm: thread/src/thread_java_iterator.c thread/src/thread_native_basic.c vmcore/src/jvmti/jvmti_thread.cpp vmcore/src/jvmti/jvmti_thread_group.cpp
Date Thu, 21 Sep 2006 19:39:28 GMT
Author: geirm
Date: Thu Sep 21 12:39:27 2006
New Revision: 448645

URL: http://svn.apache.org/viewvc?view=rev&rev=448645
Log:
HARMONY-1517

jvmtiGetThreadGroupChildren method returns threads which belongs not only
to the given group but to all children groups recurcively, which contradicts
to the spec.

Also jvmtiGetAllThreads method according to the spec should return only alive
ones, while currently it returns threads which was not yet run.

committed and tested on Ubuntu 6 - note that I have confidence only in c-unit and smoke. 
There are
failing tests in kernel, but they seem to always have been


Modified:
    incubator/harmony/enhanced/drlvm/trunk/vm/thread/src/thread_java_iterator.c
    incubator/harmony/enhanced/drlvm/trunk/vm/thread/src/thread_native_basic.c
    incubator/harmony/enhanced/drlvm/trunk/vm/vmcore/src/jvmti/jvmti_thread.cpp
    incubator/harmony/enhanced/drlvm/trunk/vm/vmcore/src/jvmti/jvmti_thread_group.cpp

Modified: incubator/harmony/enhanced/drlvm/trunk/vm/thread/src/thread_java_iterator.c
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/drlvm/trunk/vm/thread/src/thread_java_iterator.c?view=diff&rev=448645&r1=448644&r2=448645
==============================================================================
--- incubator/harmony/enhanced/drlvm/trunk/vm/thread/src/thread_java_iterator.c (original)
+++ incubator/harmony/enhanced/drlvm/trunk/vm/thread/src/thread_java_iterator.c Thu Sep 21
12:39:27 2006
@@ -62,18 +62,21 @@
  * @param[in] it iterator
  */
 jthread VMCALL jthread_iterator_next(jthread_iterator_t *it) {
-        hythread_t tm_native_thread;
-        jvmti_thread_t tm_java_thread;
-        tm_native_thread = hythread_iterator_next((hythread_iterator_t *)it);
-        while(tm_native_thread!=NULL)
-        {
+    hythread_t tm_native_thread;
+    jvmti_thread_t tm_java_thread;
+    tm_native_thread = hythread_iterator_next((hythread_iterator_t *)it);
+    while(tm_native_thread!=NULL)
+    {
+        if (hythread_is_alive(tm_native_thread)) {
             tm_java_thread = hythread_get_private_data(tm_native_thread);
-                if (tm_java_thread){
-                        return (jthread)tm_java_thread->thread_object;
-                }
-                tm_native_thread = hythread_iterator_next((hythread_iterator_t *)it);
+            if (tm_java_thread){
+                return (jthread)tm_java_thread->thread_object;
+            }
         }
-        return NULL;
+        tm_native_thread = hythread_iterator_next((hythread_iterator_t *)it);
+    }
+
+    return NULL;
 } 
 
 /**
@@ -89,8 +92,8 @@
         assert (status == TM_ERROR_NONE);
         res = jthread_iterator_next(&iterator);
         while(res!=NULL){
-                count++;        
-                res = jthread_iterator_next(&iterator);
+            count++;        
+            res = jthread_iterator_next(&iterator);
         }
         status=jthread_iterator_reset(&iterator);
         assert (status == TM_ERROR_NONE);

Modified: incubator/harmony/enhanced/drlvm/trunk/vm/thread/src/thread_native_basic.c
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/drlvm/trunk/vm/thread/src/thread_native_basic.c?view=diff&rev=448645&r1=448644&r2=448645
==============================================================================
--- incubator/harmony/enhanced/drlvm/trunk/vm/thread/src/thread_native_basic.c (original)
+++ incubator/harmony/enhanced/drlvm/trunk/vm/thread/src/thread_native_basic.c Thu Sep 21
12:39:27 2006
@@ -187,7 +187,7 @@
     thread->os_handle = os_handle;
     thread_set_self(thread);
     
-    thread->state = TM_THREAD_STATE_ALIVE;
+    thread->state = TM_THREAD_STATE_ALIVE | TM_THREAD_STATE_RUNNABLE;
     assert(thread == tm_self_tls);
     TRACE(("TM: native attached: native: %p ",  tm_self_tls));
 
@@ -716,7 +716,6 @@
     thread_set_self(NULL);
     status = hythread_global_unlock(NULL);
     assert (status == TM_ERROR_NONE);
- 
     return (void *)(IDATA)apr_thread_exit(thd, APR_SUCCESS);
 }
 

Modified: incubator/harmony/enhanced/drlvm/trunk/vm/vmcore/src/jvmti/jvmti_thread.cpp
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/drlvm/trunk/vm/vmcore/src/jvmti/jvmti_thread.cpp?view=diff&rev=448645&r1=448644&r2=448645
==============================================================================
--- incubator/harmony/enhanced/drlvm/trunk/vm/vmcore/src/jvmti/jvmti_thread.cpp (original)
+++ incubator/harmony/enhanced/drlvm/trunk/vm/vmcore/src/jvmti/jvmti_thread.cpp Thu Sep 21
12:39:27 2006
@@ -67,10 +67,11 @@
 
     if (NULL != thread)
     {
-        if (!is_valid_thread_object(thread))
+        if (!is_valid_thread_object(thread)) {
             return JVMTI_ERROR_INVALID_THREAD;
+        }
     }
-    else
+    else 
         thread = jthread_self();
 
     if (thread_state_ptr == NULL){
@@ -123,7 +124,8 @@
     //allocate memory
     err=jvmtiAllocate(env,java_thread_count*sizeof(jthread),(unsigned char**)&java_threads);
     if (err != JVMTI_ERROR_NONE){
-          return err; 
+        jthread_iterator_release(&iterator);
+        return err; 
     } 
     for (i=0;i<java_thread_count;i++)    {
         java_threads[i]=jthread_iterator_next(&iterator);

Modified: incubator/harmony/enhanced/drlvm/trunk/vm/vmcore/src/jvmti/jvmti_thread_group.cpp
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/drlvm/trunk/vm/vmcore/src/jvmti/jvmti_thread_group.cpp?view=diff&rev=448645&r1=448644&r2=448645
==============================================================================
--- incubator/harmony/enhanced/drlvm/trunk/vm/vmcore/src/jvmti/jvmti_thread_group.cpp (original)
+++ incubator/harmony/enhanced/drlvm/trunk/vm/vmcore/src/jvmti/jvmti_thread_group.cpp Thu
Sep 21 12:39:27 2006
@@ -195,8 +195,8 @@
 
     jclass cll = struct_Class_to_java_lang_Class_Handle(VM_Global_State::loader_env->java_lang_Thread_Class);
     jobjectArray jt = jvmti_test_jenv -> NewObjectArray(10, cll, 0);
-    id = jvmti_test_jenv -> GetMethodID(cl, "enumerate","([Ljava/lang/Thread;)I");
-    cc = jvmti_test_jenv -> CallIntMethod (group, id, jt);
+    id = jvmti_test_jenv -> GetMethodID(cl, "enumerate","([Ljava/lang/Thread;Z)I");
+    cc = jvmti_test_jenv -> CallIntMethod (group, id, jt, JNI_FALSE);
     jthread * threads = NULL;
     jvmti_error = _allocate(sizeof(jthread) * cc, (unsigned char **)&threads);
 



Mime
View raw message