diff options
author | ko1 <ko1@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2019-04-05 08:15:11 +0000 |
---|---|---|
committer | ko1 <ko1@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2019-04-05 08:15:11 +0000 |
commit | 2b5bb8a0875b75f18e628c8b2df22760536bdad9 (patch) | |
tree | ed4f1e080d81f7f5b47c8a10ce6c33285220bed5 /test/ruby | |
parent | 7fe64d17d3cd455a3f014d6f756cb201320f7f9a (diff) | |
download | ruby-2b5bb8a0875b75f18e628c8b2df22760536bdad9.tar.gz |
add definemethod/definesmethod insn.
* insns.def: add definemethod and definesmethod (singleton method)
instructions. Old YARV contains these instructions, but it is moved
to methods of FrozenCore class because remove number of instructions
can improve performance for some techniques (static stack caching
and so on). However, we don't employ these technique and it is hard
to optimize/analysis definition sequence. So I decide to introduce
them (and remove definition methods). `putiseq` insn is also removed.
* vm_method.c (rb_scope_visibility_get): renamed to
`vm_scope_visibility_get()` and make it accept `ec`.
Same for `vm_scope_module_func_check()`.
These fixes are result of refactoring `vm_define_method`.
* vm_insnhelper.c (rb_vm_get_cref): renamed to `vm_get_cref`
because of consistency with other functions.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@67442 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'test/ruby')
-rw-r--r-- | test/ruby/test_jit.rb | 19 |
1 files changed, 5 insertions, 14 deletions
diff --git a/test/ruby/test_jit.rb b/test/ruby/test_jit.rb index 7adb1e8d6d..332d6fc2ed 100644 --- a/test/ruby/test_jit.rb +++ b/test/ruby/test_jit.rb @@ -183,18 +183,6 @@ class TestJIT < Test::Unit::TestCase assert_compile_once('2', result_inspect: '2', insns: %i[putobject]) end - def test_compile_insn_putspecialobject_putiseq - assert_eval_with_jit("#{<<~"begin;"}\n#{<<~"end;"}", stdout: 'hellohello', success_count: 2, insns: %i[putspecialobject putiseq]) - begin; - print 2.times.map { - def method_definition - 'hello' - end - method_definition - }.join - end; - end - def test_compile_insn_putstring_concatstrings_tostring assert_compile_once('"a#{}b" + "c"', result_inspect: '"abc"', insns: %i[putstring concatstrings tostring]) end @@ -952,8 +940,10 @@ class TestJIT < Test::Unit::TestCase insns = [] RubyVM::InstructionSequence.compile(script).to_a.last.each do |(insn, *args)| case insn - when :putiseq, :send + when :send insns += collect_insns(args.last) + when :definemethod, :definesmethod + insns += collect_insns(args[1]) when :defineclass insns += collect_insns(args[1]) end @@ -968,7 +958,8 @@ class TestJIT < Test::Unit::TestCase insns = iseq_array.last.select { |x| x.is_a?(Array) }.map(&:first) iseq_array.last.each do |(insn, *args)| case insn - when :putiseq, :send + when :definemethod, :definesmethod, + :send insns += collect_insns(args.last) end end |