Skip to content

Commit ab00b69

Browse files
committed
doc
1 parent 8a06ce6 commit ab00b69

File tree

1 file changed

+4
-6
lines changed

1 file changed

+4
-6
lines changed

runtime/js/effect.js

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -7,10 +7,10 @@ a triple of handlers, which are invoked when the fiber terminates
77
The low-level continuation of the topmost fiber (which is currently
88
executing) is passed from function to function as an additional
99
argument. Its stack of exception handlers is stored in
10-
[caml_exn_stack].
10+
[caml_current_stack.x].
1111
Exception handlers are pushed into this stack
1212
when entering a [try ... with ...] and popped on exit.
13-
Handlers are stored in [caml_handlers]
13+
Handlers are stored in [caml_current_stack.h]
1414
and the remaining fibers are stored in [caml_fiber_stack].
1515
To install an effect handler, we push a new fiber into the execution context.
1616
@@ -145,11 +145,10 @@ function caml_perform_effect(eff, k0) {
145145
var handler = caml_current_stack.h[3];
146146
var last_fiber = caml_current_stack;
147147
last_fiber.k = k0;
148-
last_fiber.e = 0;
148+
var cont = [245 /*continuation*/, last_fiber, 0];
149149
// Move to parent fiber and execute the effect handler there
150150
// The handler is defined in Stdlib.Effect, so we know that the arity matches
151151
var k1 = caml_pop_fiber();
152-
var cont = [245 /*continuation*/, last_fiber, 0];
153152
return caml_stack_check_depth()
154153
? handler(eff, cont, last_fiber, k1)
155154
: caml_trampoline_return(handler, [eff, cont, last_fiber, k1]);
@@ -172,11 +171,10 @@ function caml_reperform_effect(eff, cont, last, k0) {
172171
var handler = caml_current_stack.h[3];
173172
var last_fiber = caml_current_stack;
174173
last_fiber.k = k0;
175-
last_fiber.e = 0;
174+
last.e = last_fiber;
176175
// Move to parent fiber and execute the effect handler there
177176
// The handler is defined in Stdlib.Effect, so we know that the arity matches
178177
var k1 = caml_pop_fiber();
179-
last.e = last_fiber;
180178
return caml_stack_check_depth()
181179
? handler(eff, cont, last_fiber, k1)
182180
: caml_trampoline_return(handler, [eff, cont, last_fiber, k1]);

0 commit comments

Comments
 (0)