Fixing the OpenJDK ARM Support

This work has been completed, and is now in OpenJDK HEAD. This page is now mostly for historical documentation.

This page covers my work to fix the OpenJDK port for the ARM, that has been broken since May, 2010. This work initially requires fixing two bugs, and then adding some other patches after that works that are Thumb2 specific. The two bug reports are: PR 323 PR 484

Once that works, I plan to integrate the RTC Thumb2 JIT enhancements. These are patches which were not integrated into icedtea yet, because they show some regressions in the test suite. So after merging, there will likely be some bug fixing required.

Support for the ARM assembler was disabled due to other improvements to IcedTea and OpenJDK by commenting out the HOTSPOT_ASM flag in openjdk/hotspot/make/linux/makefiles/zeroshark.make.

+#XXX disabled until it has the updated frame anchor code (PR icedteopenjdk.orig/hotspot/323)
+#XXX and the updated calling convention for deopt (PR icedteopenjdk.orig/hotspot/484)
Here's a nice summary on what needs to be updated for pr323 at

I have a patch for pr323 that is now under more testing. This fixes the calling convention that got broken in the ARM assembler. The change added a Frame Pointer to the Thread data structure, which is now used where the Stack Pointer used to be. There are two main files this change effected are cppInterpreter_arm.S, and thumb2.cpp. There is also an initial patch for pr484 done by xerces merged in, but is currently untested. This patch doesn't effect any of the other changes.

Where the old code sets the Stack Pointer to zero, this now sets the Frame Pointer to zero instead. In the case the Stack Pointer is being set to a non-zero value, the Frame Pointer gets set to that value, and the Stack Pointer now points to the top of the Zero stack. There is a bit of a weird order this must be done in though. First the Stack Pointer has to be set to zero before setting the Frame Pointer. Then the Stack Pointer can be set to the top of the Zero stack.

Currently with this patch, the ARM assembler appears to work, while more debugging needs to be done to thumb2.cpp, which contains the thumb2 JIT. The Thumb2 JIT isn't used with Shark, so that combination may work now.

However this post makes it sound like there is still a problem which will have to be looked into. Here's another post on the new calling convention, and why HOTSPOT_ASM was commented out.

The RTC patches are explained in detail in this message by the author. Here's the 4 patches:

  • patch1
  • patch2
  • patch3
  • patch4
  • I merged my patches in after applying these 4 patches. For the interested, you can grab the Merged patch, but note this is still being debugged as all the files I modified have changed pretty heavily. There are still problems with the original RTC patches as noted in this post. So if can't build itself yet, there is obviously more that needs to be done,

    I found a good ARM assembler manual, which was very useful as my ARM assembler is more than rusty, and dates from the original Thumb1 days anyway.

    Testing Results

    These are the test results for OpenJDK's Hotsot tests n a variety of platforms and versions for comparison. These are built and run using the default packages with no chnages to establish a baseline for judging future test results on the ARM. Without baseline testing results, it's close to impossible to catch subtle regressions.

    The sources used are the unpatched versions as used by Icedtea, so all the patches apply cleanly. All source code has been imported into a temporary bzr repository for development of the ARM specific patches. I also grabbed the drop *.zip files, stuck them in a stable place, and then used the config options to use those, instead of downloading new ones after a make distclean

    When configuring, I discovered that not using the --with-openjdk option to configure builds java twice, wasting critical build time, but also can cause problems with the bootstrap directory not getting setup correctly, so the build fails.

    Icedtea 6-1.8

    Icedtea 6-1.8 was built using the sources from the openjdk-6-src-b18-16_feb_2010 tarball currently used by Icedtea6-1.8. The default configure options used were:
    ../OpenJDK/icedtea6-1.8/configure -with-parallel-jobs=1 --disable-docs --disable-plugin --with-openjdk

    Icedtea 6

    Icedtea 6 was built using the sources from the openjdk-6-src-b20-21_jun_2010 tarball currently used by Icedtea 6. The default configure options used were:
    ../OpenJDK/icedtea6/configure --with-parallel-jobs=1 --disable-docs --disable-plugin --with-openjdk

    Icedtea 7

    Icedtea 6 was built using the sources from the mercurial repository at using The default configure options used were:
    ../OpenJDK/icedtea/configure --with-parallel-jobs=1 --disable-docs> --disable-plugin --with-openjdk

    ARM Test Results

    Test results using the patched ARM assembler

    Hotspot 8 Errors 2 Failures
    JDK aborted aborted
    Langtools 10 Errors No Failures

    Test results using the ARM assembler interpreter

    Hotspot No Errors No Failures
    JDK 56 Errors 74 Failures
    Langtools 3 Errors 0 Failures
    Hotspot 7 Errors 3 Failures
    JDK (still running) (still running)
    Langtools 10 Errors No Failures

    x86_64 Test Results

    Many of these failures are because I didn't have $DISPLAY set, and some tests depend on X11. At least on the two 64bit machines I tried, the tests hung the desktop, making it impossible to get a complete run.

    Hotspot No Errors 1 Failure
    JDK No Errors 107 Failures
    Langtools No Errors No Failures
    Hotspot No Errors 1 Failure
    JDK No Errors 130 Failures
    Langtools 1 Error No Failures
    Hotspot No Errors 1 Failure
    JDK No Errors 158 Failures
    Langtools 2 Error No Failures

    x86 Test Results

    For these tests, $DISPLAY was still unset to keep the environment the same.

    Hotspot No Errors 1 Failure
    JDK No Errors 107 Failures
    Langtools 1 Error No Failures
    Hotspot No Errors 1 Failure
    JDK 1 Error 130 Failures
    Langtools 1 Error No Failures