You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Effects: double translation of functions and dynamic switching between direct-style and CPS code (#1461)
* Effects: double translation of functions and
... dynamic switching between direct-style and CPS code. (#1461)
* Add caml_assume_no_effects primitive and tests
Passing a function [f] as argument of `caml_assume_no_effects`
guarantees that, when compiling with `--enable doubletranslate`, the
direct-style version of [f] is called, which is faster than the CPS
version. As a consequence, performing an effect in a transitive callee
of [f] will raise `Effect.Unhandled`, regardless of any effect handlers
installed before the call to `caml_assume_no_effects`, unless a new
effect handler was installed in the meantime.
Usage:
```
external assume_no_effects : (unit -> 'a) -> 'a = "caml_assume_no_effects"
... caml_assume_no_effects (fun () -> (* Will be called in direct style... *)) ...
```
When double translation is disabled, `caml_assume_no_effects` simply
acts like `fun f -> f ()`.
This primitive is exposed via `Js_of_ocaml.Js.Effect.assume_no_perform`.
* CR: Fix non-raised Unhandled with assume_no_perform
* CR: Commit suggestion for compiler/lib/driver.ml
Co-authored-by: Jérôme Vouillon <[email protected]>
* Fix runtime deps, add missing test
* Runtime format
* Factorize substitution logic
* CR: make caml_callback an alias of caml_call_gen...
... when double translation is enabled.
* Promote tests
* CR: Fix caml_trampoline_cps and rename it to caml_resume
* CR: First fixes to Lambda_lifting_simple
* Simplify and clarify Lambda_lifting_simple
* Format runtime
* Fix bug: functions inside CPS functions were not lambda-lifted
* Runtime: fix caml_uncaught_effect_handler
We can use a single definition for the CPS transformation and the double
translation. The definition for the CPS transformation was wrong, since
it did not take a continuation as parameter.
* Runtime: the trampoline now distinguish direct and CPS calls
* Fix unregistered test and add one for nested handler
* Uses 'tests' dune stanza
* Reformat dune files and remove leftover files
* CR: Fixes in Lambda_lifting_simple
* CR: remove unnecessary conditionals in Effects
* CR: Remove duplicate instruction
* CR: Apply suggested simplifications
* Add test for lambda-lifting of mutually recursive functions
* CR
* Revert addition of no longer necessary Freevars functions
* Add wasm mode to double translation tests
* CR: Add missing Wasm stubs
* Revert "Add wasm mode to double translation tests"
This reverts commit d3cc1b7.
* Update dune.inc
* CR
* CR
* Use copy_file rather than duplicate tests
* Update comment
* Simplify function rewrite_instr
* Function assume_no_perform makes perform fail for all effect implementations
* CR: Add --effects option
* Fix Dynlink and limit use of --enable=effects
* Reformat
* CR
* CR
* CR: add missing bound check
* CR: Simplification in compiler/lib/effects.ml
Co-authored-by: Jérôme Vouillon <[email protected]>
* CR: simplify closure allocation
* Javascript runtime: stop using 'arguments'
* Fix too early effects backend setting
Co-authored-by: Jérôme Vouillon <[email protected]>
* Fix uses of `--enable=effects` in lib-wasm/
* Move assume_no_perform to Jsoo_runtime
* Fix: move C primitive
* CR
* CR: rephrase comment
Co-authored-by: hhugo <[email protected]>
* CR: Move effects backend choice logic
* CR: simplify
* Docs: document double translation better
Only document the use of `--enable effects` for now, as only this option
is correctly handled by Dune, and document possible caching issues with
`--effects=double-translation`.
* Fix warning
* Fix another warning
* Update manual/effects.wiki
Co-authored-by: Jérôme Vouillon <[email protected]>
* CR: revert some changes in docs
Co-authored-by: Jérôme Vouillon <[email protected]>
* Don't set effects_backend in _cmd_arg_ modules
* Fix compilation
* CR
* CR: add CONFIG macro
* Re-export Jsoo_runtime from the js_of_ocaml library
* Fix spurious free var warning over CONFIG macro
* CR: Update compiler/lib/driver.ml
Co-authored-by: hhugo <[email protected]>
* Remove duplicate effects flag
* CR: more explicit type for effects backend
* CR: doc phrasing
* CR: revert obsolete change
* Fix assertion
* CR: comment to justify constant
* reformat
* Fixes
* Fix assert failure
* reformat
* CR: Create Js_of_ocaml.Effect_js
* CR: move new tests to tests-jsoo/lib-effects
* Fix warnings in tests
---------
Co-authored-by: Jérôme Vouillon <[email protected]>
Co-authored-by: hhugo <[email protected]>
Copy file name to clipboardExpand all lines: CHANGES.md
+1Lines changed: 1 addition & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -6,6 +6,7 @@
6
6
* Merged Wasm_of_ocaml (#1724)
7
7
* Lib: removed no longer relevant Js.optdef type annotations (#1769)
8
8
* Misc: drop support for IE
9
+
* Effects: add an optional feature of "dynamic switching" between CPS and direct style, resulting in better performance when no effect handler is installed
9
10
10
11
## Bug fixes
11
12
* Fix small bug in global data flow analysis (#1768)
0 commit comments