Mercurial > hg > truffle
comparison src/share/vm/compiler/compileBroker.cpp @ 4559:723df37192d6
Make it possible again to build a real client libjvm, drop the UseGraal flag.
Use the --vm option instead of a special -vm option in the bench command
author | Gilles Duboscq <duboscq@ssw.jku.at> |
---|---|
date | Fri, 10 Feb 2012 17:04:03 +0100 |
parents | 3c21eee8ab4d |
children | 33df1aeaebbf |
comparison
equal
deleted
inserted
replaced
4558:3706975946e4 | 4559:723df37192d6 |
---|---|
42 #include "runtime/javaCalls.hpp" | 42 #include "runtime/javaCalls.hpp" |
43 #include "runtime/os.hpp" | 43 #include "runtime/os.hpp" |
44 #include "runtime/sharedRuntime.hpp" | 44 #include "runtime/sharedRuntime.hpp" |
45 #include "runtime/sweeper.hpp" | 45 #include "runtime/sweeper.hpp" |
46 #include "utilities/dtrace.hpp" | 46 #include "utilities/dtrace.hpp" |
47 #ifdef GRAAL | |
47 #include "graal/graalCompiler.hpp" | 48 #include "graal/graalCompiler.hpp" |
49 #endif | |
48 #ifdef COMPILER1 | 50 #ifdef COMPILER1 |
49 #include "c1/c1_Compiler.hpp" | 51 #include "c1/c1_Compiler.hpp" |
50 #endif | 52 #endif |
51 #ifdef COMPILER2 | 53 #ifdef COMPILER2 |
52 #include "opto/c2compiler.hpp" | 54 #include "opto/c2compiler.hpp" |
678 | 680 |
679 #ifndef SHARK | 681 #ifndef SHARK |
680 // Set the interface to the current compiler(s). | 682 // Set the interface to the current compiler(s). |
681 int c1_count = CompilationPolicy::policy()->compiler_count(CompLevel_simple); | 683 int c1_count = CompilationPolicy::policy()->compiler_count(CompLevel_simple); |
682 int c2_count = CompilationPolicy::policy()->compiler_count(CompLevel_full_optimization); | 684 int c2_count = CompilationPolicy::policy()->compiler_count(CompLevel_full_optimization); |
685 #ifdef GRAAL | |
686 _compilers[0] = new GraalCompiler(); | |
687 #else | |
683 #ifdef COMPILER1 | 688 #ifdef COMPILER1 |
684 if (UseGraal) { | 689 if (c1_count > 0) { |
685 _compilers[0] = new GraalCompiler(); | 690 _compilers[0] = new Compiler(); |
686 } else if (c1_count > 0) { | |
687 _compilers[0] = new Compiler(); | |
688 } | 691 } |
689 #endif // COMPILER1 | 692 #endif // COMPILER1 |
693 #endif | |
690 | 694 |
691 #ifdef COMPILER2 | 695 #ifdef COMPILER2 |
692 if (c2_count > 0) { | 696 if (c2_count > 0) { |
693 _compilers[1] = new C2Compiler(); | 697 _compilers[1] = new C2Compiler(); |
694 } | 698 } |
934 } | 938 } |
935 | 939 |
936 // ------------------------------------------------------------------ | 940 // ------------------------------------------------------------------ |
937 // CompileBroker::is_idle | 941 // CompileBroker::is_idle |
938 bool CompileBroker::is_idle() { | 942 bool CompileBroker::is_idle() { |
943 #ifndef GRAAL | |
939 if (_c2_method_queue != NULL && !_c2_method_queue->is_empty()) { | 944 if (_c2_method_queue != NULL && !_c2_method_queue->is_empty()) { |
940 return false; | 945 return false; |
941 } else if (_c1_method_queue != NULL && !_c1_method_queue->is_empty()) { | 946 } else if (_c1_method_queue != NULL && !_c1_method_queue->is_empty()) { |
942 return false; | 947 return false; |
943 } else { | 948 } else { |
945 for (int i=0; i<num_threads; i++) { | 950 for (int i=0; i<num_threads; i++) { |
946 if (_method_threads->at(i)->task() != NULL) { | 951 if (_method_threads->at(i)->task() != NULL) { |
947 return false; | 952 return false; |
948 } | 953 } |
949 } | 954 } |
950 | 955 } |
951 // No pending or active compilations. | 956 #endif |
952 return true; | 957 // No pending or active compilations. |
953 } | 958 return true; |
954 } | 959 } |
955 | 960 |
956 | 961 |
957 // ------------------------------------------------------------------ | 962 // ------------------------------------------------------------------ |
958 // CompileBroker::compile_method | 963 // CompileBroker::compile_method |
1041 // Acquire our lock. | 1046 // Acquire our lock. |
1042 { | 1047 { |
1043 MutexLocker locker(queue->lock(), THREAD); | 1048 MutexLocker locker(queue->lock(), THREAD); |
1044 | 1049 |
1045 if (JavaThread::current()->is_compiling() && !BackgroundCompilation) { | 1050 if (JavaThread::current()->is_compiling() && !BackgroundCompilation) { |
1046 | 1051 #ifdef GRAAL |
1047 TRACE_graal_1("Recursive compile %s!", method->name_and_sig_as_C_string()); | 1052 TRACE_graal_1("Recursive compile %s!", method->name_and_sig_as_C_string()); |
1053 #endif | |
1048 method->set_not_compilable(); | 1054 method->set_not_compilable(); |
1049 return; | 1055 return; |
1050 } | 1056 } |
1051 | 1057 |
1052 // Make sure the method has not slipped into the queues since | 1058 // Make sure the method has not slipped into the queues since |
1111 // NOTE: in the event that there are multiple compiler threads and | 1117 // NOTE: in the event that there are multiple compiler threads and |
1112 // there is de-optimization/recompilation, things will get hairy, | 1118 // there is de-optimization/recompilation, things will get hairy, |
1113 // and in that case it's best to protect both the testing (here) of | 1119 // and in that case it's best to protect both the testing (here) of |
1114 // these bits, and their updating (here and elsewhere) under a | 1120 // these bits, and their updating (here and elsewhere) under a |
1115 // common lock. | 1121 // common lock. |
1116 /*task = create_compile_task(queue, | 1122 #ifndef GRAAL |
1123 task = create_compile_task(queue, | |
1117 compile_id, method, | 1124 compile_id, method, |
1118 osr_bci, comp_level, | 1125 osr_bci, comp_level, |
1119 hot_method, hot_count, comment, | 1126 hot_method, hot_count, comment, |
1120 blocking);*/ | 1127 blocking); |
1128 #endif | |
1121 } | 1129 } |
1122 | 1130 |
1123 #ifdef GRAAL | 1131 #ifdef GRAAL |
1124 if (!JavaThread::current()->is_compiling()) { | 1132 if (!JavaThread::current()->is_compiling()) { |
1125 method->set_queued_for_compilation(); | 1133 method->set_queued_for_compilation(); |
1126 GraalCompiler::instance()->compile_method(method, osr_bci, blocking); | 1134 GraalCompiler::instance()->compile_method(method, osr_bci, blocking); |
1127 } else { | 1135 } else { |
1128 // Recursive compile request => ignore. | 1136 // Recursive compile request => ignore. |
1129 } | 1137 } |
1130 #endif | 1138 #endif |
1131 | 1139 #ifndef GRAAL |
1132 /*if (blocking) { | 1140 if (blocking) { |
1133 wait_for_completion(task); | 1141 wait_for_completion(task); |
1134 }*/ | 1142 } |
1143 #endif | |
1135 } | 1144 } |
1136 | 1145 |
1137 | 1146 |
1138 nmethod* CompileBroker::compile_method(methodHandle method, int osr_bci, | 1147 nmethod* CompileBroker::compile_method(methodHandle method, int osr_bci, |
1139 int comp_level, | 1148 int comp_level, |