comparison src/share/vm/runtime/thread.cpp @ 16435:b20d00b2ac2e

fixed deadlock in GraalVM under -Xcomp (JBS:GRAAL-48)
author Doug Simon <doug.simon@oracle.com>
date Wed, 09 Jul 2014 19:02:29 +0200
parents 84a14e69fa8b
children ce6696559683
comparison
equal deleted inserted replaced
16434:2d01fb8f8acb 16435:b20d00b2ac2e
3743 return status; 3743 return status;
3744 } 3744 }
3745 #endif 3745 #endif
3746 3746
3747 // initialize compiler(s) 3747 // initialize compiler(s)
3748 #if defined(COMPILER1) || defined(COMPILER2) || defined(SHARK) || defined(COMPILERGRAAL) 3748 #if defined(COMPILERGRAAL)
3749 if (Arguments::mode() != Arguments::_comp) {
3750 // Only initialize compilation if not -Xcomp. Deadlock can
3751 // occur during the class initialization below as follows:
3752 // 1. This thread acquires the initialization lock for a class
3753 // and then blocks while waiting for some method to be compiled.
3754 // 2. Graal compilation thread(s) try to access the locked class
3755 // and will block waiting for the initialization lock. This
3756 // prevents the requested compilation in 1 from completing.
3757 CompileBroker::compilation_init();
3758 }
3759 #elif defined(COMPILER1) || defined(COMPILER2) || defined(SHARK) || defined(COMPILERGRAAL)
3749 CompileBroker::compilation_init(); 3760 CompileBroker::compilation_init();
3750 #endif 3761 #endif
3751 3762
3752 if (EnableInvokeDynamic) { 3763 if (EnableInvokeDynamic) {
3753 // Pre-initialize some JSR292 core classes to avoid deadlock during class loading. 3764 // Pre-initialize some JSR292 core classes to avoid deadlock during class loading.
3756 // (see SystemDictionary::find_method_handle_intrinsic). 3767 // (see SystemDictionary::find_method_handle_intrinsic).
3757 initialize_class(vmSymbols::java_lang_invoke_MethodHandle(), CHECK_0); 3768 initialize_class(vmSymbols::java_lang_invoke_MethodHandle(), CHECK_0);
3758 initialize_class(vmSymbols::java_lang_invoke_MemberName(), CHECK_0); 3769 initialize_class(vmSymbols::java_lang_invoke_MemberName(), CHECK_0);
3759 initialize_class(vmSymbols::java_lang_invoke_MethodHandleNatives(), CHECK_0); 3770 initialize_class(vmSymbols::java_lang_invoke_MethodHandleNatives(), CHECK_0);
3760 } 3771 }
3772
3773 #if defined(COMPILERGRAAL)
3774 if (Arguments::mode() == Arguments::_comp) {
3775 // Do deferred compilation initialization (see above) now.
3776 CompileBroker::compilation_init();
3777 }
3778 #endif
3761 3779
3762 #if INCLUDE_MANAGEMENT 3780 #if INCLUDE_MANAGEMENT
3763 Management::initialize(THREAD); 3781 Management::initialize(THREAD);
3764 #endif // INCLUDE_MANAGEMENT 3782 #endif // INCLUDE_MANAGEMENT
3765 3783