Skip to content

Commit

Permalink
Fixed callref call in VM engine
Browse files Browse the repository at this point in the history
Signed-off-by: Louis-Vincent Boudreault <lv.boudreault95@gmail.com>
  • Loading branch information
lvboudre committed Oct 2, 2019
1 parent 556a50d commit 7f42b83
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 0 deletions.
3 changes: 3 additions & 0 deletions src/vm/virtual_machine.nit
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
4 changes: 4 additions & 0 deletions src/vm/vm_optimizations.nit
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 7f42b83

Please sign in to comment.