1Stdlib.Obj(3) OCaml library Stdlib.Obj(3)
2
3
4
6 Stdlib.Obj - no description
7
9 Module Stdlib.Obj
10
12 Module Obj
13 : (module Stdlib__obj)
14
15
16
17
18
19
20
21 type t
22
23
24
25
26
27 val repr : 'a -> t
28
29
30
31
32 val obj : t -> 'a
33
34
35
36
37 val magic : 'a -> 'b
38
39
40
41
42 val is_block : t -> bool
43
44
45
46
47 val is_int : t -> bool
48
49
50
51
52 val tag : t -> int
53
54
55
56
57 val size : t -> int
58
59
60
61
62 val reachable_words : t -> int
63
64 Computes the total size (in words, including the headers) of all heap
65 blocks accessible from the argument. Statically allocated blocks are
66 excluded.
67
68 @Since 4.04
69
70
71
72 val field : t -> int -> t
73
74
75
76
77 val set_field : t -> int -> t -> unit
78
79 When using flambda:
80
81
82 set_field MUST NOT be called on immutable blocks. (Blocks allocated in
83 C stubs, or with new_block below, are always considered mutable.)
84
85 The same goes for set_double_field and set_tag . However, for set_tag
86 , in the case of immutable blocks where the middle-end optimizers never
87 see code that discriminates on their tag (for example records), the op‐
88 eration should be safe. Such uses are nonetheless discouraged.
89
90 For experts only: set_field et al can be made safe by first wrapping
91 the block in Sys.opaque_identity , so any information about its con‐
92 tents will not be propagated.
93
94
95
96 val set_tag : t -> int -> unit
97
98
99
100
101 val double_field : t -> int -> float
102
103
104
105
106 val set_double_field : t -> int -> float -> unit
107
108
109
110
111 val new_block : int -> int -> t
112
113
114
115
116 val dup : t -> t
117
118
119
120
121 val truncate : t -> int -> unit
122
123
124
125
126 val add_offset : t -> Int32.t -> t
127
128
129
130
131 val with_tag : int -> t -> t
132
133
134
135
136 val first_non_constant_constructor_tag : int
137
138
139
140
141 val last_non_constant_constructor_tag : int
142
143
144
145
146 val lazy_tag : int
147
148
149
150
151 val closure_tag : int
152
153
154
155
156 val object_tag : int
157
158
159
160
161 val infix_tag : int
162
163
164
165
166 val forward_tag : int
167
168
169
170
171 val no_scan_tag : int
172
173
174
175
176 val abstract_tag : int
177
178
179
180
181 val string_tag : int
182
183
184
185
186 val double_tag : int
187
188
189
190
191 val double_array_tag : int
192
193
194
195
196 val custom_tag : int
197
198
199
200
201 val final_tag : int
202
203
204
205
206 val int_tag : int
207
208
209
210
211 val out_of_heap_tag : int
212
213
214
215
216 val unaligned_tag : int
217
218
219
220 module Extension_constructor : sig end
221
222
223
224
225
226 val extension_constructor : 'a -> extension_constructor
227
228
229
230
231 val extension_name : extension_constructor -> string
232
233
234
235
236 val extension_id : extension_constructor -> int
237
238
239
240
241
242 The following two functions are deprecated. Use module Marshal in‐
243 stead.
244
245 val marshal : t -> bytes
246
247
248
249
250 val unmarshal : bytes -> int -> t * int
251
252
253
254 module Ephemeron : sig end
255
256
257
258
259
260
261
262OCamldoc 2021-01-26 Stdlib.Obj(3)