Skip to content

Commit

Permalink
[multicore] DLS helper in Utils
Browse files Browse the repository at this point in the history
Summary: As per title, plus a comment fix in AnalysisGlobalState.mli.

Reviewed By: skcho

Differential Revision:
D66805765

Privacy Context Container: L1208441

fbshipit-source-id: de1b9a3506676e9bf10e6c76fc2583ef2f2f99d7
  • Loading branch information
ngorogiannis authored and facebook-github-bot committed Dec 7, 2024
1 parent 0c97c35 commit bf165c9
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 4 deletions.
8 changes: 4 additions & 4 deletions infer/src/IR/AnalysisGlobalState.mli
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,10 @@ open! IStd
(** {2 Global state for the backend analyses}
While global state should be kept under control at possible (so try to introduce as little of it
as possible!), it is sometimes too convenient to ignore. This module lets us do it safely, at
least until infer becomes multicore. In particular, global state is appropriately and safely
stashed away and restored when the analysis of a procedure is suspended to go analyze another
procedure with ondemand (see the {!Backend.Ondemand} module). *)
as possible!), it is sometimes too convenient to ignore. This module lets us do it safely. In
particular, global state (really, domain-local state) is appropriately and safely stashed away
and restored when the analysis of a procedure is suspended to go analyze another procedure with
ondemand (see the {!Backend.Ondemand} module). *)

type t

Expand Down
3 changes: 3 additions & 0 deletions infer/src/base/Utils.ml
Original file line number Diff line number Diff line change
Expand Up @@ -513,3 +513,6 @@ let is_term_dumb () =
true
| _ ->
false


let with_dls key ~f = Domain.DLS.get key |> f |> Domain.DLS.set key
4 changes: 4 additions & 0 deletions infer/src/base/Utils.mli
Original file line number Diff line number Diff line change
Expand Up @@ -152,3 +152,7 @@ val zip_fold : init:'a -> f:('a -> Zip.in_file -> Zip.entry -> 'a) -> zip_filena
val is_term_dumb : unit -> bool
(** Check if the terminal is "dumb" or otherwise has very limited functionality. For example, Emacs'
eshell reports itself as a dumb terminal. *)

val with_dls : 'a Domain.DLS.key -> f:('a -> 'a) -> unit
[@@warning "-unused-value-declaration"]
(** get value in domain local storage, pass to [f] and set to result *)

0 comments on commit bf165c9

Please sign in to comment.