Import Debian changes 20180207-1
[hcoop/debian/mlton.git] / mlton / backend / runtime.sig
1 (* Copyright (C) 2009,2016-2017 Matthew Fluet.
2 * Copyright (C) 1999-2007 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 signature RUNTIME_STRUCTS =
11 sig
12 end
13
14 signature RUNTIME =
15 sig
16 include RUNTIME_STRUCTS
17
18 structure GCField:
19 sig
20 datatype t =
21 AtomicState
22 | CardMapAbsolute
23 | CurrentThread
24 | CurSourceSeqsIndex
25 | ExnStack
26 | Frontier (* The place where the next object is allocated. *)
27 | Limit (* frontier + heapSize - LIMIT_SLOP *)
28 | LimitPlusSlop (* frontier + heapSize *)
29 | MaxFrameSize
30 | SignalIsPending
31 | StackBottom
32 | StackLimit (* Must have StackTop <= StackLimit *)
33 | StackTop (* Points at the next available byte on the stack. *)
34
35 val layout: t -> Layout.t
36 val offset: t -> Bytes.t (* Field offset in struct GC_state. *)
37 val setOffsets: {atomicState: Bytes.t,
38 cardMapAbsolute: Bytes.t,
39 currentThread: Bytes.t,
40 curSourceSeqsIndex: Bytes.t,
41 exnStack: Bytes.t,
42 frontier: Bytes.t,
43 limit: Bytes.t,
44 limitPlusSlop: Bytes.t,
45 maxFrameSize: Bytes.t,
46 signalIsPending: Bytes.t,
47 stackBottom: Bytes.t,
48 stackLimit: Bytes.t,
49 stackTop: Bytes.t} -> unit
50 val setSizes: {atomicState: Bytes.t,
51 cardMapAbsolute: Bytes.t,
52 currentThread: Bytes.t,
53 curSourceSeqsIndex: Bytes.t,
54 exnStack: Bytes.t,
55 frontier: Bytes.t,
56 limit: Bytes.t,
57 limitPlusSlop: Bytes.t,
58 maxFrameSize: Bytes.t,
59 signalIsPending: Bytes.t,
60 stackBottom: Bytes.t,
61 stackLimit: Bytes.t,
62 stackTop: Bytes.t} -> unit
63 val size: t -> Bytes.t (* Field size in struct GC_state. *)
64 val toString: t -> string
65 end
66 structure RObjectType:
67 sig
68 datatype t =
69 Array of {hasIdentity: bool,
70 bytesNonObjptrs: Bytes.t,
71 numObjptrs: int}
72 | Normal of {hasIdentity: bool,
73 bytesNonObjptrs: Bytes.t,
74 numObjptrs: int}
75 | Stack
76 | Weak of {gone: bool}
77 end
78
79 val arrayLengthOffset: unit -> Bytes.t
80 val arrayLengthSize: unit -> Bytes.t
81 val arrayMetaDataSize: unit -> Bytes.t
82 val cpointerSize: unit -> Bytes.t
83 val headerOffset: unit -> Bytes.t
84 val headerSize: unit -> Bytes.t
85 val headerToTypeIndex: word -> int
86 val labelSize: unit -> Bytes.t
87 val limitSlop: Bytes.t
88 val maxFrameSize: Bytes.t
89 val normalMetaDataSize: unit -> Bytes.t
90 val objptrSize: unit -> Bytes.t
91 val typeIndexToHeader: int -> word
92 end