David A Roberts

LLJVM

LLJVM provides a set of tools and libraries for running comparatively low level languages (such as C) on the JVM.

The C to JVM bytecode compilation provided by LLJVM involves several steps. Source code is first compiled to LLVM intermediate representation (IR) by a frontend such as llvm-gcc or clang. LLVM IR is then translated to Jasmin assembly code, linked against other Java classes, and then assembled to JVM bytecode.

The use of LLVM IR as the intermediate representation allows more information about the source program to be preserved, compared to other methods which use MIPS binary as the intermediate representation. For example, functions are mapped to individual JVM methods, and all function calls are made with native JVM invocation instructions. This allows compiled code to be linked against arbitrary Java classes, and Java programs to natively call individual functions in the compiled code. It also allows programs to be split across multiple classes (comparable to dynamic linking), rather than statically linking everything into a single class.

Also note that while C is currently the only supported input language, any language with a compiler targeting LLVM IR could potentially be supported.

There are several ways to obtain the current release:

Links



blog comments powered by Disqus

Search

Loading...


Random Quote

Loading...



© 2007–2011 David A Roberts. Valid XHTML & CSS. Entries (RSS) & Comments (RSS). Source code.