Skip to content

Commit fc94587

Browse files
committed
Deploying to wikidoc from @ 969bb0c 🚀
1 parent c079a4c commit fc94587

File tree

13 files changed

+343612
-659353
lines changed

13 files changed

+343612
-659353
lines changed

doc/dev/manual/effects.wiki

Lines changed: 11 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -11,14 +11,13 @@ The analysis is especially effective on monomorphic code. It is not so effective
1111
We hope to improve on this by trying alternative compilation
1212
strategies.
1313

14-
An alternative CPS transform is provided under the {{--effects=double-translation}} option. It keeps a direct-style version of the transformed functions in addition to the CPS version. The choice of running the CPS version is delayed to run time. Since CPS code is usually slower, this can avoid degradations. In addition, one can ensure that some code is run in direct style by using {{Jsoo_runtime.Effect.assume_no_perform}}. A caveat is that Dune does not know about {{--effects=double-translation}} yet and may try to link together files built with {{--enable=double-translation}} and files built with only {{--enable=effects}}, which gives an error. A work-around is to disable separate compilation by using the option {{(js_of_ocaml (compilation_mode whole_program))}}.
14+
An alternative CPS transform is provided under the {{{--effects=double-translation}}} option. It keeps a direct-style version of the transformed functions in addition to the CPS version. The choice of running the CPS version is delayed to run time. Since CPS code is usually slower, this can avoid degradations. In addition, one can ensure that some code is run in direct style by using {{{Jsoo_runtime.Effect.assume_no_perform}}}.
1515

1616
=== Dune integration ===
1717

18-
We're still working on dune support for compiling js_of_ocaml programs
19-
with effect handlers enabled.
18+
Dune is aware of the {{{--enable effects}}} option. So, you can just add it to the Js_of_ocaml flags {{{(js_of_ocaml (flags ...))}}} wherever you want to use it.
2019

21-
For now, here are two possible setups.
20+
We're still working on dune support for the {{{--effects}}} option. For now, here are two possible setups.
2221

2322
=== Whole dune workspace setup ===
2423

@@ -27,8 +26,8 @@ Put the following in a {{{dune}}} (or {{{dune-workspace}}}) file at the root of
2726
(env
2827
(_
2928
(js_of_ocaml
30-
(flags (:standard --enable effects))
31-
(build_runtime_flags (:standard --enable effects)))))
29+
(flags (:standard --effects=double-translation))
30+
(build_runtime_flags (:standard --effects=double-translation)))))
3231
}}}
3332

3433
With this setup, one can use both separate and whole program compilation.
@@ -37,28 +36,19 @@ With this setup, one can use both separate and whole program compilation.
3736
=== Sub directory setup ===
3837

3938
If you want to enable effect handlers for some binaries only, you'll
40-
have to give-up separate compilation for now using the following in
41-
your {{{dune}}} file.
42-
43-
{{{
44-
(env
45-
(_
46-
(js_of_ocaml
47-
(compilation_mode whole_program))))
48-
}}}
49-
50-
Then pass the rights {{{js_of_ocaml}}} flags to the executable stanza
51-
39+
have to give-up separate compilation for now using:
5240
{{{
5341
(executable
5442
(name main)
55-
(js_of_ocaml (flags (:standard --enable effects)))
43+
(js_of_ocaml
44+
(compilation_mode whole_program)
45+
(flags (:standard --effects=double-translation)))
5646
)
5747
}}}
5848

5949
Trying to use separate compilation would result in a error while attempting to link the final js file.
6050
{{{
6151
js_of_ocaml: Error: Incompatible build info detected while linking.
62-
- test6.bc.runtime.js: effects=false
63-
- .cmphash.eobjs/byte/dune__exe.cmo.js: effects=true
52+
- test6.bc.runtime.js: effects=disabled
53+
- .cmphash.eobjs/byte/dune__exe.cmo.js: effects=double-translation
6454
}}}

doc/dev/manual/files/boulderdash/boulderdash.bc.js

Lines changed: 3 additions & 3 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

doc/dev/manual/files/cubes/cubes.bc.js

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

doc/dev/manual/files/graph_viewer/viewer_js.bc.js

Lines changed: 3 additions & 3 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)