summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--byterun/callback.c6
-rw-r--r--byterun/interp.c6
2 files changed, 3 insertions, 9 deletions
diff --git a/byterun/callback.c b/byterun/callback.c
index c585ba17a..7eeab3b63 100644
--- a/byterun/callback.c
+++ b/byterun/callback.c
@@ -60,9 +60,7 @@ value callback(value closure, value arg)
extern_sp -= 2;
extern_sp[0] = arg;
extern_sp[1] = closure;
- callback_depth++;
res = interprete(callback1_code, sizeof(callback1_code));
- callback_depth--;
return res;
}
@@ -74,9 +72,7 @@ value callback2(value closure, value arg1, value arg2)
extern_sp[0] = arg1;
extern_sp[1] = arg2;
extern_sp[2] = closure;
- callback_depth++;
res = interprete(callback2_code, sizeof(callback2_code));
- callback_depth--;
return res;
}
@@ -89,9 +85,7 @@ value callback3(value closure, value arg1, value arg2, value arg3)
extern_sp[1] = arg2;
extern_sp[2] = arg3;
extern_sp[3] = closure;
- callback_depth++;
res = interprete(callback3_code, sizeof(callback3_code));
- callback_depth--;
return res;
}
diff --git a/byterun/interp.c b/byterun/interp.c
index e6f71c9f6..1769e6fb4 100644
--- a/byterun/interp.c
+++ b/byterun/interp.c
@@ -161,7 +161,6 @@ value interprete(code_t prog, asize_t prog_size)
struct longjmp_buffer * initial_external_raise;
int initial_sp_offset;
struct caml__roots_block *initial_local_roots;
- int initial_callback_depth;
struct longjmp_buffer raise_buf;
value * modify_dest, modify_newval;
#ifndef THREADED_CODE
@@ -188,11 +187,10 @@ value interprete(code_t prog, asize_t prog_size)
initial_local_roots = local_roots;
initial_sp_offset = (char *) stack_high - (char *) extern_sp;
initial_external_raise = external_raise;
- initial_callback_depth = callback_depth;
+ callback_depth++;
if (sigsetjmp(raise_buf.buf, 1)) {
local_roots = initial_local_roots;
- callback_depth = initial_callback_depth;
accu = exn_bucket;
goto raise_exception;
}
@@ -745,6 +743,7 @@ value interprete(code_t prog, asize_t prog_size)
if ((char *) sp >= (char *) stack_high - initial_sp_offset) {
exn_bucket = accu;
external_raise = initial_external_raise;
+ callback_depth--;
siglongjmp(external_raise->buf, 1);
}
pc = Trap_pc(sp);
@@ -950,6 +949,7 @@ value interprete(code_t prog, asize_t prog_size)
Instruct(STOP):
external_raise = initial_external_raise;
extern_sp = sp;
+ callback_depth--;
return accu;
Instruct(EVENT):