Towards the end of last week I started trying to figure out how to slot an LLVM-based JIT into IcedTea. I had a vague idea that I could simply port C1 to it, but I’m not sure that would work so well. Both existing JITs expect to manage register allocation, for example, which LLVM will have to do. So I started hacking at the build system to have it build an entirely new JIT. I called it “shark” — I was going to call it C0 what with the other JITs being called C1 and C2, but I didn’t like the mild confusion that having them named and numbered causes, and shark was too good a name to waste on a one-off dummy architecture.

And speaking of one-off dummy architectures, my “if I can build on a platform that doesn’t even exist then I can build on anything” proved short lived — it doesn’t help on architectures that do exist but have really stupid unames that need truncating. I’m talking about ARM, of course, uname freak of the cosmos. So I’m going to try and get that working this week too.

I got two emails with zero patches yesterday. One I was expecting, from Yi Zhan of Intel who has it working on ia64; the other was totally out of the blue, from Ruediger Oertel of SuSE who has it building on s390 and s390x. I always hoped it would Just Work™ but I never quite believed it! Now all I need is the time to integrate it all!

Which I may just have. While I was poking around trying to fix the IcedTea 7 stack overflow I discovered that a) we mark a lot of stack unusable with 64kb pages, and b) the stack region locator doesn’t seem to work, at least for the cases with guard pages, or for ia64, or possibly with 64kb pages when the Java thread is an initial thread. I spent some time looking into it and rewriting it, and I think I have it sussed. (If you ever wanted to know where ia64 puts its guard pages then you need this!) Now it all seems to work I’m going to spend the afternoon writing some emails to the HotSpot list, then next week I intend to hole up and implement my holy grail of a zero build system that does not require any patching to build on a new architecture.

So don’t expect any action from me until that’s done :)

The 64kb pages issue turned out to be really simple. HotSpot reserves a bunch of pages at the end of the stack for overflow recovery. There’s one “red” page, two “yellow” pages, and three “shadow zone” pages. I don’t know what any of these pages actually do, but I do know that a 512k stack of eight 64k pages less six reserved pages and one glibc guard page leaves… 64k for everything else. It was throwing a StackOverflowError because it was actually running out of stack.