Browse Source

[eval] disable call optimization for now (see #6583)

Simon Krajewski 8 years ago
parent
commit
4ac4cd9108

+ 7 - 6
src/macro/eval/evalJit.ml

@@ -546,23 +546,23 @@ and jit_expr jit return e =
 		| TField(ef,fa) ->
 			let name = hash_s (field_name fa) in
 			let execs = List.map (jit_expr jit false) el in
-			let is_overridden c s_name =
+			(* let is_overridden c s_name =
 				try
 					Hashtbl.find ctx.overrides (c.cl_path,s_name)
 				with Not_found ->
 					false
-			in
+			in *)
 			let is_proper_method cf = match cf.cf_kind with
 				| Method MethDynamic -> false
 				| Method _ -> true
 				| Var _ -> false
 			in
-			let instance_call c =
+			(* let instance_call c =
 				let exec = jit_expr jit false ef in
 				let proto = get_instance_prototype ctx (path_hash c.cl_path) ef.epos in
 				let i = get_proto_field_index proto name in
 				emit_proto_field_call proto i (exec :: execs) e.epos
-			in
+			in *)
 			let default () =
 				let exec = jit_expr jit false ef in
 				emit_method_call exec name execs e.epos
@@ -590,7 +590,8 @@ and jit_expr jit return e =
 					let i = get_proto_field_index proto name in
 					emit_proto_field_call proto i execs e.epos
 				| FInstance(c,_,cf) when is_proper_method cf ->
-					if is_overridden c cf.cf_name then
+					default();
+					(* if is_overridden c cf.cf_name then
 						default()
 					else if not c.cl_interface then
 						instance_call c
@@ -600,7 +601,7 @@ and jit_expr jit return e =
 						| _ ->
 							default()
 					end else
-						default()
+						default() *)
 				| _ ->
 					let exec = jit_expr jit false ef in
 					emit_field_call exec name execs e.epos

+ 16 - 0
tests/misc/projects/Issue6583/Macro1.hx

@@ -0,0 +1,16 @@
+class BaseClass {
+	public function new() { }
+	public function f() {
+		Sys.stderr().writeString("BaseClass.f");
+	}
+}
+
+class Macro1 {
+	static public macro function macro1() {
+		return macro null;
+	}
+
+	static public function call(ref:BaseClass) {
+		ref.f();
+	}
+}

+ 12 - 0
tests/misc/projects/Issue6583/Macro2.hx

@@ -0,0 +1,12 @@
+class ChildClass extends Macro1.BaseClass {
+	override public function f() {
+		Sys.stderr().writeString("ChildClass.f");
+	}
+}
+
+class Macro2 {
+	static public macro function macro2() {
+		Macro1.call(new ChildClass());
+		return macro null;
+	}
+}

+ 6 - 0
tests/misc/projects/Issue6583/Main.hx

@@ -0,0 +1,6 @@
+class Main {
+    static function main() {
+        Macro1.macro1();
+        Macro2.macro2();
+    }
+}

+ 1 - 0
tests/misc/projects/Issue6583/compile.hxml

@@ -0,0 +1 @@
+-main Main

+ 1 - 0
tests/misc/projects/Issue6583/compile.hxml.stderr

@@ -0,0 +1 @@
+ChildClass.f