diff --git a/src/vm/virtual_machine.nit b/src/vm/virtual_machine.nit index c7e57c69b9..7aad754801 100644 --- a/src/vm/virtual_machine.nit +++ b/src/vm/virtual_machine.nit @@ -233,6 +233,9 @@ class VirtualMachine super NaiveInterpreter redef fun send(mproperty: MMethod, args: Array[Instance]): nullable Instance do var recv = args.first + if self.routine_types.has(recv.mtype.name) then + return super + end var mtype = recv.mtype var ret = send_commons(mproperty, args, mtype) if ret != null then return ret diff --git a/src/vm/vm_optimizations.nit b/src/vm/vm_optimizations.nit index 514d3d1a60..d9a3650dfe 100644 --- a/src/vm/vm_optimizations.nit +++ b/src/vm/vm_optimizations.nit @@ -24,10 +24,14 @@ redef class VirtualMachine # Add optimization of the method dispatch redef fun callsite(callsite: nullable CallSite, arguments: Array[Instance]): nullable Instance do + if routine_types.has(callsite.recv.name) then + return super + end var initializers = callsite.mpropdef.initializers if initializers.is_empty then return send_optimize(callsite.as(not null), arguments) var recv = arguments.first + var i = 1 for p in initializers do if p isa MMethod then