Skip to content

Commit

Permalink
Avoid two uses of RD.vars
Browse files Browse the repository at this point in the history
Avoids creation of intermediate lists
  • Loading branch information
sim642 committed Feb 27, 2024
1 parent 4e7f66b commit 9ede6b6
Showing 1 changed file with 5 additions and 6 deletions.
11 changes: 5 additions & 6 deletions src/analyses/apron/relationPriv.apron.ml
Original file line number Diff line number Diff line change
Expand Up @@ -86,13 +86,13 @@ struct

let escape node ask getg sideg (st:relation_components_t) escaped:relation_components_t =
let rel = st.rel in
let esc_vars = List.filter (fun var -> match AV.find_metadata var with
let rel_local = RD.remove_filter rel (fun var ->
match AV.find_metadata var with
| Some (Global _) -> false
| Some (Local r) -> EscapeDomain.EscapedVars.mem r escaped
| _ -> false
) (RD.vars rel)
)
in
let rel_local = RD.remove_vars rel esc_vars in
{ st with rel = rel_local }

let sync (ask: Q.ask) getg sideg (st: relation_components_t) reason =
Expand Down Expand Up @@ -626,13 +626,12 @@ struct
st
else
let rel = st.rel in
let g_vars = List.filter (fun var ->
let rel_side = RD.keep_filter rel (fun var ->
match AV.find_metadata var with
| Some (Global _) -> true
| _ -> false
) (RD.vars rel)
)
in
let rel_side = RD.keep_vars rel g_vars in
sideg V.mutex_inits rel_side;
let rel_local = RD.remove_filter rel (fun var ->
match AV.find_metadata var with
Expand Down

0 comments on commit 9ede6b6

Please sign in to comment.