start | find | index | login or register | edit
by earl, 5592 days ago
A few days back, something had me stumble into recent OpenJDK-related developments. Here's a report of that journey, as I found it to be inspiring. After all, it seems that Sun's open-source release of Java worked as some sort of catalyst to spark a lot of extremely interesting development in the fields of alternative JVM implementations.

Please note that all of the following are highly personal observations, gathered from reading a lot of stuff on the web. It's a summary of what I read and the picture I took away from that. Obviously, that's not necessarily correct, and heck, I may even get it factually wrong at times. You've been warned.

Before OpenJDK, besides Sun's proprietary Java implementation, notable open-source/research implementations were Cacao, Jikes, Kaffe and GCJ. One of the problems all those implementations had to face was that implementing a JVM only gets you that far; to really become a usable Java runtime, you also need an implementation of the standard class libraries. To share the burden, this work got somewhat consolidated into what became GNU Classpath, which got adopted by all the aforementioned JVMs.

Well, that was the status before OpenJDK, which was released in November 2006. My recent interest in those matters was sparked by stumbling over Gary Benson's weblog. He's working for RedHat "extending OpenJDK to build and run on all the platforms we [RedHat] support." Now, OpenJDK supports x86/x86-64 and SPARC. I'm not so sure about RedHat, but they definitely support zSeries and PPC beyond that, and I'm pretty sure they support IA-64 as well.

So as part of this job, Gary Benson recently worked on porting OpenJDK to run on PPC, and it seems that this was a quite painful experience:

"Red Hat sponsored the creation of a PowerPC port. Getting this port to the state where it just worked -- where it could run basic applications very slowly -- required over 10,000 lines of very low-level, system-specific code, of which approximately 1,000 lines were assembler. This took of the order of half a man-year."

So based on that, Gary Benson decided to build a cross-platform interpreter-only port of OpenJDK, dubbed Zero. Zero has been stable now for a while (since Mar 2008), and is known to work nicely on Alpha, ARM, IA-64, MIPS, PPC, x86-64, and zSeries. The big news is, that as of February 2009, OpenJDK builds including Zero pass the Java 6 TCK, in other words: the Zero port of OpenJDK is certified as valid and compatible Java 6 implementation.

Granted, Zero is slow, but for some tasks it's better to have a compliant but slow Java than no Java at all.

As an aside, this general approach seems to be worthy to be adopted by other alternative VM implementations. Cacao, for example, is now (since Jun 2008) integrated with OpenJDK (strictly, it's integrated with IcedTea, but I won't bother you with that bit here) and can therefore be used as a fast, JITting VM embedded in what is a regular Java runtime otherwise (i.e. Sun's class libraries). Cacao also supports a similar set of platforms as Zero, namely Alpha, ARM, MIPS64, PPC, SPARC64, x86-64, and zSeries.

But alas, Zero is not the end of this trip report. Realising the potential of this code-base, Gary Benson also started to work on extending interpreter-only Zero by once again adding a native JIT compiler back to the mix. This effort is termed Shark, and, lo and behold, in a true strife for minimalism and code re-use, Shark utilises LLVM. And while it's still very much a work in progress, and has several bugs that simply crash the JVM, it shows a way for improvement, performance-wise: at the moment it's between a factor 2 to 5 slower compared to Sun's [create HotSpot] Server VM. Which, on the one hand, obviously is a big slowdown for performance-critical apps, but on the other hand is already a reasonable range to have a lot of apps working just fine (you wouldn't really notice too much in an Ant build, for example). And once again, that's quite early and unoptimized code, that's not even utilizing any of LLVM's optimization passes. So there's quite some potential left to explore.

And here's where my travel report comes to an end, with tons of links to explore those interesting developments for yourself. One final reading suggestion is Andrew Haley's OpenJDK article in RedHat Magazine providing a short historical perspective (and you'll also be given the raison d'ĂȘtre for IcedTea).
powered by vanilla
echo earlZstrainYat|tr ZY @. • esa3 • online for 8533 days • c'est un vanilla site