A blog about programming topics, mostly JVM, Linux kernel, and x86 related things.

Friday, August 29, 2008

Jato status update #4

The bytecode coverage of Jato is now at 42% thanks to Siam's commit 4485e7c ("x86: add support for array load/store of different types")! The commit adds support for char, byte, short, and object array load and store bytecode instructions. There are also patches floating around for long arrays but Jato needs bit more work on the 64-bit code before we can merge them.

We also discovered in the process that our reload logic was broken. Fortunately, it's now fixed by commit ee2e564 ("jit: fix insertion of reload instructions").

Thursday, August 21, 2008

Jato status update #3

Siam added support for integer array load and store instructions in commit 3e96c24 ("x86: add support for iastore and iaload instructions"). He's now working on byte, char, and short array load and store functions.

For a long time I have wanted to be able to use System.out.println() in the regression suite. The register allocator was blocking that but now that Arthur has fixed it I started working on the issue again. After some debugging, I noticed that we don't handle the expression stack properly for basic blocks that are part of an exception handler. The bytecode instructions expect the top-most element to be the exception thrown but now it's just empty.

As we don't have other support for exception handling, I simply disabled compilation of exception handlers in commit c3aaa6c ("jit: don't compile exception handler basic blocks"). We're not quite there yet, though, as with the the fix, I now get a SIGSEGV somewhere deep in GNU Classpath.

Monday, August 18, 2008

Jato status update #2

Arthur has finally fixed a long-standing bug in Jato and we no longer clobber registers when invoking methods!

Callee-saved registers are now saved and restored unconditionally as of commit b92b9d3 ("x86: Unconditionally save callee-saved registers in function prolog."). We should save a callee-saved register only if a method actually uses it but implementing that turned out to be harder than expected. So to get things rolling we decided to go forward with the simple (but correct) approach and leave the optimization for later.

Commit bfc93a7 ("x86: CALL_* now properly create intervals for caller saved registers.") adds some preliminary code for handling caller-saved registers. The good news is that after this commit, we no longer clobber caller-saved registers. The bad news is that if a method has a CALL instruction, all caller-saved registers will be blocked from the whole method. That is, only the three callee-saved registers, EBX, ESI, and EDI are available for allocating a register for non-fixed intervals.

So while the register allocator needs more fixing still, the generated code is finally correct and working.