[llvm-dev] A "Java Backend"

Renato Golin via llvm-dev llvm-dev at lists.llvm.org
Tue Jul 19 08:58:17 PDT 2016


On 19 July 2016 at 15:52, Sanjoy Das via llvm-dev
<llvm-dev at lists.llvm.org> wrote:
> But you're right that it will still be difficult to naively
> inter-operate between Java and C++ objects.  Which is why it will be
> an interesting research project. :)

If you're trying to bypass/replace JNI, you're in for a surprise. :)

The number of bugs I found while interacting with Java from C or C++
on different VMs (MS, Sun, OpenJDK) were astounding.

Apart from the usual C++ class layout (which may be better in gcj as
David says), we had corruption in the stack because the VMs weren't
understanding the unwind information.

I originally found the stack bug in 2002 on Windows, later checked in
2008 and it was still there. I'd be surprised if that's fixed, and
even more surprised if that's the only remaining problem.

And those were only through JNI, a relatively safe interface. If you
try to send C++ directly to Java Bytecode, you'll find a huge list of
"implementation details" that are not just undefined, but thoroughly
undocumented and different on purpose (like memory allocation,
signals, asynchronous I/O, threads, etc).

Good luck! :)

cheers,
--renato


More information about the llvm-dev mailing list