Update of "cowjac"
Not logged in

Many hyperlinks are disabled.
Use anonymous login to enable hyperlinks.

Overview

Artifact ID: 726d460cf56c6932c802e98f9c77a61fb17b8ab9
Page Name:cowjac
Date: 2012-09-15 10:35:42
Original User: dg
Parent: cad5b28db780e906273c28839f5923f0f870664d
Content

cowjac is an experimental AOT Java compiler. It works by compiling Java into reasonably portable C++, and then compiling the C++.

Introduction

It's intended for use on devices which don't support or allow running a JVM. cowjac produces completely standalone binaries.

Performance is adequate (some very rough-and-ready benchmarks on my machine show that, with all the optimisation turned on, it runs at about a quarter the speed of Hotspot Server... which is still very fast). Footprint is not brilliant; right now every binary gets most of the Apache Harmony standard library compiled into it, which means that they're about 2MB minimum.

Reflection is not supported. There's some basic and largely broken support for Class objects, and just enough of java.lang.reflect to make System.arraycopy work, but that's it. There is currently no built-in garbage collector or threading (but both are planned; all the hooks are in place for a simple and portable mark/sweep garbage collector, but it's not done yet). However, linking against libgc works just fine.

The current status of cowjac is that it will run command-line applications well enough to do benchmarks.

cowjac uses the Soot Java analysis framework to do the heavy lifting. It also contains a severely truncated version of the Apache Harmony standard library.

Getting it

Currently cowjac is still in the mad hacking stage, and the only distribution package is an automatically generated tarball from the head of the repository:

I'd strongly recommend you clone the repository instead:

fossil clone https://chiselapp.com/user/dg/repository/cowjac cowjac.fossil
mkdir cowjac
cd cowjac
fossil open ../cowjac.fossil

To build cowjac, you'll need Java, Scala, and ant.

[edit build.xml and change the two scala paths at the top]
ant run
make
./cowjac

Using it

There's currently an incredibly basic test framework to make it all go. When you do ant run, the contents of library/src will be compiled into the cowjacOutput directory; doing make (with as much -j as you've got, there are a lot of files) will compile all this into a binary which you can run.

library/src contains a completely standalone Java environment. If it's not in there, you don't get to use it. There's a reasonable amount, but some of the more exotic stuff are just stubs and some is just missing (Calendar, DateTime, NumberFormat, Formatter... *shudder*). Using unimplemented features will either produce Java compilation errors, runtime exceptions or assertion failures, or just crash. If you feel like you want to add stuff, let me know and I'll give you repository access.

Support

None!

But I have been prodded into writing a few notes:

If you have any questions, email me, David Given, at dg@cowlark.com. If there's any interest I'll set up a mailing list.

Licensing

Soot is licensed under the GNU Lesser General Public License.

Apache Harmony is licensed under the Apache License version 2.0.

Everything else I, David Given (dg@cowlark.com) wrote, and is available under the Simplified BSD License.