fun compile_callsite(callsite: CallSite, arguments: Array[RuntimeVariable]): nullable RuntimeVariable
do
if callsite.is_broken then return null
return self.send(callsite.mproperty, arguments)
end
src/compiler/abstract_compiler.nit:1354,2--1358,4
redef fun compile_callsite(callsite, args)
do
var rta = compiler.runtime_type_analysis
# TODO: Inlining of new-style constructors with initializers
if compiler.modelbuilder.toolcontext.opt_direct_call_monomorph.value and rta != null and callsite.mpropdef.initializers.is_empty then
var tgs = rta.live_targets(callsite)
if tgs.length == 1 then
return direct_call(tgs.first, args)
end
end
# Shortcut intern methods as they are not usually redefinable
if callsite.mpropdef.is_intern and callsite.mproperty.name != "object_id" then
# `object_id` is the only redefined intern method, so it can not be directly called.
# TODO find a less ugly approach?
return direct_call(callsite.mpropdef, args)
end
return super
end
src/compiler/separate_compiler.nit:1428,2--1445,4
redef fun compile_callsite(callsite, arguments)
do
var res = super
if callsite.erasure_cast and not self.compiler.as(SeparateErasureCompiler).modelbuilder.toolcontext.opt_no_check_erasure_cast.value then
assert res != null
var mtype = callsite.msignature.return_mtype
assert mtype != null
self.add("/* Erasure cast for return {res} isa {mtype} */")
var cond = self.type_test(res, mtype, "erasure")
self.add("if (!{cond}) \{")
#var x = self.class_name_string(res)
#var y = self.class_name_string(arguments.first)
#self.add("PRINT_ERROR(\"Erasure cast: expected {mtype} (self is %s), got %s for {res}\\n\", {y}, {x});")
self.add_abort("Cast failed")
self.add("\}")
end
return res
end
src/compiler/separate_erasure_compiler.nit:538,2--555,4