Skip to content

Commit 8a87272

Browse files
authored
flambda-backend: Remove Obj.set_tag and Obj.truncate (#73)
1 parent d9017ae commit 8a87272

File tree

2 files changed

+3
-13
lines changed

2 files changed

+3
-13
lines changed

stdlib/obj.ml

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,6 @@ external magic : 'a -> 'b = "%identity"
3030
external is_int : t -> bool = "%obj_is_int"
3131
let [@inline always] is_block a = not (is_int a)
3232
external tag : t -> int = "caml_obj_tag" [@@noalloc]
33-
external set_tag : t -> int -> unit = "caml_obj_set_tag"
3433
external size : t -> int = "%obj_size"
3534
external reachable_words : t -> int = "caml_obj_reachable_words"
3635
external field : t -> int -> t = "%obj_field"
@@ -47,7 +46,6 @@ external set_raw_field : t -> int -> raw_data -> unit
4746

4847
external new_block : int -> int -> t = "caml_obj_block"
4948
external dup : t -> t = "caml_obj_dup"
50-
external truncate : t -> int -> unit = "caml_obj_truncate"
5149
external add_offset : t -> Int32.t -> t = "caml_obj_add_offset"
5250
external with_tag : int -> t -> t = "caml_obj_with_tag"
5351

stdlib/obj.mli

Lines changed: 3 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -46,22 +46,16 @@ external field : t -> int -> t = "%obj_field"
4646

4747
(** When using flambda:
4848
49-
[set_field] MUST NOT be called on immutable blocks. (Blocks allocated
50-
in C stubs, or with [new_block] below, are always considered mutable.)
51-
52-
The same goes for [set_double_field] and [set_tag]. However, for
53-
[set_tag], in the case of immutable blocks where the middle-end optimizers
54-
never see code that discriminates on their tag (for example records), the
55-
operation should be safe. Such uses are nonetheless discouraged.
49+
[set_field] and [set_double_field] MUST NOT be called on immutable
50+
blocks. (Blocks allocated in C stubs, or with [new_block] below,
51+
are always considered mutable.)
5652
5753
For experts only:
5854
[set_field] et al can be made safe by first wrapping the block in
5955
{!Sys.opaque_identity}, so any information about its contents will not
6056
be propagated.
6157
*)
6258
external set_field : t -> int -> t -> unit = "%obj_set_field"
63-
external set_tag : t -> int -> unit = "caml_obj_set_tag"
64-
[@@ocaml.deprecated "Use with_tag instead."]
6559

6660
val [@inline always] double_field : t -> int -> float (* @since 3.11.2 *)
6761
val [@inline always] set_double_field : t -> int -> float -> unit
@@ -75,8 +69,6 @@ external set_raw_field : t -> int -> raw_data -> unit
7569

7670
external new_block : int -> int -> t = "caml_obj_block"
7771
external dup : t -> t = "caml_obj_dup"
78-
external truncate : t -> int -> unit = "caml_obj_truncate"
79-
[@@ocaml.deprecated]
8072
external add_offset : t -> Int32.t -> t = "caml_obj_add_offset"
8173
(* @since 3.12.0 *)
8274
external with_tag : int -> t -> t = "caml_obj_with_tag"

0 commit comments

Comments
 (0)