|
@@ -124,30 +124,29 @@ let rec wait_loop process_params verbose accept =
|
|
|
let sign = Define.get_signature com2.defines in
|
|
|
let ftime = file_time ffile in
|
|
|
let fkey = (ffile,sign) in
|
|
|
- let t = Timer.timer ["server";"parser cache"] in
|
|
|
- let data = try
|
|
|
- let cfile = CompilationServer.find_file cs fkey in
|
|
|
- if cfile.c_time <> ftime then raise Not_found;
|
|
|
- cfile.c_package,cfile.c_decls
|
|
|
- with Not_found ->
|
|
|
- has_parse_error := false;
|
|
|
- let data = TypeloadParse.parse_file com2 file p in
|
|
|
- let info,is_unusual = if !has_parse_error then "not cached, has parse error",true
|
|
|
- else if is_display_file then "not cached, is display file",true
|
|
|
- else begin try
|
|
|
- (* We assume that when not in display mode it's okay to cache stuff that has #if display
|
|
|
- checks. The reasoning is that non-display mode has more information than display mode. *)
|
|
|
- if not com2.display.dms_display then raise Not_found;
|
|
|
- let ident = Hashtbl.find Parser.special_identifier_files ffile in
|
|
|
- Printf.sprintf "not cached, using \"%s\" define" ident,true
|
|
|
- with Not_found ->
|
|
|
- CompilationServer.cache_file cs fkey ftime data;
|
|
|
- "cached",false
|
|
|
- end in
|
|
|
- if is_unusual then ServerMessage.parsed com2 "" (ffile,info);
|
|
|
- data
|
|
|
- in
|
|
|
- t();
|
|
|
+ let data = Std.finally (Timer.timer ["server";"parser cache"]) (fun () ->
|
|
|
+ try
|
|
|
+ let cfile = CompilationServer.find_file cs fkey in
|
|
|
+ if cfile.c_time <> ftime then raise Not_found;
|
|
|
+ cfile.c_package,cfile.c_decls
|
|
|
+ with Not_found ->
|
|
|
+ has_parse_error := false;
|
|
|
+ let data = TypeloadParse.parse_file com2 file p in
|
|
|
+ let info,is_unusual = if !has_parse_error then "not cached, has parse error",true
|
|
|
+ else if is_display_file then "not cached, is display file",true
|
|
|
+ else begin try
|
|
|
+ (* We assume that when not in display mode it's okay to cache stuff that has #if display
|
|
|
+ checks. The reasoning is that non-display mode has more information than display mode. *)
|
|
|
+ if not com2.display.dms_display then raise Not_found;
|
|
|
+ let ident = Hashtbl.find Parser.special_identifier_files ffile in
|
|
|
+ Printf.sprintf "not cached, using \"%s\" define" ident,true
|
|
|
+ with Not_found ->
|
|
|
+ CompilationServer.cache_file cs fkey ftime data;
|
|
|
+ "cached",false
|
|
|
+ end in
|
|
|
+ if is_unusual then ServerMessage.parsed com2 "" (ffile,info);
|
|
|
+ data
|
|
|
+ ) () in
|
|
|
data
|
|
|
);
|
|
|
let check_module_shadowing com paths m =
|