< prev index next >

src/share/vm/prims/jni.cpp

Print this page

        

*** 4152,4162 **** if (args && (args->version != JNI_VERSION_1_1 || args->version != JNI_VERSION_1_2)) { return JNI_EVERSION; } */ ! Thread* t = ThreadLocalStorage::get_thread_slow(); if (t != NULL) { // If the thread has been attached this operation is a no-op *(JNIEnv**)penv = ((JavaThread*) t)->jni_environment(); return JNI_OK; } --- 4152,4162 ---- if (args && (args->version != JNI_VERSION_1_1 || args->version != JNI_VERSION_1_2)) { return JNI_EVERSION; } */ ! Thread* t = Thread::current(); if (t != NULL) { // If the thread has been attached this operation is a no-op *(JNIEnv**)penv = ((JavaThread*) t)->jni_environment(); return JNI_OK; }
*** 4167,4180 **** // Set correct safepoint info. The thread is going to call into Java when // initializing the Java level thread object. Hence, the correct state must // be set in order for the Safepoint code to deal with it correctly. thread->set_thread_state(_thread_in_vm); - // Must do this before initialize_thread_local_storage thread->record_stack_base_and_size(); ! ! thread->initialize_thread_local_storage(); if (!os::create_attached_thread(thread)) { delete thread; return JNI_ERR; } --- 4167,4178 ---- // Set correct safepoint info. The thread is going to call into Java when // initializing the Java level thread object. Hence, the correct state must // be set in order for the Safepoint code to deal with it correctly. thread->set_thread_state(_thread_in_vm); thread->record_stack_base_and_size(); ! thread->initialize_thread_current(); if (!os::create_attached_thread(thread)) { delete thread; return JNI_ERR; }
*** 4277,4288 **** HOTSPOT_JNI_DETACHCURRENTTHREAD_ENTRY(vm); VM_Exit::block_if_vm_exited(); JNIWrapper("DetachCurrentThread"); ! // If the thread has been deattacted the operations is a no-op ! if (ThreadLocalStorage::thread() == NULL) { HOTSPOT_JNI_DETACHCURRENTTHREAD_RETURN(JNI_OK); return JNI_OK; } JavaThread* thread = JavaThread::current(); --- 4275,4286 ---- HOTSPOT_JNI_DETACHCURRENTTHREAD_ENTRY(vm); VM_Exit::block_if_vm_exited(); JNIWrapper("DetachCurrentThread"); ! // If the thread has already been detached the operations is a no-op ! if (Thread::current() == NULL) { HOTSPOT_JNI_DETACHCURRENTTHREAD_RETURN(JNI_OK); return JNI_OK; } JavaThread* thread = JavaThread::current();
*** 4335,4345 **** #define JVMPI_VERSION_1 ((jint)0x10000001) #define JVMPI_VERSION_1_1 ((jint)0x10000002) #define JVMPI_VERSION_1_2 ((jint)0x10000003) #endif // !JVMPI_VERSION_1 ! Thread* thread = ThreadLocalStorage::thread(); if (thread != NULL && thread->is_Java_thread()) { if (Threads::is_supported_jni_version_including_1_1(version)) { *(JNIEnv**)penv = ((JavaThread*) thread)->jni_environment(); ret = JNI_OK; return ret; --- 4333,4343 ---- #define JVMPI_VERSION_1 ((jint)0x10000001) #define JVMPI_VERSION_1_1 ((jint)0x10000002) #define JVMPI_VERSION_1_2 ((jint)0x10000003) #endif // !JVMPI_VERSION_1 ! Thread* thread = Thread::current(); if (thread != NULL && thread->is_Java_thread()) { if (Threads::is_supported_jni_version_including_1_1(version)) { *(JNIEnv**)penv = ((JavaThread*) thread)->jni_environment(); ret = JNI_OK; return ret;
< prev index next >