Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
02110-1301, USA.
- $Id: java_lang_VMThread.c 7246 2007-01-29 18:49:05Z twisti $
-
*/
#include "config.h"
-#include "vm/types.h"
+
+#include <stdint.h>
#include "native/jni.h"
+#include "native/llni.h"
#include "native/native.h"
+
#include "native/include/java_lang_ThreadGroup.h"
#include "native/include/java_lang_Object.h" /* java_lang_Thread.h */
#include "native/include/java_lang_Throwable.h" /* java_lang_Thread.h */
#include "native/include/java_lang_VMThread.h"
#include "native/include/java_lang_Thread.h"
+
+#include "native/include/java_lang_VMThread.h"
+
#include "native/vm/java_lang_Thread.h"
-#if defined(ENABLE_THREADS)
-# include "threads/native/threads.h"
-#endif
+#include "threads/threads-common.h"
+
+#include "vmcore/utf8.h"
+
+
+/* native methods implemented by this file ************************************/
+
+static JNINativeMethod methods[] = {
+ { "countStackFrames", "()I", (void *) (intptr_t) &Java_java_lang_VMThread_countStackFrames },
+ { "start", "(J)V", (void *) (intptr_t) &Java_java_lang_VMThread_start },
+ { "interrupt", "()V", (void *) (intptr_t) &Java_java_lang_VMThread_interrupt },
+ { "isInterrupted", "()Z", (void *) (intptr_t) &Java_java_lang_VMThread_isInterrupted },
+ { "suspend", "()V", (void *) (intptr_t) &Java_java_lang_VMThread_suspend },
+ { "resume", "()V", (void *) (intptr_t) &Java_java_lang_VMThread_resume },
+ { "nativeSetPriority", "(I)V", (void *) (intptr_t) &Java_java_lang_VMThread_nativeSetPriority },
+ { "nativeStop", "(Ljava/lang/Throwable;)V", (void *) (intptr_t) &Java_java_lang_VMThread_nativeStop },
+ { "currentThread", "()Ljava/lang/Thread;", (void *) (intptr_t) &Java_java_lang_VMThread_currentThread },
+ { "yield", "()V", (void *) (intptr_t) &Java_java_lang_VMThread_yield },
+ { "interrupted", "()Z", (void *) (intptr_t) &Java_java_lang_VMThread_interrupted },
+ { "holdsLock", "(Ljava/lang/Object;)Z", (void *) (intptr_t) &Java_java_lang_VMThread_holdsLock },
+ { "getState", "()Ljava/lang/String;", (void *) (intptr_t) &Java_java_lang_VMThread_getState },
+};
+
+
+/* _Jv_java_lang_VMThread_init *************************************************
+
+ Register native functions.
+
+*******************************************************************************/
+
+void _Jv_java_lang_VMThread_init(void)
+{
+ utf *u;
+
+ u = utf_new_char("java/lang/VMThread");
+
+ native_method_register(u, methods, NATIVE_METHODS_COUNT);
+}
/*
* Method: countStackFrames
* Signature: ()I
*/
-JNIEXPORT s4 JNICALL Java_java_lang_VMThread_countStackFrames(JNIEnv *env, java_lang_VMThread *this)
+JNIEXPORT int32_t JNICALL Java_java_lang_VMThread_countStackFrames(JNIEnv *env, java_lang_VMThread *this)
{
- return _Jv_java_lang_Thread_countStackFrames(this->thread);
+ java_lang_Thread *thread;
+
+ LLNI_field_get_ref(this, thread, thread);
+
+ return _Jv_java_lang_Thread_countStackFrames(thread);
}
* Method: start
* Signature: (J)V
*/
-JNIEXPORT void JNICALL Java_java_lang_VMThread_start(JNIEnv *env, java_lang_VMThread *this, s8 stacksize)
+JNIEXPORT void JNICALL Java_java_lang_VMThread_start(JNIEnv *env, java_lang_VMThread *this, int64_t stacksize)
{
- _Jv_java_lang_Thread_start(this->thread, stacksize);
+ java_lang_Thread *thread;
+
+ LLNI_field_get_ref(this, thread, thread);
+
+ _Jv_java_lang_Thread_start(thread, stacksize);
}
*/
JNIEXPORT void JNICALL Java_java_lang_VMThread_interrupt(JNIEnv *env, java_lang_VMThread *this)
{
- _Jv_java_lang_Thread_interrupt(this->thread);
+ java_lang_Thread *thread;
+
+ LLNI_field_get_ref(this, thread, thread);
+
+ _Jv_java_lang_Thread_interrupt(thread);
}
* Method: isInterrupted
* Signature: ()Z
*/
-JNIEXPORT s4 JNICALL Java_java_lang_VMThread_isInterrupted(JNIEnv *env, java_lang_VMThread *this)
+JNIEXPORT int32_t JNICALL Java_java_lang_VMThread_isInterrupted(JNIEnv *env, java_lang_VMThread *this)
{
- return _Jv_java_lang_Thread_isInterrupted(this->thread);
+ java_lang_Thread *thread;
+
+ LLNI_field_get_ref(this, thread, thread);
+
+ return _Jv_java_lang_Thread_isInterrupted(thread);
}
*/
JNIEXPORT void JNICALL Java_java_lang_VMThread_suspend(JNIEnv *env, java_lang_VMThread *this)
{
- _Jv_java_lang_Thread_suspend(this->thread);
+ java_lang_Thread *thread;
+
+ LLNI_field_get_ref(this, thread, thread);
+
+ _Jv_java_lang_Thread_suspend(thread);
}
*/
JNIEXPORT void JNICALL Java_java_lang_VMThread_resume(JNIEnv *env, java_lang_VMThread *this)
{
- _Jv_java_lang_Thread_resume(this->thread);
+ java_lang_Thread *thread;
+
+ LLNI_field_get_ref(this, thread, thread);
+
+ _Jv_java_lang_Thread_resume(thread);
}
* Method: nativeSetPriority
* Signature: (I)V
*/
-JNIEXPORT void JNICALL Java_java_lang_VMThread_nativeSetPriority(JNIEnv *env, java_lang_VMThread *this, s4 priority)
+JNIEXPORT void JNICALL Java_java_lang_VMThread_nativeSetPriority(JNIEnv *env, java_lang_VMThread *this, int32_t priority)
{
- _Jv_java_lang_Thread_setPriority(this->thread, priority);
+ java_lang_Thread *thread;
+
+ LLNI_field_get_ref(this, thread, thread);
+
+ _Jv_java_lang_Thread_setPriority(thread, priority);
}
/*
* Class: java/lang/VMThread
* Method: nativeStop
- * Signature: (Ljava/lang/Object;)V
+ * Signature: (Ljava/lang/Throwable;)V
*/
JNIEXPORT void JNICALL Java_java_lang_VMThread_nativeStop(JNIEnv *env, java_lang_VMThread *this, java_lang_Throwable *t)
{
- _Jv_java_lang_Thread_stop(this->thread, t);
+ java_lang_Thread *thread;
+
+ LLNI_field_get_ref(this, thread, thread);
+
+ _Jv_java_lang_Thread_stop(thread, t);
}
* Method: interrupted
* Signature: ()Z
*/
-JNIEXPORT s4 JNICALL Java_java_lang_VMThread_interrupted(JNIEnv *env, jclass clazz)
+JNIEXPORT int32_t JNICALL Java_java_lang_VMThread_interrupted(JNIEnv *env, jclass clazz)
{
return _Jv_java_lang_Thread_interrupted();
}
* Method: holdsLock
* Signature: (Ljava/lang/Object;)Z
*/
-JNIEXPORT s4 JNICALL Java_java_lang_VMThread_holdsLock(JNIEnv *env, jclass clazz, java_lang_Object* o)
+JNIEXPORT int32_t JNICALL Java_java_lang_VMThread_holdsLock(JNIEnv *env, jclass clazz, java_lang_Object* o)
{
return _Jv_java_lang_Thread_holdsLock(o);
}
*/
JNIEXPORT java_lang_String* JNICALL Java_java_lang_VMThread_getState(JNIEnv *env, java_lang_VMThread *this)
{
- return _Jv_java_lang_Thread_getState(this->thread);
+ java_lang_Thread *thread;
+
+ LLNI_field_get_ref(this, thread, thread);
+
+ return _Jv_java_lang_Thread_getState(thread);
}