Mercurial > hg > graal-compiler
comparison src/share/vm/compiler/compileBroker.cpp @ 4981:1b8d02e10ee8
Remove the hacks around "is_Compiler_thread" assertions; Graal no longer uses the compiler thread mechanisms; don't create a C++ compilation queue or any compiler threads.
author | Thomas Wuerthinger <thomas.wuerthinger@oracle.com> |
---|---|
date | Mon, 27 Feb 2012 22:15:05 +0100 |
parents | 532be189cf09 |
children | 957c266d8bc5 |
comparison
equal
deleted
inserted
replaced
4980:1c7c5be93e84 | 4981:1b8d02e10ee8 |
---|---|
727 // Set the interface to the current compiler(s). | 727 // Set the interface to the current compiler(s). |
728 int c1_count = CompilationPolicy::policy()->compiler_count(CompLevel_simple); | 728 int c1_count = CompilationPolicy::policy()->compiler_count(CompLevel_simple); |
729 int c2_count = CompilationPolicy::policy()->compiler_count(CompLevel_full_optimization); | 729 int c2_count = CompilationPolicy::policy()->compiler_count(CompLevel_full_optimization); |
730 #if defined(GRAAL) | 730 #if defined(GRAAL) |
731 _compilers[0] = new GraalCompiler(); | 731 _compilers[0] = new GraalCompiler(); |
732 c1_count = 0; | |
733 c2_count = 0; | |
732 #elif defined(COMPILER1) | 734 #elif defined(COMPILER1) |
733 if (c1_count > 0) { | 735 if (c1_count > 0) { |
734 _compilers[0] = new Compiler(); | 736 _compilers[0] = new Compiler(); |
735 } | 737 } |
736 #endif // COMPILER1 | 738 #endif // COMPILER1 |
941 // CompileBroker::init_compiler_threads | 943 // CompileBroker::init_compiler_threads |
942 // | 944 // |
943 // Initialize the compilation queue | 945 // Initialize the compilation queue |
944 void CompileBroker::init_compiler_threads(int c1_compiler_count, int c2_compiler_count) { | 946 void CompileBroker::init_compiler_threads(int c1_compiler_count, int c2_compiler_count) { |
945 EXCEPTION_MARK; | 947 EXCEPTION_MARK; |
946 #if !defined(ZERO) && !defined(SHARK) | 948 #if !defined(ZERO) && !defined(SHARK) && !defined(GRAAL) |
947 assert(c2_compiler_count > 0 || c1_compiler_count > 0, "No compilers?"); | 949 assert(c2_compiler_count > 0 || c1_compiler_count > 0, "No compilers?"); |
948 #endif // !ZERO && !SHARK | 950 #endif // !ZERO && !SHARK |
949 if (c2_compiler_count > 0) { | 951 if (c2_compiler_count > 0) { |
950 _c2_method_queue = new CompileQueue("C2MethodQueue", MethodCompileQueue_lock); | 952 _c2_method_queue = new CompileQueue("C2MethodQueue", MethodCompileQueue_lock); |
951 } | 953 } |
1079 // between the reference handler thread, a GC (instigated | 1081 // between the reference handler thread, a GC (instigated |
1080 // by a compiler thread), and compiled method registration. | 1082 // by a compiler thread), and compiled method registration. |
1081 if (instanceRefKlass::owns_pending_list_lock(JavaThread::current())) { | 1083 if (instanceRefKlass::owns_pending_list_lock(JavaThread::current())) { |
1082 return; | 1084 return; |
1083 } | 1085 } |
1086 #ifdef GRAAL | |
1087 if (!JavaThread::current()->is_compiling()) { | |
1088 method->set_queued_for_compilation(); | |
1089 GraalCompiler::instance()->compile_method(method, osr_bci, is_compile_blocking(method, osr_bci)); | |
1090 } else { | |
1091 // Recursive compile request => ignore. | |
1092 } | |
1093 #else | |
1084 | 1094 |
1085 // Outputs from the following MutexLocker block: | 1095 // Outputs from the following MutexLocker block: |
1086 CompileTask* task = NULL; | 1096 CompileTask* task = NULL; |
1087 bool blocking = false; | 1097 bool blocking = false; |
1088 CompileQueue* queue = compile_queue(comp_level); | 1098 CompileQueue* queue = compile_queue(comp_level); |
1089 | 1099 |
1090 // Acquire our lock. | 1100 // Acquire our lock. |
1091 { | 1101 { |
1092 MutexLocker locker(queue->lock(), thread); | 1102 MutexLocker locker(queue->lock(), thread); |
1093 | |
1094 #ifdef GRAAL | |
1095 if (JavaThread::current()->is_compiling() && !BackgroundCompilation) { | |
1096 TRACE_graal_1("Recursive compile %s!", method->name_and_sig_as_C_string()); | |
1097 method->set_not_compilable(); | |
1098 return; | |
1099 } | |
1100 #endif | |
1101 | 1103 |
1102 // Make sure the method has not slipped into the queues since | 1104 // Make sure the method has not slipped into the queues since |
1103 // last we checked; note that those checks were "fast bail-outs". | 1105 // last we checked; note that those checks were "fast bail-outs". |
1104 // Here we need to be more careful, see 14012000 below. | 1106 // Here we need to be more careful, see 14012000 below. |
1105 if (compilation_is_in_queue(method, osr_bci)) { | 1107 if (compilation_is_in_queue(method, osr_bci)) { |
1161 // NOTE: in the event that there are multiple compiler threads and | 1163 // NOTE: in the event that there are multiple compiler threads and |
1162 // there is de-optimization/recompilation, things will get hairy, | 1164 // there is de-optimization/recompilation, things will get hairy, |
1163 // and in that case it's best to protect both the testing (here) of | 1165 // and in that case it's best to protect both the testing (here) of |
1164 // these bits, and their updating (here and elsewhere) under a | 1166 // these bits, and their updating (here and elsewhere) under a |
1165 // common lock. | 1167 // common lock. |
1166 #ifndef GRAAL | |
1167 task = create_compile_task(queue, | 1168 task = create_compile_task(queue, |
1168 compile_id, method, | 1169 compile_id, method, |
1169 osr_bci, comp_level, | 1170 osr_bci, comp_level, |
1170 hot_method, hot_count, comment, | 1171 hot_method, hot_count, comment, |
1171 blocking); | 1172 blocking); |
1172 #endif | 1173 } |
1173 } | 1174 |
1174 | |
1175 #ifdef GRAAL | |
1176 if (!JavaThread::current()->is_compiling()) { | |
1177 method->set_queued_for_compilation(); | |
1178 GraalCompiler::instance()->compile_method(method, osr_bci, blocking); | |
1179 } else { | |
1180 // Recursive compile request => ignore. | |
1181 } | |
1182 #else | |
1183 if (blocking) { | 1175 if (blocking) { |
1184 wait_for_completion(task); | 1176 wait_for_completion(task); |
1185 } | 1177 } |
1186 #endif | 1178 #endif |
1187 } | 1179 } |