Skip to content

Commit e4ac22b

Browse files
vouillonhhugo
authored andcommitted
Effects: calling convention fix
1 parent 45059d1 commit e4ac22b

File tree

4 files changed

+15
-17
lines changed

4 files changed

+15
-17
lines changed

compiler/tests-jsoo/lib-effects/dune

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,6 @@
88
;; This requires the unreleased dune 3.7 to work
99
(enabled_if true)
1010
(flags -allow-output-patterns)
11-
(modes js))
11+
(modes js best))
1212
(preprocess
1313
(pps ppx_expect)))

compiler/tests-jsoo/lib-effects/state.ml

Lines changed: 6 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -262,14 +262,9 @@ let main () : unit =
262262

263263
let%expect_test _ =
264264
ignore (IntCell.run ~init:0 (fun () -> StrCell.run ~init:"" main));
265-
[%expect.unreachable]
266-
[@@expect.uncaught_exn
267-
{|
268-
(Failure "TypeError: a is not a function")
269-
Trailing output
270-
---------------
271-
0
272-
42
273-
21
274-
Hello...
275-
...World! |}]
265+
[%expect {|
266+
0
267+
42
268+
21
269+
Hello...
270+
...World! |}]

compiler/tests-jsoo/lib-effects/transaction.ml

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -118,5 +118,8 @@ let%expect_test _ =
118118
save
119119
T1: Before abort 21
120120
before raise
121-
inner exception: Stack overflow
122-
outer exception: Failure("TypeError: a is not a function") |}]
121+
restore
122+
restore
123+
raise
124+
T0: T1 aborted with 21
125+
T0: 10 |}]

runtime/effect.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -120,20 +120,20 @@ function caml_perform_effect(eff, cont, k0) {
120120
}
121121

122122
//Provides: caml_alloc_stack
123-
//Requires: caml_pop_fiber, caml_fiber_stack
123+
//Requires: caml_pop_fiber, caml_fiber_stack, caml_call_gen
124124
//If: effects
125125
function caml_alloc_stack(hv, hx, hf) {
126126
function hval(x) {
127127
// Call [hv] in the parent fiber
128128
var f=caml_fiber_stack.h[1];
129129
var k=caml_pop_fiber();
130-
return f(x, k);
130+
return caml_call_gen(f, [x, k]);
131131
}
132132
function hexn(e) {
133133
// Call [hx] in the parent fiber
134134
var f=caml_fiber_stack.h[2];
135135
var k=caml_pop_fiber();
136-
return f(e, k);
136+
return caml_call_gen(f, [e, k]);
137137
}
138138
return [0, hval, [0, hexn, 0], [0, hv, hx, hf], 0];
139139
}

0 commit comments

Comments
 (0)