src/hotspot/share/prims/jni.cpp
changeset 47765 b7c7428eaab9
parent 47662 2493edd8b479
child 47796 47629b00daa9
--- a/src/hotspot/share/prims/jni.cpp	Mon Oct 30 16:37:53 2017 +0100
+++ b/src/hotspot/share/prims/jni.cpp	Tue Oct 31 11:55:09 2017 -0400
@@ -25,6 +25,7 @@
 
 #include "precompiled.hpp"
 #include "jni.h"
+#include "jvm.h"
 #include "ci/ciReplay.hpp"
 #include "classfile/altHashing.hpp"
 #include "classfile/classFileStream.hpp"
@@ -55,7 +56,6 @@
 #include "prims/jniCheck.hpp"
 #include "prims/jniExport.hpp"
 #include "prims/jniFastGetField.hpp"
-#include "prims/jvm.h"
 #include "prims/jvm_misc.hpp"
 #include "prims/jvmtiExport.hpp"
 #include "prims/jvmtiThreadState.hpp"
@@ -263,7 +263,7 @@
 
 #ifdef ASSERT
   Histogram* JNIHistogram;
-  static volatile jint JNIHistogram_lock = 0;
+  static volatile int JNIHistogram_lock = 0;
 
   class JNIHistogramElement : public HistogramElement {
     public:
@@ -3277,9 +3277,9 @@
 
 // Initialization state for three routines below relating to
 // java.nio.DirectBuffers
-static          jint directBufferSupportInitializeStarted = 0;
-static volatile jint directBufferSupportInitializeEnded   = 0;
-static volatile jint directBufferSupportInitializeFailed  = 0;
+static          int directBufferSupportInitializeStarted = 0;
+static volatile int directBufferSupportInitializeEnded   = 0;
+static volatile int directBufferSupportInitializeFailed  = 0;
 static jclass    bufferClass                 = NULL;
 static jclass    directBufferClass           = NULL;
 static jclass    directByteBufferClass       = NULL;
@@ -3844,9 +3844,9 @@
 extern const struct JNIInvokeInterface_ jni_InvokeInterface;
 
 // Global invocation API vars
-volatile jint vm_created = 0;
+volatile int vm_created = 0;
 // Indicate whether it is safe to recreate VM
-volatile jint safe_to_recreate_vm = 1;
+volatile int safe_to_recreate_vm = 1;
 struct JavaVM_ main_vm = {&jni_InvokeInterface};
 
 
@@ -4045,7 +4045,7 @@
 
   HOTSPOT_JNI_GETCREATEDJAVAVMS_ENTRY((void **) vm_buf, bufLen, (uintptr_t *) numVMs);
 
-  if (vm_created) {
+  if (vm_created == 1) {
     if (numVMs != NULL) *numVMs = 1;
     if (bufLen > 0)     *vm_buf = (JavaVM *)(&main_vm);
   } else {
@@ -4065,7 +4065,7 @@
   jint res = JNI_ERR;
   DT_RETURN_MARK(DestroyJavaVM, jint, (const jint&)res);
 
-  if (!vm_created) {
+  if (vm_created == 0) {
     res = JNI_ERR;
     return res;
   }
@@ -4086,7 +4086,7 @@
   ThreadStateTransition::transition_from_native(thread, _thread_in_vm);
   if (Threads::destroy_vm()) {
     // Should not change thread state, VM is gone
-    vm_created = false;
+    vm_created = 0;
     res = JNI_OK;
     return res;
   } else {
@@ -4226,7 +4226,7 @@
 
 jint JNICALL jni_AttachCurrentThread(JavaVM *vm, void **penv, void *_args) {
   HOTSPOT_JNI_ATTACHCURRENTTHREAD_ENTRY(vm, penv, _args);
-  if (!vm_created) {
+  if (vm_created == 0) {
   HOTSPOT_JNI_ATTACHCURRENTTHREAD_RETURN((uint32_t) JNI_ERR);
     return JNI_ERR;
   }
@@ -4285,7 +4285,7 @@
   jint ret = JNI_ERR;
   DT_RETURN_MARK(GetEnv, jint, (const jint&)ret);
 
-  if (!vm_created) {
+  if (vm_created == 0) {
     *penv = NULL;
     ret = JNI_EDETACHED;
     return ret;
@@ -4336,7 +4336,7 @@
 
 jint JNICALL jni_AttachCurrentThreadAsDaemon(JavaVM *vm, void **penv, void *_args) {
   HOTSPOT_JNI_ATTACHCURRENTTHREADASDAEMON_ENTRY(vm, penv, _args);
-  if (!vm_created) {
+  if (vm_created == 0) {
   HOTSPOT_JNI_ATTACHCURRENTTHREADASDAEMON_RETURN((uint32_t) JNI_ERR);
     return JNI_ERR;
   }