Import Debian changes 20180207-1
[hcoop/debian/mlton.git] / basis-library / mlton / gc.sml
CommitLineData
7f918cf1
CE
1(* Copyright (C) 1999-2008 Henry Cejtin, Matthew Fluet, Suresh
2 * Jagannathan, and Stephen Weeks.
3 * Copyright (C) 1997-2000 NEC Research Institute.
4 *
5 * MLton is released under a BSD-style license.
6 * See the file MLton-LICENSE for details.
7 *)
8
9structure MLtonGC =
10 struct
11 open Primitive.MLton.GC
12
13 val gcState = Primitive.MLton.GCState.gcState
14
15 val pack : unit -> unit =
16 fn () => pack gcState
17 val unpack : unit -> unit =
18 fn () => unpack gcState
19
20 val setHashConsDuringGC : bool -> unit =
21 fn b => setHashConsDuringGC (gcState, b)
22 val setMessages : bool -> unit =
23 fn b => setMessages (gcState, b)
24 val setRusageMeasureGC : bool -> unit =
25 fn b => setRusageMeasureGC (gcState, b)
26 val setSummary : bool -> unit =
27 fn b => setSummary (gcState, b)
28
29 structure Statistics =
30 struct
31 local
32 fun mk conv prim =
33 fn () => conv (prim gcState)
34 val mkSize = mk C_Size.toLargeInt
35 val mkUIntmax = mk C_UIntmax.toLargeInt
36 in
37 val bytesAllocated = mkUIntmax getBytesAllocated
38 val lastBytesLive = mkSize getLastBytesLive
39 val maxBytesLive = mkSize getMaxBytesLive
40 val numCopyingGCs = mkUIntmax getNumCopyingGCs
41 val numMarkCompactGCs = mkUIntmax getNumMarkCompactGCs
42 val numMinorGCs = mkUIntmax getNumMinorGCs
43 end
44 end
45
46 end