Skip to content

Commit d99326f

Browse files
committed
remove oo_id, use Obj.field, "%field1" is dedicated for tuple
1 parent 62a6d24 commit d99326f

File tree

2 files changed

+3
-3
lines changed

2 files changed

+3
-3
lines changed

jscomp/runtime/bs_stdlib_mini.mli

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,7 @@ module Obj : sig
6161
(* The compiler ensures (|0) operation *)
6262
external set_tag : t -> int -> unit = "tag" [@@bs.set]
6363
external repr : 'a -> t = "%identity"
64+
external obj : t -> 'a = "%identity"
6465
external magic : 'a -> 'b = "%identity"
6566
external size : t -> int = "#obj_length"
6667
end

jscomp/runtime/caml_hash.ml

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -79,8 +79,6 @@ let unsafe_pop (q : 'a t) =
7979
external ( +~ ) : nativeint -> nativeint -> nativeint =
8080
"caml_int32_add"
8181

82-
(*ATTENTION: refer {!Oo.id} *)
83-
external oo_id : Obj.t -> int = "%field1"
8482

8583
open Caml_hash_primitive
8684

@@ -134,7 +132,8 @@ let caml_hash (count : int) _limit (seed : nativeint)
134132
let obj_tag = Obj.tag obj in
135133
let tag = (size lsl 10) lor obj_tag in
136134
if tag = 248 (* Obj.object_tag*) then
137-
hash.contents <- caml_hash_mix_int hash.contents (Caml_nativeint_extern.of_int (oo_id obj))
135+
hash.contents <- caml_hash_mix_int hash.contents
136+
(Caml_nativeint_extern.of_int (Obj.obj (Obj.field obj 1) : int))
138137
else
139138
begin
140139
hash.contents <- caml_hash_mix_int hash.contents (Caml_nativeint_extern.of_int tag) ;

0 commit comments

Comments
 (0)