Skip to content

Commit a5a4966

Browse files
coqbot-app[bot]ppedrot
andauthoredMar 18, 2025
Merge PR coq#20367: Don't hcons in place in univ instances
Reviewed-by: ppedrot Co-authored-by: ppedrot <ppedrot@users.noreply.github.com>
2 parents baa12fe + fff1375 commit a5a4966

File tree

1 file changed

+5
-20
lines changed

1 file changed

+5
-20
lines changed
 

‎kernel/uVars.ml

+5-20
Original file line numberDiff line numberDiff line change
@@ -106,26 +106,11 @@ struct
106106
let qlen = Array.length aq in
107107
let ulen = Array.length au in
108108
if Int.equal qlen 0 && Int.equal ulen 0 then 0, empty
109-
else begin
110-
let h = ref 0 in
111-
for i = 0 to qlen - 1 do
112-
let x = Array.unsafe_get aq i in
113-
let hx, x' = Quality.hcons x in
114-
h := Hashset.Combine.combine !h hx;
115-
if x == x' then ()
116-
else Array.unsafe_set aq i x'
117-
done;
118-
for i = 0 to ulen - 1 do
119-
let x = Array.unsafe_get au i in
120-
let hx, x' = Level.hcons x in
121-
h := Hashset.Combine.combine !h hx;
122-
if x == x' then ()
123-
else Array.unsafe_set au i x'
124-
done;
125-
(* [h] must be positive (XXX why?). *)
126-
let h = !h land 0x3FFFFFFF in
127-
h, a
128-
end
109+
else
110+
let hq, aq' = Hashcons.hashcons_array Quality.hcons aq in
111+
let hu, au' = Hashcons.hashcons_array Level.hcons au in
112+
let a = if aq' == aq && au' == au then a else (aq',au') in
113+
Hashset.Combine.combine hq hu, a
129114

130115
let eq t1 t2 =
131116
CArray.equal (==) (fst t1) (fst t2)

0 commit comments

Comments
 (0)
Please sign in to comment.