Skip to content

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 
 
 
 
 

Repository files navigation

ocaml-dynamic-wind

This is a dynamic-wind library implemented with OCaml effect handlers. It provides the following three semantics.

  • dynwind_delim -- delimited-continuation semantics
  • dynwind_full -- full-continuation semantics
  • dynwind_full_noopt -- unoptimized full-continuation semantics for benchmarking

Repository Layout

  • Makefile -- Makefile for building the library
  • src -- library source code
  • benchmark -- benchmark programs

Each experiment directory under benchmark/ has its own Makefile and run.sh. The benchmark Makefiles automatically build the required library archives via the top-level Makefile.

Building the Library

Run the following command at the top level.

make libs

This generates the following archives under _lib/.

_lib/dynwind_delim/dynwind_delim.cmxa
_lib/dynwind_full/dynwind_full.cmxa
_lib/dynwind_full_noopt/dynwind_full.cmxa

To remove the generated files, run:

make clean-libs

_lib/ is a local build output directory used only inside this repository.

Using the Library

To use the library from your own OCaml file, link with ocamlopt and specify the archive and include path for the semantics you want to use.

Full-continuation semantics:

ocamlopt \
  -I _lib/dynwind_full \
  -o your_program.exe \
  _lib/dynwind_full/dynwind_full.cmxa \
  your_program.ml

Delimited-continuation semantics:

ocamlopt \
  -I _lib/dynwind_delim \
  -o your_program.exe \
  _lib/dynwind_delim/dynwind_delim.cmxa \
  your_program.ml

Unoptimized full-continuation semantics:

ocamlopt \
  -I _lib/dynwind_full_noopt \
  -o your_program.exe \
  _lib/dynwind_full_noopt/dynwind_full.cmxa \
  your_program.ml

Quick Library Checks

Each library directory contains small tests.

cd src/dynwind_delim
ocaml tests.ml

cd ../dynwind_full
ocaml tests.ml
ocaml example.ml

cd ../dynwind_full_noopt
ocaml tests.ml
ocaml example.ml

Building the Benchmarks

Each benchmark can be built by running make exe in the corresponding experiment directory.

Example:

cd benchmark/install-wrapper
make exe

Running the Benchmarks

Built executables can be run directly.

cd benchmark/install-wrapper
./base/countdown.exe 2000000
./full/countdown.exe 2000000
./delim/countdown.exe 2000000

The run.sh script in each experiment directory is an experiment script that also sets the CPU governor, disables turbo boost, pins execution with taskset, and runs post-processing scripts. It assumes a Linux environment with sudo, cpupower, taskset, hyperfine, and python3.

cd benchmark/install-wrapper
sh run.sh

Experiment results are stored in *.bench files.

About

No description, website, or topics provided.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages