зеркало из https://github.com/github/ruby.git
Test invokebuiltin in test_jit
ISeq#to_a is commented out because it's broken now
This commit is contained in:
Родитель
11aa07c270
Коммит
0483d01f6b
|
@ -600,6 +600,12 @@ class TestJIT < Test::Unit::TestCase
|
||||||
skip "support this in opt_call_c_function (low priority)"
|
skip "support this in opt_call_c_function (low priority)"
|
||||||
end
|
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
|
def test_jit_output
|
||||||
out, err = eval_with_jit('5.times { puts "MJIT" }', verbose: 1, min_calls: 5)
|
out, err = eval_with_jit('5.times { puts "MJIT" }', verbose: 1, min_calls: 5)
|
||||||
assert_equal("MJIT\n" * 5, out)
|
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
|
# Make sure that the script has insns expected to be tested
|
||||||
used_insns = method_insns(script)
|
used_insns = method_insns(script)
|
||||||
insns.each do |insn|
|
insns.each do |insn|
|
||||||
unless used_insns.include?(insn)
|
mark_tested_insn(insn, used_insns: used_insns)
|
||||||
$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
|
end
|
||||||
|
|
||||||
assert_equal(
|
assert_equal(
|
||||||
|
@ -1030,6 +1032,14 @@ class TestJIT < Test::Unit::TestCase
|
||||||
end
|
end
|
||||||
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.
|
# 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.
|
# Note that this intentionally excludes insns in script's toplevel because they are not JIT-ed.
|
||||||
def method_insns(script)
|
def method_insns(script)
|
||||||
|
|
Загрузка…
Ссылка в новой задаче