diff options
author | k0kubun <k0kubun@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2018-05-03 08:47:32 +0000 |
---|---|---|
committer | k0kubun <k0kubun@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2018-05-03 08:47:32 +0000 |
commit | 6dd4657fc2bbbb1aad36afc24dcb19553fd41ab6 (patch) | |
tree | 30bbb9a008342d710ec3cde4743e4ace8627954c /test/ruby/test_jit.rb | |
parent | d9d84688d68cad09c654a42c570fcb9781ccc160 (diff) |
_mjit_compile_send.erb: retry inlining attr_reader
This reverts r63249 (revert r63212) and fixes a bug in it. The test to
prevent the bug is added as well.
vm_insnhelper.c: add `index` argument to vm_getivar. The argument is
created so that MJIT can pass the value of `cc->aux.index` on compilation
time. The cache invalidation in _mjit_compile_send_guard.erb is only
working for the cache value on compilation time.
Note: As `index` is always passed as constant and it's force-inlined,
the performance of `vm_getivar` won't be degraded in VM.
_mjit_compile_send_guard.erb: New. Used to invalidate inlined values of cc.
common.mk: update dependencies for _mjit_compile_send_guard.erb
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@63333 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'test/ruby/test_jit.rb')
-rw-r--r-- | test/ruby/test_jit.rb | 31 |
1 files changed, 31 insertions, 0 deletions
diff --git a/test/ruby/test_jit.rb b/test/ruby/test_jit.rb index 4699de7d2a..891b7f496f 100644 --- a/test/ruby/test_jit.rb +++ b/test/ruby/test_jit.rb @@ -612,6 +612,37 @@ class TestJIT < Test::Unit::TestCase print(2 * a.test) end; + + assert_eval_with_jit("#{<<~"begin;"}\n#{<<~"end;"}", stdout: "true", success_count: 1, min_calls: 2) + begin; + class Hoge + attr_reader :foo + + def initialize + @foo = [] + @bar = nil + end + end + + class Fuga < Hoge + def initialize + @bar = nil + @foo = [] + end + end + + def test(recv) + recv.foo.empty? + end + + hoge = Hoge.new + fuga = Fuga.new + + test(hoge) # VM: cc set index=1 + test(hoge) # JIT: compile with index=1 + test(fuga) # JIT -> VM: cc set index=2 + print test(hoge) # JIT: should use index=1, not index=2 in cc + end; end def test_clean_so |