Skip to content

Commit 1a32269

Browse files
committed
simplify
1 parent 8f71b6c commit 1a32269

File tree

1 file changed

+6
-4
lines changed

1 file changed

+6
-4
lines changed

runtime/js/effect.js

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -142,12 +142,13 @@ function caml_perform_effect(eff, cont, last, k0) {
142142
}
143143

144144
//Provides: caml_alloc_stack
145-
//Requires: caml_pop_fiber, caml_fiber_stack, caml_call_gen, caml_stack_check_depth, caml_trampoline_return
145+
//Requires: caml_pop_fiber, caml_call_gen, caml_stack_check_depth, caml_trampoline_return
146146
//If: effects
147147
//Version: >= 5.0
148148
function caml_alloc_stack(hv, hx, hf) {
149+
var handlers = [0, hv, hx, hf];
149150
function call(i, x) {
150-
var f = caml_fiber_stack.h[i];
151+
var f = handlers[i];
151152
var args = [x, caml_pop_fiber()];
152153
return caml_stack_check_depth()
153154
? caml_call_gen(f, args)
@@ -161,7 +162,6 @@ function caml_alloc_stack(hv, hx, hf) {
161162
// Call [hx] in the parent fiber
162163
return call(2, e);
163164
}
164-
var handlers = [0, hv, hx, hf];
165165
return { r: { k: hval, x: [0, hexn, 0], e: 0 }, h: null, sh: handlers };
166166
}
167167

@@ -197,7 +197,9 @@ function caml_continuation_use_and_update_handler_noexc(
197197
// Pre OCaml 5.2, last/cont[2] was not populated.
198198
while (last.r.e !== 0) last = last.r.e;
199199
}
200-
last.sh = [0, hval, hexn, heff];
200+
last.sh[1] = hval;
201+
last.sh[2] = hexn;
202+
last.sh[3] = heff;
201203
return stack;
202204
}
203205

0 commit comments

Comments
 (0)