Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 7 additions & 7 deletions src/absil/ildiag.fs
Original file line number Diff line number Diff line change
Expand Up @@ -5,18 +5,18 @@
module internal FSharp.Compiler.AbstractIL.Diagnostics


let diagnosticsLog = ref (Some stdout)
let mutable diagnosticsLog = Some stdout

let setDiagnosticsChannel s = diagnosticsLog := s
let setDiagnosticsChannel s = diagnosticsLog <- s

let dflushn () = match !diagnosticsLog with None -> () | Some d -> d.WriteLine(); d.Flush()
let dflush () = match !diagnosticsLog with None -> () | Some d -> d.Flush()
let dflushn () = match diagnosticsLog with None -> () | Some d -> d.WriteLine(); d.Flush()
let dflush () = match diagnosticsLog with None -> () | Some d -> d.Flush()
let dprintn (s:string) =
match !diagnosticsLog with None -> () | Some d -> d.Write s; d.Write "\n"; dflush()
match diagnosticsLog with None -> () | Some d -> d.Write s; d.Write "\n"; dflush()

let dprintf (fmt: Format<_,_,_,_>) =
Printf.kfprintf dflush (match !diagnosticsLog with None -> System.IO.TextWriter.Null | Some d -> d) fmt
Printf.kfprintf dflush (match diagnosticsLog with None -> System.IO.TextWriter.Null | Some d -> d) fmt

let dprintfn (fmt: Format<_,_,_,_>) =
Printf.kfprintf dflushn (match !diagnosticsLog with None -> System.IO.TextWriter.Null | Some d -> d) fmt
Printf.kfprintf dflushn (match diagnosticsLog with None -> System.IO.TextWriter.Null | Some d -> d) fmt

18 changes: 9 additions & 9 deletions src/absil/illib.fs
Original file line number Diff line number Diff line change
Expand Up @@ -47,15 +47,15 @@ let LOH_SIZE_THRESHOLD_BYTES = 80_000
// Library: ReportTime
//---------------------------------------------------------------------
let reportTime =
let tFirst = ref None
let tPrev = ref None
let mutable tFirst = None
let mutable tPrev = None
fun showTimes descr ->
if showTimes then
let t = Process.GetCurrentProcess().UserProcessorTime.TotalSeconds
let prev = match !tPrev with None -> 0.0 | Some t -> t
let first = match !tFirst with None -> (tFirst := Some t; t) | Some t -> t
let prev = match tPrev with None -> 0.0 | Some t -> t
let first = match tFirst with None -> (tFirst <- Some t; t) | Some t -> t
printf "ilwrite: TIME %10.3f (total) %10.3f (delta) - %s\n" (t - first) (t - prev) descr
tPrev := Some t
tPrev <- Some t

//-------------------------------------------------------------------------
// Library: projections
Expand Down Expand Up @@ -573,10 +573,10 @@ module String =
let getLines (str: string) =
use reader = new StringReader(str)
[|
let line = ref (reader.ReadLine())
while not (isNull !line) do
yield !line
line := reader.ReadLine()
let mutable line = reader.ReadLine()
while not (isNull line) do
yield line
line <- reader.ReadLine()
if str.EndsWithOrdinal("\n") then
// last trailing space not returned
// http://stackoverflow.com/questions/19365404/stringreader-omits-trailing-linebreak
Expand Down
Loading