logo of the SSW institute ;)
Computer Science
System Software

Home

General
Staff
Contact
Partners
Alumni

Research
Areas
Projects
Papers
Books
Reports
Awards

Teaching
Lectures
Exams
B.Projects
M.Theses
PhD Theses
Go Abroad

Misc
Talks
Library
Gallery
Links
Search

Webmaster


A Runtime Environment for the Truffle/C VM

Matthias Grimmer
Institute for System Software
Johannes Kepler University Linz, Austria


Abstract

This thesis presents an efficient runtime environment for a C interpreter implemented in Java. This interpreter uses the Truffle framework and is called the Truffle/C VM. A runtime environment for this VM has to bridge Java code, running in a Java Virtual Machine (JVM), and native code. This is necessary because C code, which runs in the Truffle/C VM (Java), can call any function present as native code (e.g., C standard library functions). It is not possible to use the Truffle/C VM to execute these native functions because their source code is often not available or written in different programming languages. To accomplish the interoperability between the Truffle/C VM and the native functions, this thesis introduces two concepts.

Firstly, it presents an efficient and dynamic approach for calling native functions from within Java. Traditionally, programmers use the Java Native Interface (JNI) to call such functions. This thesis introduces a new mechanism, which is tailored specifically towards calling native functions from Java. It is called the Graal Native Function Interface (GNFI). It is faster than JNI in all relevant cases and more flexible because it avoids the JNI boiler-plate code.

The second concept describes a memory model for the Truffle/C VM. This memory model offers sharing of run-time data between the interpreter (written in Java) and native code.

The runtime environment of the Truffle/C VM facilitates GNFI to provide an efficient function handling for the VM. It uses the memory model to establish interoperability between interpreted C code and native C code.

This thesis evaluates GNFI and the Truffle/C VM separately. The measurements demonstrate a significant performance advantage of GNFI compared to JNI and the Java Native Access (JNA) for normal Java applications. Also, the evaluation shows that the Truffle/C VM, using the introduced memory model, has a reasonable performance compared to C code, compiled using GCC.

Master's thesis, Johannes Kepler University Linz, November 2013

Download as PDF