1Obj(3)                           OCaml library                          Obj(3)
2
3
4

NAME

6       Obj - Operations on internal representations of values.
7

Module

9       Module   Obj
10

Documentation

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