Skip to content

Commit

Permalink
[coq] Preliminary support for memprof_limits token-based interruption
Browse files Browse the repository at this point in the history
  • Loading branch information
ejgallego committed Apr 3, 2024
1 parent 41d8b33 commit 5731f11
Show file tree
Hide file tree
Showing 7 changed files with 8 additions and 7 deletions.
1 change: 1 addition & 0 deletions compiler/cc.ml
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,5 @@ type t =
; workspaces : (string * (Coq.Workspace.t, string) Result.t) list
; default : Coq.Workspace.t
; io : Fleche.Io.CallBack.t
; token : Coq.Limits.Token.t
}
3 changes: 1 addition & 2 deletions compiler/compile.ml
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ let save_diags_file ~(doc : Fleche.Doc.t) =
Util.format_to_file ~file ~f:Output.pp_diags diags

let compile_file ~cc file =
let { Cc.io; root_state; workspaces; default } = cc in
let { Cc.io; root_state; workspaces; default; token } = cc in
let lvl = Io.Level.info in
let message = Format.asprintf "compiling file %s@\n%!" file in
io.message ~lvl ~message;
Expand All @@ -35,7 +35,6 @@ let compile_file ~cc file =
let workspace = workspace_of_uri ~io ~workspaces ~uri ~default in
let env = Doc.Env.make ~init:root_state ~workspace in
let raw = Util.input_all file in
let token = Coq.Limits.Token.create () in
let () = Theory.create ~io ~token ~env ~uri ~raw ~version:1 in
match Theory.Check.maybe_check ~io ~token with
| None -> ()
Expand Down
3 changes: 2 additions & 1 deletion compiler/driver.ml
Original file line number Diff line number Diff line change
Expand Up @@ -37,14 +37,15 @@ let go args =
let root_state = coq_init ~debug in
let roots = if List.length roots < 1 then [ Sys.getcwd () ] else roots in
let default = Coq.Workspace.default ~debug ~cmdline in
let () = Coq.Limits.start () in
let token = Coq.Limits.Token.create () in
let workspaces =
List.map
(fun dir -> (dir, Coq.Workspace.guess ~token ~cmdline ~debug ~dir))
roots
in
List.iter (log_workspace ~io) workspaces;
let cc = Cc.{ root_state; workspaces; default; io } in
let cc = Cc.{ root_state; workspaces; default; io; token } in
(* Initialize plugins *)
plugin_init plugins;
Compile.compile ~cc files
2 changes: 2 additions & 0 deletions controller/coq_lsp.ml
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,8 @@ let rec lsp_init_loop ~ifn ~ofn ~cmdline ~debug =

let lsp_main bt coqcorelib coqlib ocamlpath vo_load_path ml_include_path
require_libraries delay =
Coq.Limits.start ();

(* Try to be sane w.r.t. \r\n in Windows *)
Stdlib.set_binary_mode_in stdin true;
Stdlib.set_binary_mode_out stdout true;
Expand Down
3 changes: 1 addition & 2 deletions coq/limits.ml
Original file line number Diff line number Diff line change
Expand Up @@ -46,5 +46,4 @@ module Coq : Intf = struct
end

module Mp = Limits_mp_impl

include Coq
include Mp
1 change: 0 additions & 1 deletion coq/limits.mli
Original file line number Diff line number Diff line change
Expand Up @@ -16,5 +16,4 @@ end

module Coq : Intf
module Mp : Intf

include Intf
2 changes: 1 addition & 1 deletion vendor/coq
Submodule coq updated 1 files
+1 −4 library/global.ml

0 comments on commit 5731f11

Please sign in to comment.