When developing on the compiler, developers very rarely need to build the entire JVM. Additionally, building only the compiler component is much faster than building the entire JVM. Therefore, this document outlines the process for speeding compiler development by only building the compiler component.
Note, this approach only works if the changes are limited to the compiler component; cross component work will require a full JVM rebuild.
First, build OpenJ9 as per the instructions in https://github.com/eclipse-openj9/openj9/tree/master/doc/build-instructions. Then, to build only the Compiler component, set up your environment as follows:
EXTENSIONS_DIR=<path to openj9-openjdk extensions repo>
JAVA_BASE=$EXTENSIONS_DIR/build/linux-x86_64-normal-server-release
# Go to top level directory
cd $EXTENSIONS_DIR/..
# Set up directory structure
ln -s $EXTENSIONS_DIR/openj9/runtime/compiler
ln -s $EXTENSIONS_DIR/omr
# Set up env vars
export TRHOME=$PWD
export J9SRC=$JAVA_BASE/vm
export PATH=$J9SRC:$PATH
# If using a clean openj9/omr repo, regenerate the tracegen files
pushd .
cd $TRHOME/compiler/env
tracegen -treatWarningAsError -generatecfiles -threshold 1 -file j9jit.tdf
echo ""
popd
# Compiler Makefile variables
export JIT_SRCBASE=$TRHOME
export JIT_OBJBASE=$TRHOME/objs
export JIT_DLL_DIR=$TRHOME
Then to build:
make -C $TRHOME/compiler -f compiler.mk BUILD_CONFIG=prod -j<num threads> J9_VERSION=29
To clean:
rm -rf $JIT_OBJBASE