This is a dynamic-wind library implemented with OCaml effect handlers. It provides the following three semantics.
dynwind_delim-- delimited-continuation semanticsdynwind_full-- full-continuation semanticsdynwind_full_noopt-- unoptimized full-continuation semantics for benchmarking
- 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.
Run the following command at the top level.
make libsThis 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.
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.mlDelimited-continuation semantics:
ocamlopt \
-I _lib/dynwind_delim \
-o your_program.exe \
_lib/dynwind_delim/dynwind_delim.cmxa \
your_program.mlUnoptimized full-continuation semantics:
ocamlopt \
-I _lib/dynwind_full_noopt \
-o your_program.exe \
_lib/dynwind_full_noopt/dynwind_full.cmxa \
your_program.mlEach 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.mlEach benchmark can be built by running make exe in the corresponding experiment directory.
Example:
cd benchmark/install-wrapper
make exeBuilt executables can be run directly.
cd benchmark/install-wrapper
./base/countdown.exe 2000000
./full/countdown.exe 2000000
./delim/countdown.exe 2000000The 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.shExperiment results are stored in *.bench files.