diff options
author | Xavier Leroy <xavier.leroy@inria.fr> | 1998-04-14 14:45:50 +0000 |
---|---|---|
committer | Xavier Leroy <xavier.leroy@inria.fr> | 1998-04-14 14:45:50 +0000 |
commit | 49c266fde7121a352f62b3118d1dc96e7b098735 (patch) | |
tree | 59e23c712a282b28c0fa4033fa1e6ae9e1bb1a6d | |
parent | bc44a970de1d765354ef6d926370a2e32b9993bb (diff) |
Meilleure gestion de callback_depth (l'ancienne ne resistait pas aux exceptions
git-svn-id: http://caml.inria.fr/svn/ocaml/trunk@1917 f963ae5c-01c2-4b8c-9fe0-0dff7051ff02
-rw-r--r-- | byterun/callback.c | 6 | ||||
-rw-r--r-- | byterun/interp.c | 6 |
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): |