Skip to content

Commit

Permalink
Fix trace calls outside of if tracing
Browse files Browse the repository at this point in the history
  • Loading branch information
michael-schwarz committed Sep 19, 2023
1 parent 0f59ac9 commit d0e9064
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 10 deletions.
8 changes: 4 additions & 4 deletions src/solvers/sLRphased.ml
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ module Make =
let effects = ref Set.empty in
let side y d =
assert (not (S.Dom.is_bot d));
trace "sol" "SIDE: Var: %a\nVal: %a\n" S.Var.pretty_trace y S.Dom.pretty d;
if tracing then trace "sol" "SIDE: Var: %a\nVal: %a\n" S.Var.pretty_trace y S.Dom.pretty d;
let first = not (Set.mem y !effects) in
effects := Set.add y !effects;
if first then (
Expand Down Expand Up @@ -109,11 +109,11 @@ module Make =
if wpx then
if b then
let nar = narrow old tmp in
trace "sol" "NARROW: Var: %a\nOld: %a\nNew: %a\nWiden: %a\n" S.Var.pretty_trace x S.Dom.pretty old S.Dom.pretty tmp S.Dom.pretty nar;
if tracing then trace "sol" "NARROW: Var: %a\nOld: %a\nNew: %a\nWiden: %a\n" S.Var.pretty_trace x S.Dom.pretty old S.Dom.pretty tmp S.Dom.pretty nar;
nar
else
let wid = S.Dom.widen old (S.Dom.join old tmp) in
trace "sol" "WIDEN: Var: %a\nOld: %a\nNew: %a\nWiden: %a\n" S.Var.pretty_trace x S.Dom.pretty old S.Dom.pretty tmp S.Dom.pretty wid;
if tracing then trace "sol" "WIDEN: Var: %a\nOld: %a\nNew: %a\nWiden: %a\n" S.Var.pretty_trace x S.Dom.pretty old S.Dom.pretty tmp S.Dom.pretty wid;
wid
else
tmp
Expand Down Expand Up @@ -163,7 +163,7 @@ module Make =
and sides x =
let w = try HM.find set x with Not_found -> VS.empty in
let v = Enum.fold (fun d z -> try S.Dom.join d (HPM.find rho' (z,x)) with Not_found -> d) (S.Dom.bot ()) (VS.enum w)
in trace "sol" "SIDES: Var: %a\nVal: %a\n" S.Var.pretty_trace x S.Dom.pretty v; v
in if tracing then trace "sol" "SIDES: Var: %a\nVal: %a\n" S.Var.pretty_trace x S.Dom.pretty v; v
and eq x get set =
eval_rhs_event x;
match S.system x with
Expand Down
12 changes: 6 additions & 6 deletions src/solvers/sLRterm.ml
Original file line number Diff line number Diff line change
Expand Up @@ -64,14 +64,14 @@ module SLR3term =
HM.replace rho x (S.Dom.bot ());
HM.replace infl x (VS.add x VS.empty);
let c = if side then count_side else count in
trace "sol" "INIT: Var: %a with prio %d\n" S.Var.pretty_trace x !c;
if tracing then trace "sol" "INIT: Var: %a with prio %d\n" S.Var.pretty_trace x !c;
HM.replace key x !c; decr c
end
in
let sides x =
let w = try HM.find set x with Not_found -> VS.empty in
let v = Enum.fold (fun d z -> try S.Dom.join d (HPM.find rho' (z,x)) with Not_found -> d) (S.Dom.bot ()) (VS.enum w) in
trace "sol" "SIDES: Var: %a\nVal: %a\n" S.Var.pretty_trace x S.Dom.pretty v; v
if tracing then trace "sol" "SIDES: Var: %a\nVal: %a\n" S.Var.pretty_trace x S.Dom.pretty v; v
in
let rec iterate b_old prio =
if H.size !q = 0 || min_key q > prio then ()
Expand Down Expand Up @@ -122,7 +122,7 @@ module SLR3term =
)
*)
(* if S.Dom.is_bot d then print_endline "BOT" else *)
trace "sol" "SIDE: Var: %a\nVal: %a\n" S.Var.pretty_trace y S.Dom.pretty d;
if tracing then trace "sol" "SIDE: Var: %a\nVal: %a\n" S.Var.pretty_trace y S.Dom.pretty d;
let first = not (Set.mem y !effects) in
effects := Set.add y !effects;
if first then (
Expand Down Expand Up @@ -156,17 +156,17 @@ module SLR3term =
if wpx then
if S.Dom.leq tmp old then (
let nar = narrow old tmp in
trace "sol" "NARROW1: Var: %a\nOld: %a\nNew: %a\nNarrow: %a" S.Var.pretty_trace x S.Dom.pretty old S.Dom.pretty tmp S.Dom.pretty nar;
if tracing then trace "sol" "NARROW1: Var: %a\nOld: %a\nNew: %a\nNarrow: %a" S.Var.pretty_trace x S.Dom.pretty old S.Dom.pretty tmp S.Dom.pretty nar;
nar, true
) else
if b_old then (
let nar = narrow old tmp in
trace "sol" "NARROW2: Var: %a\nOld: %a\nNew: %a\nNarrow: %a" S.Var.pretty_trace x S.Dom.pretty old S.Dom.pretty tmp S.Dom.pretty nar;
if tracing then trace "sol" "NARROW2: Var: %a\nOld: %a\nNew: %a\nNarrow: %a" S.Var.pretty_trace x S.Dom.pretty old S.Dom.pretty tmp S.Dom.pretty nar;
nar, true
)
else (
let wid = S.Dom.widen old (S.Dom.join old tmp) in
trace "sol" "WIDEN: Var: %a\nOld: %a\nNew: %a\nWiden: %a" S.Var.pretty_trace x S.Dom.pretty old S.Dom.pretty tmp S.Dom.pretty wid;
if tracing then trace "sol" "WIDEN: Var: %a\nOld: %a\nNew: %a\nWiden: %a" S.Var.pretty_trace x S.Dom.pretty old S.Dom.pretty tmp S.Dom.pretty wid;
wid, false
)
else
Expand Down

0 comments on commit d0e9064

Please sign in to comment.