You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@harmony.apache.org by gs...@apache.org on 2006/11/02 23:16:05 UTC
svn commit: r470553 - in /incubator/harmony/enhanced/drlvm/trunk/vm/vmcore:
include/jvmti_internal.h include/version_svn_tag.h src/jvmti/jvmti.cpp
src/jvmti/jvmti_thread.cpp src/jvmti/jvmti_thread_group.cpp
Author: gshimansky
Date: Thu Nov 2 14:16:04 2006
New Revision: 470553
URL: http://svn.apache.org/viewvc?view=rev&rev=470553
Log:
Applied HARMONY-1950 [DRLVM][JVMTI] Java methods called from JVMTI functions should not generate events
Tests passed on Gentoo linux
Modified:
incubator/harmony/enhanced/drlvm/trunk/vm/vmcore/include/jvmti_internal.h
incubator/harmony/enhanced/drlvm/trunk/vm/vmcore/include/version_svn_tag.h
incubator/harmony/enhanced/drlvm/trunk/vm/vmcore/src/jvmti/jvmti.cpp
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/vmcore/include/jvmti_internal.h
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/drlvm/trunk/vm/vmcore/include/jvmti_internal.h?view=diff&rev=470553&r1=470552&r2=470553
==============================================================================
--- incubator/harmony/enhanced/drlvm/trunk/vm/vmcore/include/jvmti_internal.h (original)
+++ incubator/harmony/enhanced/drlvm/trunk/vm/vmcore/include/jvmti_internal.h Thu Nov 2 14:16:04 2006
@@ -151,6 +151,7 @@
Lock_Manager TIenvs_lock;
Lock_Manager dcList_lock;
VMBreakPoints* vm_brpt;
+ hythread_tls_key_t TL_ti_enabled; //thread local TI flag
DebugUtilsTI();
@@ -165,6 +166,10 @@
bool isEnabled();
void setEnabled();
void setDisabled();
+
+ bool isLocallyEnabled();
+ void setLocallyEnabled();
+ void setLocallyDisabled();
jvmtiPhase getPhase()
{
Modified: incubator/harmony/enhanced/drlvm/trunk/vm/vmcore/include/version_svn_tag.h
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/drlvm/trunk/vm/vmcore/include/version_svn_tag.h?view=diff&rev=470553&r1=470552&r2=470553
==============================================================================
--- incubator/harmony/enhanced/drlvm/trunk/vm/vmcore/include/version_svn_tag.h (original)
+++ incubator/harmony/enhanced/drlvm/trunk/vm/vmcore/include/version_svn_tag.h Thu Nov 2 14:16:04 2006
@@ -18,6 +18,6 @@
#ifndef _VERSION_SVN_TAG_
#define _VERSION_SVN_TAG_
-#define VERSION_SVN_TAG "468686"
+#define VERSION_SVN_TAG "470475"
#endif // _VERSION_SVN_TAG_
Modified: incubator/harmony/enhanced/drlvm/trunk/vm/vmcore/src/jvmti/jvmti.cpp
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/drlvm/trunk/vm/vmcore/src/jvmti/jvmti.cpp?view=diff&rev=470553&r1=470552&r2=470553
==============================================================================
--- incubator/harmony/enhanced/drlvm/trunk/vm/vmcore/src/jvmti/jvmti.cpp (original)
+++ incubator/harmony/enhanced/drlvm/trunk/vm/vmcore/src/jvmti/jvmti.cpp Thu Nov 2 14:16:04 2006
@@ -317,12 +317,16 @@
assert(res == JVMTI_ERROR_NONE);
vm_brpt = new VMBreakPoints();
assert(vm_brpt);
+ IDATA status = hythread_tls_alloc(&TL_ti_enabled);
+ assert(status == TM_ERROR_NONE);
+
return;
}
DebugUtilsTI::~DebugUtilsTI()
{
ReleaseNotifyLists();
+ hythread_tls_free(TL_ti_enabled);
delete vm_brpt;
return;
}
@@ -690,8 +694,22 @@
this->agents = agents;
}
+bool DebugUtilsTI::isLocallyEnabled() {
+ //default value is that ti enabled on thread level
+ return hythread_tls_get(hythread_self(), this->TL_ti_enabled) == NULL;
+}
+
+void DebugUtilsTI::setLocallyEnabled() {
+ //default value is that ti enabled on thread level
+ hythread_tls_set(hythread_self(), this->TL_ti_enabled, NULL);
+}
+
+void DebugUtilsTI::setLocallyDisabled() {
+ hythread_tls_set(hythread_self(), this->TL_ti_enabled, this);
+}
+
bool DebugUtilsTI::isEnabled() {
- return status;
+ return status && isLocallyEnabled();
}
void DebugUtilsTI::setEnabled() {
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=470553&r1=470552&r2=470553
==============================================================================
--- 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 Nov 2 14:16:04 2006
@@ -481,6 +481,7 @@
jvmtiThreadInfo* info_ptr)
{
TRACE2("jvmti.thread", "GetThreadInfo called");
+ DebugUtilsTI *ti = VM_Global_State::loader_env->TI;
SuspendEnabledChecker sec;
/*
* Check given env & current phase.
@@ -500,6 +501,8 @@
else
thread = jthread_self();
+ ti->setLocallyDisabled();//-----------------------------------V
+
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);
@@ -517,6 +520,8 @@
id = jvmti_test_jenv -> GetMethodID(cl, "getContextClassLoader","()Ljava/lang/ClassLoader;");
info_ptr -> context_class_loader = jvmti_test_jenv -> CallObjectMethod (thread, id);
+ ti->setLocallyEnabled();//------------------------------------^
+
return JVMTI_ERROR_NONE;
}
@@ -652,6 +657,7 @@
JNIEnv * jni_env;
TRACE2("jvmti.thread", "RunAgentThread called");
+ DebugUtilsTI *ti = VM_Global_State::loader_env->TI;
SuspendEnabledChecker sec;
/*
* Check given env & current phase.
@@ -670,6 +676,8 @@
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);
@@ -687,6 +695,8 @@
attrs.daemon = JNI_TRUE;
attrs.jvmti_env = env;
jthread_create_with_function(jni_env, thread, &attrs, proc, arg);
+
+ ti->setLocallyEnabled();//-----------------------------------^
return JVMTI_ERROR_NONE;
}
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=470553&r1=470552&r2=470553
==============================================================================
--- 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 Nov 2 14:16:04 2006
@@ -46,6 +46,7 @@
{
TRACE2("jvmti.thread.group", "GetTopThreadGroups called");
SuspendEnabledChecker sec;
+ DebugUtilsTI *ti = VM_Global_State::loader_env->TI;
/*
* Check given env & current phase.
*/
@@ -58,6 +59,8 @@
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;");
@@ -75,6 +78,8 @@
parent = jvmti_test_jenv -> CallObjectMethod (group, id);
}
+ ti->setLocallyEnabled();//-----------------------------------^
+
jvmtiError jvmti_error = _allocate(sizeof(jthreadGroup*),
(unsigned char **)groups_ptr);
@@ -104,6 +109,7 @@
{
TRACE2("jvmti.thread.group", "GetThreadGroupInfo called");
SuspendEnabledChecker sec;
+ DebugUtilsTI *ti = VM_Global_State::loader_env->TI;
/*
* Check given env & current phase.
*/
@@ -120,6 +126,8 @@
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);
@@ -134,6 +142,8 @@
id = jvmti_test_jenv -> GetMethodID(cl, "isDaemon","()Z");
info_ptr -> is_daemon = jvmti_test_jenv -> CallBooleanMethod (group, id);
+ ti->setLocallyEnabled();//-----------------------------------^
+
return JVMTI_ERROR_NONE;
}
@@ -154,6 +164,7 @@
{
TRACE2("jvmti.thread.group", "GetThreadGroupChildren called");
SuspendEnabledChecker sec;
+ DebugUtilsTI *ti = VM_Global_State::loader_env->TI;
/*
* Check given env & current phase.
*/
@@ -171,6 +182,8 @@
return JVMTI_ERROR_NULL_POINTER;
}
+ ti->setLocallyDisabled();//-----------------------------------V
+
jclass cl = GetObjectClass(jvmti_test_jenv, group);
jobjectArray jg = jvmti_test_jenv -> NewObjectArray(10, cl, 0);
jmethodID id = jvmti_test_jenv -> GetMethodID(cl, "enumerate","([Ljava/lang/ThreadGroup;)I");
@@ -181,6 +194,8 @@
if (JVMTI_ERROR_NONE != jvmti_error)
{
+
+ ti->setLocallyEnabled();//-----------------------------------^
return jvmti_error;
}
@@ -198,6 +213,9 @@
jobjectArray jt = jvmti_test_jenv -> NewObjectArray(10, cll, 0);
id = jvmti_test_jenv -> GetMethodID(cl, "enumerate","([Ljava/lang/Thread;Z)I");
cc = jvmti_test_jenv -> CallIntMethod (group, id, jt, JNI_FALSE);
+
+ ti->setLocallyEnabled();//-----------------------------------^
+
jthread * threads = NULL;
jvmti_error = _allocate(sizeof(jthread) * cc, (unsigned char **)&threads);