Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Bug about static method dispatch fixed

  • Loading branch information...
commit 466fba17e5f032af4d649230a71b7efdf7c2c523 1 parent 40acfe5
@miura1729 authored
Showing with 17 additions and 4 deletions.
  1. +2 −0  bm_so_mandelbrot.rb
  2. +12 −3 lib/llvmutil.rb
  3. +3 −1 lib/vmtraverse.rb
View
2  bm_so_mandelbrot.rb
@@ -60,6 +60,8 @@
printf "%c", byte_acc # .chr
byte_acc = 0
bit_num = 0
+ else
+ 0
end
# nil
end
View
15 lib/llvmutil.rb
@@ -376,7 +376,12 @@ def gen_method_select(rectype, lexklass, mname)
return [nil, nil]
elsif candidatenum == 1 then
- minfo = mtab.values[0]
+ minfo = nil
+ if recklass then
+ minfo = mtab[recklass]
+ else
+ minfo = mtab.values[0]
+ end
if minfo.is_a?(Hash) then
return [minfo, minfo[:func]]
else
@@ -631,23 +636,27 @@ def do_function(receiver, info, ins, local_vars, args, mname, curlevel)
rectype = receiver ? receiver[0] : nil
minfo, func = gen_method_select(rectype, info[0], mname)
if minfo then
+ rettype = minfo[:rettype]
+ # rettype = RubyType.new(nil, info[3], "Return type of #{mname}")
pppp "RubyMethod called #{mname.inspect}"
para = gen_arg_eval(args, receiver, ins, local_vars, info, minfo, mname)
- @expstack.push [minfo[:rettype],
+ @expstack.push [rettype,
lambda {|b, context|
recklass = receiver ? receiver[0].klass : nil
minfo, func = gen_method_select(rectype, info[0], mname)
+
if !with_selfp(receiver, info[0], mname) then
para.pop
end
+
if func then
gen_call(func, para ,b, context)
else
# p mname
# p recklass
# raise "Undefined method \"#{mname}\" in #{info[3]}"
- rettype = minfo[:rettype]
+# rettype = minfo[:rettype]
gen_call_from_ruby(rettype, receiver[0], mname, para, curlevel, b, context)
end
}]
View
4 lib/vmtraverse.rb
@@ -795,6 +795,7 @@ def visit_local_block_end(code, ins, local_vars, ln, info)
end
def visit_default(code, ins, local_vars, ln, info)
+ p ins
pppp "Unprocessed instruction #{ins}"
end
@@ -1158,7 +1159,8 @@ def visit_putobject(code, ins, local_vars, ln, info)
}]
end
- # putspecialobject
+ def visit_putspecialobject(code, ins, local_vars, ln, info)
+ end
def visit_putiseq(code, ins, local_vars, ln, info)
end
Please sign in to comment.
Something went wrong with that request. Please try again.