Skip to content

Commit

Permalink
flambda-backend: Install runtime events for runtime5 (#2106)
Browse files Browse the repository at this point in the history
  • Loading branch information
riaqn authored Nov 30, 2023
1 parent d35d125 commit b0ca708
Show file tree
Hide file tree
Showing 23 changed files with 122 additions and 46 deletions.
7 changes: 5 additions & 2 deletions Makefile.common-jst
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,7 @@ dune_config_targets = \

$(ocamldir)/otherlibs/dune:
if [ "$(RUNTIME_DIR)" = "runtime4" ]; then \
echo "(dirs (:standard \ systhreads))" > $@; \
echo "(dirs (:standard \ systhreads runtime_events))" > $@; \
else \
echo "(dirs (:standard \ systhreads4))" > $@; \
fi
Expand Down Expand Up @@ -249,11 +249,14 @@ install_for_test: _install
done; \
ln -s . lex; ln -s . yacc; \
ln -s _install/lib/ocaml/compiler-libs compilerlibs; \
mkdir -p otherlibs/{unix,dynlink/native,str,bigarray}; \
mkdir -p otherlibs/{unix,dynlink/native,str,bigarray,runtime_events}; \
ln -s ../stdlib/threads otherlibs/systhreads$(RUNTIME_SUFFIX); \
$(cpl) stdlib/unix/{lib,}unix* otherlibs/unix; \
$(cpl) stdlib/dynlink/dynlink* otherlibs/dynlink; \
$(cpl) stdlib/str/{lib,}str* otherlibs/str; \
if [[ x"$(RUNTIME_DIR)" = x"runtime" ]]; then \
$(cpl) stdlib/runtime_events/{lib,}runtime_events* otherlibs/runtime_events; \
fi; \
ln -s ../_build/main/$(ocamldir)/toplevel/byte/.ocamltoplevel.objs/byte toplevel; \
)

Expand Down
12 changes: 10 additions & 2 deletions configure

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

20 changes: 11 additions & 9 deletions configure.ac
Original file line number Diff line number Diff line change
Expand Up @@ -667,12 +667,15 @@ AS_CASE([$host],
[exeext=".exe"],
[exeext=''])

dnl CR ocaml 5 runtime:
dnl otherlibraries="dynlink runtime_events"
otherlibraries="dynlink"
lib_dynlink=true
dnl CR ocaml 5 runtime:
dnl lib_runtime_events = true

AS_IF(
[test x"$enable_runtime5" = x"yes"],
[otherlibraries="$otherlibraries runtime_events"
lib_runtime_events=true],
[])

