Mercurial > hg > graal-jvmci-8
comparison src/share/vm/runtime/compilationPolicy.cpp @ 14526:10c4df6767c4
removed GPU offload interaction with compilation policy
author | Doug Simon <doug.simon@oracle.com> |
---|---|
date | Thu, 13 Mar 2014 17:48:44 +0100 |
parents | d8041d695d19 |
children | 4ca6dc0799b6 |
comparison
equal
deleted
inserted
replaced
14525:5e55de0379d9 | 14526:10c4df6767c4 |
---|---|
103 // Don't allow Xcomp to cause compiles in replay mode | 103 // Don't allow Xcomp to cause compiles in replay mode |
104 if (ReplayCompiles) return false; | 104 if (ReplayCompiles) return false; |
105 | 105 |
106 if (m->has_compiled_code()) return false; // already compiled | 106 if (m->has_compiled_code()) return false; // already compiled |
107 | 107 |
108 if (CompilationPolicy::can_be_offloaded_to_gpu(m)) return true; | |
109 | |
110 if (!can_be_compiled(m, comp_level)) return false; | 108 if (!can_be_compiled(m, comp_level)) return false; |
111 | 109 |
112 return !UseInterpreter || // must compile all methods | 110 return !UseInterpreter || // must compile all methods |
113 (UseCompiler && AlwaysCompileLoopMethods && m->has_loops() && CompileBroker::should_compile_new_jobs()); // eagerly compile loop methods | 111 (UseCompiler && AlwaysCompileLoopMethods && m->has_loops() && CompileBroker::should_compile_new_jobs()); // eagerly compile loop methods |
114 } | 112 } |
157 } | 155 } |
158 } else if (is_compile(comp_level)) { | 156 } else if (is_compile(comp_level)) { |
159 result = !m->is_not_osr_compilable(comp_level); | 157 result = !m->is_not_osr_compilable(comp_level); |
160 } | 158 } |
161 return (result && can_be_compiled(m, comp_level)); | 159 return (result && can_be_compiled(m, comp_level)); |
162 } | |
163 | |
164 bool CompilationPolicy::can_be_offloaded_to_gpu(methodHandle m) { | |
165 #ifdef GRAAL | |
166 if (GPUOffload && gpu::initialized_gpus() > 0) { | |
167 // Check if this method can be off-loaded to GPU. | |
168 if (m->is_synthetic()) { | |
169 // A lambda method is a synthetic method. | |
170 Symbol * klass_name = m->method_holder()->name(); | |
171 Symbol * method_name = m->name(); | |
172 { | |
173 ResourceMark rm; | |
174 if (klass_name != NULL) { | |
175 const char* javaClass = "java/"; | |
176 // Exclude java library classes - for now | |
177 if (strncmp(klass_name->as_C_string(), javaClass, strlen(javaClass))) { | |
178 if (method_name != NULL) { | |
179 const char* lambdaPrefix = "lambda$"; | |
180 char* methodPrefix = strstr(method_name->as_C_string(), lambdaPrefix); | |
181 if (methodPrefix != 0) { | |
182 if ((strncmp(lambdaPrefix, methodPrefix, strlen(lambdaPrefix)) == 0)) { | |
183 if (TraceGPUInteraction) { | |
184 char buf[O_BUFLEN]; | |
185 tty->print_cr("Selected lambda method %s for GPU offload", m->name_and_sig_as_C_string(buf, O_BUFLEN)); | |
186 } | |
187 return true; | |
188 } | |
189 } | |
190 } | |
191 } | |
192 } | |
193 } | |
194 } | |
195 } | |
196 #endif | |
197 return false; | |
198 } | 160 } |
199 | 161 |
200 bool CompilationPolicy::is_compilation_enabled() { | 162 bool CompilationPolicy::is_compilation_enabled() { |
201 // NOTE: CompileBroker::should_compile_new_jobs() checks for UseCompiler | 163 // NOTE: CompileBroker::should_compile_new_jobs() checks for UseCompiler |
202 return !delay_compilation_during_startup() && CompileBroker::should_compile_new_jobs(); | 164 return !delay_compilation_during_startup() && CompileBroker::should_compile_new_jobs(); |