Browse Source

Dce fix, also create dumpfiles in platform-subdir

Simon Krajewski 12 năm trước cách đây
mục cha
commit
99548f7a01
2 tập tin đã thay đổi với 6 bổ sung4 xóa
  1. 3 3
      codegen.ml
  2. 3 1
      dce.ml

+ 3 - 3
codegen.ml

@@ -1814,7 +1814,7 @@ let dump_types com =
 	let s_expr = try if Common.defined_value com Define.Dump = "pretty" then Type.s_expr_pretty "\t" else Type.s_expr with Not_found -> Type.s_expr in
 	List.iter (fun mt ->
 		let path = Type.t_path mt in
-		let buf,close = create_dumpfile [] ("dump" :: fst path @ [snd path]) in
+		let buf,close = create_dumpfile [] ("dump" :: (Common.platform_name com.platform) :: fst path @ [snd path]) in
 		let print fmt = Printf.kprintf (fun s -> Buffer.add_string buf s) fmt in
 		(match mt with
 		| Type.TClassDecl c ->
@@ -1854,7 +1854,7 @@ let dump_types com =
 	) com.types
 
 let dump_dependencies com =
-	let buf,close = create_dumpfile [] ["dump";".dependencies"] in
+	let buf,close = create_dumpfile [] ["dump";Common.platform_name com.platform;".dependencies"] in
 	let print fmt = Printf.kprintf (fun s -> Buffer.add_string buf s) fmt in
 	let dep = Hashtbl.create 0 in
 	List.iter (fun m ->
@@ -1866,7 +1866,7 @@ let dump_dependencies com =
 		) m.m_extra.m_deps;
 	) com.Common.modules;
 	close();
-	let buf,close = create_dumpfile [] ["dump";".dependants"] in
+	let buf,close = create_dumpfile [] ["dump";Common.platform_name com.platform;".dependants"] in
 	let print fmt = Printf.kprintf (fun s -> Buffer.add_string buf s) fmt in
 	Hashtbl.iter (fun n ml ->
 		print "%s:\n" n;

+ 3 - 1
dce.ml

@@ -204,9 +204,11 @@ let rec to_string dce t =
 		let pop = push t in
 		PMap.iter (fun _ cf -> to_string dce cf.cf_type) a.a_fields;
 		pop();
-	| TFun(args,r) ->
+	| TFun(args,r) as t ->
+		let pop = push t in
 		List.iter (fun (_,_,t) -> to_string dce t) args;
 		to_string dce r;
+		pop();
 	| _ -> ()
 
 and field dce c n stat =