Skip to content

Commit

Permalink
Add parallel parsing (issue #589)
Browse files Browse the repository at this point in the history
  • Loading branch information
sim642 committed Feb 16, 2022
1 parent 7b24e52 commit c7dba57
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 6 deletions.
2 changes: 1 addition & 1 deletion src/dune
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
(public_name goblint.lib)
(wrapped false)
(modules :standard \ goblint mainarinc mainspec privPrecCompare apronPrecCompare)
(libraries goblint.sites goblint-cil.all-features batteries.unthreaded qcheck-core.runner sha json-data-encoding jsonrpc cpu
(libraries goblint.sites goblint-cil.all-features batteries.unthreaded qcheck-core.runner sha json-data-encoding jsonrpc cpu parmap
; Conditionally compile based on whether apron optional dependency is installed or not.
; Alternative dependencies seem like the only way to optionally depend on optional dependencies.
; See: https://dune.readthedocs.io/en/stable/concepts.html#alternative-dependencies.
Expand Down
15 changes: 10 additions & 5 deletions src/maingoblint.ml
Original file line number Diff line number Diff line change
Expand Up @@ -292,12 +292,17 @@ let merge_preprocessed cpp_file_names =
(* get the AST *)
if get_bool "dbg.verbose" then print_endline "Parsing files.";
let get_ast_and_record_deps f =
let file = Cilfacade.getAST f in
(* Drop <built-in> and <command-line> from dependencies *)
Hashtbl.add Preprocessor.dependencies f @@ List.filter (fun (n,_) -> n <> "<built-in>" && n <> "<command-line>") file.files;
file
Cilfacade.getAST f
in
let files_AST = List.map (get_ast_and_record_deps) cpp_file_names in
(* let files_AST = Parmap.parmap ~ncores:(Goblintutil.jobs ()) (get_ast_and_record_deps) (L cpp_file_names) in *)
let files_AST = List.map (get_ast_and_record_deps) (cpp_file_names) in

List.iter2 (fun f file ->
(* Drop <built-in> and <command-line> from dependencies *)
Hashtbl.add Preprocessor.dependencies f @@ List.filter (fun (n,_) -> n <> "<built-in>" && n <> "<command-line>") file.Cil.files;
) cpp_file_names files_AST;

(* raise Exit; *)

let cilout =
if get_string "dbg.cilout" = "" then Legacy.stderr else Legacy.open_out (get_string "dbg.cilout")
Expand Down

0 comments on commit c7dba57

Please sign in to comment.