diff options
author | tromey <tromey@138bc75d-0d04-0410-961f-82ee72b054a4> | 2002-04-10 20:36:04 +0000 |
---|---|---|
committer | tromey <tromey@138bc75d-0d04-0410-961f-82ee72b054a4> | 2002-04-10 20:36:04 +0000 |
commit | 77d87cdc3d778d7697fb376b668df581d58fd04d (patch) | |
tree | 83b2914991f41b4c53152d00ff2da8b3917d29df /libjava/jni.cc | |
parent | c0211d6b2681a4afeaf40eb4491a6cf9405e57a8 (diff) | |
download | gcc-77d87cdc3d778d7697fb376b668df581d58fd04d.tar.gz |
* Makefile.in: Rebuilt.
* Makefile.am (java/lang/Thread.h): Mark
_Jv_AttachCurrentThreadAsDaemon as friend.
* gcj/javaprims.h (_Jv_AttachCurrentThreadAsDaemon): Declare.
* gcj/cni.h (JvAttachCurrentThreadAsDaemon): New function.
* java/lang/natThread.cc (_Jv_AttachCurrentThreadAsDaemon): New
function.
* java/lang/natRuntime.cc (_load): Recognize JNI_VERSION_1_4.
* jni.cc (_Jv_JNI_GetVersion): Return JNI_VERSION_1_4.
(_Jv_JNI_InvokeFunctions): Added
_Jv_JNI_AttachCurrentThreadAsDaemon.
(_Jv_JNI_GetEnv): Handle JNI_VERSION_1_4.
(JNI_GetDefaultJavaVMInitArgs): Likewise.
(JNI_CreateJavaVM): Likewise.
(_Jv_JNI_AttachCurrentThread): Likewise.
(_Jv_JNI_AttachCurrentThread): Added `is_daemon' argument.
(_Jv_JNI_AttachCurrentThreadAsDaemon): New method.
(_Jv_JNIFunctions): Initialize new fields.
(_Jv_JNI_NewDirectByteBuffer): New function.
(_Jv_JNI_GetDirectBufferAddress): Likewise.
(_Jv_JNI_GetDirectBufferCapacity): Likewise.
* include/jni.h (JNI_VERSION_1_4): New macro.
(JNIInvokeInterface::AttachCurrentThreadAsDaemon): New field.
(_Jv_JavaVM::AttachCurrentThreadAsDaemon): New method.
(JNINativeInterface::NewDirectByteBuffer): New field.
(JNINativeInterface::GetDirectBufferAddress): New field.
(JNINativeInterface::GetDirectBufferCapacity): New field.
(_Jv_JNIEnv::NewDirectByteBuffer): New method.
(_Jv_JNIEnv::GetDirectBufferAddress): New method.
(_Jv_JNIEnv::GetDirectBufferCapacity): New method.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@52144 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'libjava/jni.cc')
-rw-r--r-- | libjava/jni.cc | 73 |
1 files changed, 57 insertions, 16 deletions
diff --git a/libjava/jni.cc b/libjava/jni.cc index 1abd2d2497a..bb504209cf5 100644 --- a/libjava/jni.cc +++ b/libjava/jni.cc @@ -424,7 +424,7 @@ wrap_value (JNIEnv *env, T *value) static jint _Jv_JNI_GetVersion (JNIEnv *) { - return JNI_VERSION_1_2; + return JNI_VERSION_1_4; } static jclass @@ -1672,6 +1672,31 @@ _Jv_JNI_DeleteWeakGlobalRef (JNIEnv *, jweak obj) +// Direct byte buffers. + +static jobject +_Jv_JNI_NewDirectByteBuffer (JNIEnv *, void *, jlong) +{ + // For now we don't support this. + return NULL; +} + +static void * +_Jv_JNI_GetDirectBufferAddress (JNIEnv *, jobject) +{ + // For now we don't support this. + return NULL; +} + +static jlong +_Jv_JNI_GetDirectBufferCapacity (JNIEnv *, jobject) +{ + // For now we don't support this. + return -1; +} + + + // Hash table of native methods. static JNINativeMethod *nathash; // Number of slots used. @@ -2096,7 +2121,8 @@ _Jv_JNIMethod::call (ffi_cif *, void *ret, ffi_raw *args, void *__this) // An internal helper function. static jint -_Jv_JNI_AttachCurrentThread (JavaVM *, jstring name, void **penv, void *args) +_Jv_JNI_AttachCurrentThread (JavaVM *, jstring name, void **penv, + void *args, jboolean is_daemon) { JavaVMAttachArgs *attach = reinterpret_cast<JavaVMAttachArgs *> (args); java::lang::ThreadGroup *group = NULL; @@ -2104,7 +2130,8 @@ _Jv_JNI_AttachCurrentThread (JavaVM *, jstring name, void **penv, void *args) if (attach) { // FIXME: do we really want to support 1.1? - if (attach->version != JNI_VERSION_1_2 + if (attach->version != JNI_VERSION_1_4 + && attach->version != JNI_VERSION_1_2 && attach->version != JNI_VERSION_1_1) return JNI_EVERSION; @@ -2147,7 +2174,10 @@ _Jv_JNI_AttachCurrentThread (JavaVM *, jstring name, void **penv, void *args) { try { - _Jv_AttachCurrentThread (name, group); + if (is_daemon) + _Jv_AttachCurrentThreadAsDaemon (name, group); + else + _Jv_AttachCurrentThread (name, group); } catch (jthrowable t) { @@ -2163,7 +2193,13 @@ _Jv_JNI_AttachCurrentThread (JavaVM *, jstring name, void **penv, void *args) static jint _Jv_JNI_AttachCurrentThread (JavaVM *vm, void **penv, void *args) { - return _Jv_JNI_AttachCurrentThread (vm, NULL, penv, args); + return _Jv_JNI_AttachCurrentThread (vm, NULL, penv, args, false); +} + +static jint +_Jv_JNI_AttachCurrentThreadAsDaemon (JavaVM *vm, void **penv, void *args) +{ + return _Jv_JNI_AttachCurrentThread (vm, NULL, penv, args, true); } static jint @@ -2185,10 +2221,9 @@ _Jv_JNI_DestroyJavaVM (JavaVM *vm) return JNI_ERR; } - jint r = _Jv_JNI_AttachCurrentThread (vm, - main_name, + jint r = _Jv_JNI_AttachCurrentThread (vm, main_name, reinterpret_cast<void **> (&env), - NULL); + NULL, false); if (r < 0) return r; } @@ -2227,7 +2262,8 @@ _Jv_JNI_GetEnv (JavaVM *, void **penv, jint version) #endif // FIXME: do we really want to support 1.1? - if (version != JNI_VERSION_1_2 && version != JNI_VERSION_1_1) + if (version != JNI_VERSION_1_4 && version != JNI_VERSION_1_2 + && version != JNI_VERSION_1_1) { *penv = NULL; return JNI_EVERSION; @@ -2241,12 +2277,12 @@ jint JNI_GetDefaultJavaVMInitArgs (void *args) { jint version = * (jint *) args; - // Here we only support 1.2. - if (version != JNI_VERSION_1_2) + // Here we only support 1.2 and 1.4. + if (version != JNI_VERSION_1_2 && version != JNI_VERSION_1_4) return JNI_EVERSION; JavaVMInitArgs *ia = reinterpret_cast<JavaVMInitArgs *> (args); - ia->version = JNI_VERSION_1_2; + ia->version = JNI_VERSION_1_4; ia->nOptions = 0; ia->options = NULL; ia->ignoreUnrecognized = true; @@ -2271,8 +2307,8 @@ JNI_CreateJavaVM (JavaVM **vm, void **penv, void *args) if (args != NULL) { jint version = * (jint *) args; - // We only support 1.2. - if (version != JNI_VERSION_1_2) + // We only support 1.2 and 1.4. + if (version != JNI_VERSION_1_2 && version != JNI_VERSION_1_4) return JNI_EVERSION; JavaVMInitArgs *ia = reinterpret_cast<JavaVMInitArgs *> (args); for (int i = 0; i < ia->nOptions; ++i) @@ -2614,7 +2650,11 @@ struct JNINativeInterface _Jv_JNIFunctions = _Jv_JNI_NewWeakGlobalRef, // NewWeakGlobalRef _Jv_JNI_DeleteWeakGlobalRef, // DeleteWeakGlobalRef - _Jv_JNI_ExceptionCheck + _Jv_JNI_ExceptionCheck, // ExceptionCheck + + _Jv_JNI_NewDirectByteBuffer, // NewDirectByteBuffer + _Jv_JNI_GetDirectBufferAddress, // GetDirectBufferAddress + _Jv_JNI_GetDirectBufferCapacity // GetDirectBufferCapacity }; struct JNIInvokeInterface _Jv_JNI_InvokeFunctions = @@ -2626,5 +2666,6 @@ struct JNIInvokeInterface _Jv_JNI_InvokeFunctions = _Jv_JNI_DestroyJavaVM, _Jv_JNI_AttachCurrentThread, _Jv_JNI_DetachCurrentThread, - _Jv_JNI_GetEnv + _Jv_JNI_GetEnv, + _Jv_JNI_AttachCurrentThreadAsDaemon }; |