Mercurial > hg > graal-jvmci-8
comparison src/share/vm/compiler/compileBroker.cpp @ 14107:800057208a2c
enable C1 + Graal tiered
author | Tom Rodriguez <tom.rodriguez@oracle.com> |
---|---|
date | Thu, 06 Mar 2014 17:11:39 -0800 |
parents | fe034af88233 |
children | 7ad529321294 |
comparison
equal
deleted
inserted
replaced
14106:ca37cb080dad | 14107:800057208a2c |
---|---|
793 int c1_count = CompilationPolicy::policy()->compiler_count(CompLevel_simple); | 793 int c1_count = CompilationPolicy::policy()->compiler_count(CompLevel_simple); |
794 int c2_count = CompilationPolicy::policy()->compiler_count(CompLevel_full_optimization); | 794 int c2_count = CompilationPolicy::policy()->compiler_count(CompLevel_full_optimization); |
795 #ifdef GRAAL | 795 #ifdef GRAAL |
796 GraalCompiler* graal = new GraalCompiler(); | 796 GraalCompiler* graal = new GraalCompiler(); |
797 #endif | 797 #endif |
798 #ifdef GRAALVM | 798 #if defined(GRAALVM) && !defined(TIERED) |
799 _compilers[0] = graal; | 799 _compilers[0] = graal; |
800 c1_count = 0; | 800 c1_count = 0; |
801 c2_count = 0; | 801 c2_count = 0; |
802 #else // GRAALVM | 802 #endif // GRAALVM && !TIERED |
803 | |
803 #ifdef COMPILER1 | 804 #ifdef COMPILER1 |
804 if (c1_count > 0) { | 805 if (c1_count > 0) { |
805 _compilers[0] = new Compiler(); | 806 _compilers[0] = new Compiler(); |
806 } | 807 } |
807 #endif // COMPILER1 | 808 #endif // COMPILER1 |
808 | 809 |
810 #if defined(GRAALVM) | |
811 _compilers[1] = graal; | |
812 c2_count = 0; | |
813 #endif // GRAALVM | |
814 | |
809 #ifdef COMPILER2 | 815 #ifdef COMPILER2 |
810 if (c2_count > 0) { | 816 if (c2_count > 0) { |
811 _compilers[1] = new C2Compiler(); | 817 _compilers[1] = new C2Compiler(); |
812 } | 818 } |
813 #endif // COMPILER2 | 819 #endif // COMPILER2 |
814 #endif // GRAALVM | |
815 #else // SHARK | 820 #else // SHARK |
816 int c1_count = 0; | 821 int c1_count = 0; |
817 int c2_count = 1; | 822 int c2_count = 1; |
818 | 823 |
819 _compilers[1] = new SharkCompiler(); | 824 _compilers[1] = new SharkCompiler(); |
1090 tty->print("request: "); | 1095 tty->print("request: "); |
1091 method->print_short_name(tty); | 1096 method->print_short_name(tty); |
1092 if (osr_bci != InvocationEntryBci) { | 1097 if (osr_bci != InvocationEntryBci) { |
1093 tty->print(" osr_bci: %d", osr_bci); | 1098 tty->print(" osr_bci: %d", osr_bci); |
1094 } | 1099 } |
1095 tty->print(" comment: %s count: %d", comment, hot_count); | 1100 tty->print(" level: %d comment: %s count: %d", comp_level, comment, hot_count); |
1096 if (!hot_method.is_null()) { | 1101 if (!hot_method.is_null()) { |
1097 tty->print(" hot: "); | 1102 tty->print(" hot: "); |
1098 if (hot_method() != method()) { | 1103 if (hot_method() != method()) { |
1099 hot_method->print_short_name(tty); | 1104 hot_method->print_short_name(tty); |
1100 } else { | 1105 } else { |
1140 // between the reference handler thread, a GC (instigated | 1145 // between the reference handler thread, a GC (instigated |
1141 // by a compiler thread), and compiled method registration. | 1146 // by a compiler thread), and compiled method registration. |
1142 if (InstanceRefKlass::owns_pending_list_lock(JavaThread::current())) { | 1147 if (InstanceRefKlass::owns_pending_list_lock(JavaThread::current())) { |
1143 return; | 1148 return; |
1144 } | 1149 } |
1145 #ifdef GRAALVM | 1150 |
1146 if (!JavaThread::current()->is_graal_compiling()) { | 1151 #if defined(GRAALVM) |
1147 bool blockingCompilation = is_compile_blocking(method, osr_bci) || | 1152 // In tiered mode we want to only handle highest tier compiles and |
1148 CompilationPolicy::can_be_offloaded_to_gpu(method); | 1153 // in non-tiered mode the default level should be |
1149 GraalCompiler::instance()->compile_method(method, osr_bci, blockingCompilation); | 1154 // CompLevel_full_optimization which equals CompLevel_highest_tier. |
1150 } else { | 1155 assert(TieredCompilation || comp_level == CompLevel_full_optimization, "incorrect compile level"); |
1151 // Recursive compile request => ignore. | 1156 assert(CompLevel_full_optimization == CompLevel_highest_tier, "incorrect level definition"); |
1152 } | 1157 if (comp_level == CompLevel_full_optimization) { |
1153 #else | 1158 if (!JavaThread::current()->is_graal_compiling()) { |
1159 bool blockingCompilation = is_compile_blocking(method, osr_bci) || | |
1160 CompilationPolicy::can_be_offloaded_to_gpu(method); | |
1161 GraalCompiler::instance()->compile_method(method, osr_bci, blockingCompilation); | |
1162 } else { | |
1163 // Can't enqueue this request because there would be no one to service it, so simply return. | |
1164 } | |
1165 return; | |
1166 } | |
1167 assert(TieredCompilation, "should only reach here in tiered mode"); | |
1168 #endif // GRAALVM | |
1154 | 1169 |
1155 // Outputs from the following MutexLocker block: | 1170 // Outputs from the following MutexLocker block: |
1156 CompileTask* task = NULL; | 1171 CompileTask* task = NULL; |
1157 bool blocking = false; | 1172 bool blocking = false; |
1158 CompileQueue* queue = compile_queue(comp_level); | 1173 CompileQueue* queue = compile_queue(comp_level); |
1233 } | 1248 } |
1234 | 1249 |
1235 if (blocking) { | 1250 if (blocking) { |
1236 wait_for_completion(task); | 1251 wait_for_completion(task); |
1237 } | 1252 } |
1238 #endif | |
1239 } | 1253 } |
1240 | 1254 |
1241 | 1255 |
1242 nmethod* CompileBroker::compile_method(methodHandle method, int osr_bci, | 1256 nmethod* CompileBroker::compile_method(methodHandle method, int osr_bci, |
1243 int comp_level, | 1257 int comp_level, |
2363 | 2377 |
2364 nmethods_size += stats->_nmethods_size; | 2378 nmethods_size += stats->_nmethods_size; |
2365 nmethods_code_size += stats->_nmethods_code_size; | 2379 nmethods_code_size += stats->_nmethods_code_size; |
2366 | 2380 |
2367 if (per_compiler) { | 2381 if (per_compiler) { |
2368 tty->print_cr(" %s {speed: %d bytes/s; standard: %6.3f s, %d bytes, %d methods; osr: %6.3f s, %d bytes, %d methods; nmethods_size: %d bytes; nmethods_code_size: %d bytes}", | 2382 tty->print_cr(" %s {speed: %d bytes/s; standard: %6.3f s, %d bytes, %d methods; osr: %6.3f s, %d bytes, %d methods; nmethods_size: %d bytes; nmethods_code_size: %d bytes}", |
2369 comp->name(), stats->bytes_per_second(), | 2383 comp->name(), stats->bytes_per_second(), |
2370 stats->_standard._time.seconds(), stats->_standard._bytes, stats->_standard._count, | 2384 stats->_standard._time.seconds(), stats->_standard._bytes, stats->_standard._count, |
2371 stats->_osr._time.seconds(), stats->_osr._bytes, stats->_osr._count, | 2385 stats->_osr._time.seconds(), stats->_osr._bytes, stats->_osr._count, |
2372 stats->_nmethods_size, stats->_nmethods_code_size); | 2386 stats->_nmethods_size, stats->_nmethods_code_size); |
2373 } | 2387 } |
2374 } | 2388 } |
2375 } | 2389 } |
2376 total_compile_count = osr_compile_count + standard_compile_count; | 2390 total_compile_count = osr_compile_count + standard_compile_count; |
2377 total_compilation.add(osr_compilation); | 2391 total_compilation.add(osr_compilation); |