@ -40,9 +40,16 @@ let invalid_access_inst fmt_thunk inst =
let invalid_access_term fmt_thunk term =
let invalid_access_term fmt_thunk term =
invalid_access fmt_thunk Llair . Term . pp term Llair . Term . loc
invalid_access fmt_thunk Llair . Term . pp term Llair . Term . loc
(* * Functional statistics *)
let steps = ref 0
let step () = Int . incr steps
(* * Status reporting *)
type status =
type status =
| Safe
| Safe of { steps : int }
| Unsafe of int
| Unsafe of { alarms : int ; steps : int }
| Ok
| Ok
| Unsound
| Unsound
| Incomplete
| Incomplete
@ -58,8 +65,8 @@ type status =
let pp_status ppf stat =
let pp_status ppf stat =
let pf fmt = Format . fprintf ppf fmt in
let pf fmt = Format . fprintf ppf fmt in
match stat with
match stat with
| Safe -> pf " Safe "
| Safe {steps } -> pf " Safe (%i) " steps
| Unsafe i -> pf " Unsafe: %i " i
| Unsafe { alarms ; steps } -> pf " Unsafe: %i (%i) " alarms steps
| Ok -> pf " Ok "
| Ok -> pf " Ok "
| Unsound -> pf " Unsound "
| Unsound -> pf " Unsound "
| Incomplete -> pf " Incomplete "
| Incomplete -> pf " Incomplete "
@ -72,7 +79,8 @@ let pp_status ppf stat =
| UnknownError msg -> pf " Unknown error: %s " msg
| UnknownError msg -> pf " Unknown error: %s " msg
let safe_or_unsafe () =
let safe_or_unsafe () =
if ! invalid_access_count = 0 then Safe else Unsafe ! invalid_access_count
if ! invalid_access_count = 0 then Safe { steps = ! steps }
else Unsafe { alarms = ! invalid_access_count ; steps = ! steps }
type gc_stats = { allocated : float ; promoted : float ; peak_size : float }
type gc_stats = { allocated : float ; promoted : float ; peak_size : float }
[ @@ deriving sexp ]
[ @@ deriving sexp ]