comparison src/share/vm/runtime/compilationPolicy.cpp @ 13683:de839ec35cc7

schedule lambda method compilation and execution on GPU (PTX) when possible; fix a couple of bugs.
author S.Bharadwaj Yadavalli <bharadwaj.yadavalli@oracle.com>
date Fri, 17 Jan 2014 16:03:13 -0500
parents 359f7e70ae7f
children 9161ed8ce796
comparison
equal deleted inserted replaced
13682:c4ff08d2aa0d 13683:de839ec35cc7
43 #include "runtime/timer.hpp" 43 #include "runtime/timer.hpp"
44 #include "runtime/vframe.hpp" 44 #include "runtime/vframe.hpp"
45 #include "runtime/vm_operations.hpp" 45 #include "runtime/vm_operations.hpp"
46 #include "utilities/events.hpp" 46 #include "utilities/events.hpp"
47 #include "utilities/globalDefinitions.hpp" 47 #include "utilities/globalDefinitions.hpp"
48 #ifdef GRAAL
49 #include "runtime/gpu.hpp"
50 #endif
48 51
49 CompilationPolicy* CompilationPolicy::_policy; 52 CompilationPolicy* CompilationPolicy::_policy;
50 elapsedTimer CompilationPolicy::_accumulated_time; 53 elapsedTimer CompilationPolicy::_accumulated_time;
51 bool CompilationPolicy::_in_vm_startup; 54 bool CompilationPolicy::_in_vm_startup;
52 55
99 bool CompilationPolicy::must_be_compiled(methodHandle m, int comp_level) { 102 bool CompilationPolicy::must_be_compiled(methodHandle m, int comp_level) {
100 // Don't allow Xcomp to cause compiles in replay mode 103 // Don't allow Xcomp to cause compiles in replay mode
101 if (ReplayCompiles) return false; 104 if (ReplayCompiles) return false;
102 105
103 if (m->has_compiled_code()) return false; // already compiled 106 if (m->has_compiled_code()) return false; // already compiled
107
108 #ifdef GRAAL
109 // Check if this is a Lambda method that can be compiled to a GPU.
110 if (m->is_lambda()) {
111 // If GPU is available and the necessary linkage is available
112 // rerurn true indicatin that this method must be compiled.
113 if (gpu::is_available() && gpu::has_gpu_linkage()) {
114 if (TraceGPUInteraction) {
115 tty->print("Compiling Lambda method");
116 m->print_short_name();
117 switch (gpu::get_target_il_type()) {
118 case gpu::PTX :
119 tty->print_cr(" to PTX");
120 break;
121 case gpu::HSAIL :
122 tty->print_cr(" to HSAIL");
123 break;
124 default :
125 tty->print_cr(" to Unknown GPU!!!");
126 }
127 }
128 return true;
129 }
130 }
131 #endif
132
104 if (!can_be_compiled(m, comp_level)) return false; 133 if (!can_be_compiled(m, comp_level)) return false;
105 134
106 return !UseInterpreter || // must compile all methods 135 return !UseInterpreter || // must compile all methods
107 (UseCompiler && AlwaysCompileLoopMethods && m->has_loops() && CompileBroker::should_compile_new_jobs()); // eagerly compile loop methods 136 (UseCompiler && AlwaysCompileLoopMethods && m->has_loops() && CompileBroker::should_compile_new_jobs()); // eagerly compile loop methods
108 } 137 }