Przeglądaj źródła

Merge branch 'development' into hxb_server_cache_simn_cleanup

# Conflicts:
#	src/compiler/server.ml
#	src/core/json/genjson.ml
Simon Krajewski 1 rok temu
rodzic
commit
15ff2ff192

+ 2 - 2
src/codegen/codegen.ml

@@ -388,8 +388,8 @@ module Dump = struct
 		let dep = Hashtbl.create 0 in
 		List.iter (fun m ->
 			print "%s:\n" (Path.UniqueKey.lazy_path m.m_extra.m_file);
-			PMap.iter (fun _ (sign,mpath) ->
-				let m2 = com.module_lut#find mpath in
+			PMap.iter (fun _ mdep ->
+				let m2 = com.module_lut#find mdep.md_path in
 				let file = Path.UniqueKey.lazy_path m2.m_extra.m_file in
 				print "\t%s\n" file;
 				let l = try Hashtbl.find dep file with Not_found -> [] in

+ 6 - 6
src/compiler/hxb/hxbWriter.ml

@@ -2207,12 +2207,12 @@ module HxbWriter = struct
 
 		begin
 			let deps = DynArray.create () in
-			PMap.iter (fun _ (sign,path) ->
-				if sign = m.m_extra.m_sign then begin
-					(* TODO: We probably need module_kind in m_deps to handle this properly. *)
-					if not (ExtString.String.ends_with (snd path) "import.hx") then
-						DynArray.add deps path;
-				end
+			PMap.iter (fun _ mdep ->
+				match mdep.md_kind with
+				| MCode | MExtern | MFake when mdep.md_sign = m.m_extra.m_sign ->
+						DynArray.add deps mdep.md_path;
+				| _ ->
+					()
 			) m.m_extra.m_deps;
 			if DynArray.length deps > 0 then begin
 				start_chunk writer MDR;

+ 6 - 3
src/compiler/server.ml

@@ -318,7 +318,9 @@ let check_module sctx ctx m_path m_extra p =
 			(com.cs#get_context sign)#find_module_extra mpath
 		in
 		let check_dependencies () =
-			PMap.iter (fun _ (sign,mpath) ->
+			PMap.iter (fun _ mdep ->
+				let sign = mdep.md_sign in
+				let mpath = mdep.md_path in
 				let m2_extra = try
 					find_module_extra sign mpath
 				with Not_found ->
@@ -493,8 +495,9 @@ let rec add_modules sctx ctx (m : module_def) (from_binary : bool) (p : pos) =
 				if not from_binary || m != m then
 					com.module_lut#add m.m_path m;
 				handle_cache_bound_objects com m.m_extra.m_cache_bound_objects;
-				PMap.iter (fun _ (sign,mpath) ->
-					if sign = own_sign then begin
+				PMap.iter (fun _ mdep ->
+					let mpath = mdep.md_path in
+					if mdep.md_sign = own_sign then begin
 						let m2 = try
 							com.module_lut#find mpath
 						with Not_found ->

+ 7 - 6
src/context/memory.ml

@@ -38,9 +38,10 @@ let rec scan_module_deps cs m h =
 		()
 	else begin
 		Hashtbl.add h m.m_id m;
-		PMap.iter (fun _ (sign,mpath) ->
-			let m = (cs#get_context sign)#find_module mpath in
-			scan_module_deps cs m h) m.m_extra.m_deps
+		PMap.iter (fun _ mdep ->
+			let m = (cs#get_context mdep.md_sign)#find_module mdep.md_path in
+			scan_module_deps cs m h
+		) m.m_extra.m_deps
 	end
 
 let module_sign key md =
@@ -274,9 +275,9 @@ let display_memory com =
 			());
 		if verbose then begin
 			print (Printf.sprintf "      %d total deps" (List.length deps));
-			PMap.iter (fun _ (sign,mpath) ->
-				let md = (com.cs#get_context sign)#find_module mpath in
-				print (Printf.sprintf "      dep %s%s" (s_type_path mpath) (module_sign key md));
+			PMap.iter (fun _ mdep ->
+				let md = (com.cs#get_context mdep.md_sign)#find_module mdep.md_path in
+				print (Printf.sprintf "      dep %s%s" (s_type_path mdep.md_path) (module_sign key md));
 			) m.m_extra.m_deps;
 		end;
 		flush stdout

+ 3 - 3
src/core/json/genjson.ml

@@ -712,10 +712,10 @@ let generate_module modules find_module m =
 			| MSGood -> "Good"
 			| MSBad reason -> Printer.s_module_skip_reason reason
 			| MSUnknown -> "Unknown");
-		"dependencies",jarray (PMap.fold (fun (sign,mpath) acc ->
+		"dependencies",jarray (PMap.fold (fun mdep acc ->
 			(jobject [
-				"path",jstring (s_type_path mpath);
-				"sign",jstring (Digest.to_hex (find_module mpath).m_extra.m_sign);
+				"path",jstring (s_type_path mdep.md_path);
+				"sign",jstring (Digest.to_hex (find_module mdep.md_path).m_extra.m_sign);
 			]) :: acc
 		) m.m_extra.m_deps []);
 		"dependents",jarray (List.map (fun (path, sign) -> (jobject [

+ 1 - 1
src/core/tFunctions.ml

@@ -291,7 +291,7 @@ let null_abstract = {
 
 let add_dependency ?(skip_postprocess=false) m mdep =
 	if m != null_module && mdep != null_module && (m.m_path != mdep.m_path || m.m_extra.m_sign != mdep.m_extra.m_sign) then begin
-		m.m_extra.m_deps <- PMap.add mdep.m_id (mdep.m_extra.m_sign, mdep.m_path) m.m_extra.m_deps;
+		m.m_extra.m_deps <- PMap.add mdep.m_id ({md_sign = mdep.m_extra.m_sign; md_path = mdep.m_path; md_kind = mdep.m_extra.m_kind}) m.m_extra.m_deps;
 		(* In case the module is cached, we'll have to run post-processing on it again (issue #10635) *)
 		if not skip_postprocess then m.m_extra.m_processed <- 0
 	end

+ 1 - 1
src/core/tPrinting.ml

@@ -641,7 +641,7 @@ module Printer = struct
 			"m_cache_state",s_module_cache_state me.m_cache_state;
 			"m_added",string_of_int me.m_added;
 			"m_checked",string_of_int me.m_checked;
-			"m_deps",s_pmap string_of_int (fun (_,m) -> snd m) me.m_deps;
+			"m_deps",s_pmap string_of_int (fun mdep -> snd mdep.md_path) me.m_deps;
 			"m_processed",string_of_int me.m_processed;
 			"m_kind",s_module_kind me.m_kind;
 			"m_binded_res",""; (* TODO *)

+ 7 - 1
src/core/tType.ml

@@ -401,6 +401,12 @@ and module_def_display = {
 	mutable m_import_positions : (pos,bool ref) PMap.t;
 }
 
+and module_dep = {
+	md_sign : Digest.t;
+	md_kind : module_kind;
+	md_path : path;
+}
+
 and module_def_extra = {
 	m_file : Path.UniqueKey.lazy_t;
 	m_sign : Digest.t;
@@ -411,7 +417,7 @@ and module_def_extra = {
 	mutable m_added : int;
 	mutable m_checked : int;
 	mutable m_processed : int;
-	mutable m_deps : (int,(Digest.t (* sign *) * path)) PMap.t;
+	mutable m_deps : (int,module_dep) PMap.t;
 	mutable m_kind : module_kind;
 	mutable m_cache_bound_objects : cache_bound_object DynArray.t;
 	mutable m_features : (string,bool) Hashtbl.t;