ruby-changes:58691
From: Takashi <ko1@a...>
Date: Sun, 10 Nov 2019 14:24:45 +0900 (JST)
Subject: [ruby-changes:58691] 0483d01f6b (master): Test invokebuiltin in test_jit
https://git.ruby-lang.org/ruby.git/commit/?id=0483d01f6b From 0483d01f6bdd3d16b31244a7aaadb4c31f6ecee7 Mon Sep 17 00:00:00 2001 From: Takashi Kokubun <takashikkbn@g...> Date: Sat, 9 Nov 2019 21:16:10 -0800 Subject: Test invokebuiltin in test_jit ISeq#to_a is commented out because it's broken now diff --git a/test/ruby/test_jit.rb b/test/ruby/test_jit.rb index a50eac5..bb5727f 100644 --- a/test/ruby/test_jit.rb +++ b/test/ruby/test_jit.rb @@ -600,6 +600,12 @@ class TestJIT < Test::Unit::TestCase https://github.com/ruby/ruby/blob/trunk/test/ruby/test_jit.rb#L600 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 https://github.com/ruby/ruby/blob/trunk/test/ruby/test_jit.rb#L1011 # 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 https://github.com/ruby/ruby/blob/trunk/test/ruby/test_jit.rb#L1032 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) -- cgit v0.10.2 -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/