Saturday, December 13, 2008

Bops, tree hugging, and safe wagers

Back in July I wrote about how Apache Harmony's TreeMap implementation had been used (with modifications) to deliver improvements in Sun's SPECjbb2005 score by "a solid 3-5% depending on the platform" according to Dave who also promised that they were "making the necessary steps to give back [the] code changes to Apache Harmony"; even though they are not obliged to do so according to the Apache License.

Did you expect us to sit and wait?!

IBM has just published its latest SPECjbb2005 scores with, amongst other things, an enhanced version of TreeMap from Harmony that gives them a 10% boost, and thereby move ahead in many reporting categories. Derek has all the details, and I encourage you to read them.

It would be interesting to look back and compare the changes Sun and IBM made to Harmony's TreeMap, and merge them for the common good.

While I'm sure Dave's intentions are pure, I doubt the suits will let him contribute his changes back to Apache and all the talk of "requiring innovation sharing in the commons" only applies in one direction. In fact, I'm so sure, that if Sun do successfully contribute their TreeMap changes back to Apache Harmony I promise to give £500 of my own hard-earned money to The Woodland Trust to benefit some real trees.

Friday, December 12, 2008

Debugging mixed-language code in Apache Harmony + Eclipse

I've been hacking in managed runtimes for more years than I'd care to mention, and plenty of that time has been spent in debuggers of one sort or another!

...and that's the point. Implementing a runtime requires that you have a suite of debuggers that cover the different target platform native code and the dynamic late-bound language du jour. You have to switch from Eclipse to WinDbg/gdb and back again frequently.

Intel's Software group have (for some unknown reason) been quite low key about their innovation in this space, with the development of an integrated debugger for Java and JNI environments. This advance has been enabled by the combination of support in the Eclipse Java Debug Tools and Apache Harmony runtime.

Now, as you step into a native method from Java, the Eclipse debugger shows a logical representation of the mixed Java thread / C thread stack frames and allows you to inspect variables etc. in either language. They also support the JNI methods that call back into Java so you get full roundtripping. Cool.

For most people who need to debug a system comprising Java and native code this is exactly what you want to do, and its a real time saver to be able to manage the breakpoints, variable watches and flow of control from a single IDE.

Kudos to Chris, Vasily, Gregory, Ilya, et al who made this work. Clearly people who live in the real world!

Go watch the screencast demo, download it and try it out!