Skip to content

Commit af16df2

Browse files
authored
Merge pull request #63 from effect-handlers/ocaml5.3
Update to OCaml5.3
2 parents 9760974 + dfc0d5c commit af16df2

File tree

16 files changed

+74
-52
lines changed

16 files changed

+74
-52
lines changed

.github/workflows/system_ocaml.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
name: Multicore OCaml
1+
name: OCaml
22

33
# Controls when the workflow will run
44
on:

Makefile

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ DOCKERHUB=effecthandlers/effect-handlers
33
all: bench_eff bench_hia bench_koka bench_links bench_ocaml
44

55
system_base:
6-
docker build -t $(DOCKERHUB):base systems
6+
docker build --build-arg UID=$$(id -u) --build-arg GID=$$(id -g) -t $(DOCKERHUB):base systems
77

88
# Eff in ocaml
99
system_eff: system_base
@@ -101,7 +101,7 @@ test_libhandler: system_libhandler
101101
docker run -v $(shell pwd):/source $(DOCKERHUB):libhandler \
102102
make -C /source/benchmarks/libhandler test
103103

104-
# Multicore OCaml
104+
# OCaml
105105
system_ocaml: system_base
106106
docker build -t $(DOCKERHUB):ocaml systems/ocaml
107107

README.md

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ $ make bench_ocaml
1717
```
1818

1919
runs the OCaml benchmarks and produces `benchmarks/ocaml/results.csv` which
20-
contains the results of running the Multicore OCaml benchmarks.
20+
contains the results of running the OCaml benchmarks.
2121

2222
## System availability
2323

@@ -31,12 +31,13 @@ contains the results of running the Multicore OCaml benchmarks.
3131
| [libmpeff](https://github.com/koka-lang/libmprompt) | [![libmpeff](https://github.com/effect-handlers/effect-handlers-bench/actions/workflows/system_libmpeff.yml/badge.svg)](https://github.com/effect-handlers/effect-handlers-bench/actions/workflows/system_libmpeff.yml) |
3232
| [libseff](https://github.com/effect-handlers/libseff.git) | [![libseff](https://github.com/effect-handlers/effect-handlers-bench/actions/workflows/system_libseff.yml/badge.svg)](https://github.com/effect-handlers/effect-handlers-bench/actions/workflows/system_libseff.yml) |
3333
| [Links](https://github.com/links-lang/links) | [![Links](https://github.com/effect-handlers/effect-handlers-bench/actions/workflows/system_links.yml/badge.svg)](https://github.com/effect-handlers/effect-handlers-bench/actions/workflows/system_links.yml) |
34-
| [Multicore OCaml](https://github.com/ocaml-multicore/ocaml-multicore) | [![Multicore OCaml](https://github.com/effect-handlers/effect-handlers-bench/actions/workflows/system_ocaml.yml/badge.svg)](https://github.com/effect-handlers/effect-handlers-bench/actions/workflows/system_ocaml.yml) |
34+
| [OCaml](https://github.com/ocaml/ocaml)\* | [![OCaml](https://github.com/effect-handlers/effect-handlers-bench/actions/workflows/system_ocaml.yml/badge.svg)](https://github.com/effect-handlers/effect-handlers-bench/actions/workflows/system_ocaml.yml) |
3535

36+
\* OCaml's multishot continuations are supported via [ocaml-multicont](https://github.com/dhil/ocaml-multicont)
3637

3738
## Benchmark availability
3839

39-
| | Eff | Effekt | Handlers in Action | Koka | Multicore OCaml | Libseff | Libmpeff |
40+
| | Eff | Effekt | Handlers in Action | Koka | OCaml | Libseff | Libmpeff |
4041
| :---------------------- | :----------------: | :----------------: | :----------------: | :----------------: | :----------------: | :----------------: | :----------------: |
4142
| **Countdown** | :heavy_check_mark: | :heavy_check_mark: | :heavy_check_mark: | :heavy_check_mark: | :heavy_check_mark: | :heavy_check_mark: | :heavy_check_mark: |
4243
| **Fibonacci Recursive** | :heavy_check_mark: | :heavy_check_mark: | :heavy_check_mark: | :heavy_check_mark: | :heavy_check_mark: | :heavy_check_mark: | :heavy_check_mark: |
@@ -144,4 +145,4 @@ related to work on effect handlers). Whilst we do not enforce any
144145
standards on artifacts, we do recommend that artifacts conform with
145146
[the artifacts evaluation packaging guidelines used by various
146147
programming language
147-
conferences](https://artifact-eval.org/guidelines.html).
148+
conferences](https://artifact-eval.org/guidelines.html).

benchmarks/ocaml/Makefile

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -26,17 +26,17 @@ test: build
2626
cd handler_sieve ; ./main 10 > actual ; echo 17 > expected ; diff expected actual
2727

2828
build:
29-
cd countdown ; opam exec --switch=4.12.0+domains+effects -- ocamlopt -O3 -o main main.ml
30-
cd fibonacci_recursive ; opam exec --switch=4.12.0+domains+effects -- ocamlopt -O3 -o main main.ml
31-
cd product_early ; opam exec --switch=4.12.0+domains+effects -- ocamlopt -O3 -o main main.ml
32-
cd iterator ; opam exec --switch=4.12.0+domains+effects -- ocamlopt -O3 -o main main.ml
33-
cd nqueens ; opam exec --switch=4.12.0+domains+effects -- ocamlopt -O3 -o main main.ml
34-
cd generator ; opam exec --switch=4.12.0+domains+effects -- ocamlopt -O3 -o main main.ml
35-
cd tree_explore ; opam exec --switch=4.12.0+domains+effects -- ocamlopt -O3 -o main main.ml
36-
cd triples ; opam exec --switch=4.12.0+domains+effects -- ocamlopt -O3 -o main main.ml
37-
cd parsing_dollars ; opam exec --switch=4.12.0+domains+effects -- ocamlopt -O3 -o main main.ml
38-
cd resume_nontail ; opam exec --switch=4.12.0+domains+effects -- ocamlopt -O3 -o main main.ml
39-
cd handler_sieve ; opam exec --switch=4.12.0+domains+effects -- ocamlopt -O3 -o main main.ml
29+
cd countdown ; opam exec --switch=5.3.0 -- ocamlopt -O3 -I $$(opam var lib)/multicont multicont.cmxa -o main main.ml
30+
cd fibonacci_recursive ; opam exec --switch=5.3.0 -- ocamlopt -O3 -I $$(opam var lib)/multicont multicont.cmxa -o main main.ml
31+
cd product_early ; opam exec --switch=5.3.0 -- ocamlopt -O3 -I $$(opam var lib)/multicont multicont.cmxa -o main main.ml
32+
cd iterator ; opam exec --switch=5.3.0 -- ocamlopt -O3 -I $$(opam var lib)/multicont multicont.cmxa -o main main.ml
33+
cd nqueens ; opam exec --switch=5.3.0 -- ocamlopt -O3 -I $$(opam var lib)/multicont multicont.cmxa -o main main.ml
34+
cd generator ; opam exec --switch=5.3.0 -- ocamlopt -O3 -I $$(opam var lib)/multicont multicont.cmxa -o main main.ml
35+
cd tree_explore ; opam exec --switch=5.3.0 -- ocamlopt -O3 -I $$(opam var lib)/multicont multicont.cmxa -o main main.ml
36+
cd triples ; opam exec --switch=5.3.0 -- ocamlopt -O3 -I $$(opam var lib)/multicont multicont.cmxa -o main main.ml
37+
cd parsing_dollars ; opam exec --switch=5.3.0 -- ocamlopt -O3 -I $$(opam var lib)/multicont multicont.cmxa -o main main.ml
38+
cd resume_nontail ; opam exec --switch=5.3.0 -- ocamlopt -O3 -I $$(opam var lib)/multicont multicont.cmxa -o main main.ml
39+
cd handler_sieve ; opam exec --switch=5.3.0 -- ocamlopt -O3 -I $$(opam var lib)/multicont multicont.cmxa -o main main.ml
4040

4141
clean:
4242
-rm */main.cmi

benchmarks/ocaml/countdown/main.ml

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
1+
open Effect
2+
open Effect.Deep
13

2-
effect Get : unit -> int
3-
effect Set : int -> unit
4+
type _ Effect.t += Get : unit -> int t
5+
type _ Effect.t += Set : int -> unit t
46

57
let rec countdown () =
68
let i = perform (Get ()) in
@@ -15,13 +17,12 @@ let run n =
1517
try
1618
countdown ()
1719
with
18-
| effect (Get ()) k -> continue k (!s)
19-
| effect (Set i) k -> s := i; continue k ()
20+
| effect (Get ()), k -> continue k (!s)
21+
| effect (Set i), k -> s := i; continue k ()
2022

2123
let main () =
2224
let n = try int_of_string (Sys.argv.(1)) with _ -> 5 in
2325
let r = run n in
2426
Printf.printf "%d\n" r
2527

2628
let _ = main ()
27-

benchmarks/ocaml/generator/main.ml

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
1+
open Effect
2+
open Effect.Deep
13

2-
effect Yield : int -> unit
4+
type _ Effect.t += Yield : int -> unit t
35

46
type tree =
57
| Leaf
@@ -20,7 +22,7 @@ let rec iterate = function
2022
let rec generate f =
2123
match f () with
2224
| () -> Empty
23-
| effect (Yield v) k -> Thunk (v, fun () -> continue k ())
25+
| effect (Yield v), k -> Thunk (v, fun () -> continue k ())
2426

2527
let rec sum a = function
2628
| Empty -> a

benchmarks/ocaml/handler_sieve/main.ml

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
1+
open Effect
2+
open Effect.Deep
13

2-
effect Prime : int -> bool
4+
type _ Effect.t += Prime: int -> bool t
35

46
let rec primes i n a =
57
if (i >= n)
@@ -10,7 +12,7 @@ let rec primes i n a =
1012
try
1113
primes (i + 1) n (a + i)
1214
with
13-
| effect (Prime e) k ->
15+
| effect (Prime e), k ->
1416
if (e mod i = 0)
1517
then continue k false
1618
else continue k (perform (Prime e))
@@ -21,7 +23,7 @@ let run n =
2123
try
2224
primes 2 n 0
2325
with
24-
| effect (Prime e) k -> continue k true
26+
| effect (Prime e), k -> continue k true
2527

2628
let main () =
2729
let n = try int_of_string (Sys.argv.(1)) with _ -> 10 in

benchmarks/ocaml/iterator/main.ml

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
1+
open Effect
2+
open Effect.Deep
13

2-
effect Emit : int -> unit
4+
type _ Effect.t += Emit: int -> unit t
35

46
let rec range l u =
57
if (l > u)
@@ -14,7 +16,7 @@ let run n =
1416
(range 0 n;
1517
!s)
1618
with
17-
| effect (Emit e) k -> (s := !s + e ; continue k ())
19+
| effect (Emit e), k -> (s := !s + e ; continue k ())
1820

1921
let main () =
2022
let n = try int_of_string (Sys.argv.(1)) with _ -> 5 in

benchmarks/ocaml/nqueens/main.ml

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
1+
open Effect
2+
open Effect.Deep
13

2-
effect Pick : int -> int
4+
type _ Effect.t += Pick: int -> int t
35
exception Fail
46

57
let rec safe queen diag xs =
@@ -24,10 +26,10 @@ let run n =
2426
match place n n with
2527
| _x -> 1
2628
| exception Fail -> 0
27-
| effect (Pick size) k ->
29+
| effect (Pick size), k ->
2830
let rec loop i a =
2931
if i = size then (a + continue k i)
30-
else loop (i+1) (a + continue (Obj.clone_continuation k) i)
32+
else loop (i+1) (a + continue (Multicont.Deep.clone_continuation k) i)
3133
in loop 1 0
3234

3335
let main () =

benchmarks/ocaml/parsing_dollars/main.ml

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
1+
open Effect
2+
open Effect.Deep
13

24
type chr = int
35

4-
effect Read : unit -> chr
5-
6-
effect Emit : int -> unit
6+
type _ Effect.t += Read: unit -> chr t
7+
type _ Effect.t += Emit: int -> unit t
78

89
exception Stop
910

10-
1111
let newline = 10
1212
let is_newline c = c = 10
1313
let dollar = 36
@@ -26,7 +26,7 @@ let sum action =
2626
try
2727
(action () ; !s)
2828
with
29-
| effect (Emit e) k -> (s := !s + e ; continue k ())
29+
| effect (Emit e), k -> (s := !s + e ; continue k ())
3030

3131
let catch action =
3232
try
@@ -40,7 +40,7 @@ let feed n action =
4040
try
4141
action ()
4242
with
43-
| effect (Read ()) k ->
43+
| effect (Read ()), k ->
4444
if (!i > n)
4545
then raise Stop
4646
else if(!j = 0)

0 commit comments

Comments
 (0)