Skip to content

Commit 7f42b83

Browse files
committed
Fixed callref call in VM engine
Signed-off-by: Louis-Vincent Boudreault <lv.boudreault95@gmail.com>
1 parent 556a50d commit 7f42b83

2 files changed

Lines changed: 7 additions & 0 deletions

File tree

src/vm/virtual_machine.nit

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -233,6 +233,9 @@ class VirtualMachine super NaiveInterpreter
233233
redef fun send(mproperty: MMethod, args: Array[Instance]): nullable Instance
234234
do
235235
var recv = args.first
236+
if self.routine_types.has(recv.mtype.name) then
237+
return super
238+
end
236239
var mtype = recv.mtype
237240
var ret = send_commons(mproperty, args, mtype)
238241
if ret != null then return ret

src/vm/vm_optimizations.nit

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,10 +24,14 @@ redef class VirtualMachine
2424
# Add optimization of the method dispatch
2525
redef fun callsite(callsite: nullable CallSite, arguments: Array[Instance]): nullable Instance
2626
do
27+
if routine_types.has(callsite.recv.name) then
28+
return super
29+
end
2730
var initializers = callsite.mpropdef.initializers
2831
if initializers.is_empty then return send_optimize(callsite.as(not null), arguments)
2932

3033
var recv = arguments.first
34+
3135
var i = 1
3236
for p in initializers do
3337
if p isa MMethod then

0 commit comments

Comments
 (0)