Test invokebuiltin in test_jit

ISeq#to_a is commented out because it's broken now
This commit is contained in:
Takashi Kokubun 2019-11-09 21:16:10 -08:00
Родитель 11aa07c270
Коммит 0483d01f6b
Не найден ключ, соответствующий данной подписи
Идентификатор ключа GPG: 6FFC433B12EE23DD
1 изменённых файлов: 15 добавлений и 5 удалений

Просмотреть файл

@ -600,6 +600,12 @@ class TestJIT < Test::Unit::TestCase
skip "support this in opt_call_c_function (low priority)"
end
def test_compile_insn_invokebuiltin
# insns = collect_insns(RubyVM::InstructionSequence.of([0].method(:pack)).to_a)
# mark_tested_insn(:invokebuiltin, used_insns: insns)
assert_eval_with_jit('print [0].pack("c")', stdout: "\x00", success_count: 1)
end
def test_jit_output
out, err = eval_with_jit('5.times { puts "MJIT" }', verbose: 1, min_calls: 5)
assert_equal("MJIT\n" * 5, out)
@ -1005,11 +1011,7 @@ class TestJIT < Test::Unit::TestCase
# Make sure that the script has insns expected to be tested
used_insns = method_insns(script)
insns.each do |insn|
unless used_insns.include?(insn)
$stderr.puts
warn "'#{insn}' insn is not included in the script. Actual insns are: #{used_insns.join(' ')}\n", uplevel: uplevel+2
end
TestJIT.untested_insns.delete(insn)
mark_tested_insn(insn, used_insns: used_insns)
end
assert_equal(
@ -1030,6 +1032,14 @@ class TestJIT < Test::Unit::TestCase
end
end
def mark_tested_insn(insn, used_insns:)
unless used_insns.include?(insn)
$stderr.puts
warn "'#{insn}' insn is not included in the script. Actual insns are: #{used_insns.join(' ')}\n", uplevel: uplevel+2
end
TestJIT.untested_insns.delete(insn)
end
# Collect block's insns or defined method's insns, which are expected to be JIT-ed.
# Note that this intentionally excludes insns in script's toplevel because they are not JIT-ed.
def method_insns(script)