|
@@ -1119,7 +1119,7 @@ module Run = struct
|
|
|
let e = Type.map_expr (reduce_control_flow com) e in
|
|
|
Optimizer.reduce_control_flow com e
|
|
|
|
|
|
- let run_on_field com config c cf = match cf.cf_expr with
|
|
|
+ let run_on_field' com config c cf = match cf.cf_expr with
|
|
|
| Some e when not (is_ignored cf.cf_meta) && not (Typecore.is_removable_field com cf) && not (has_class_field_flag cf CfPostProcessed) ->
|
|
|
let config = update_config_from_meta com config cf.cf_meta in
|
|
|
let actx = create_analyzer_context com config (Printf.sprintf "%s.%s" (s_type_path c.cl_path) cf.cf_name) e in
|
|
@@ -1154,14 +1154,18 @@ module Run = struct
|
|
|
| _ -> ()
|
|
|
|
|
|
let run_on_field com config c cf =
|
|
|
- run_on_field com config c cf;
|
|
|
- List.iter (run_on_field com config c) cf.cf_overloads
|
|
|
+ run_on_field' com config c cf;
|
|
|
+ List.iter (run_on_field' com config c) cf.cf_overloads
|
|
|
|
|
|
- let run_on_class com config c =
|
|
|
+ let run_on_class com pool config c =
|
|
|
let config = update_config_from_meta com config c.cl_meta in
|
|
|
+ let fields = DynArray.create () in
|
|
|
let process_field stat cf = match cf.cf_kind with
|
|
|
- | Var _ when not stat -> ()
|
|
|
- | _ -> run_on_field com config c cf
|
|
|
+ | Var _ when not stat ->
|
|
|
+ ()
|
|
|
+ | _ ->
|
|
|
+ DynArray.add fields cf;
|
|
|
+ List.iter (DynArray.add fields) cf.cf_overloads
|
|
|
in
|
|
|
List.iter (process_field false) c.cl_ordered_fields;
|
|
|
List.iter (process_field true) c.cl_ordered_statics;
|
|
@@ -1169,6 +1173,7 @@ module Run = struct
|
|
|
| None -> ()
|
|
|
| Some f -> process_field false f;
|
|
|
end;
|
|
|
+ Parallel.run_parallel_on_array pool (DynArray.to_array fields) (run_on_field' com config c);
|
|
|
begin match TClass.get_cl_init c with
|
|
|
| None ->
|
|
|
()
|
|
@@ -1184,10 +1189,10 @@ module Run = struct
|
|
|
TClass.set_cl_init c e
|
|
|
end
|
|
|
|
|
|
- let run_on_type com config t =
|
|
|
+ let run_on_type com pool config t =
|
|
|
match t with
|
|
|
| TClassDecl c when (is_ignored c.cl_meta) -> ()
|
|
|
- | TClassDecl c -> run_on_class com config c
|
|
|
+ | TClassDecl c -> run_on_class com pool config c
|
|
|
| TEnumDecl _ -> ()
|
|
|
| TTypeDecl _ -> ()
|
|
|
| TAbstractDecl _ -> ()
|
|
@@ -1197,7 +1202,9 @@ module Run = struct
|
|
|
with_timer config.detail_times "" ["other"] (fun () ->
|
|
|
if config.optimize && config.purity_inference then
|
|
|
with_timer config.detail_times "" ["optimize";"purity-inference"] (fun () -> Purity.infer com);
|
|
|
- List.iter (run_on_type com config) types
|
|
|
+ Parallel.run_in_new_pool (fun pool ->
|
|
|
+ Parallel.run_parallel_on_array pool (Array.of_list types) (run_on_type com pool config);
|
|
|
+ )
|
|
|
)
|
|
|
end
|
|
|
;;
|