summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTakashi Kokubun <takashikkbn@gmail.com>2019-11-09 21:16:10 -0800
committerTakashi Kokubun <takashikkbn@gmail.com>2019-11-09 21:16:16 -0800
commit0483d01f6bdd3d16b31244a7aaadb4c31f6ecee7 (patch)
treee03195b80977a4a14515dd7eac3d715fc1b62a4a
parent11aa07c27071878d9f7748995febe7df96f0405d (diff)
Test invokebuiltin in test_jit
ISeq#to_a is commented out because it's broken now
-rw-r--r--test/ruby/test_jit.rb20
1 files changed, 15 insertions, 5 deletions
diff --git a/test/ruby/test_jit.rb b/test/ruby/test_jit.rb
index a50eac5b36..bb5727f5fb 100644
--- a/test/ruby/test_jit.rb
+++ b/test/ruby/test_jit.rb
@@ -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)