1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
(* SPDX-License-Identifier: AGPL-3.0-or-later *)
(* Copyright © 2021-2026 OCamlPro *)
(* Written by the Owi programmers *)

open Syntax

let cmd ~unsafe ~timeout ~timeout_instr ~source_file =
  let name = None in
  let env = Env.Concrete.empty ~context:() in
  let* modul, env =
    Compile.File.until_concrete_link env ~unsafe ~name source_file
  in
  let module Parameters = struct
    let timeout = timeout

    let timeout_instr = timeout_instr

    let use_ite_for_select = true

    let throw_away_trap = false

    let abstract_invariant = Abstract_invariant.empty ()
  end in
  let module I = Interpret.Concrete (Parameters) in
  let res, run_time =
    Benchmark.with_utime @@ fun () ->
    let* _env = I.modul ~env ~modul in
    Ok ()
  in
  Log.bench (fun m ->
    (* run_time shouldn't be none in bench mode *)
    let run_time = match run_time with None -> assert false | Some t -> t in
    m "Benchmarks:@\n@[<v>interpreter time: %fms@]" (run_time *. 1000.) );
  res