nitc :: VirtualMachine :: send_optimize
# Try to have the most efficient implementation of the method dispatch
fun send_optimize(callsite: CallSite, args: Array[Instance]): nullable Instance
do
var recv = args.first
var mtype = recv.mtype
var ret = send_commons(callsite.mproperty, args, mtype)
if ret != null then return ret
if callsite.status == 0 then callsite.optimize(recv)
var propdef
if callsite.status == 1 then
propdef = method_dispatch_sst(recv.vtable.internal_vtable, callsite.offset)
else
propdef = method_dispatch_ph(recv.vtable.internal_vtable, recv.vtable.mask,
callsite.id, callsite.offset)
end
#TODO : we need recompilations here
callsite.status = 0
return self.call(propdef, args)
end
src/vm/vm_optimizations.nit:30,2--51,4