Porting Shark

Shark when it’s done will be great, a massive improvement over Zero, but LLVM only supports a couple of the platforms people use Zero on. I’ve wondered a few times how the task of porting LLVM to a new architecture compares with writing a full HotSpot port from scratch. This morning I realised I could get a rough idea by simply counting the lines of x86-specific code, the one port they share:

  Lines of code
LLVM 2.4 34,391
HotSpot 14.0b08 77,329

This is just raw lines of code, nothing clever. Both implement a combined IA-32 and X86-64 port, and the HotSpot figure is for the Linux port with the server JIT — one OS, one JIT — so I believe it’s a fair comparison. You could infer that porting LLVM and using Zero and Shark will get you up and running with OpenJDK in about half the time. That’s not bad.