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.

Talking to people at FOSDEM made me realise just how much LiveJournal annoys me. When I started this blog I didn’t want to host it myself — the last time I tried that I spent more time fiddling with it than writing it! — but apparently I miss being in control, and since my ISP provides free WordPress installation maintainence… well… welcome to my new domain!

While I was moving the entries across I realised it’s been ages since I did a proper post. I first committed zero exactly a month ago, and if you’d asked me then what I’d like to have achieved now I’d have said an s390x port — at least! Stuff kept getting in the way, however. Fixing it up for amd64 made me realise that the core build patch was incomplete at best, and that the ports patch was far more complicated than it needed to be as a result. I spent a couple of weeks separating and rearranging the two — the tree is in a great state for new ports now — but then all kinds of things kicked off. OpenJDK 6 got released, IcedTea 7 started failing in koji, there was preparing for FOSDEM, and FOSDEM itself, and some other stuff that Lillian and I are doing… and still there are no new ports!

Anyway, hopefully the IcedTea 7 failure is #435337 — aka not my problem — but the OpenJDK 6 stuff is going to keep me busy for a time. The delay may turn out to be a good thing, however: chatting with aph made me realise I can probably make it such that new ports require no new patching at all if I generate some bits and pieces from the configure script. I’m letting that one cook in my head while I do the OpenJDK 6 stuff.