From 47860acaffe6017c3b5165d6442f9fbf5c524495 Mon Sep 17 00:00:00 2001 From: Pierre-Marie Pédrot Date: Tue, 23 Jun 2015 18:48:18 +0200 Subject: Less closures makes the GC happy. --- kernel/univ.ml | 25 +++++++++++-------------- 1 file changed, 11 insertions(+), 14 deletions(-) (limited to 'kernel') diff --git a/kernel/univ.ml b/kernel/univ.ml index 763c0822f2..4af7fe7c1c 100644 --- a/kernel/univ.ml +++ b/kernel/univ.ml @@ -723,29 +723,26 @@ let enter_arc ca g = (* repr : universes -> Level.t -> canonical_arc *) (* canonical representative : we follow the Equiv links *) -let repr g u = - let rec repr_rec u = - let a = - try UMap.find u g - with Not_found -> anomaly ~label:"Univ.repr" - (str"Universe " ++ Level.pr u ++ str" undefined") - in - match a with - | Equiv v -> repr_rec v - | Canonical arc -> arc +let rec repr g u = + let a = + try UMap.find u g + with Not_found -> anomaly ~label:"Univ.repr" + (str"Universe " ++ Level.pr u ++ str" undefined") in - repr_rec u + match a with + | Equiv v -> repr g v + | Canonical arc -> arc (* [safe_repr] also search for the canonical representative, but if the graph doesn't contain the searched universe, we add it. *) let safe_repr g u = - let rec safe_repr_rec u = + let rec safe_repr_rec g u = match UMap.find u g with - | Equiv v -> safe_repr_rec v + | Equiv v -> safe_repr_rec g v | Canonical arc -> arc in - try g, safe_repr_rec u + try g, safe_repr_rec g u with Not_found -> let can = terminal u in enter_arc can g, can -- cgit v1.2.3