harmony-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From gshiman...@apache.org
Subject svn commit: r580383 - in /harmony/enhanced/drlvm/trunk/vm/vmcore/src/jvmti: jvmti_break_intf.cpp jvmti_thread.cpp jvmti_thread_group.cpp
Date Fri, 28 Sep 2007 15:14:53 GMT
Author: gshimansky
Date: Fri Sep 28 08:14:52 2007
New Revision: 580383

URL: http://svn.apache.org/viewvc?rev=580383&view=rev
Log:
Applied patch from HARMONY-3861
[drlvm][jvmti] DRLVM jvmti test PopFrame1 intermittently failed on Linux x86


Modified:
    harmony/enhanced/drlvm/trunk/vm/vmcore/src/jvmti/jvmti_break_intf.cpp
    harmony/enhanced/drlvm/trunk/vm/vmcore/src/jvmti/jvmti_thread.cpp
    harmony/enhanced/drlvm/trunk/vm/vmcore/src/jvmti/jvmti_thread_group.cpp

Modified: harmony/enhanced/drlvm/trunk/vm/vmcore/src/jvmti/jvmti_break_intf.cpp
URL: http://svn.apache.org/viewvc/harmony/enhanced/drlvm/trunk/vm/vmcore/src/jvmti/jvmti_break_intf.cpp?rev=580383&r1=580382&r2=580383&view=diff
==============================================================================
--- harmony/enhanced/drlvm/trunk/vm/vmcore/src/jvmti/jvmti_break_intf.cpp (original)
+++ harmony/enhanced/drlvm/trunk/vm/vmcore/src/jvmti/jvmti_break_intf.cpp Fri Sep 28 08:14:52
2007
@@ -587,7 +587,12 @@
     // inside of callbacks
     InstructionDisassembler idisasm(*bp->disasm);
 
-    for (unsigned priority = 0; priority < PRIORITY_NUMBER; priority++)
+    bool is_enabled = VM_Global_State::loader_env->TI->isLocallyEnabled();
+    // if is_enabled is false then we should continue execution without
+    // reporting breakpoint event
+    for (unsigned priority = 0;
+        is_enabled && priority < PRIORITY_NUMBER;
+        priority++)
     {
         bp = find_breakpoint(addr);
         assert(!bp || bp->addr == addr);
@@ -808,7 +813,12 @@
         << " :" << location );
 
     jbyte orig_byte = bp->saved_byte;
