comparison 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
comparison
equal deleted inserted replaced
10912:4ea54634f03e 11173:6b0fd0964b87
880 #else /* USDT2 */ 880 #else /* USDT2 */
881 HOTSPOT_JNI_PUSHLOCALFRAME_ENTRY( 881 HOTSPOT_JNI_PUSHLOCALFRAME_ENTRY(
882 env, capacity); 882 env, capacity);
883 #endif /* USDT2 */ 883 #endif /* USDT2 */
884 //%note jni_11 884 //%note jni_11
885 if (capacity < 0 && capacity > MAX_REASONABLE_LOCAL_CAPACITY) { 885 if (capacity < 0 || capacity > MAX_REASONABLE_LOCAL_CAPACITY) {
886 #ifndef USDT2 886 #ifndef USDT2
887 DTRACE_PROBE1(hotspot_jni, PushLocalFrame__return, JNI_ERR); 887 DTRACE_PROBE1(hotspot_jni, PushLocalFrame__return, JNI_ERR);
888 #else /* USDT2 */ 888 #else /* USDT2 */
889 HOTSPOT_JNI_PUSHLOCALFRAME_RETURN( 889 HOTSPOT_JNI_PUSHLOCALFRAME_RETURN(
890 (uint32_t)JNI_ERR); 890 (uint32_t)JNI_ERR);
5098 // the add/dec implementations are dependent on whether we are running 5098 // the add/dec implementations are dependent on whether we are running
5099 // on a multiprocessor, and at this stage of initialization the os::is_MP 5099 // on a multiprocessor, and at this stage of initialization the os::is_MP
5100 // function used to determine this will always return false. Atomic::xchg 5100 // function used to determine this will always return false. Atomic::xchg
5101 // does not have this problem. 5101 // does not have this problem.
5102 if (Atomic::xchg(1, &vm_created) == 1) { 5102 if (Atomic::xchg(1, &vm_created) == 1) {
5103 return JNI_ERR; // already created, or create attempt in progress 5103 return JNI_EEXIST; // already created, or create attempt in progress
5104 } 5104 }
5105 if (Atomic::xchg(0, &safe_to_recreate_vm) == 0) { 5105 if (Atomic::xchg(0, &safe_to_recreate_vm) == 0) {
5106 return JNI_ERR; // someone tried and failed and retry not allowed. 5106 return JNI_ERR; // someone tried and failed and retry not allowed.
5107 } 5107 }
5108 5108
5144 if (event.should_commit()) { 5144 if (event.should_commit()) {
5145 event.set_javalangthread(java_lang_Thread::thread_id(thread->threadObj())); 5145 event.set_javalangthread(java_lang_Thread::thread_id(thread->threadObj()));
5146 event.commit(); 5146 event.commit();
5147 } 5147 }
5148 5148
5149 #ifndef PRODUCT
5150 #ifndef TARGET_OS_FAMILY_windows
5151 #define CALL_TEST_FUNC_WITH_WRAPPER_IF_NEEDED(f) f()
5152 #endif
5153
5149 // Check if we should compile all classes on bootclasspath 5154 // Check if we should compile all classes on bootclasspath
5150 NOT_PRODUCT(if (CompileTheWorld) ClassLoader::compile_the_world();) 5155 if (CompileTheWorld) ClassLoader::compile_the_world();
5151 NOT_PRODUCT(if (ReplayCompiles) ciReplay::replay(thread);) 5156 if (ReplayCompiles) ciReplay::replay(thread);
5157
5158 // Some platforms (like Win*) need a wrapper around these test
5159 // functions in order to properly handle error conditions.
5160 CALL_TEST_FUNC_WITH_WRAPPER_IF_NEEDED(test_error_handler);
5161 CALL_TEST_FUNC_WITH_WRAPPER_IF_NEEDED(execute_internal_vm_tests);
5162 #endif
5163
5152 // Since this is not a JVM_ENTRY we have to set the thread state manually before leaving. 5164 // Since this is not a JVM_ENTRY we have to set the thread state manually before leaving.
5153 ThreadStateTransition::transition_and_fence(thread, _thread_in_vm, _thread_in_native); 5165 ThreadStateTransition::transition_and_fence(thread, _thread_in_vm, _thread_in_native);
5154 } else { 5166 } else {
5155 if (can_try_again) { 5167 if (can_try_again) {
5156 // reset safe_to_recreate_vm to 1 so that retrial would be possible 5168 // reset safe_to_recreate_vm to 1 so that retrial would be possible
5163 // reset vm_created last to avoid race condition. Use OrderAccess to 5175 // reset vm_created last to avoid race condition. Use OrderAccess to
5164 // control both compiler and architectural-based reordering. 5176 // control both compiler and architectural-based reordering.
5165 OrderAccess::release_store(&vm_created, 0); 5177 OrderAccess::release_store(&vm_created, 0);
5166 } 5178 }
5167 5179
5168 NOT_PRODUCT(test_error_handler(ErrorHandlerTest));
5169 NOT_PRODUCT(execute_internal_vm_tests());
5170 return result; 5180 return result;
5171 } 5181 }
5172 5182
5173 #ifndef USDT2 5183 #ifndef USDT2
5174 HS_DTRACE_PROBE_DECL3(hotspot_jni, GetCreatedJavaVMs__entry, \ 5184 HS_DTRACE_PROBE_DECL3(hotspot_jni, GetCreatedJavaVMs__entry, \