Instructions for adding JavaFX support and hsdis (HotSpot disassembly) to the Oracle ARM JDK
Time needed to build the prerequisites to patch your JDK (on Raspberry Pi 3): 1 hour.
On a Raspberry Pi you should set the memory split to allocate 256MB to the GPU
Set memory split to 256MB GPU
sudo raspi-config
-> 7 Advanced Options
-> A3 Memory Split
-> 256
-> 7 Advanced Options
-> A3 Memory Split
-> 256
Add pi user to the video and input groups
sudo usermod -a -G video pi
sudo usermod -a -G input pi
Save changes and reboot your Pi
Install required software packages (Raspbian)
Here is the list of installed packages on my Raspberry Pi needed for building hsdis, icedtea etc
Install this list of packages on your Pi using
wget https://www.chrisnewland.com/images/jitwatch/installed-software.log
sudo dpkg --set-selections < installed-software.log
sudo apt-get -u dselect-upgrade
sudo dpkg --set-selections < installed-software.log
sudo apt-get -u dselect-upgrade
Download Oracle JDK for ARM
Next download the latest ARM JDK from Oracle (Currently Java 8 update 121)
For the Raspberry Pi you will need the 32bit hard float download "Linux ARM 32 Hard Float ABI" filename jdk-8u121-linux-arm32-vfp-hflt.tar.gz
Unpack this compressed JDK
tar -xzf jdk-8u121-linux-arm32-vfp-hflt.tar.gz
Set up JAVA_HOME environment variable to point to the JDK you just installed
export JAVA_HOME=/home/pi/jdk1.8.0_121
Patch your JDK
Choose a folder where you will download the required software
export JAVA_ARM=/home/pi/JAVA_ARM_DEV
mkdir $JAVA_ARM
cd $JAVA_ARM
mkdir $JAVA_ARM
cd $JAVA_ARM
OpenJFX Overlay
Download OpenJFX for ARM from my nightly build server
wget https://chriswhocodes.com/downloads/openjfx-8-sdk-overlay-linux-armv6hf.zip
Unpack OpenJFX overlay into your JDK
unzip openjfx-8-sdk-overlay-linux-armv6hf.zip -d $JAVA_HOME
Build hsdis
Download and unpack GNU binutils (required to build hsdis)
wget ftp://ftp.gnu.org/gnu/binutils/binutils-2.28.tar.gz
tar -xzf binutils-2.28.tar.gz
tar -xzf binutils-2.28.tar.gz
Download icedtea 6 (needed to patch OpenJDK's hsdis files for ARM CPUs)
hg clone http://icedtea.classpath.org/hg/icedtea6
Build icedtea (doesn't matter if the full build fails, we just need it to patch hsdis)
cd icedtea6/
./autogen.sh
./configure --with-jdk-home=$JAVA_HOME
make
./autogen.sh
./configure --with-jdk-home=$JAVA_HOME
make
Build hsdis (HotSpot disassembler)
cd openjdk/hotspot/src/share/tools/hsdis
make BINUTILS=$JAVA_ARM/binutils-2.28
make BINUTILS=$JAVA_ARM/binutils-2.28
Install the hsdis binary into your JDK
cp build/linux-arm/hsdis-arm.so $JAVA_HOME/jre/lib/arm/client/
cp build/linux-arm/hsdis-arm.so $JAVA_HOME/jre/lib/arm/server/
cp build/linux-arm/hsdis-arm.so $JAVA_HOME/jre/lib/arm/server/
Download JITWatch
Download JITWatch from GitHub
git clone https://github.com/AdoptOpenJDK/jitwatch $JAVA_ARM/jitwatch
Build JITWatch
cd $JAVA_ARM/jitwatch
mvn clean compile
mvn clean compile
Run JITWatch
Launch JITWatch (using JavaFX switches to use the GTK platform so it runs windowed and not fullscreen)
./launchUI.sh -Dprism.order=sw -Dglass.platform=gtk
Get your first Java program compiled and analysed using the Sandbox feature.
Open the Sandbox
Click on the "Sandbox" button in the main window to open up JITWatch's sandbox environment for testing small code samples.
Open the Sandbox config
Click the "Configure Sandbox" button to customise the sandbox environment.
Enable server VM on ARM
You will probably want to configure the Sandbox to use the server VM to access the advanced HotSpot optimisations.
Add -server to Extra VM switches
Execute the example code
Click the "Run" button to compile and execute this example program with the JIT logging switches enabled.
JITWatch will then parse and analyse the resulting log file.
Examine the results
Inspect the source, bytecode, and assembly and look in the annotated bytecode for information about inlining, branch prediction, intrinsics and other optimisations made by HotSpot when it executed your program.
For more information about JITWatch visit https://github.com/AdoptOpenJDK/jitwatch