AS_IF([test x"$enable_unix_lib" != "xno"],
[enable_unix_lib=yes
AC_CONFIG_FILES([otherlibs/unix/META])
Expand Down Expand Up @@ -2118,11 +2121,10 @@ AS_CASE([$host],

## Activate the systhread library

if [[ x"$enable_runtime5" = x"yes" ]]; then
runtime_suffix=
else
runtime_suffix=4
fi
AS_IF(
[test x"$enable_runtime5" = x"yes"],
[runtime_suffix=],
[runtime_suffix=4])

AS_CASE([$enable_systhreads,$enable_unix_lib],
[yes,no],
Expand Down
47 changes: 47 additions & 0 deletions otherlibs/runtime_events/dune
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
;**************************************************************************
;* *
;* OCaml *
;* *
;* Zesen Qian, Jane Street Europe *
;* *
;* Copyright 2023 Jane Street Group LLC *
;* *
;* All rights reserved. This file is distributed under the terms of *
;* the GNU Lesser General Public License version 2.1, with the *
;* special exception on linking described in the file LICENSE. *
;* *
;**************************************************************************

(library
(name runtime_events)
(wrapped false)
(modes byte native)
(flags (
-strict-sequence -principal -absname -w +a-4-9-40-41-42-44-45-48-66
-warn-error A -bin-annot -safe-string -strict-formats
))
(ocamlopt_flags (:include %{project_root}/ocamlopt_flags.sexp))
(library_flags (:standard -linkall))
(foreign_stubs (language c) (names runtime_events_consumer)
(flags ((:include %{project_root}/oc_cflags.sexp)
(:include %{project_root}/sharedlib_cflags.sexp)
(:include %{project_root}/oc_cppflags.sexp)))))

(install
(files
(.runtime_events.objs/native/runtime_events.cmx as runtime_events/runtime_events.cmx)
(libruntime_events_stubs.a as runtime_events/libruntime_events_stubs.a)
(libruntime_events_stubs.a as libruntime_events_stubs_native.a) ; for special_dune compat
(dllruntime_events_stubs.so as stublibs/dllruntime_events_stubs.so)
(runtime_events.cmxa as runtime_events/runtime_events.cmxa)
(runtime_events.a as runtime_events/runtime_events.a)
(runtime_events.cmxs as runtime_events/runtime_events.cmxs)
(runtime_events.cma as runtime_events/runtime_events.cma)
(runtime_events.mli as runtime_events/runtime_events.mli)
(.runtime_events.objs/byte/runtime_events.cmi as runtime_events/runtime_events.cmi)
(.runtime_events.objs/byte/runtime_events.cmt as runtime_events/runtime_events.cmt)
(.runtime_events.objs/byte/runtime_events.cmti as runtime_events/runtime_events.cmti)
(runtime_events_consumer.h as runtime_events_consumer.h)
)
(section lib)
(package ocaml))
5 changes: 3 additions & 2 deletions testsuite/tests/lib-runtime-events/test.ml
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
(* TEST
* runtime4
** skip
* runtime5
modules = "stubs.c"
include runtime_events
* skip
reason = "OCaml 5 only"
*)

external start_runtime_events : unit -> unit = "start_runtime_events"
Expand Down
5 changes: 3 additions & 2 deletions testsuite/tests/lib-runtime-events/test_caml.ml
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
(* TEST
* runtime4
** skip
* runtime5
include runtime_events
* skip
reason = "OCaml 5 only"
*)
open Runtime_events

Expand Down
5 changes: 3 additions & 2 deletions testsuite/tests/lib-runtime-events/test_caml_counters.ml
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
(* TEST
* runtime4
** skip
* runtime5
include runtime_events
* skip
reason = "OCaml 5 only"
*)
open Runtime_events

Expand Down
5 changes: 3 additions & 2 deletions testsuite/tests/lib-runtime-events/test_caml_exception.ml
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
(* TEST
* runtime5
include runtime_events
* skip
reason = "OCaml 5 only"
* runtime4
** skip
*)
open Runtime_events

Expand Down
2 changes: 1 addition & 1 deletion testsuite/tests/lib-runtime-events/test_caml_parallel.ml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
(* TEST
include runtime_events
* skip
reason = "OCaml 5 only"
reason = "CR OCaml 5 domains"
*)
open Runtime_events

Expand Down
5 changes: 3 additions & 2 deletions testsuite/tests/lib-runtime-events/test_caml_reentry.ml
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
(* TEST
* runtime5
include runtime_events
* skip
reason = "OCaml 5 only"
* runtime4
** skip
*)
open Runtime_events

Expand Down
5 changes: 3 additions & 2 deletions testsuite/tests/lib-runtime-events/test_caml_runparams.ml
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
(* TEST
* runtime4
** skip
* runtime5
include runtime_events
ocamlrunparam += ",e=4"
* skip
reason = "OCaml 5 only"
*)

(* We set the ring buffer size smaller and witness that we do indeed
Expand Down
2 changes: 1 addition & 1 deletion testsuite/tests/lib-runtime-events/test_caml_slot_reuse.ml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
(* TEST
include runtime_events
* skip
reason = "OCaml 5 only"
reason = "CR OCaml 5 domains"
*)
open Runtime_events

Expand Down
5 changes: 3 additions & 2 deletions testsuite/tests/lib-runtime-events/test_caml_stubs_gc.ml
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
(* TEST
* runtime4
** skip
* runtime5
include runtime_events
* skip
reason = "OCaml 5 only"
*)
open Runtime_events

Expand Down
3 changes: 3 additions & 0 deletions testsuite/tests/lib-runtime-events/test_compact.ml
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
(* TEST
* runtime4
** skip
* runtime5
include runtime_events;
*)
open Runtime_events
Expand Down
2 changes: 1 addition & 1 deletion testsuite/tests/lib-runtime-events/test_dropped_events.ml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
include unix
set OCAMLRUNPARAM = "e=6"
* skip
reason = "OCaml 5 only"
reason = "CR OCaml 5 domains"
** libunix
*** native
*** bytecode
Expand Down
5 changes: 3 additions & 2 deletions testsuite/tests/lib-runtime-events/test_env_start.ml
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
(* TEST
* runtime4
** skip
* runtime5
include runtime_events
set OCAML_RUNTIME_EVENTS_START = "1"
* skip
reason = "OCaml 5 only"
*)

(* In this test the runtime_events should already be started by the environment
Expand Down
5 changes: 3 additions & 2 deletions testsuite/tests/lib-runtime-events/test_external.ml
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
(* TEST
reason = "OCaml 5 only"
* runtime4
** skip
* runtime5
include runtime_events
include unix
* skip
** libunix
*** bytecode
*** native *)
Expand Down
5 changes: 3 additions & 2 deletions testsuite/tests/lib-runtime-events/test_external_preserve.ml
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
(* TEST
* runtime4
** skip
* runtime5
include runtime_events
include unix
set OCAML_RUNTIME_EVENTS_PRESERVE = "1"
* skip
reason = "OCaml 5 only"
** libunix
*** bytecode
*** native *)
Expand Down
5 changes: 3 additions & 2 deletions testsuite/tests/lib-runtime-events/test_fork.ml
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
(* TEST
* runtime4
** skip
* runtime5
include runtime_events
include unix
* skip
reason = "OCaml 5 only"
** libunix
*** bytecode
*** native *)
Expand Down
6 changes: 3 additions & 3 deletions testsuite/tests/lib-runtime-events/test_instrumented.ml
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
(* TEST
* runtime4
** skip
* runtime5
include runtime_events
flags = "-runtime-variant=i"
* skip
reason = "OCaml 5 only"
** instrumented-runtime
*** native
*)
Expand Down
Original file line number Diff line number Diff line change
@@ -1 +1 @@
lost_event_words: 0, total_sizes: 2000004, total_minors: 31
lost_event_words: 0, total_sizes: 2000004, total_minors: 15
5 changes: 3 additions & 2 deletions testsuite/tests/lib-runtime-events/test_user_event.ml
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
(* TEST
* runtime4
** skip
* runtime5
include runtime_events
* skip
reason = "OCaml 5 only"
*)
open Runtime_events

Expand Down
5 changes: 3 additions & 2 deletions testsuite/tests/lib-runtime-events/test_user_event_unknown.ml
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
(* TEST
* runtime4
** skip
* runtime5
include runtime_events
include unix
set OCAML_RUNTIME_EVENTS_PRESERVE = "1"
* skip
reason = "OCaml 5 only"
** libunix
*** bytecode
*** native
Expand Down

0 comments on commit b0ca708

Please sign in to comment.