Permalink
Browse files

[fix] compiler, bslloading: Reset plugins loading when several opx ar…

…e compiled
  • Loading branch information...
1 parent 849041a commit c7a084e53bcafb2244017a2096dc93b2bbba4f1b @BourgerieQuentin BourgerieQuentin committed Sep 5, 2012
@@ -1,5 +1,5 @@
(*
- Copyright © 2011 MLstate
+ Copyright © 2011, 2012 MLstate
This file is part of Opa.
@@ -41,6 +41,10 @@ let private_last_finalize = ref None
let pp_item fmt t = Format.pp_print_string fmt (ItemPlugin.index t)
+let clear () =
+ Hashtbl.clear table;
+ private_last_finalize := None
+
let finalize () =
let plugins = Hashtbl.fold (fun _ plugin acc -> plugin::acc) table [] in
let plugins, not_referenced = PluginSort.sort plugins in
@@ -1,5 +1,5 @@
(*
- Copyright © 2011 MLstate
+ Copyright © 2011, 2012 MLstate
This file is part of Opa.
@@ -67,3 +67,8 @@ val finalize : unit -> BslPluginInterface.plugin list
If [finalize] was never called, returns [None]
*)
val last_finalize : unit -> BslPluginInterface.plugin list option
+
+(**
+ Clear
+*)
+val clear : unit -> unit
@@ -107,6 +107,12 @@ let already_seen_plugin : (plugin_name, plugin_name) Hashtbl.t = Hashtbl.create
let extralib_plugin : (plugin_name, string) Hashtbl.t = Hashtbl.create 16
let extrapath_plugin : (plugin_name, string) Hashtbl.t = Hashtbl.create 16
+let reset () =
+ BslPluginTable.clear ();
+ Hashtbl.clear already_seen_plugin;
+ Hashtbl.clear extrapath_plugin;
+ Hashtbl.clear extralib_plugin
+
let pp_options fmt options =
let pp = DebugPrint.pp ~depth:max_int in
Format.fprintf fmt "cclib: %a@\n" pp options.O.cclib ;
@@ -296,6 +302,7 @@ let process
~options
~code
=
+ reset ();
(* Pass *)
let plugins = "opabsl" :: options.O.bypass_plugin in
let server_back_end = options.O.back_end in
@@ -304,23 +311,23 @@ let process
let search_path = cwd :: ObjectFiles.get_paths () in
(* Separated compilation: loading *)
- let () =
- let iter (package_name, _) entries =
- let iter_entry entry =
- let { S.plugin_name = basename ; extralib ; extrapath ; bypass } = resolve_entry search_path entry in
- if not (Hashtbl.mem already_seen_plugin basename)
- then (
- BslLib.declare_visibility package_name basename ;
- Hashtbl.add already_seen_plugin basename basename ;
- Hashtbl.add extralib_plugin basename extralib ;
- Hashtbl.add extrapath_plugin basename extrapath ;
- BslDynlink.load_bypass_plugin_cache (BslDynlink.MarshalPlugin bypass) ;
- )
- in
- List.iter iter_entry entries
- in
- R.iter_with_name ~packages:true ~deep:true iter
- in
+ (* let () = *)
+ (* let iter (package_name, _) entries = *)
+ (* let iter_entry entry = *)
+ (* let { S.plugin_name = basename ; extralib ; extrapath ; bypass } = resolve_entry search_path entry in *)
+ (* if not (Hashtbl.mem already_seen_plugin basename) *)
+ (* then ( *)
+ (* BslLib.declare_visibility package_name basename ; *)
+ (* Hashtbl.add already_seen_plugin basename basename ; *)
+ (* Hashtbl.add extralib_plugin basename extralib ; *)
+ (* Hashtbl.add extrapath_plugin basename extrapath ; *)
+ (* BslDynlink.load_bypass_plugin_cache (BslDynlink.MarshalPlugin bypass) ; *)
+ (* ) *)
+ (* in *)
+ (* List.iter iter_entry entries *)
+ (* in *)
+ (* R.iter_with_name ~packages:true ~deep:false iter *)
+ (* in *)
let separation = Separation.create () in
let commandline = FilePos.nopos "command line" in
@@ -1,5 +1,5 @@
(*
- Copyright © 2011 MLstate
+ Copyright © 2011, 2012 MLstate
This file is part of Opa.

0 comments on commit c7a084e

Please sign in to comment.