summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJacques Garrigue <garrigue at math.nagoya-u.ac.jp>2014-03-22 15:49:57 +0000
committerJacques Garrigue <garrigue at math.nagoya-u.ac.jp>2014-03-22 15:49:57 +0000
commit13027032932cce2533fcb52677af1288b5dc8268 (patch)
tree1911d9cf2b2f92aa201c61609a6ae4729abdd435
parent5f0b7f9a13437b8c1159bd6eaa9b4ee4349e801f (diff)
Fix PR#6350
git-svn-id: http://caml.inria.fr/svn/ocaml/trunk@14482 f963ae5c-01c2-4b8c-9fe0-0dff7051ff02
-rwxr-xr-xboot/ocamlcbin1526991 -> 1527359 bytes
-rwxr-xr-xboot/ocamldepbin420379 -> 420563 bytes
-rwxr-xr-xboot/ocamllexbin183962 -> 183978 bytes
-rw-r--r--typing/env.ml23
4 files changed, 15 insertions, 8 deletions
diff --git a/boot/ocamlc b/boot/ocamlc
index 497f48675..1c4c0053c 100755
--- a/boot/ocamlc
+++ b/boot/ocamlc
Binary files differ
diff --git a/boot/ocamldep b/boot/ocamldep
index e5333053e..24ac906a3 100755
--- a/boot/ocamldep
+++ b/boot/ocamldep
Binary files differ
diff --git a/boot/ocamllex b/boot/ocamllex
index abcd9bfe1..44f6711f0 100755
--- a/boot/ocamllex
+++ b/boot/ocamllex
Binary files differ
diff --git a/typing/env.ml b/typing/env.ml
index 18fb1f2c7..1a3396572 100644
--- a/typing/env.ml
+++ b/typing/env.ml
@@ -208,7 +208,8 @@ and functor_components = {
fcomp_res: module_type; (* Result signature *)
fcomp_env: t; (* Environment in which the result signature makes sense *)
fcomp_subst: Subst.t; (* Prefixing substitution for the result signature *)
- fcomp_cache: (Path.t, module_components) Hashtbl.t (* For memoization *)
+ fcomp_cache: (Path.t, module_components) Hashtbl.t; (* For memoization *)
+ fcomp_subst_cache: (Path.t, module_type) Hashtbl.t
}
let subst_modtype_maker (subst, mty) = Subst.modtype subst mty
@@ -478,10 +479,15 @@ let find_module path env =
let desc1 = find_module_descr p1 env in
begin match EnvLazy.force !components_of_module_maker' desc1 with
Functor_comps f ->
- let mty =
- Subst.modtype (Subst.add_module f.fcomp_param p2 f.fcomp_subst)
- f.fcomp_res in
- md mty
+ md begin try
+ Hashtbl.find f.fcomp_subst_cache p2
+ with Not_found ->
+ let mty =
+ Subst.modtype (Subst.add_module f.fcomp_param p2 f.fcomp_subst)
+ f.fcomp_res in
+ Hashtbl.add f.fcomp_subst_cache p2 mty;
+ mty
+ end
| Structure_comps c ->
raise Not_found
end
@@ -996,9 +1002,9 @@ let add_gadt_instance_chain env lv t =
let rec scrape_alias env ?path mty =
match mty, path with
- Mty_ident path, _ ->
+ Mty_ident p, _ ->
begin try
- scrape_alias env (find_modtype_expansion path env)
+ scrape_alias env (find_modtype_expansion p env) ?path
with Not_found ->
mty
end
@@ -1217,7 +1223,8 @@ and components_of_module_maker (env, sub, path, mty) =
fcomp_res = ty_res;
fcomp_env = env;
fcomp_subst = sub;
- fcomp_cache = Hashtbl.create 17 }
+ fcomp_cache = Hashtbl.create 17;
+ fcomp_subst_cache = Hashtbl.create 17 }
| Mty_ident _
| Mty_alias _ ->
Structure_comps {