]> matita.cs.unibo.it Git - helm.git/blobdiff - helm/ocaml/cic_proof_checking/cicEnvironment.ml
added parsing time benchmark
[helm.git] / helm / ocaml / cic_proof_checking / cicEnvironment.ml
index 182f8b7d9e993bf3ea6bc420f3e2ecbd9a5ed3a9..08166d5640443006405c87e76b9ed1ea8d9e834b 100644 (file)
@@ -292,14 +292,14 @@ module Cache :
        *)
       empty (); 
       HT.iter
-       (fun k v ->
+       (fun k (v,u) ->
          callback (UriManager.string_of_uri k);
          HT.add cacheOfCookedObjects 
            (UriManager.uri_of_string (UriManager.string_of_uri k))
             (***********************************************
                TSSI: FIXME add channel stuff for universes
             ************************************************)
-           ((restore_uris v),CicUniv.empty_ugraph))
+           (restore_uris v, CicUniv.recons_graph u))
        restored
     ;;
 
@@ -393,6 +393,7 @@ module Cache :
            None -> 
              assert false (* only NON dummy universes can be committed *)
          | Some g ->
+              CicUniv.assert_univs_have_uri g;
              frozen_list := List.remove_assq uri !frozen_list ;
              HT.add cacheOfCookedObjects uri (obj,g) 
     with
@@ -453,7 +454,7 @@ module Cache :
     * something. this means check and frozen must be empty.
     *)
    let remove uri =
-     if (!unchecked_list <> []) || (!frozen_list <> []) then
+     if !frozen_list <> [] then
        failwith "CicEnvironment.remove while type checking"
      else
        HT.remove cacheOfCookedObjects uri 
@@ -475,6 +476,8 @@ let dump_to_channel = Cache.dump_to_channel;;
 let restore_from_channel = Cache.restore_from_channel;;
 let empty = Cache.empty;;
 
+let total_parsing_time = ref 0.0
+
 let get_object_to_add uri =
  let filename = Http_getter.getxml' uri in
  let bodyfilename =
@@ -505,12 +508,18 @@ let get_object_to_add uri =
        | None -> ()
    end 
  in
- (* this brakes something : 
-  *   let _ = CicUniv.restart_numbering () in 
-  *)
+ (* restarts the numbering of named universes (the ones inside the cic) *)
+ let _ = CicUniv.restart_numbering () in 
+ (* HACK ORRIBILE: fa in modo che il parser metta degli universi fresh non
+  * anonimi *)
+ let _ = CicParser3.set_uri uri in 
  let obj = 
    try 
-     CicParser.obj_of_xml filename bodyfilename 
+     let time = Unix.gettimeofday() in
+     let rc = CicParser.obj_of_xml filename bodyfilename in
+     total_parsing_time := 
+       !total_parsing_time +. ((Unix.gettimeofday()) -. time );
+     rc
    with exn -> 
      cleanup ();
      (match exn with
@@ -652,12 +661,8 @@ let get_obj base_univ uri =
       o,(CicUniv.merge_ugraphs base_univ u)
   with Not_found ->
     (* this should be an error case, but if we trust the uri... *)
-    if trust_obj uri then
-      (* trusting we add it to the unchecked list *)
       let o,u = find_or_add_to_unchecked uri in
         o,(CicUniv.merge_ugraphs base_univ u)
-    else
-      raise Not_found
 ;; 
 
 exception OnlyPutOfInductiveDefinitionsIsAllowed