2
0
Эх сурвалжийг харах

[macro] remove macro_enable_cache

The only thing this governs is whether or not we set macro_interp_cache, and I don't see why we would ever not want to set for a given compilation.
Simon Krajewski 1 жил өмнө
parent
commit
6cf6ab9616

+ 2 - 5
src/compiler/compiler.ml

@@ -274,7 +274,7 @@ let check_defines com =
 	end
 
 (** Creates the typer context and types [classes] into it. *)
-let do_type ctx mctx actx display_file_dot_path macro_cache_enabled =
+let do_type ctx mctx actx display_file_dot_path =
 	let com = ctx.com in
 	let t = Timer.timer ["typing"] in
 	let cs = com.cs in
@@ -286,7 +286,6 @@ let do_type ctx mctx actx display_file_dot_path macro_cache_enabled =
 	) mctx (List.rev actx.config_macros) in
 	enter_stage com CInitMacrosDone;
 	ServerMessage.compiler_stage com;
-	MacroContext.macro_enable_cache := macro_cache_enabled;
 
 	let macros = match mctx with None -> None | Some mctx -> mctx.g.macros in
 	Setup.init_native_libs com actx.native_libs;
@@ -338,8 +337,6 @@ let compile ctx actx callbacks =
 	(* Set up display configuration *)
 	DisplayProcessing.process_display_configuration ctx;
 	let display_file_dot_path = DisplayProcessing.process_display_file com actx in
-	let macro_cache_enabled = !MacroContext.macro_enable_cache in
-	MacroContext.macro_enable_cache := true;
 	let mctx = match com.platform with
 		| CustomTarget name ->
 			begin try
@@ -364,7 +361,7 @@ let compile ctx actx callbacks =
 		if actx.cmds = [] && not actx.did_something then actx.raise_usage();
 	end else begin
 		(* Actual compilation starts here *)
-		let (tctx,display_file_dot_path) = do_type ctx mctx actx display_file_dot_path macro_cache_enabled in
+		let (tctx,display_file_dot_path) = do_type ctx mctx actx display_file_dot_path in
 		DisplayProcessing.handle_display_after_typing ctx tctx display_file_dot_path;
 		finalize_typing ctx tctx;
 		if is_diagnostics com then

+ 0 - 1
src/compiler/server.ml

@@ -608,7 +608,6 @@ let do_connect ip port args =
 
 let enable_cache_mode sctx =
 	TypeloadModule.type_module_hook := type_module sctx;
-	MacroContext.macro_enable_cache := true;
 	ServerCompilationContext.ensure_macro_setup sctx;
 	TypeloadParse.parse_hook := parse_file sctx.cs
 

+ 0 - 1
src/macro/macroApi.ml

@@ -53,7 +53,6 @@ type 'value compiler_api = {
 	define_module : string -> 'value list -> ((string * Globals.pos) list * Ast.import_mode) list -> Ast.type_path list -> unit;
 	module_dependency : string -> string -> unit;
 	current_module : unit -> module_def;
-	use_cache : unit -> bool;
 	format_string : string -> Globals.pos -> Ast.expr;
 	cast_or_unify : Type.t -> texpr -> Globals.pos -> bool;
 	add_global_metadata : string -> string -> (bool * bool * bool) -> pos -> unit;

+ 1 - 7
src/typing/macroContext.ml

@@ -34,7 +34,6 @@ module Interp = struct
 	include BuiltApi
 end
 
-let macro_enable_cache = ref false
 let macro_interp_cache = ref None
 
 let safe_decode com v expected t p f =
@@ -270,9 +269,6 @@ let make_macro_com_api com mcom p =
 		current_module = (fun() ->
 			null_module
 		);
-		use_cache = (fun() ->
-			!macro_enable_cache
-		);
 		format_string = (fun s p ->
 			FormatString.format_string com.defines s p (fun e p -> (e,p))
 		);
@@ -610,9 +606,7 @@ let init_macro_interp mctx mint =
 	ignore(TypeloadModule.load_module mctx (["haxe";"macro"],"Expr") p);
 	ignore(TypeloadModule.load_module mctx (["haxe";"macro"],"Type") p);
 	Interp.init mint;
-	if !macro_enable_cache && not (Common.defined mctx.com Define.NoMacroCache) then begin
-		macro_interp_cache := Some mint;
-	end
+	macro_interp_cache := Some mint
 
 and flush_macro_context mint mctx =
 	let t = macro_timer mctx.com ["flush"] in