Skip to content

JikesRVM binding for MMTk

License

Apache-2.0, MIT licenses found

Licenses found

Apache-2.0
LICENSE-APACHE
MIT
LICENSE-MIT
Notifications You must be signed in to change notification settings

mmtk/mmtk-jikesrvm

Repository files navigation

MMTk-JikesRVM

This repository provides the JikesRVM binding for MMTk.

Contents

Requirements

We maintain an up to date list of the prerequisites for building MMTk and its bindings in the mmtk-dev-env repository. Please make sure your dev machine satisfies those prerequisites.

MMTk/JikesRVM supports linux-i686 and linux-x86_64 (as a 32-bit program).

Before you continue

If you use the set-up explained in mmtk-dev-env, make sure to do the following steps before continuing to the Build section:

  1. Use a proper Rust toolchain. The minimal supported Rust version for MMTk-JikesRVM binding is 1.61.0. Make sure your Rust version is higher than this. We test MMTk-JikesRVM binding with Rust 1.66.1 (as specified in rust-toolchain).

  2. Set openjdk-8-jdk as the default JDK (openjdk-8-jdk is a build requirement of JikesRVM), e.g. by running:

$ update-java-alternatives --set java-1.8.0-openjdk-amd64
  1. You may also need to use ssh-agent to authenticate with github (see here for more info):
$ eval `ssh-agent`
$ ssh-add

Getting Sources (for MMTk and JikesRVM)

To work on JikesRVM binding, we expect you have a directory structure like below. This section gives instructions on how to check out those repositories with the correct version.

Your working directory/
├─ mmtk-jikesrvm/
│  ├─ jikesrvm/
│  └─ mmtk/
├─ jikesrvm/
└─ mmtk-core/ (optional)

Checkout Binding

First clone this binding repo:

$ git clone https://github.com/mmtk/mmtk-jikesrvm.git

The binding repo mainly consists of two folders, mmtk and jikesrvm.

  • mmtk is logically a part of MMTk. It exposes APIs from mmtk-core and implements the VMBinding trait from mmtk-core.
  • jikesrvm is logically a part of JikesRVM. When we build JikesRVM, we copy this folder to the JikesRVM repo (which overwrite the same files, if any, in the JikesRVM repo) and treat it as if it is a part of the JikesRVM project.

Checkout JikesRVM

You would need our JikesRVM fork which includes the support for a third party heap (like MMTk). We assume you put jikesrvm as a sibling of mmtk-jikesrvm. Cargo.toml defines the version of JikesRVM that works with the version of mmtk-jikesrvm.

Assuming your current working directory is the parent folder of mmtk-jikesrvm, you can checkout out JikesRVM and the correct version using:

$ git clone https://github.com/mmtk/jikesrvm.git
$ git -C jikesrvm checkout `sed -n 's/^jikesrvm_version.=."\(.*\)"$/\1/p' < mmtk-jikesrvm/mmtk/Cargo.toml`

Checkout MMTk core (optional)

The MMTk-JikesRVM binding points to a specific version of mmtk-core as defined in Cargo.toml. When you build the binding, cargo will fetch the specified version of mmtk-core. If you would like to use a different version or a local mmtk-core repo, you can checkout mmtk-core to a separate repo and modify the mmtk dependency in Cargo.toml.

For example, you can check out mmtk-core as a sibling of mmtk-jikesrvm.

$ git clone https://github.com/mmtk/mmtk-core.git

And change the mmtk dependency in Cargo.toml (this assumes you put mmtk-core as a sibling of mmtk-jikesrvm):

mmtk = { path = "../../mmtk-core" }

Build

MMTk building is integrated as as a step of the JikesRVM build. We recommend using the buildit script for the JikesRVM build.

$ cd repos/jikesrvm
$ ./bin/buildit localhost RBaseBaseSemiSpace --use-third-party-heap=../mmtk-jikesrvm --use-third-party-build-configs=../mmtk-jikesrvm/jikesrvm/build/configs/ --use-external-source=../mmtk-jikesrvm/jikesrvm/rvm/src --m32

The JikesRVM binary is under jikesrvm/dist/RBaseBaseSemiSpace_x86_64_m32-linux/rvm and the MMTk shared library is jikesrvm/dist/RBaseBaseSemiSpace_x86_64_m32-linux/libmmtk.so.

You can build with other build configs, check mmtk-jikesrvm/jikesrvm/build/configs.

Test

Run DaCapo Benchmarks

Fetch DaCapo:

$ # run from the repo/jikesrvm directory
$ mkdir -p benchmarks
$ wget https://downloads.sourceforge.net/project/dacapobench/archive/2006-10-MR2/dacapo-2006-10-MR2.jar -O benchmarks/dacapo-2006-10-MR2.jar

Run rvm:

$ LD_LIBRARY_PATH=dist/RBaseBaseSemiSpace_x86_64_m32-linux/ dist/RBaseBaseSemiSpace_x86_64_m32-linux/rvm -Xms75M -Xmx75M -jar benchmarks/dacapo-2006-10-MR2.jar fop
===== DaCapo fop starting =====
ThreadId(1)[INFO:/root/mmtk-core/src/plan/global.rs:112]   [POLL] copyspace0: Triggering collection
ThreadId(1)[INFO:/root/mmtk-core/src/plan/global.rs:112]   [POLL] copyspace1: Triggering collection
ThreadId(1)[INFO:/root/mmtk-core/src/plan/global.rs:112]   [POLL] copyspace0: Triggering collection
ThreadId(1)[INFO:/root/mmtk-core/src/plan/global.rs:112]   [POLL] immortal: Triggering collection
ThreadId(1)[INFO:/root/mmtk-core/src/plan/global.rs:112]   [POLL] copyspace0: Triggering collection
ThreadId(1)[INFO:/root/mmtk-core/src/plan/global.rs:112]   [POLL] copyspace1: Triggering collection
===== DaCapo fop PASSED in 3934 msec =====