Permalink
Browse files

[fix] ei: Don't share the memoization between native package

  • Loading branch information...
BourgerieQuentin committed Sep 4, 2012
1 parent 3b1f95a commit 3f3d3ce6c51a9e6173b46693e1be470a1fafd784
View
@@ -1363,7 +1363,10 @@ let pass_InsertMemoizedTypes =
let client_code = client_updater :: client_code in
let gamma, new_server_code = Pass_ExplicitInstantiation.get_memoized_definitions gamma `server in
let gamma, new_client_code = Pass_ExplicitInstantiation.get_memoized_definitions gamma `client in
- Pass_ExplicitInstantiation.finalize_memoized_defintions ();
+ (* desactivated for flat because breaks OCaml compilation
+ TODO : Fix it *)
+ Pass_ExplicitInstantiation.finalize_memoized_defintions
+ (e.PH.options.O.back_end <> `qmlflat);
let server_code = List.tail_append new_server_code server_code in
let client_code = List.tail_append new_client_code client_code in
let env_gen = {e.PH.env.P.env_gen with P.typerEnv = {e.PH.env.P.env_gen.P.typerEnv with QmlTypes.gamma = gamma ; annotmap = annotmap }} in
@@ -1549,7 +1552,10 @@ let pass_ExplicitInstantiation =
original_renaming=client_original_renaming;
renaming=client_renaming} = env.P.sliced_env.P.client in
- Pass_ExplicitInstantiation.init_memoized_definitions ();
+ (* desactivated for flat because breaks OCaml compilation
+ TODO : Fix it *)
+ Pass_ExplicitInstantiation.init_memoized_definitions
+ (e.PH.options.O.back_end <> `qmlflat);
(* TODO: optimize by adding only dummy arguments for published functions,
if there is no explicit instantiation to be done there;
@@ -1791,8 +1791,8 @@ end
module R_memo = ObjectFiles.Make(S_memo)
-let init_memoized_definitions () =
- R_memo.iter
+let init_memoized_definitions obj =
+ if obj then R_memo.iter
(fun (server, client) ->
server_memo.memoty <- TyMap.merge (fun _ n -> n) server.memoty server_memo.memoty;
server_memo.memotyl <- TylMap.merge (fun _ n -> n) server.memotyl server_memo.memotyl;
@@ -1813,8 +1813,8 @@ let init_memoized_definitions () =
client_memo.memoquant <- QuantMap.merge (fun _ n -> n) client.memoquant client_memo.memoquant;
)
-let finalize_memoized_defintions () =
- R_memo.save (server_memo, client_memo);
+let finalize_memoized_defintions obj =
+ if obj then R_memo.save (server_memo, client_memo);
reset_memo server_memo;
reset_memo client_memo
@@ -220,6 +220,14 @@ val generate_tsc_map_updates :
?memoize:bool -> local_typedefs:QmlAst.TypeIdentSet.t -> QmlTypes.gamma -> QmlAst.annotmap
-> QmlAst.annotmap * QmlAst.code_elt
-val init_memoized_definitions : unit -> unit
+(**
+ Initialize internal data structure for memoization of runtime gamma.
+ The boolean parameter indicates if compositionnality should be use.
+*)
+val init_memoized_definitions : bool -> unit
-val finalize_memoized_defintions : unit -> unit
+(**
+ Finalize internal data structure for memoization of runtime gamma
+ The boolean parameter indicates if compositionnality should be use.
+*)
+val finalize_memoized_defintions : bool -> unit

0 comments on commit 3f3d3ce

Please sign in to comment.