summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJacques Garrigue <garrigue at math.nagoya-u.ac.jp>2012-12-10 10:39:26 +0000
committerJacques Garrigue <garrigue at math.nagoya-u.ac.jp>2012-12-10 10:39:26 +0000
commit6a55d4f552897722775d93fdd8fb03996427b6cd (patch)
tree1ffb8d106960e9a30688b12f141a07ea17fe1477
parent2d4cb892dd10f121ad39ca220196545089af3f71 (diff)
downloadocaml-6a55d4f552897722775d93fdd8fb03996427b6cd.tar.gz
improve performance
git-svn-id: http://caml.inria.fr/svn/ocaml/branches/short-paths@13124 f963ae5c-01c2-4b8c-9fe0-0dff7051ff02
-rw-r--r--typing/env.ml8
-rw-r--r--typing/stypes.ml3
2 files changed, 10 insertions, 1 deletions
diff --git a/typing/env.ml b/typing/env.ml
index 963e4f0cb1..2cd877fbd2 100644
--- a/typing/env.ml
+++ b/typing/env.ml
@@ -65,6 +65,7 @@ module EnvLazy : sig
val force : ('a -> 'b) -> ('a,'b) t -> 'b
val create : 'a -> ('a,'b) t
+ val is_val : ('a,'b) t -> bool
end = struct
@@ -88,6 +89,9 @@ end = struct
x := Raise e;
raise e
+ let is_val x =
+ match !x with Done _ -> true | _ -> false
+
let create x =
let x = ref (Thunk x) in
x
@@ -670,11 +674,13 @@ let lookup_cltype lid env =
mark_type_path env desc.clty_path;
r
-(* Iter on an environment (ignoring the body of functors) *)
+(* Iter on an environment (ignoring the body of functors and
+ not yet evaluated structures) *)
let iter_env proj1 proj2 f env =
Ident.iter (fun id (x,_) -> f (Pident id) x) (proj1 env);
let rec iter_components path path' mcomps =
+ if EnvLazy.is_val mcomps then
match EnvLazy.force !components_of_module_maker' mcomps with
Structure_comps comps ->
Tbl.iter
diff --git a/typing/stypes.ml b/typing/stypes.ml
index 0e67340f68..49f0e89590 100644
--- a/typing/stypes.ml
+++ b/typing/stypes.ml
@@ -156,6 +156,8 @@ let get_info () =
let dump filename =
if !Clflags.annotations then begin
+ let real = !Clflags.real_paths in
+ Clflags.real_paths := true;
let info = get_info () in
let pp =
match filename with
@@ -164,6 +166,7 @@ let dump filename =
sort_filter_phrases ();
ignore (List.fold_left (print_info pp) Location.none info);
phrases := [];
+ Clflags.real_paths := real
end else begin
annotations := [];
end;