-    for (unsigned priority = 0; priority < PRIORITY_NUMBER; priority++)
+    bool is_enabled = VM_Global_State::loader_env->TI->isLocallyEnabled();
+    // if is_enabled is false then we should continue execution without
+    // reporting breakpoint event
+    for (unsigned priority = 0;
+        is_enabled && priority < PRIORITY_NUMBER;
+        priority++)
     {
         bp = find_breakpoint(method, location);;
         assert(bp->method == method);
@@ -1317,7 +1327,7 @@
     TRACE2("jvmti.break", "BREAKPOINT occured: " << native_location);
 
     DebugUtilsTI *ti = VM_Global_State::loader_env->TI;
-    if (!ti->isEnabled() || ti->getPhase() != JVMTI_PHASE_LIVE)
+    if (ti->getPhase() != JVMTI_PHASE_LIVE)
         return false;
 
     // Now it is necessary to set up a transition to

Modified: harmony/enhanced/drlvm/trunk/vm/vmcore/src/jvmti/jvmti_thread.cpp
URL: http://svn.apache.org/viewvc/harmony/enhanced/drlvm/trunk/vm/vmcore/src/jvmti/jvmti_thread.cpp?rev=580383&r1=580382&r2=580383&view=diff
==============================================================================
--- harmony/enhanced/drlvm/trunk/vm/vmcore/src/jvmti/jvmti_thread.cpp (original)
+++ harmony/enhanced/drlvm/trunk/vm/vmcore/src/jvmti/jvmti_thread.cpp Fri Sep 28 08:14:52
2007
@@ -499,34 +499,37 @@
     if (info_ptr == NULL)
         return JVMTI_ERROR_NULL_POINTER;
 
-    if (NULL != thread)
-    {
-        if (!is_valid_thread_object(thread))
+    if (NULL != thread) {
+        if (!is_valid_thread_object(thread)) {
             return JVMTI_ERROR_INVALID_THREAD;
-    }
-    else
+        }
+    } else {
         thread = jthread_self();
-
-    ti->setLocallyDisabled();//-----------------------------------V
+        assert(thread != NULL);
+    }
 
     jclass cl = GetObjectClass(jvmti_test_jenv, thread);
-    jmethodID id = jvmti_test_jenv -> GetMethodID(cl, "getName","()Ljava/lang/String;");
-    jstring  name = jvmti_test_jenv -> CallObjectMethod (thread, id);
-    info_ptr -> name = (char *)jvmti_test_jenv -> GetStringUTFChars (name, false);
 
-    id = jvmti_test_jenv -> GetMethodID(cl, "getPriority","()I");
-    info_ptr -> priority = jvmti_test_jenv -> CallIntMethod (thread, id);
-
-    id = jvmti_test_jenv -> GetMethodID(cl, "isDaemon","()Z");
-    info_ptr -> is_daemon = jvmti_test_jenv -> CallBooleanMethod (thread, id);
-
-    id = jvmti_test_jenv -> GetMethodID(cl, "getThreadGroup","()Ljava/lang/ThreadGroup;");
-    info_ptr -> thread_group = jvmti_test_jenv -> CallObjectMethod (thread, id);
-
-    id = jvmti_test_jenv -> GetMethodID(cl, "getContextClassLoader","()Ljava/lang/ClassLoader;");
-    info_ptr -> context_class_loader = jvmti_test_jenv -> CallObjectMethod (thread,
id);
-
-    ti->setLocallyEnabled();//------------------------------------^
+    jfieldID id = jvmti_test_jenv->GetFieldID(cl, "name", "Ljava/lang/String;");
+    assert(id != NULL); // field must exist in kernel class
+    jstring name = jvmti_test_jenv->GetObjectField(thread, id);
+    info_ptr->name = (char*)jvmti_test_jenv->GetStringUTFChars(name, false);
+
+    id = jvmti_test_jenv->GetFieldID(cl, "priority", "I");
+    assert(id != NULL); // field must exist in kernel class
+    info_ptr->priority = jvmti_test_jenv->GetIntField(thread, id);
+
+    id = jvmti_test_jenv->GetFieldID(cl, "daemon","Z");
+    assert(id != NULL); // field must exist in kernel class
+    info_ptr->is_daemon = jvmti_test_jenv->GetBooleanField(thread, id);
+
+    id = jvmti_test_jenv->GetFieldID(cl, "group","Ljava/lang/ThreadGroup;");
+    assert(id != NULL); // field must exist in kernel class
+    info_ptr->thread_group = jvmti_test_jenv->GetObjectField(thread, id);
+
+    id = jvmti_test_jenv->GetFieldID(cl, "contextClassLoader","Ljava/lang/ClassLoader;");
+    assert(id != NULL); // field must exist in kernel class
+    info_ptr->context_class_loader = jvmti_test_jenv->GetObjectField(thread, id);
 
     return JVMTI_ERROR_NONE;
 }
@@ -682,14 +685,12 @@
         return JVMTI_ERROR_NULL_POINTER;
     }
 
-    ti->setLocallyDisabled();//-----------------------------------V
-
     // Set daemon flag for the thread
     jclass thread_class = GetObjectClass(jvmti_test_jenv, thread);
     assert(thread_class);
-    jmethodID set_daemon = GetMethodID(jvmti_test_jenv, thread_class, "setDaemon", "(Z)V");
-    assert(set_daemon);
-    CallVoidMethod(jvmti_test_jenv, thread, set_daemon, JNI_TRUE);
+    jfieldID is_daemon = jvmti_test_jenv->GetFieldID(thread_class, "daemon", "Z");
+    assert(is_daemon);
+    jvmti_test_jenv->SetBooleanField(thread, is_daemon, JNI_TRUE);
 
     jni_env = jthread_get_JNI_env(jthread_self());
 
@@ -702,8 +703,6 @@
     attrs.arg = arg;
 
     jthread_create_with_function(jni_env, thread, &attrs);
-
-    ti->setLocallyEnabled();//-----------------------------------^
 
     return JVMTI_ERROR_NONE;
 }

Modified: harmony/enhanced/drlvm/trunk/vm/vmcore/src/jvmti/jvmti_thread_group.cpp
URL: http://svn.apache.org/viewvc/harmony/enhanced/drlvm/trunk/vm/vmcore/src/jvmti/jvmti_thread_group.cpp?rev=580383&r1=580382&r2=580383&view=diff
==============================================================================
--- harmony/enhanced/drlvm/trunk/vm/vmcore/src/jvmti/jvmti_thread_group.cpp (original)
+++ harmony/enhanced/drlvm/trunk/vm/vmcore/src/jvmti/jvmti_thread_group.cpp Fri Sep 28 08:14:52
2007
@@ -61,26 +61,25 @@
         return JVMTI_ERROR_NULL_POINTER;
     }
 
