Mercurial > hg > graal-compiler
comparison src/share/vm/compiler/compileBroker.cpp @ 7154:5d0bb7d52783
changes to support Graal co-existing with the other HotSpot compiler(s) and being used for explicit compilation requests and code installation via the Graal API
author | Doug Simon <doug.simon@oracle.com> |
---|---|
date | Wed, 12 Dec 2012 21:36:40 +0100 |
parents | 1baf7f1e3f23 |
children | 291ffc492eb6 |
comparison
equal
deleted
inserted
replaced
7153:c421c19b7bf8 | 7154:5d0bb7d52783 |
---|---|
751 | 751 |
752 #ifndef SHARK | 752 #ifndef SHARK |
753 // Set the interface to the current compiler(s). | 753 // Set the interface to the current compiler(s). |
754 int c1_count = CompilationPolicy::policy()->compiler_count(CompLevel_simple); | 754 int c1_count = CompilationPolicy::policy()->compiler_count(CompLevel_simple); |
755 int c2_count = CompilationPolicy::policy()->compiler_count(CompLevel_full_optimization); | 755 int c2_count = CompilationPolicy::policy()->compiler_count(CompLevel_full_optimization); |
756 #if defined(GRAAL) | 756 |
757 _compilers[0] = new GraalCompiler(); | 757 #ifdef GRAAL |
758 GraalCompiler* graal = new GraalCompiler(); | |
759 #endif | |
760 | |
761 #if defined(GRAALVM) | |
762 _compilers[0] = graal; | |
758 c1_count = 0; | 763 c1_count = 0; |
759 c2_count = 0; | 764 c2_count = 0; |
760 #elif defined(COMPILER1) | 765 #elif defined(COMPILER1) |
761 if (c1_count > 0) { | 766 if (c1_count > 0) { |
762 _compilers[0] = new Compiler(); | 767 _compilers[0] = new Compiler(); |
969 // CompileBroker::init_compiler_threads | 974 // CompileBroker::init_compiler_threads |
970 // | 975 // |
971 // Initialize the compilation queue | 976 // Initialize the compilation queue |
972 void CompileBroker::init_compiler_threads(int c1_compiler_count, int c2_compiler_count) { | 977 void CompileBroker::init_compiler_threads(int c1_compiler_count, int c2_compiler_count) { |
973 EXCEPTION_MARK; | 978 EXCEPTION_MARK; |
974 #if !defined(ZERO) && !defined(SHARK) && !defined(GRAAL) | 979 #if !defined(ZERO) && !defined(SHARK) && !defined(GRAALVM) |
975 assert(c2_compiler_count > 0 || c1_compiler_count > 0, "No compilers?"); | 980 assert(c2_compiler_count > 0 || c1_compiler_count > 0, "No compilers?"); |
976 #endif // !ZERO && !SHARK | 981 #endif // !ZERO && !SHARK && !GRAALVM |
977 if (c2_compiler_count > 0) { | 982 if (c2_compiler_count > 0) { |
978 _c2_method_queue = new CompileQueue("C2MethodQueue", MethodCompileQueue_lock); | 983 _c2_method_queue = new CompileQueue("C2MethodQueue", MethodCompileQueue_lock); |
979 } | 984 } |
980 if (c1_compiler_count > 0) { | 985 if (c1_compiler_count > 0) { |
981 _c1_method_queue = new CompileQueue("C1MethodQueue", MethodCompileQueue_lock); | 986 _c1_method_queue = new CompileQueue("C1MethodQueue", MethodCompileQueue_lock); |
1022 } | 1027 } |
1023 | 1028 |
1024 // ------------------------------------------------------------------ | 1029 // ------------------------------------------------------------------ |
1025 // CompileBroker::is_idle | 1030 // CompileBroker::is_idle |
1026 bool CompileBroker::is_idle() { | 1031 bool CompileBroker::is_idle() { |
1027 #ifndef GRAAL | |
1028 if (_c2_method_queue != NULL && !_c2_method_queue->is_empty()) { | 1032 if (_c2_method_queue != NULL && !_c2_method_queue->is_empty()) { |
1029 return false; | 1033 return false; |
1030 } else if (_c1_method_queue != NULL && !_c1_method_queue->is_empty()) { | 1034 } else if (_c1_method_queue != NULL && !_c1_method_queue->is_empty()) { |
1031 return false; | 1035 return false; |
1032 } else { | 1036 } else { |
1035 if (_method_threads->at(i)->task() != NULL) { | 1039 if (_method_threads->at(i)->task() != NULL) { |
1036 return false; | 1040 return false; |
1037 } | 1041 } |
1038 } | 1042 } |
1039 } | 1043 } |
1040 #endif | |
1041 // No pending or active compilations. | 1044 // No pending or active compilations. |
1042 return true; | 1045 return true; |
1043 } | 1046 } |
1044 | 1047 |
1045 | 1048 |
1120 // between the reference handler thread, a GC (instigated | 1123 // between the reference handler thread, a GC (instigated |
1121 // by a compiler thread), and compiled method registration. | 1124 // by a compiler thread), and compiled method registration. |
1122 if (InstanceRefKlass::owns_pending_list_lock(JavaThread::current())) { | 1125 if (InstanceRefKlass::owns_pending_list_lock(JavaThread::current())) { |
1123 return; | 1126 return; |
1124 } | 1127 } |
1125 #ifdef GRAAL | 1128 #ifdef GRAALVM |
1126 if (!JavaThread::current()->is_compiling()) { | 1129 if (!JavaThread::current()->is_compiling()) { |
1127 method->set_queued_for_compilation(); | 1130 method->set_queued_for_compilation(); |
1128 GraalCompiler::instance()->compile_method(method, osr_bci, is_compile_blocking(method, osr_bci)); | 1131 GraalCompiler::instance()->compile_method(method, osr_bci, is_compile_blocking(method, osr_bci)); |
1129 } else { | 1132 } else { |
1130 // Recursive compile request => ignore. | 1133 // Recursive compile request => ignore. |