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 @Since 4.04
75
76
77
78 val field : t -> int -> t
79
80
81
82
83 val set_field : t -> int -> t -> unit
84
85 When using flambda:
86
87
88 set_field MUST NOT be called on immutable blocks. (Blocks allocated in
89 C stubs, or with new_block below, are always considered mutable.)
90
91 The same goes for set_double_field and set_tag . However, for set_tag
92 , in the case of immutable blocks where the middle-end optimizers never
93 see code that discriminates on their tag (for example records), the op‐
94 eration should be safe. Such uses are nonetheless discouraged.
95
96 For experts only: set_field et al can be made safe by first wrapping
97 the block in Sys.opaque_identity , so any information about its con‐
98 tents will not be propagated.
99
100
101
102 val set_tag : t -> int -> unit
103
104
105
106
107 val double_field : t -> int -> float
108
109
110
111
112 val set_double_field : t -> int -> float -> unit
113
114
115
116
117 val raw_field : t -> int -> raw_data
118
119
120
121
122 val set_raw_field : t -> int -> raw_data -> unit
123
124
125
126
127 val new_block : int -> int -> t
128
129
130
131
132 val dup : t -> t
133
134
135
136
137 val truncate : t -> int -> unit
138
139
140
141
142 val add_offset : t -> Int32.t -> t
143
144
145
146
147 val with_tag : int -> t -> t
148
149
150
151
152 val first_non_constant_constructor_tag : int
153
154
155
156
157 val last_non_constant_constructor_tag : int
158
159
160
161
162 val lazy_tag : int
163
164
165
166
167 val closure_tag : int
168
169
170
171
172 val object_tag : int
173
174
175
176
177 val infix_tag : int
178
179
180
181
182 val forward_tag : int
183
184
185
186
187 val no_scan_tag : int
188
189
190
191
192 val abstract_tag : int
193
194
195
196
197 val string_tag : int
198
199
200
201
202 val double_tag : int
203
204
205
206
207 val double_array_tag : int
208
209
210
211
212 val custom_tag : int
213
214
215
216
217 val final_tag : int
218
219
220
221
222 val int_tag : int
223
224
225
226
227 val out_of_heap_tag : int
228
229
230
231
232 val unaligned_tag : int
233
234
235
236 module Closure : sig end
237
238
239
240
241 module Extension_constructor : sig end
242
243
244
245
246
247 val extension_constructor : 'a -> extension_constructor
248
249
250
251
252 val extension_name : extension_constructor -> string
253
254
255
256
257 val extension_id : extension_constructor -> int
258
259
260
261
262
263 The following two functions are deprecated. Use module Marshal in‐
264 stead.
265
266 val marshal : t -> bytes
267
268
269
270
271 val unmarshal : bytes -> int -> t * int
272
273
274
275 module Ephemeron : sig end
276
277
278
279
280
281
282
283OCamldoc 2021-07-22 Stdlib.Obj(3)