Skip to content
Snippets Groups Projects
Commit 6b199a8f authored by Loïc Correnson's avatar Loïc Correnson
Browse files

[wp/why3] fix context wrt tasks

parent 423e5f24
No related branches found
No related tags found
No related merge requests found
...@@ -1311,50 +1311,48 @@ let is_trivial (t : Why3.Task.task) = ...@@ -1311,50 +1311,48 @@ let is_trivial (t : Why3.Task.task) =
let build_proof_task ?timeout ?steplimit ~prover wpo () = let build_proof_task ?timeout ?steplimit ~prover wpo () =
try try
WpContext.on_context (Wpo.get_context wpo) (* Always generate common task *)
begin fun () -> let context = Wpo.get_context wpo in
(* Always generate common task *) let task = WpContext.on_context context task_of_wpo wpo in
let task = task_of_wpo wpo in if Wp_parameters.Check.get ()
if Wp_parameters.Check.get () then Task.return VCS.checked (* Why3 tasks are type-checked *)
then Task.return VCS.checked (* Why3 tasks are type-checked *) else
else if Wp_parameters.Generate.get ()
if Wp_parameters.Generate.get () then Task.return VCS.no_result (* Only generate *)
then Task.return VCS.no_result (* Only generate *) else
else let drv , config , task = prover_task prover task in
let drv , config , task = prover_task prover task in if is_trivial task then
if is_trivial task then Task.return VCS.valid
Task.return VCS.valid else
else let mode = get_mode () in
let mode = get_mode () in match mode with
match mode with | NoCache ->
| NoCache -> call_prover ~timeout ~steplimit drv prover config task
call_prover ~timeout ~steplimit drv prover config task | Offline ->
| Offline -> let hash = task_hash wpo drv prover task in
let hash = task_hash wpo drv prover task in let result = get_cache_result ~mode hash |> VCS.cached in
let result = get_cache_result ~mode hash |> VCS.cached in if VCS.is_verdict result then incr hits else incr miss ;
if VCS.is_verdict result then incr hits else incr miss ; Task.return result
| Update | Replay | Rebuild | Cleanup ->
let hash = task_hash wpo drv prover task in
let result =
get_cache_result ~mode hash
|> promote ~timeout ~steplimit |> VCS.cached in
if VCS.is_verdict result
then
begin
incr hits ;
Task.return result Task.return result
| Update | Replay | Rebuild | Cleanup -> end
let hash = task_hash wpo drv prover task in else
let result = Task.finally
get_cache_result ~mode hash (call_prover ~timeout ~steplimit drv prover config task)
|> promote ~timeout ~steplimit |> VCS.cached in begin function
if VCS.is_verdict result | Task.Result result when VCS.is_verdict result ->
then incr miss ;
begin set_cache_result ~mode hash prover result
incr hits ; | _ -> ()
Task.return result end
end
else
Task.finally
(call_prover ~timeout ~steplimit drv prover config task)
begin function
| Task.Result result when VCS.is_verdict result ->
incr miss ;
set_cache_result ~mode hash prover result
| _ -> ()
end
end ()
with exn -> with exn ->
if Wp_parameters.has_dkey dkey_api then if Wp_parameters.has_dkey dkey_api then
Wp_parameters.fatal "[Why3 Error] %a@\n%s" Wp_parameters.fatal "[Why3 Error] %a@\n%s"
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment