diff --git a/infer/src/backend/RestartScheduler.ml b/infer/src/backend/RestartScheduler.ml index 9f373f97a..08cb4de44 100644 --- a/infer/src/backend/RestartScheduler.ml +++ b/infer/src/backend/RestartScheduler.ml @@ -18,15 +18,21 @@ let of_list (lst : 'a list) : 'a ProcessPool.TaskGenerator.t = (** This behaves exactly the same as the FileScheduler so far. The goal is that it will use a work queue and proc locking to avoid repeating work and hopefully get some in process cache hits. *) -let make sources = +let make_with_procs_from sources = let gen = - List.rev_map sources ~f:(fun sf -> SchedulerTypes.File sf) + List.map sources ~f:SourceFiles.proc_names_of_source + |> List.concat + |> List.rev_map ~f:(fun procname -> SchedulerTypes.Procname procname) |> List.permute ~random_state:(Random.State.make (Array.create ~len:1 0)) |> of_list in let next x = let res = gen.next x in - (* see defn of gen above to see why res should never match Some (Procname _) *) - match res with None -> None | Some (Procname _) -> assert false | Some (File _) as v -> v + (* see defn of gen above to see why res should never match Some (File _) *) + match res with None -> None | Some (File _) -> assert false | Some (Procname _) as v -> v in {gen with next} + + +let make sources = + ProcessPool.TaskGenerator.chain (make_with_procs_from sources) (FileScheduler.make sources)