Skip to content

MateVM/MateVM

Repository files navigation

MateVM is a Java JIT compiler written in Haskell, using already existing libaries, namly Harpy and hs-java.

MateVM is i686 (i.e. 32-Bit) only at the moment.

Visit us at #MateVM on OFTC!

We use hs-java to parse Java Classfiles in order to get a Java Bytecode representation. Afterwards we perform a basic-block analysis and generate a control-flow-graph (CFG). We apply several program-analyses, transformations and optimizations. Given the annotated CFG we emit native code for a method with Harpy (i686) in an on demand manner.

At the moment we try to minimize effort, by focusing on essential features of the JVM, for example there is no support for threads yet.

Dependencies

Install GHC via your distro manager. Make sure you install it with shared libaries. On Ubuntu 12.04 LTS that is:

$ sudo apt-get install ghc-dynamic ghc-prof \
  cabal-install libzip-dev libgc-dev

For an easy installation of the remaining packages, you can use the script ./tools/installhaskellenv.sh.

PLEASE NOTE: it deletes your ~/.cabal and ~/.ghc directory first in order to get a fresh cabal install!

Try it

Build the mate executable with (building with cabal isn't supported yet)

$ make

it also builds a simple base library for the Java Runtime, so be sure javac is in your $PATH. There are some working examples in ./tests/, you can execute one with the given Makefile; assume you want to execute ./tests/Fib.java:

$ make tests/Fib

or without the Makefile

$ javac tests/Fib.java
$ ./mate tests.Fib

you can compare the output with your Java JVM (java in your $PATH) with:

$ make tests/Fib.test

we also have a build bot which checks for broken cabal dependencies every night, and it also checks the build with make tests.

Unfortunately, we can't use GNU Classpath yet, but we're working on it, so stay tuned!

About

A Java JIT compiler written in Haskell

Resources

Stars

Watchers

Forks

Packages

No packages published

Languages