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