Browse Source

added --no-inline

Nicolas Cannasse 17 years ago
parent
commit
cf656bb597
3 changed files with 7 additions and 1 deletions
  1. 1 0
      doc/CHANGES.txt
  2. 1 0
      main.ml
  3. 5 1
      typer.ml

+ 1 - 0
doc/CHANGES.txt

@@ -18,6 +18,7 @@
 	fix for protected as3 classes
 	fix for protected as3 classes
 	added support for flash9 XML (in flash.xml package)
 	added support for flash9 XML (in flash.xml package)
 	added neko.vm.Tls for Neko 1.6.1
 	added neko.vm.Tls for Neko 1.6.1
+	added --no-inline
 
 
 2008-01-13: 1.17
 2008-01-13: 1.17
 	fixed Int32.compare, added Int32.read and Int32.write
 	fixed Int32.compare, added Int32.read and Int32.write

+ 1 - 0
main.ml

@@ -357,6 +357,7 @@ try
 		),": display code tips");
 		),": display code tips");
 		("--no-output", Arg.Unit (fun() -> no_output := true),": compiles but does not generate any file");
 		("--no-output", Arg.Unit (fun() -> no_output := true),": compiles but does not generate any file");
 		("--times", Arg.Unit (fun() -> Plugin.times := true),": mesure compilation times");
 		("--times", Arg.Unit (fun() -> Plugin.times := true),": mesure compilation times");
+		("--no-inline", Arg.Unit (fun() -> Plugin.define "no_inline"),": disable inlining");
 	] in
 	] in
 	let current = ref 0 in
 	let current = ref 0 in
 	let args = Array.of_list ("" :: params) in
 	let args = Array.of_list ("" :: params) in

+ 5 - 1
typer.ml

@@ -36,6 +36,7 @@ type context = {
 	warn : string -> pos -> unit;
 	warn : string -> pos -> unit;
 	error : error_msg -> pos -> unit;
 	error : error_msg -> pos -> unit;
 	flash9 : bool;
 	flash9 : bool;
+	doinline : bool;
 	mutable std : module_def;
 	mutable std : module_def;
 	mutable untyped : bool;
 	mutable untyped : bool;
 	mutable isproxy : bool;
 	mutable isproxy : bool;
@@ -143,6 +144,7 @@ let context err warn =
 		constructs = Hashtbl.create 0;
 		constructs = Hashtbl.create 0;
 		delays = ref [];
 		delays = ref [];
 		flash9 = Plugin.defined "flash9";
 		flash9 = Plugin.defined "flash9";
+		doinline = not (Plugin.defined "no_inline");
 		in_constructor = false;
 		in_constructor = false;
 		in_static = false;
 		in_static = false;
 		in_loop = false;
 		in_loop = false;
@@ -2031,7 +2033,8 @@ and type_call ctx e el p =
 			ignore(follow f.cf_type); (* force evaluation *)
 			ignore(follow f.cf_type); (* force evaluation *)
 			(match f.cf_expr with
 			(match f.cf_expr with
 			| Some { eexpr = TFunction fd } ->
 			| Some { eexpr = TFunction fd } ->
-				(match type_inline ctx fd ethis params tret p with
+				let i = if ctx.doinline then type_inline ctx fd ethis params tret p else None in
+				(match i with
 				| None -> mk (TCall (mk (TField (ethis,f.cf_name)) t p,params)) tret p
 				| None -> mk (TCall (mk (TField (ethis,f.cf_name)) t p,params)) tret p
 				| Some e -> e)
 				| Some e -> e)
 			| _ -> error "Recursive inline is not supported" p)
 			| _ -> error "Recursive inline is not supported" p)
@@ -2718,6 +2721,7 @@ let type_module ctx m tdecls loadp =
 		ret = ctx.ret;
 		ret = ctx.ret;
 		isproxy = ctx.isproxy;
 		isproxy = ctx.isproxy;
 		flash9 = ctx.flash9;
 		flash9 = ctx.flash9;
+		doinline = ctx.doinline;
 		current = m;
 		current = m;
 		locals = PMap.empty;
 		locals = PMap.empty;
 		locals_map = PMap.empty;
 		locals_map = PMap.empty;