Skip to content

Commit

Permalink
Fix mistake in upstream PR12735 backport and add test case (#3362)
Browse files Browse the repository at this point in the history
  • Loading branch information
mshinwell authored Dec 11, 2024
1 parent 8d31575 commit 2a51862
Show file tree
Hide file tree
Showing 3 changed files with 27 additions and 1 deletion.
2 changes: 1 addition & 1 deletion backend/cmm_helpers.ml
Original file line number Diff line number Diff line change
Expand Up @@ -4337,7 +4337,7 @@ let dls_get ~dbg = Cop (Cdls_get, [], dbg)
let perform ~dbg eff =
let cont =
make_alloc dbg ~tag:Runtimetags.cont_tag
[int_const dbg 0]
[int_const dbg 0; int_const dbg 0]
~mode:Cmm.Alloc_mode.Heap
in
(* Rc_normal means "allow tailcalls". Preventing them here by using Rc_nontail
Expand Down
25 changes: 25 additions & 0 deletions testsuite/tests/effects/pr3362.ml
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
(* TEST
skip;
reason = "CR ocaml 5 effects: re-enable this test";
runtime5;
{ bytecode; }
{ native; }
*)

open Effect
open Effect.Deep

type _ t += F : string t

let handle comp =
Gc.compact ();
try_with comp ()
{ effc = fun (type a) (e : a t) ->
Gc.compact ();
match e with
| F -> Some (fun (k : (a,_) continuation) ->
Gc.compact (); continue k "Hello, world!")
| _ -> None }

let () = handle (fun () ->
Gc.compact (); print_endline (perform F ^ (" " ^ perform F)))
1 change: 1 addition & 0 deletions testsuite/tests/effects/pr3362.reference
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Hello, world! Hello, world!

0 comments on commit 2a51862

Please sign in to comment.