|
|
@ -66,8 +66,7 @@ let garbage_collect (q : t) ~wrt =
|
|
|
|
|>
|
|
|
|
|>
|
|
|
|
[%Trace.retn fun {pf} -> pf "%a" pp]
|
|
|
|
[%Trace.retn fun {pf} -> pf "%a" pp]
|
|
|
|
|
|
|
|
|
|
|
|
type from_call =
|
|
|
|
type from_call = {subst: Var.Subst.t; frame: Sh.t}
|
|
|
|
{subst: Var.Subst.t; frame: Sh.t; actuals_to_formals: (Exp.t * Var.t) list}
|
|
|
|
|
|
|
|
[@@deriving compare, equal, sexp]
|
|
|
|
[@@deriving compare, equal, sexp]
|
|
|
|
|
|
|
|
|
|
|
|
(** Express formula in terms of formals instead of actuals, and enter scope
|
|
|
|
(** Express formula in terms of formals instead of actuals, and enter scope
|
|
|
@ -90,7 +89,7 @@ let jump actuals formals ?temps q =
|
|
|
|
in
|
|
|
|
in
|
|
|
|
( Option.fold ~f:(Fn.flip Sh.exists) temps
|
|
|
|
( Option.fold ~f:(Fn.flip Sh.exists) temps
|
|
|
|
~init:(and_eqs formals actuals q')
|
|
|
|
~init:(and_eqs formals actuals q')
|
|
|
|
, {subst= freshen_locals; frame= Sh.emp; actuals_to_formals= []} )
|
|
|
|
, {subst= freshen_locals; frame= Sh.emp} )
|
|
|
|
|>
|
|
|
|
|>
|
|
|
|
[%Trace.retn fun {pf} (q', {subst}) ->
|
|
|
|
[%Trace.retn fun {pf} (q', {subst}) ->
|
|
|
|
pf "@[<hv>subst: %a@ q': %a@]" Var.Subst.pp subst Sh.pp q']
|
|
|
|
pf "@[<hv>subst: %a@ q': %a@]" Var.Subst.pp subst Sh.pp q']
|
|
|
@ -116,8 +115,8 @@ let call ~summaries actuals formals locals globals q =
|
|
|
|
in
|
|
|
|
in
|
|
|
|
let q'' = and_eqs formals actuals q' in
|
|
|
|
let q'' = and_eqs formals actuals q' in
|
|
|
|
( if not summaries then
|
|
|
|
( if not summaries then
|
|
|
|
let q'', subst = (Sh.extend_us locals q'', freshen_locals) in
|
|
|
|
let q'' = Sh.extend_us locals q'' in
|
|
|
|
(q'', {subst; frame= Sh.emp; actuals_to_formals= []})
|
|
|
|
(q'', {subst= freshen_locals; frame= Sh.emp})
|
|
|
|
else
|
|
|
|
else
|
|
|
|
let formals_set = Var.Set.of_list formals in
|
|
|
|
let formals_set = Var.Set.of_list formals in
|
|
|
|
(* Add the formals here to do garbage collection and then get rid of
|
|
|
|
(* Add the formals here to do garbage collection and then get rid of
|
|
|
@ -134,11 +133,8 @@ let call ~summaries actuals formals locals globals q =
|
|
|
|
(Solver.infer_frame pre xs foot)
|
|
|
|
(Solver.infer_frame pre xs foot)
|
|
|
|
~message:"Solver couldn't infer frame of a garbage-collected pre"
|
|
|
|
~message:"Solver couldn't infer frame of a garbage-collected pre"
|
|
|
|
in
|
|
|
|
in
|
|
|
|
let q'', subst =
|
|
|
|
let q'' = Sh.extend_us locals (and_eqs formals actuals foot) in
|
|
|
|
(Sh.extend_us locals (and_eqs formals actuals foot), freshen_locals)
|
|
|
|
(q'', {subst= freshen_locals; frame}) )
|
|
|
|
in
|
|
|
|
|
|
|
|
(q'', {subst; frame; actuals_to_formals= List.zip_exn actuals formals})
|
|
|
|
|
|
|
|
)
|
|
|
|
|
|
|
|
|>
|
|
|
|
|>
|
|
|
|
[%Trace.retn fun {pf} (q', {subst; frame}) ->
|
|
|
|
[%Trace.retn fun {pf} (q', {subst; frame}) ->
|
|
|
|
pf "@[<v>subst: %a@ frame: %a@ q': %a@]" Var.Subst.pp subst pp frame pp
|
|
|
|
pf "@[<v>subst: %a@ frame: %a@ q': %a@]" Var.Subst.pp subst pp frame pp
|
|
|
|