From 070937696df57d59190ce5453b929e59246ce511 Mon Sep 17 00:00:00 2001 From: Louis-Vincent Boudreault Date: Mon, 7 Oct 2019 09:54:19 -0400 Subject: [PATCH] removed `nitvm` engine from tests Signed-off-by: Louis-Vincent Boudreault --- src/compiler/abstract_compiler.nit | 4 +- src/compiler/global_compiler.nit | 3 +- src/compiler/separate_compiler.nit | 3 +- src/compiler/separate_erasure_compiler.nit | 3 +- src/test_callref.nit | 104 ---------------------------- tests/testall.sh | 2 +- 6 files changed, 9 insertions(+), 110 deletions(-) delete mode 100644 src/test_callref.nit diff --git a/src/compiler/abstract_compiler.nit b/src/compiler/abstract_compiler.nit index e3132da..77a20f4 100644 --- a/src/compiler/abstract_compiler.nit +++ b/src/compiler/abstract_compiler.nit @@ -1392,7 +1392,7 @@ abstract class AbstractCompilerVisitor fun native_array_set(native_array: RuntimeVariable, index: Int, value: RuntimeVariable) is abstract # Instantiate a new routine pointer - fun routine_ref_instance(routine_mclass_type: MClassType, recv: RuntimeVariable, mmethoddef: MMethodDef): RuntimeVariable is abstract + fun routine_ref_instance(routine_mclass_type: MClassType, recv: RuntimeVariable, callsite: CallSite): RuntimeVariable is abstract # Call the underlying referenced function fun routine_ref_call(mmethoddef: MMethodDef, args: Array[RuntimeVariable]) is abstract @@ -4406,7 +4406,7 @@ redef class ACallrefExpr redef fun expr(v) do var recv = v.expr(self.n_expr, null) - var res = v.routine_ref_instance(mtype.as(MClassType), recv, callsite.as(not null).mpropdef) + var res = v.routine_ref_instance(mtype.as(MClassType), recv, callsite.as(not null)) return res end end diff --git a/src/compiler/global_compiler.nit b/src/compiler/global_compiler.nit index 2d2e6f2..765e630 100644 --- a/src/compiler/global_compiler.nit +++ b/src/compiler/global_compiler.nit @@ -463,8 +463,9 @@ class GlobalCompilerVisitor self.add("{recv}[{i}]={val};") end - redef fun routine_ref_instance(routine_mclass_type, recv, mmethoddef) + redef fun routine_ref_instance(routine_mclass_type, recv, callsite) do + var mmethoddef = callsite.mpropdef var method = new CustomizedRuntimeFunction(mmethoddef, recv.mcasttype.as(MClassType)) var my_recv = recv if recv.mtype.is_c_primitive then diff --git a/src/compiler/separate_compiler.nit b/src/compiler/separate_compiler.nit index 9c98d07..64edec5 100644 --- a/src/compiler/separate_compiler.nit +++ b/src/compiler/separate_compiler.nit @@ -2188,9 +2188,10 @@ class SeparateCompilerVisitor self.add("{recv}[{i}]={val};") end - redef fun routine_ref_instance(routine_type, recv, mmethoddef) + redef fun routine_ref_instance(routine_type, recv, callsite) do #debug "ENTER ref_instance" + var mmethoddef = callsite.mpropdef var mmethod = mmethoddef.mproperty # routine_mclass is the specialized one, e.g: FunRef1, ProcRef2, etc.. var routine_mclass = routine_type.mclass diff --git a/src/compiler/separate_erasure_compiler.nit b/src/compiler/separate_erasure_compiler.nit index 28ee0f0..8e0a0b2 100644 --- a/src/compiler/separate_erasure_compiler.nit +++ b/src/compiler/separate_erasure_compiler.nit @@ -679,8 +679,9 @@ class SeparateErasureCompilerVisitor return res end - redef fun routine_ref_instance(routine_type, recv, mmethoddef) + redef fun routine_ref_instance(routine_type, recv, callsite) do + var mmethoddef = callsite.mpropdef #debug "ENTER ref_instance" var mmethod = mmethoddef.mproperty # routine_mclass is the specialized one, e.g: FunRef1, ProcRef2, etc.. diff --git a/src/test_callref.nit b/src/test_callref.nit deleted file mode 100644 index 59e2b47..0000000 --- a/src/test_callref.nit +++ /dev/null @@ -1,104 +0,0 @@ -# This file is part of NIT ( http://www.nitlanguage.org ). -# -# Copyright 2019-2020 Louis-Vincent Boudreault -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -import functional - -redef class Object - fun toto(x: Int): Int - do - return x + 1 - end -end - -redef class Int - redef fun toto(x) do return x + self - - fun mult_by(x: Int): Int do return x * self -end - -class A - fun fun1: String - do - return "in A::fun1" - end -end - -class B - super A - - redef fun fun1 - do - return "in B::fun1" - end -end - -class Counter - var x = 0 - fun incr do x += 1 -end - -class C[E] - var x: E - redef fun to_s - do - if x != null then - return "x is {x.as(not null)}" - end - return "x is null" - end -end - -var a = new A -var b: A = new B -var f1 = &a.fun1 -assert f1.call == "in A::fun1" -var f2 = &b.fun1 -assert f2.call == "in B::fun1" - -var f3 = &10.mult_by -assert f3.call(10) == 100 - -var f4 = &f2.call -assert f4.call == "in B::fun1" - -var f5: Fun0[Object] = &f4.call -assert f5.call == "in B::fun1" -assert f5.call == "in B::fun1" - -assert (&10.toto).call(100) == 110 -assert (&"allo".toto).call(1) == 2 - -var cnt = new Counter -var p1 = &cnt.incr -var ps = [p1,p1,p1,p1,p1] - -for p in ps do p.call -assert cnt.x == 5 - -var c1 = new C[nullable Object](null) -var c2 = new C[nullable Int](null) - -var f6 = &c1.to_s -var f7 = &c2.to_s - -assert f6.call == "x is null" -assert f7.call == "x is null" - -c1.x = "test" -c2.x = 100 - -assert f6.call == "x is test" -assert f7.call == "x is 100" diff --git a/tests/testall.sh b/tests/testall.sh index 7740b5f..ff71517 100755 --- a/tests/testall.sh +++ b/tests/testall.sh @@ -15,7 +15,7 @@ # Run some tests on each engine -engine=(nitcg nitcg nitcs nitcsg nitce niti nitvm) +engine=(nitcg nitcg nitcs nitcsg nitce niti) if uname | grep MINGW64 1>/dev/null 2>&1; then engine=(nitcg nitcg nitcs nitcsg nitce) fi -- 1.7.9.5