diff options
| author | filliatr | 2001-03-26 14:38:56 +0000 |
|---|---|---|
| committer | filliatr | 2001-03-26 14:38:56 +0000 |
| commit | 460c4e8ec39fe71734c50815954aa4f8036f3a33 (patch) | |
| tree | 6acb6eb488b861cecbf94d7b00b3b0164fdf3207 | |
| parent | 0160fc641d13341ff592993a7725a4e6d2e8941c (diff) | |
cache pour les constantes
git-svn-id: svn+ssh://scm.gforge.inria.fr/svn/coq/trunk@1490 85f007b7-540e-0410-9357-904b9bb8a0f7
| -rw-r--r-- | contrib/extraction/extraction.ml | 18 |
1 files changed, 13 insertions, 5 deletions
diff --git a/contrib/extraction/extraction.ml b/contrib/extraction/extraction.ml index 4aebbe7b91..9dff1a4249 100644 --- a/contrib/extraction/extraction.ml +++ b/contrib/extraction/extraction.ml @@ -263,6 +263,9 @@ let add_constructor_extraction c e = let lookup_constructor_extraction i = Gmap.find i !constructor_extraction_table +let constant_table = + ref (Gmap.empty : (section_path, extraction_result) Gmap.t) + (*s Extraction of a type. *) (* When calling [extract_type] we suppose that the type of [c] is an @@ -553,11 +556,16 @@ and extract_constr env ctx c = (*s Extraction of a constant. *) and extract_constant sp = - (* TODO: Axioms *) - let cb = Global.lookup_constant sp in - let typ = cb.const_type in - let body = match cb.const_body with Some c -> c | None -> assert false in - extract_constr_with_type (Global.env()) [] body typ + try + Gmap.find sp !constant_table + with Not_found -> + (* TODO: Axioms *) + let cb = Global.lookup_constant sp in + let typ = cb.const_type in + let body = match cb.const_body with Some c -> c | None -> assert false in + let e = extract_constr_with_type (Global.env()) [] body typ in + constant_table := Gmap.add sp e !constant_table; + e (*s Extraction of an inductive. *) |
