Coroutines for Java

Lukas Stadler
Welcome!

This page contains information about the experimental coroutine implementation for the HotSpot Java VM. The implementation is part of the Da Vinci Machine Project, a larger effort to bring features to the JVM that help dynamic language implementations. But coroutines aren't only useful for dynamic languages, they also have many advantages for Java programmers.
Please read the introductory pdf for a more in-depth overview and a bit of history.

Introduction, API, etc.:

Please take a look at the following document, it describes everything you need to know about coroutines and this implementation for Java:

Building

(Very short) build instructions:
  • Get mercurial and the mercurial forest extension.

  • Get the mlvm repository from http://hg.openjdk.java.net/mlvm/mlvm:
    hg fclone http://hg.openjdk.java.net/mlvm/mlvm patches

  • Follow the instructions from the README.txt contained within the mlvm repo.
    Make sure that the coro patch is enabled by adding "coro" or "coro-simple" (see below) to the set of guards: guards="buildable testable coro"

Pre-built binaries:

The build process can be very complex, so you can just download one of the following pre-built binaries:
  • Simplified version (coro-simple): this version does not allow for coroutine serialization and migration, but is generally more stable.
    Coroutine VM SDK MacOS x64 - (product build) (debug build)
    Coroutine VM SDK Linux x64 - (product build) (debug build)

  • Full version (coro): contains all features including serialization and migration, but is less stable that the simplified version.
    Coroutine VM SDK Linux x64 - (product build) (debug build)
    The maximum number of allocated stacks per thread (default: 100) can be configured via: -Dcoro.stacksPerThread=xxx.

Publications