In this paper, we presented Habanero-Java with OpenCL generation (HJ-OpenCL). HJ-OpenCL facilitates OpenCL utilization from a parallel JVM program.
The HJ-OpenCL language and compiler enable:

\begin{enumerate}
\item
Automatic generation of OpenCL kernels and JNI glue code from a Java parallel-for construct, (\hjforall{}).
\item
Efficient access to regular, multi-dimensional arrays in Java kernels intended for OpenCL execution using the \mbox{\tt array view} construct.
\item
Support for all-to-all barriers in OpenCL kernels using the \nextOp{} language construct.
\end{enumerate}

Unlike previous work, our approach also preserves Java exception semantics by 
generating code with {\em exception-safe} and {\em unsafe} regions using the \safe{} language construct.

Performance evaluation on multiple heterogeneous platforms demonstrated the advantages of flexibly executing
a single Java application across multiple execution modes.
On an AMD APU accessed from OpenCL, our results show speedups of up to 36.7$\times$ relative to sequential Java on the host 4-core CPU, 
and of up to 55.0$\times$ on an integrated GPU. 
For a system with an Intel Xeon CPU and a discrete NVIDIA Fermi GPU, OpenCL execution demonstrates performance improvement up to 
35.7$\times$ for the 12-core CPU and 324.0$\times$ for the GPU, relative to sequential Java. However, it is also important to note that some benchmarks
tested performed best when executed on the HJ runtime due to OpenCL overheads and the benefits of
load-balancing in the HJ runtime.

This work combines the best of managed and native execution. Using managed languages like Java, programmers gain
programmability, portability, extensive libraries, and high-level language features. However, this work and others have demonstrated 
lackluster performance in the JVM for computationally heavy workloads. On the other hand, native execution in OpenCL not only uses
native threads to eliminate overheads from managed execution but also facilitates execution on a variety of architectures.
HJ-OpenCL combines the parallel HJ programming language, a multi-threaded JVM runtime, and OpenCL execution to enable
complete portability, rapid prototyping, and transparent execution of Java applications across all OpenCL platforms.
