1Obj(3) OCaml library Obj(3)
2
3
4
6 Obj - Operations on internal representations of values.
7
9 Module Obj
10
12 Module Obj
13 : sig end
14
15
16 Operations on internal representations of values.
17
18 Not for the casual user.
19
20
21
22
23
24 type t
25
26
27
28
29 type raw_data = nativeint
30
31
32
33
34
35 val repr : 'a -> t
36
37
38
39
40 val obj : t -> 'a
41
42
43
44
45 val magic : 'a -> 'b
46
47
48
49
50 val is_block : t -> bool
51
52
53
54
55 val is_int : t -> bool
56
57
58
59
60 val tag : t -> int
61
62
63
64
65 val size : t -> int
66
67
68
69
70 val reachable_words : t -> int
71
72 Computes the total size (in words, including the headers) of all heap
73 blocks accessible from the argument. Statically allocated blocks are
74 included.
75
76
77 Since 4.04
78
79
80
81 val field : t -> int -> t
82
83
84
85
86 val set_field : t -> int -> t -> unit
87
88 When using flambda:
89
90
91 set_field MUST NOT be called on immutable blocks. (Blocks allocated in
92 C stubs, or with new_block below, are always considered mutable.)
93
94 The same goes for set_double_field .
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 compare_and_swap_field : t -> int -> t -> t -> bool
103
104
105
106
107 val is_shared : t -> bool
108
109
110
111
112 val double_field : t -> int -> float
113
114
115
116
117 val set_double_field : t -> int -> float -> unit
118
119
120
121
122 val raw_field : t -> int -> raw_data
123
124
125
126
127 val set_raw_field : t -> int -> raw_data -> unit
128
129
130
131
132 val new_block : int -> int -> t
133
134
135
136
137 val dup : t -> t
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 forcing_tag : int
163
164
165
166
167 val cont_tag : int
168
169
170
171
172 val lazy_tag : int
173
174
175
176
177 val closure_tag : int
178
179
180
181
182 val object_tag : int
183
184
185
186
187 val infix_tag : int
188
189
190
191
192 val forward_tag : int
193
194
195
196
197 val no_scan_tag : int
198
199
200
201
202 val abstract_tag : int
203
204
205
206
207 val string_tag : int
208
209
210
211
212 val double_tag : int
213
214
215
216
217 val double_array_tag : int
218
219
220
221
222 val custom_tag : int
223
224
225
226
227 val int_tag : int
228
229
230
231
232 val out_of_heap_tag : int
233
234
235
236
237 val unaligned_tag : int
238
239
240
241 module Closure : sig end
242
243
244
245
246 module Extension_constructor : sig end
247
248
249
250
251 module Ephemeron : sig end
252
253
254
255
256
257
258
259OCamldoc 2023-07-20 Obj(3)