Skip to content

Commit 2bac94d

Browse files
vouillonhhugo
authored andcommitted
Wasm runtime: make resuming continuations more efficient
This was done in #1765 for the JavaScript runtime. See corresponding OCaml PR ocaml/ocaml#12735
1 parent 184c470 commit 2bac94d

File tree

2 files changed

+274
-257
lines changed

2 files changed

+274
-257
lines changed

compiler/lib/effects.ml

Lines changed: 6 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -624,30 +624,12 @@ let cps_block ~st ~k ~orig_pc block =
624624
Some
625625
(fun ~k ->
626626
let e =
627-
match Config.target () with
628-
| `JavaScript -> (
629-
match continuation_and_tail with
630-
| None -> Prim (Extern "caml_perform_effect", [ Pv effect_; Pv k ])
631-
| Some (continuation, tail) ->
632-
Prim
633-
( Extern "caml_reperform_effect"
634-
, [ Pv effect_; continuation; tail; Pv k ] ))
635-
| `Wasm -> (
636-
(* temporary until we finish the change to the wasmoo
637-
runtime *)
638-
match continuation_and_tail with
639-
| None ->
640-
Prim
641-
( Extern "caml_perform_effect"
642-
, [ Pv effect_
643-
; Pc (Int Targetint.zero)
644-
; Pc (Int Targetint.zero)
645-
; Pv k
646-
] )
647-
| Some (continuation, tail) ->
648-
Prim
649-
( Extern "caml_perform_effect"
650-
, [ Pv effect_; continuation; tail; Pv k ] ))
627+
match continuation_and_tail with
628+
| None -> Prim (Extern "caml_perform_effect", [ Pv effect_; Pv k ])
629+
| Some (continuation, tail) ->
630+
Prim
631+
( Extern "caml_reperform_effect"
632+
, [ Pv effect_; continuation; tail; Pv k ] )
651633
in
652634
let x = Var.fresh () in
653635
[ Let (x, e) ], Return x)

0 commit comments

Comments
 (0)