I took my first glance through Hotspot recently. I’m vaguely curious to see what it would take to port it to PowerPC, not because I have a particular love for that architecture, but because it is important for switching Fedora and RHEL from GCJ to OpenJDK. Also, I’m spending a bit of time researching what I want to work on next, and I think OpenJDK is one of the available options.

Hotspot seems like pretty nice C++ code, overall. The structure is easy to navigate. There are comments pretty much where I expect them.

So far I’ve only looked at simple bits. In particular I tried to read the code that corresponds to code in libgcj with which I am very familiar — the interpreter and the verifier.

The Hotspot verifier is a bit more “C++-y” than mine. Stuff is spread out a bit more and a little more abstract, so I find it somewhat harder to read. But, that’s to be expected. I didn’t try to delve into the deeper things (how do they really handle jsr), since I was only looking at this while waiting for a build today. Some other time.

There seem to be two bytecode interpreters in Hotspot. First, a simple C-ish one, roughly like the libgcj interpreter before I added direct threading. This one is not the default, I suppose it is probably only used when bootstrapping on a new platform or something like that.

The other interpreter is trickier and implements something which is sort of like early Kaffe JITs. The idea is that most bytecodes have an associated function that generates bits of machine code. Before executing a method, a very simple form of JITting is applied where these functions are called to compile code, naively, into a buffer which is then executed.

Well, I hope that is what happens… I’m not trusting myself much this week and the code is fairly convoluted.

I haven’t made much progress on my goal of seeing how hard a port is. The existing ports look pretty small… from 28 KLOC (amd64) to 36 KLOC (sparc).

Share if you liked it


  • […] I’m still considering what to work on next. As I mentioned earlier, OpenJDK seems to be one viable option. The only other idea I have at the moment is a massive change to the C and C++ front ends to GCC. […]

  • If a total stranger ( but nice person ) has any influence, I say go for OpenJDK.
    To get a full GPL’d OSS JDK much needs to be done. A person with your obvious experience and talent could provide a lot to making that occur in a timely manner. The benefits to the Java community and world, in general, are vast.

    …just 2 cents so whatever you decide, best of luck at it.

Join the Discussion

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>