Set up MMTk and OpenJDK
This tutorial can be completed with any binding. However, for the sake of simplicity, only the setup for the OpenJDK binding will be described in detail here. If you would like to use another binding, you will need to follow the README files in their respective repositories (JikesRVM, V8) to set them up, and find appropriate benchmarks for testing. Also, while it may be useful to fork the relevant repositories to your own account, it is not required for this tutorial.
First, set up OpenJDK, MMTk, and the binding:
- Clone the OpenJDK binding and mmtk-core repository, and install any relevant dependencies by following the instructions in the OpenJDK binding repository.
- Ensure you can build OpenJDK according to the instructions in the READMEs of
the mmtk-core repository and the
OpenJDK binding repository.
- Use the
slowdebug
option when building the OpenJDK binding. This is the fastest debug variant to build, and allows for easier debugging and better testing. The rest of the tutorial will assume you are usingslowdebug
. - You can use the env var
MMTK_PLAN=[PlanName]
to choose a plan to use at run-time. The plans that are relevant to this tutorial areNoGC
andSemiSpace
. - Make sure you only use the env var
MMTK_PLAN=[PlanName]
when you run the generatedjava
binary (./build/linux-x86_64-normal-server-$DEBUG_LEVEL/jdk/bin/java
). Do not setMMTK_PLAN
when you build OpenJDK (if you already have set the env varMMTK_PLAN
, you would need to doexport MMTK_PLAN=
orunset MMTK_PLAN
to clear the env var before building).
- Use the
The MMTk OpenJDK binding ships with a fixed version of mmtk-core, specified in mmtk-openjdk/mmtk/Cargo.toml
.
For local development, you would need to build the binding with a local copy of the mmtk-core repo that you
can modify. You would need to point the mmtk dependency to a local path.
- Find
mmtk
under[dependencies]
inmmtk-openjdk/mmtk/Cargo.toml
. It should point to the mmtk-core git path with a specific revision. - Comment out the line for the git dependency, and uncomment the following line for a local dependency.
- The local dependency points to
mmtk-openjdk/repos/mmtk-core
by default. If your local mmtk-core path is notmmtk-openjdk/repos/mmtk-core
, modify the path to point to your local mmtk-core. - Rebuild the OpenJDK binding.