diff options
-rw-r--r-- | libjava/ChangeLog | 18 | ||||
-rw-r--r-- | libjava/gnu/classpath/jdwp/natVMVirtualMachine.cc | 12 | ||||
-rw-r--r-- | libjava/include/jvmti_md.h | 10 | ||||
-rw-r--r-- | libjava/jvmti.cc | 29 |
4 files changed, 42 insertions, 27 deletions
diff --git a/libjava/ChangeLog b/libjava/ChangeLog index 9c1e9510691..6f03ecb3292 100644 --- a/libjava/ChangeLog +++ b/libjava/ChangeLog @@ -1,3 +1,21 @@ +2007-01-29 Keith Seitz <keiths@redhat.com> + + * include/jvmti_md.h (_CLASSPATH_VM_JVMTI_TYPES_DEFINED): + Define. + [__GCJ_JNI_IMPL__]: Define our own JVMTI types when building + gcj. All jvmti object types now are defined to be their + corresponding java classes. + * jvmti.cc (_Jv_JVMTI_SuspendThread): Remove casting from + jthread to Thread*. + (_Jv_JVMTI_ResumeThread): Likewise. + (_Jv_JVMTI_InterruptThread): Likewise. + (_Jv_JVMTI_SetEventNotificationMode): Likewise. + * gnu/classpath/jdwp/natVMVirtualMachine.cc + (jdwpClassPrepareCB): Likewise. + (jdwpThreadEndCB): Likewise. + (jdwpThreadStartCB): Likewise. + (jdwpVMInitCB): Likewise. + 2007-01-28 Michele Sandri <gpointorama@gmail.com> * gnu/java/nio/channels/natFileChannelWin32.cc diff --git a/libjava/gnu/classpath/jdwp/natVMVirtualMachine.cc b/libjava/gnu/classpath/jdwp/natVMVirtualMachine.cc index 1e0806652c5..389b6cc62ae 100644 --- a/libjava/gnu/classpath/jdwp/natVMVirtualMachine.cc +++ b/libjava/gnu/classpath/jdwp/natVMVirtualMachine.cc @@ -426,7 +426,6 @@ jdwpClassPrepareCB (jvmtiEnv *env, MAYBE_UNUSED JNIEnv *jni_env, { using namespace gnu::classpath::jdwp; - Thread *t = reinterpret_cast<Thread *> (thread); jint flags = 0; jvmtiError err = env->GetClassStatus (klass, &flags); if (err != JVMTI_ERROR_NONE) @@ -444,7 +443,7 @@ jdwpClassPrepareCB (jvmtiEnv *env, MAYBE_UNUSED JNIEnv *jni_env, status |= ClassPrepareEvent::STATUS_INITIALIZED; event::ClassPrepareEvent *event - = new event::ClassPrepareEvent (t, klass, status); + = new event::ClassPrepareEvent (thread, klass, status); Jdwp::notify (event); } @@ -454,8 +453,7 @@ jdwpThreadEndCB (MAYBE_UNUSED jvmtiEnv *env, MAYBE_UNUSED JNIEnv *jni_env, { using namespace gnu::classpath::jdwp::event; - Thread *t = reinterpret_cast<Thread *> (thread); - ThreadEndEvent *e = new ThreadEndEvent (t); + ThreadEndEvent *e = new ThreadEndEvent (thread); gnu::classpath::jdwp::Jdwp::notify (e); } @@ -465,8 +463,7 @@ jdwpThreadStartCB (MAYBE_UNUSED jvmtiEnv *env, MAYBE_UNUSED JNIEnv *jni_env, { using namespace gnu::classpath::jdwp::event; - Thread *t = reinterpret_cast<Thread *> (thread); - ThreadStartEvent *e = new ThreadStartEvent (t); + ThreadStartEvent *e = new ThreadStartEvent (thread); gnu::classpath::jdwp::Jdwp::notify (e); } @@ -497,6 +494,5 @@ jdwpVMInitCB (MAYBE_UNUSED jvmtiEnv *env, MAYBE_UNUSED JNIEnv *jni_env, // Send JDWP VMInit using namespace gnu::classpath::jdwp::event; - Thread *init_thread = reinterpret_cast<Thread *> (thread); - gnu::classpath::jdwp::Jdwp::notify (new VmInitEvent (init_thread)); + gnu::classpath::jdwp::Jdwp::notify (new VmInitEvent (thread)); } diff --git a/libjava/include/jvmti_md.h b/libjava/include/jvmti_md.h index 549d42151d3..2270f3f3d16 100644 --- a/libjava/include/jvmti_md.h +++ b/libjava/include/jvmti_md.h @@ -1,5 +1,5 @@ /* jvmti_md.h - Copyright (C) 2006 Free Software Foundation, Inc. + Copyright (C) 2006, 2007 Free Software Foundation, Inc. This file is part of GNU Classpath. @@ -53,6 +53,14 @@ executable file might be covered by the GNU General Public License. */ /* One for each callback. */ \ bool enabled[EVENT_SLOTS]; +/* Redefine the standard JVMTI types to something a little more + precise than "jobject". */ +#define _CLASSPATH_VM_JVMTI_TYPES_DEFINED +typedef java::lang::Thread *jthread; +typedef java::lang::ThreadGroup *jthreadGroup; +typedef jlong jlocation; +typedef struct _Jv_rawMonitorID *jrawMonitorID; + #endif /* __GCJ_JNI_IMPL__ */ #endif /* __GCJ_JVMTI_MD_H__ */ diff --git a/libjava/jvmti.cc b/libjava/jvmti.cc index f7329841747..03eec74b4c1 100644 --- a/libjava/jvmti.cc +++ b/libjava/jvmti.cc @@ -155,12 +155,10 @@ _Jv_JVMTI_SuspendThread (MAYBE_UNUSED jvmtiEnv *env, jthread thread) using namespace java::lang; THREAD_DEFAULT_TO_CURRENT (thread); - - Thread *t = reinterpret_cast<Thread *> (thread); - THREAD_CHECK_VALID (t); - THREAD_CHECK_IS_ALIVE (t); + THREAD_CHECK_VALID (thread); + THREAD_CHECK_IS_ALIVE (thread); - _Jv_Thread_t *data = _Jv_ThreadGetData (t); + _Jv_Thread_t *data = _Jv_ThreadGetData (thread); _Jv_SuspendThread (data); return JVMTI_ERROR_NONE; } @@ -171,12 +169,10 @@ _Jv_JVMTI_ResumeThread (MAYBE_UNUSED jvmtiEnv *env, jthread thread) using namespace java::lang; THREAD_DEFAULT_TO_CURRENT (thread); + THREAD_CHECK_VALID (thread); + THREAD_CHECK_IS_ALIVE (thread); - Thread *t = reinterpret_cast<Thread *> (thread); - THREAD_CHECK_VALID (t); - THREAD_CHECK_IS_ALIVE (t); - - _Jv_Thread_t *data = _Jv_ThreadGetData (t); + _Jv_Thread_t *data = _Jv_ThreadGetData (thread); _Jv_ResumeThread (data); return JVMTI_ERROR_NONE; } @@ -191,10 +187,9 @@ _Jv_JVMTI_InterruptThread (MAYBE_UNUSED jvmtiEnv *env, jthread thread) if (thread == NULL) return JVMTI_ERROR_INVALID_THREAD; - Thread *real_thread = reinterpret_cast<Thread *> (thread); - THREAD_CHECK_VALID (real_thread); - THREAD_CHECK_IS_ALIVE (real_thread); - real_thread->interrupt(); + THREAD_CHECK_VALID (thread); + THREAD_CHECK_IS_ALIVE (thread); + thread->interrupt(); return JVMTI_ERROR_NONE; } @@ -1172,10 +1167,8 @@ _Jv_JVMTI_SetEventNotificationMode (jvmtiEnv *env, jvmtiEventMode mode, if (event_thread != NULL) { - using namespace java::lang; - Thread *t = reinterpret_cast<Thread *> (event_thread); - THREAD_CHECK_VALID (t); - THREAD_CHECK_IS_ALIVE (t); + THREAD_CHECK_VALID (event_thread); + THREAD_CHECK_IS_ALIVE (event_thread); } bool enabled; |