From 9ee705bb88927768c0740d7985247f6d67ab31b1 Mon Sep 17 00:00:00 2001 From: Josh Berdine Date: Wed, 24 Mar 2021 14:15:58 -0700 Subject: [PATCH] [sledge] Resolve match-on-mutable-state-prevent-uncurry warnings Summary: This warning (68) triggers when a function argument pattern depends on mutable state, which prevents the remaining arguments from being uncurried, causing additional closure allocations. Reviewed By: jvillard Differential Revision: D27188311 fbshipit-source-id: a43354e15 --- sledge/cli/domain_itv.ml | 6 +++--- sledge/src/control.ml | 8 ++++---- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/sledge/cli/domain_itv.ml b/sledge/cli/domain_itv.ml index a8a7c3761..fc31eb884 100644 --- a/sledge/cli/domain_itv.ml +++ b/sledge/cli/domain_itv.ml @@ -32,11 +32,11 @@ let bindings (itv : t) = let sexp_of_t (itv : t) = let sexps = - Array.fold_right (bindings itv) [] ~f:(fun (v, {inf; sup}) acc -> + Array.fold_right (bindings itv) [] ~f:(fun (v, i) acc -> Sexp.List [ Sexp.Atom (Var.to_string v) - ; Sexp.Atom (Scalar.to_string inf) - ; Sexp.Atom (Scalar.to_string sup) ] + ; Sexp.Atom (Scalar.to_string i.inf) + ; Sexp.Atom (Scalar.to_string i.sup) ] :: acc ) in Sexp.List sexps diff --git a/sledge/src/control.ml b/sledge/src/control.ml index 84027a0d2..aa7e16b50 100644 --- a/sledge/src/control.ml +++ b/sledge/src/control.ml @@ -91,8 +91,8 @@ module Make (Opts : Domain_intf.Opts) (Dom : Domain_intf.Dom) = struct let empty = Empty |> check invariant - let push_return Llair.{callee= {formals; locals}; return; recursive} - from_call stk = + let push_return call from_call stk = + let Llair.{callee= {formals; locals}; return; recursive; _} = call in Return {recursive; dst= return; formals; locals; from_call; stk} |> check invariant @@ -366,8 +366,8 @@ module Make (Opts : Domain_intf.Opts) (Dom : Domain_intf.Dom) = struct let state = Option.fold ~f:Dom.exec_kill areturn state in exec_jump stk state block return - let exec_call stk state block ({Llair.callee; areturn; return; _} as call) - globals = + let exec_call stk state block call globals = + let Llair.{callee; areturn; return; _} = call in if Llair.Func.is_undefined callee then exec_skip_func stk state block areturn return else exec_call stk state block call globals