diff src/share/vm/prims/jni.cpp @ 11173:6b0fd0964b87

Merge with http://hg.openjdk.java.net/hsx/hsx25/hotspot/
author Doug Simon <doug.simon@oracle.com>
date Wed, 31 Jul 2013 11:00:54 +0200
parents 836a62f43af9 59b052799158
children cefad50507d8
line wrap: on
line diff
--- a/src/share/vm/prims/jni.cpp	Tue Jul 30 13:03:28 2013 -0700
+++ b/src/share/vm/prims/jni.cpp	Wed Jul 31 11:00:54 2013 +0200
@@ -882,7 +882,7 @@
                                    env, capacity);
 #endif /* USDT2 */
   //%note jni_11
-  if (capacity < 0 && capacity > MAX_REASONABLE_LOCAL_CAPACITY) {
+  if (capacity < 0 || capacity > MAX_REASONABLE_LOCAL_CAPACITY) {
 #ifndef USDT2
     DTRACE_PROBE1(hotspot_jni, PushLocalFrame__return, JNI_ERR);
 #else /* USDT2 */
@@ -5100,7 +5100,7 @@
   // function used to determine this will always return false. Atomic::xchg
   // does not have this problem.
   if (Atomic::xchg(1, &vm_created) == 1) {
-    return JNI_ERR;   // already created, or create attempt in progress
+    return JNI_EEXIST;   // already created, or create attempt in progress
   }
   if (Atomic::xchg(0, &safe_to_recreate_vm) == 0) {
     return JNI_ERR;  // someone tried and failed and retry not allowed.
@@ -5146,9 +5146,21 @@
       event.commit();
     }
 
+#ifndef PRODUCT
+  #ifndef TARGET_OS_FAMILY_windows
+    #define CALL_TEST_FUNC_WITH_WRAPPER_IF_NEEDED(f) f()
+  #endif
+
     // Check if we should compile all classes on bootclasspath
-    NOT_PRODUCT(if (CompileTheWorld) ClassLoader::compile_the_world();)
-    NOT_PRODUCT(if (ReplayCompiles) ciReplay::replay(thread);)
+    if (CompileTheWorld) ClassLoader::compile_the_world();
+    if (ReplayCompiles) ciReplay::replay(thread);
+
+    // Some platforms (like Win*) need a wrapper around these test
+    // functions in order to properly handle error conditions.
+    CALL_TEST_FUNC_WITH_WRAPPER_IF_NEEDED(test_error_handler);
+    CALL_TEST_FUNC_WITH_WRAPPER_IF_NEEDED(execute_internal_vm_tests);
+#endif
+
     // Since this is not a JVM_ENTRY we have to set the thread state manually before leaving.
     ThreadStateTransition::transition_and_fence(thread, _thread_in_vm, _thread_in_native);
   } else {
@@ -5165,8 +5177,6 @@
     OrderAccess::release_store(&vm_created, 0);
   }
 
-  NOT_PRODUCT(test_error_handler(ErrorHandlerTest));
-  NOT_PRODUCT(execute_internal_vm_tests());
   return result;
 }