Skip to content

Commit

Permalink
Add configure option --enable-poll-insertion
Browse files Browse the repository at this point in the history
Use the new configure option
Add -enable-poll-insertion compilation flag
Fix tests
ocaml/configure updated
Add --enable-poll-insertion to CI
Add to build_ocaml_compiler.sexp
Remove CR (it's done by this PR)
Use Config.poll_insertion to set the default for the compile flag
  • Loading branch information
gretay-js committed Dec 2, 2022
1 parent 0c3afa3 commit ffc8a66
Show file tree
Hide file tree
Showing 28 changed files with 3,527 additions and 4,572 deletions.
8 changes: 4 additions & 4 deletions .github/workflows/build.yml
Expand Up @@ -18,7 +18,7 @@ jobs:
ocamlrunparam: "v=0,V=1"

- name: closure_cfg_local
config: --enable-middle-end=closure --enable-stack-allocation
config: --enable-middle-end=closure --enable-stack-allocation --enable-poll-insertion
os: ubuntu-latest
ocamlparam: _,ocamlcfg=1

Expand All @@ -28,12 +28,12 @@ jobs:
ocamlparam: ''

- name: flambda1_frame_pointers
config: --enable-middle-end=flambda --enable-frame-pointers
config: --enable-middle-end=flambda --enable-frame-pointers --enable-poll-insertion
os: ubuntu-latest
ocamlparam: ''

- name: flambda1_cfg_local
config: --enable-middle-end=flambda --enable-stack-allocation
config: --enable-middle-end=flambda --enable-stack-allocation --enable-poll-insertion
os: ubuntu-latest
ocamlparam: _,ocamlcfg=1

Expand All @@ -45,7 +45,7 @@ jobs:
ocamlrunparam: "v=0,V=1"

- name: flambda2_frame_pointers
config: --enable-middle-end=flambda2 --enable-frame-pointers
config: --enable-middle-end=flambda2 --enable-frame-pointers --enable-poll-insertion
os: ubuntu-latest
ocamlparam: ''

Expand Down
1 change: 1 addition & 0 deletions backend/polling.ml
Expand Up @@ -262,6 +262,7 @@ let find_poll_alloc_or_calls instr =
List.rev !matches

let is_disabled fun_name =
(not Config.poll_insertion) ||
!Flambda_backend_flags.disable_poll_insertion ||
function_is_assumed_to_never_poll fun_name

Expand Down
1 change: 1 addition & 0 deletions build_ocaml_compiler.sexp
Expand Up @@ -19,5 +19,6 @@
no_flat_float_array
perf_demangled_symbols
stack_allocation
poll_insertion
))
)
8 changes: 7 additions & 1 deletion driver/flambda_backend_args.ml
Expand Up @@ -62,6 +62,9 @@ let mk_dcheckmach f =
let mk_disable_poll_insertion f =
"-disable-poll-insertion", Arg.Unit f, " Do not insert poll points"

let mk_enable_poll_insertion f =
"-enable-poll-insertion", Arg.Unit f, " Insert poll points"

let mk_long_frames f =
"-long-frames", Arg.Unit f, " Allow stack frames longer than 2^16 bytes"

Expand Down Expand Up @@ -467,6 +470,7 @@ module type Flambda_backend_options = sig
val dcheckmach : unit -> unit

val disable_poll_insertion : unit -> unit
val enable_poll_insertion : unit -> unit

val long_frames : unit -> unit
val no_long_frames : unit -> unit
Expand Down Expand Up @@ -547,6 +551,7 @@ struct
mk_dcheckmach F.dcheckmach;

mk_disable_poll_insertion F.disable_poll_insertion;
mk_enable_poll_insertion F.enable_poll_insertion;

mk_long_frames F.long_frames;
mk_no_long_frames F.no_long_frames;
Expand Down Expand Up @@ -663,6 +668,7 @@ module Flambda_backend_options_impl = struct
let dcheckmach = set' Flambda_backend_flags.dump_checkmach

let disable_poll_insertion = set' Flambda_backend_flags.disable_poll_insertion
let enable_poll_insertion = clear' Flambda_backend_flags.disable_poll_insertion

let long_frames = set' Flambda_backend_flags.allow_long_frames
let no_long_frames = clear' Flambda_backend_flags.allow_long_frames
Expand Down Expand Up @@ -868,7 +874,7 @@ module Extra_params = struct
| "heap-reduction-threshold" -> set_int' Flambda_backend_flags.heap_reduction_threshold
| "alloc-check" -> set' Flambda_backend_flags.alloc_check
| "dump-checkmach" -> set' Flambda_backend_flags.dump_checkmach
| "disable-poll-insertion" -> set' Flambda_backend_flags.disable_poll_insertion
| "poll-insertion" -> set' Flambda_backend_flags.disable_poll_insertion
| "long-frames" -> set' Flambda_backend_flags.allow_long_frames
| "debug-long-frames-threshold" ->
begin match Compenv.check_int ppf name v with
Expand Down
2 changes: 2 additions & 0 deletions driver/flambda_backend_args.mli
Expand Up @@ -37,6 +37,8 @@ module type Flambda_backend_options = sig
val dcheckmach : unit -> unit

val disable_poll_insertion : unit -> unit
val enable_poll_insertion : unit -> unit

val long_frames : unit -> unit
val no_long_frames : unit -> unit
val long_frames_threshold : int -> unit
Expand Down
5 changes: 2 additions & 3 deletions driver/flambda_backend_flags.ml
Expand Up @@ -27,9 +27,8 @@ let heap_reduction_threshold = ref default_heap_reduction_threshold (* -heap-red
let alloc_check = ref false (* -alloc-check *)
let dump_checkmach = ref false (* -dcheckmach *)

(* CR-soon gyorsh: re-enable tests testsuite/tests/asmcomp/poll_*
when changing the default for [disable_poll_insertion] to false. *)
let disable_poll_insertion = ref true (* -disable-poll-insertion *)
let disable_poll_insertion = ref (not Config.poll_insertion)
(* -disable-poll-insertion *)
let allow_long_frames = ref true (* -no-long-frames *)
(* Keep the value of [max_long_frames_threshold] in sync with LONG_FRAME_MARKER
in ocaml/runtime/roots_nat.c *)
Expand Down
1 change: 1 addition & 0 deletions ocaml/Makefile.config.in
Expand Up @@ -252,6 +252,7 @@ STDLIB_MANPAGES=@stdlib_manpages@
NAKED_POINTERS=@naked_pointers@
INTEL_JCC_BUG_CFLAGS=@intel_jcc_bug_cflags@
STACK_ALLOCATION=@stack_allocation@
POLL_INSERTION=@poll_insertion@
DUNE=@dune@

### Native command to build ocamlrun.exe
Expand Down

0 comments on commit ffc8a66

Please sign in to comment.