Import Upstream version 20180207
[hcoop/debian/mlton.git] / runtime / gc / controls.h
1 /* Copyright (C) 2017 Matthew Fluet.
2 * Copyright (C) 1999-2005 Henry Cejtin, Matthew Fluet, Suresh
3 * Jagannathan, and Stephen Weeks.
4 * Copyright (C) 1997-2000 NEC Research Institute.
5 *
6 * MLton is released under a BSD-style license.
7 * See the file MLton-LICENSE for details.
8 */
9
10 #if (defined (MLTON_GC_INTERNAL_TYPES))
11
12 struct GC_ratios {
13 /* Minimum live ratio to use copying GC. */
14 float copy;
15 /* Only use generational GC with copying collection if the ratio of
16 * heap size to live data size is below copyGenerational.
17 */
18 float copyGenerational;
19 float grow;
20 float hashCons;
21 /* Desired ratio of heap size to live data. */
22 float live;
23 /* Minimum live ratio to use mark-compact GC. */
24 float markCompact;
25 /* Only use generational GC with mark-compact collection if the
26 * ratio of heap size to live data size is below
27 * markCompactGenerational.
28 */
29 float markCompactGenerational;
30 /* As long as the ratio of bytes live to nursery size is greater
31 * than nurseryRatio, use minor GCs.
32 */
33 float nursery;
34 float ramSlop;
35 float stackCurrentGrow;
36 float stackCurrentMaxReserved;
37 float stackCurrentPermitReserved;
38 float stackCurrentShrink;
39 float stackMaxReserved;
40 float stackShrink;
41 };
42
43 struct GC_controls {
44 size_t fixedHeap; /* If 0, then no fixed heap. */
45 size_t maxHeap; /* if zero, then unlimited, else limit total heap */
46 bool mayLoadWorld;
47 bool mayPageHeap; /* Permit paging heap to disk during GC */
48 bool mayProcessAtMLton;
49 bool messages; /* Print a message at the start and end of each gc. */
50 size_t oldGenArraySize; /* Arrays larger are allocated in old gen, if possible. */
51 struct GC_ratios ratios;
52 bool rusageMeasureGC;
53 bool summary; /* Print a summary of gc info when program exits. */
54 FILE* summaryFile;
55 };
56
57 #endif /* (defined (MLTON_GC_INTERNAL_TYPES)) */
58
59 #if (defined (MLTON_GC_INTERNAL_FUNCS))
60
61 static inline bool detailedGCTime (GC_state s);
62 static inline bool needGCTime (GC_state s);
63
64 #endif /* (defined (MLTON_GC_INTERNAL_FUNCS)) */