@@ -65318,35 +65318,47 @@ let name x : string =
65318
65318
| Ml | Runtime -> x.id.name
65319
65319
| External v -> v
65320
65320
65321
- let equal (x : t) y =
65322
- match x.kind with
65323
- | External x_kind->
65324
- begin match y.kind with
65325
- | External y_kind ->
65326
- x_kind = (y_kind : string)
65327
- | _ -> false
65328
- end
65329
- | Ml -> y.kind = Ml && Ext_ident.equal x.id y.id
65330
- | Runtime ->
65331
- y.kind = Runtime && Ext_ident.equal x.id y.id
65332
- let hash (x : t) =
65333
- match x.kind with
65334
- | External x_kind -> Bs_hash_stubs.hash_string x_kind
65335
- | Ml | Runtime ->
65336
- let x_id = x.id in
65337
- Bs_hash_stubs.hash_stamp_and_name x_id.stamp x_id.name
65338
-
65339
- module Hash = Hashtbl_make.Make(struct
65340
- type nonrec t = t
65341
- let hash = hash
65342
- let equal = equal
65343
- end)
65321
+ module Cmp = struct
65322
+ type nonrec t = t
65323
+ let equal (x : t) y =
65324
+ match x.kind with
65325
+ | External x_kind->
65326
+ begin match y.kind with
65327
+ | External y_kind ->
65328
+ x_kind = (y_kind : string)
65329
+ | _ -> false
65330
+ end
65331
+ | Ml
65332
+ | Runtime -> Ext_ident.equal x.id y.id
65333
+ (* #1556
65334
+ Note the main difference between [Ml] and [Runtime] is
65335
+ that we have more assumptions about [Runtime] module,
65336
+ like its purity etc, and its name uniqueues, in the pattern match
65337
+ {[
65338
+ Qualified (_,Runtime, Some "caml_int_compare")
65339
+ ]}
65340
+ and we could do more optimziations.
65341
+ However, here if it is [hit]
65342
+ (an Ml module = an Runtime module), which means both exists,
65343
+ so adding either does not matter
65344
+ if it is not hit, fine
65345
+ *)
65346
+ (* | Ml -> y.kind = Ml && *)
65347
+ (* | Runtime -> *)
65348
+ (* y.kind = Runtime && Ext_ident.equal x.id y.id *)
65349
+ let hash (x : t) =
65350
+ match x.kind with
65351
+ | External x_kind -> Bs_hash_stubs.hash_string x_kind
65352
+ | Ml
65353
+ | Runtime ->
65354
+ let x_id = x.id in
65355
+ Bs_hash_stubs.hash_stamp_and_name x_id.stamp x_id.name
65356
+ end
65357
+
65358
+ module Hash = Hashtbl_make.Make (Cmp)
65359
+
65360
+ module Hash_set = Hash_set.Make (Cmp)
65344
65361
65345
- module Hash_set = Hash_set.Make( struct
65346
- type nonrec t = t
65347
- let hash = hash
65348
- let equal = equal
65349
- end)
65350
65362
end
65351
65363
module Ocaml_stdlib_slots
65352
65364
= struct
0 commit comments