-    ti->setLocallyDisabled();//-----------------------------------V
-
     jclass cl = struct_Class_to_java_lang_Class_Handle(VM_Global_State::loader_env->java_lang_Thread_Class);
-    jmethodID id = jvmti_test_jenv -> GetMethodID(cl,
-            "getThreadGroup","()Ljava/lang/ThreadGroup;");
-    jobject current_thread = (jobject)jthread_self();
-    jobject group = jvmti_test_jenv -> CallObjectMethod (current_thread, id);
+    jfieldID id = jvmti_test_jenv->GetFieldID(cl, "group","Ljava/lang/ThreadGroup;");
+    assert(id != NULL);
+    jthread current_thread = jthread_self();
+    jobject group = jvmti_test_jenv->GetObjectField(current_thread, id);
 
     cl = struct_Class_to_java_lang_Class_Handle(VM_Global_State::loader_env->java_lang_ThreadGroup_Class);
-    id = jvmti_test_jenv -> GetMethodID(cl,
-            "getParent","()Ljava/lang/ThreadGroup;");
-
-    jobject parent = jvmti_test_jenv -> CallObjectMethod (group, id);
-    while (parent)
-    {
-        group = parent;
-        parent = jvmti_test_jenv -> CallObjectMethod (group, id);
-    }
+    id = jvmti_test_jenv->GetFieldID(cl, "parent","Ljava/lang/ThreadGroup;");
+    assert(id != NULL);
 
-    ti->setLocallyEnabled();//-----------------------------------^
+    for(jobject parent = group; parent != NULL;
+        group = parent, parent = jvmti_test_jenv->GetObjectField(group, id))
+    {} // empty loop
+
+    //while(parent != NULL)
+    //{
+    //    group = parent;
+    //    parent = jvmti_test_jenv->GetObjectField(group, id);
+    //}
 
     jvmtiError jvmti_error = _allocate(sizeof(jthreadGroup*),
             (unsigned char **)groups_ptr);
@@ -123,28 +122,27 @@
         return JVMTI_ERROR_INVALID_THREAD_GROUP;
     }
 
-    if (info_ptr == NULL)
-    {
+    if (info_ptr == NULL) {
         return JVMTI_ERROR_NULL_POINTER;
     }
 
-    ti->setLocallyDisabled();//-----------------------------------V
-
     jclass cl = GetObjectClass(jvmti_test_jenv, group);
-    jmethodID id = jvmti_test_jenv -> GetMethodID(cl, "getParent","()Ljava/lang/ThreadGroup;");
-    info_ptr -> parent = jvmti_test_jenv -> CallObjectMethod (group, id);
-
-    id = jvmti_test_jenv -> GetMethodID(cl, "getName","()Ljava/lang/String;");
-    jstring  name = jvmti_test_jenv -> CallObjectMethod (group, id);
-    info_ptr -> name = (char *)jvmti_test_jenv -> GetStringUTFChars (name, false);
-
-    id = jvmti_test_jenv -> GetMethodID(cl, "getMaxPriority","()I");
-    info_ptr -> max_priority = jvmti_test_jenv -> CallIntMethod (group, id);
-
-    id = jvmti_test_jenv -> GetMethodID(cl, "isDaemon","()Z");
-    info_ptr -> is_daemon = jvmti_test_jenv -> CallBooleanMethod (group, id);
-
-    ti->setLocallyEnabled();//-----------------------------------^
+    jfieldID id = jvmti_test_jenv->GetFieldID(cl, "parent","Ljava/lang/ThreadGroup;");
+    assert(id != NULL);
+    info_ptr->parent = jvmti_test_jenv->GetObjectField(group, id);
+
+    id = jvmti_test_jenv->GetFieldID(cl, "name","Ljava/lang/String;");
+    assert(id != NULL);
+    jstring name = jvmti_test_jenv->GetObjectField(group, id);
+    info_ptr->name = (char*)jvmti_test_jenv->GetStringUTFChars(name, false);
+
+    id = jvmti_test_jenv->GetFieldID(cl, "maxPriority","I");
+    assert(id != NULL);
+    info_ptr->max_priority = jvmti_test_jenv->GetIntField(group, id);
+
+    id = jvmti_test_jenv->GetFieldID(cl, "daemon","Z");
+    assert(id != NULL);
+    info_ptr->is_daemon = jvmti_test_jenv->GetBooleanField(group, id);
 
     return JVMTI_ERROR_NONE;
 }



Mime
View raw message