From d79a41cc27455169b56cf8de562a979f50811ac3 Mon Sep 17 00:00:00 2001 From: Mark Shinwell Date: Wed, 29 Nov 2023 18:12:26 +0000 Subject: [PATCH 1/3] Fix conflict between async exns and compactor patches --- ocaml/runtime/gc_ctrl.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ocaml/runtime/gc_ctrl.c b/ocaml/runtime/gc_ctrl.c index 746011eefc9..82ba6c93019 100644 --- a/ocaml/runtime/gc_ctrl.c +++ b/ocaml/runtime/gc_ctrl.c @@ -302,7 +302,7 @@ CAMLprim value caml_gc_compaction(value v) value exn = gc_major_exn(1); ++ Caml_state->stat_forced_major_collections; CAML_EV_END(EV_EXPLICIT_GC_COMPACT); - return caml_raise_if_exception(exn); + return caml_raise_async_if_exception(exn, ""); } CAMLprim value caml_gc_stat(value v) From 87648650042a17639fd3b4110070ee2fefdc1067 Mon Sep 17 00:00:00 2001 From: Mark Shinwell Date: Wed, 29 Nov 2023 18:12:32 +0000 Subject: [PATCH 2/3] Silence warning about sync_check_error --- ocaml/runtime/platform.c | 1 + ocaml/runtime/sync_posix.h | 8 +++++++- 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/ocaml/runtime/platform.c b/ocaml/runtime/platform.c index eec2529ac2b..55418ff406d 100644 --- a/ocaml/runtime/platform.c +++ b/ocaml/runtime/platform.c @@ -34,6 +34,7 @@ #endif #include "caml/alloc.h" +#define CAML_NO_SYNC_CHECK_ERROR #include "sync_posix.h" /* Error reporting */ diff --git a/ocaml/runtime/sync_posix.h b/ocaml/runtime/sync_posix.h index 7b8475f6d4e..9b2d2c1b481 100644 --- a/ocaml/runtime/sync_posix.h +++ b/ocaml/runtime/sync_posix.h @@ -92,7 +92,7 @@ Caml_inline int sync_mutex_unlock(sync_mutex m) /* If we're using glibc, use a custom condition variable implementation to avoid this bug: https://sourceware.org/bugzilla/show_bug.cgi?id=25847 - + For now we only have this on linux because it directly uses the linux futex syscalls. */ #if defined(__linux__) && defined(__GNU_LIBRARY__) && defined(__GLIBC__) && defined(__GLIBC_MINOR__) @@ -206,6 +206,10 @@ Caml_inline int sync_condvar_wait(sync_condvar c, sync_mutex m) /* Reporting errors */ +/* Silence warnings about the following function when pulled into + e.g. platform.c by the flambda-backend custom-condvar fix. */ +#ifndef CAML_NO_SYNC_CHECK_ERROR + static void sync_check_error(int retcode, char * msg) { char * err; @@ -225,4 +229,6 @@ static void sync_check_error(int retcode, char * msg) caml_raise_sys_error(str); } +#endif + #endif /* CAML_SYNC_POSIX_H */ From 155489cea4d191e192ed1201fc0693ac6ca8ec7c Mon Sep 17 00:00:00 2001 From: Mark Shinwell Date: Wed, 29 Nov 2023 18:28:02 +0000 Subject: [PATCH 3/3] Use Caml_inline --- ocaml/runtime/platform.c | 1 - ocaml/runtime/sync_posix.h | 8 +------- 2 files changed, 1 insertion(+), 8 deletions(-) diff --git a/ocaml/runtime/platform.c b/ocaml/runtime/platform.c index 55418ff406d..eec2529ac2b 100644 --- a/ocaml/runtime/platform.c +++ b/ocaml/runtime/platform.c @@ -34,7 +34,6 @@ #endif #include "caml/alloc.h" -#define CAML_NO_SYNC_CHECK_ERROR #include "sync_posix.h" /* Error reporting */ diff --git a/ocaml/runtime/sync_posix.h b/ocaml/runtime/sync_posix.h index 9b2d2c1b481..558f7a94e09 100644 --- a/ocaml/runtime/sync_posix.h +++ b/ocaml/runtime/sync_posix.h @@ -206,11 +206,7 @@ Caml_inline int sync_condvar_wait(sync_condvar c, sync_mutex m) /* Reporting errors */ -/* Silence warnings about the following function when pulled into - e.g. platform.c by the flambda-backend custom-condvar fix. */ -#ifndef CAML_NO_SYNC_CHECK_ERROR - -static void sync_check_error(int retcode, char * msg) +Caml_inline void sync_check_error(int retcode, char * msg) { char * err; char buf[1024]; @@ -229,6 +225,4 @@ static void sync_check_error(int retcode, char * msg) caml_raise_sys_error(str); } -#endif - #endif /* CAML_SYNC_POSIX_H */