Skip to content

Commit

Permalink
Remove USE_MMAP_MAP_STACK build option.
Browse files Browse the repository at this point in the history
This build option is no longer has any effect in multicont, as we use
only the public API of the OCaml runtime to manage stacks.
  • Loading branch information
dhil committed May 19, 2024
1 parent b845989 commit 44bf4c3
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 13 deletions.
10 changes: 3 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ $ make uninstall

The primary reason to build from source is to toggle configurable
options of this library, which are not readily available via OPAM
install. Currently, the following options are supported:
install. Currently, there is only one optional build:

* `UNIQUE_FIBERS` (default: disabled): Since commit
[ocaml/ocaml#e12b508](https://github.com/ocaml/ocaml/commit/e12b508876065723ed5fc35c0945030c9b7cd100)
Expand All @@ -71,17 +71,13 @@ this option to preserve unique identities amongst fibers as without
this option a fiber clone is an exact copy of the original fiber,
including its identity. By enabling this option, a cloned fiber will
be assigned a new unique identity.
* `USE_MMAP_MAP_STACK` (default: disabled): Enable to use [virtual
memory mapped
stacks](https://man7.org/linux/man-pages/man2/mmap.2.html) rather than
stacks allocated by malloc.

Configurable options are toggled directly on the command line as a
prefix to the `make` command. For instance, the following enables
unique fiber identities and mmap stacks:
unique fiber identities:

```shell
$ UNIQUE_FIBERS=1 USE_MMAP_MAP_STACK=1 make all
$ UNIQUE_FIBERS=1 make all
```

Setting an option to `1` enables it, whereas any other possible
Expand Down
4 changes: 2 additions & 2 deletions config/configure.ml
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@ let add_flag flag =
add_native_flag flag

let () =
let options = [ "USE_MMAP_MAP_STACK"
; "UNIQUE_FIBERS"]
let options =
[ "UNIQUE_FIBERS" ]
in
let toggle option =
match Sys.getenv_opt option with
Expand Down
10 changes: 6 additions & 4 deletions lib/multicont_stubs.c
Original file line number Diff line number Diff line change
Expand Up @@ -105,10 +105,10 @@ CAMLprim value multicont_clone_continuation(value k) {

// Allocate a fresh stack segment the size of [current]
clone = caml_alloc_stack_noexc(Stack_high(current) - Stack_base(current),
Stack_handle_value(current),
Stack_handle_exception(current),
Stack_handle_effect(current),
fiber_id);
Stack_handle_value(current),
Stack_handle_exception(current),
Stack_handle_effect(current),
fiber_id);
// Check whether allocation failed
if (!clone) caml_raise_out_of_memory();

Expand Down Expand Up @@ -160,3 +160,5 @@ CAMLprim value multicont_drop_continuation(value k) {
}
CAMLreturn(Val_unit);
}

#undef MULTICONT52

0 comments on commit 44bf4c3

Please sign in to comment.