aboutsummaryrefslogtreecommitdiff
path: root/lib/hashcons.ml
diff options
context:
space:
mode:
authorppedrot2012-09-26 20:38:55 +0000
committerppedrot2012-09-26 20:38:55 +0000
commitb12466ef14d4bdf13af9c2f772c692ee1760da2d (patch)
treecfd2c437c5836f4132040f2b89bbdfc0f708ea44 /lib/hashcons.ml
parentfb1eb17d40febf3f4927568921b64b7a8c7ca028 (diff)
Reusing the Hashset data structure in Hashcons. Hopefully, this should
not disrupt anything... git-svn-id: svn+ssh://scm.gforge.inria.fr/svn/coq/trunk@15836 85f007b7-540e-0410-9357-904b9bb8a0f7
Diffstat (limited to 'lib/hashcons.ml')
-rw-r--r--lib/hashcons.ml11
1 files changed, 3 insertions, 8 deletions
diff --git a/lib/hashcons.ml b/lib/hashcons.ml
index f71af15c75..8daeec9444 100644
--- a/lib/hashcons.ml
+++ b/lib/hashcons.ml
@@ -58,11 +58,7 @@ module Make (X : HashconsedType) =
* w.r.t (=), although the equality on keys is X.equal. This is
* granted since we hcons the subterms before looking up in the table.
*)
- module Htbl = Hashtbl.Make(
- struct type t=X.t
- let hash=X.hash
- let equal x1 x2 = (*incr comparaison;*) X.equal x1 x2
- end)
+ module Htbl = Hashset.Make(X)
(* The table is created when () is applied.
* Hashconsing is then very simple:
@@ -73,9 +69,8 @@ module Make (X : HashconsedType) =
let tab = Htbl.create 97 in
(fun u x ->
let y = X.hashcons u x in
- (* incr acces;*)
- try let r = Htbl.find tab y in(* incr succes;*) r
- with Not_found -> Htbl.add tab y y; y)
+ Htbl.repr (X.hash y) y tab)
+
end
(* A few usefull wrappers: