Mercurial > hg > graal-compiler
diff 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 |
line wrap: on
line diff
--- a/src/share/vm/runtime/compilationPolicy.cpp Fri Jan 17 17:26:47 2014 +0100 +++ b/src/share/vm/runtime/compilationPolicy.cpp Fri Jan 17 16:03:13 2014 -0500 @@ -45,6 +45,9 @@ #include "runtime/vm_operations.hpp" #include "utilities/events.hpp" #include "utilities/globalDefinitions.hpp" +#ifdef GRAAL +#include "runtime/gpu.hpp" +#endif CompilationPolicy* CompilationPolicy::_policy; elapsedTimer CompilationPolicy::_accumulated_time; @@ -101,6 +104,32 @@ if (ReplayCompiles) return false; if (m->has_compiled_code()) return false; // already compiled + +#ifdef GRAAL + // Check if this is a Lambda method that can be compiled to a GPU. + if (m->is_lambda()) { + // If GPU is available and the necessary linkage is available + // rerurn true indicatin that this method must be compiled. + if (gpu::is_available() && gpu::has_gpu_linkage()) { + if (TraceGPUInteraction) { + tty->print("Compiling Lambda method"); + m->print_short_name(); + switch (gpu::get_target_il_type()) { + case gpu::PTX : + tty->print_cr(" to PTX"); + break; + case gpu::HSAIL : + tty->print_cr(" to HSAIL"); + break; + default : + tty->print_cr(" to Unknown GPU!!!"); + } + } + return true; + } + } +#endif + if (!can_be_compiled(m, comp_level)) return false; return !UseInterpreter || // must compile all methods