1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00
ruby--ruby/tool/ruby_vm/views
k0kubun e72a86fc93 _mjit_compile_send.erb: inline attr_reader call
_mjit_compile_send_guard.erb: carve out the shared logic to invalidate
inlined method call

common.mk: update dependency for this change

test_jit.rb: add test for attr_reader optimization

* Benchmark

```
require 'benchmark_driver'

Benchmark.driver do |x|
  x.prelude %{
    class C
      attr_reader :a
      def initialize
        @a = 1
      end
    end

    o = C.new

    def l o
      i = 0
      while i < 1000000
        o.a
        i += 1
      end
    end
  }
  x.report 'aread', %{ l o }
  x.loop_count 1000

  x.rbenv 'before', 'before,--jit', 'after,--jit'
  x.verbose
end
```

```
before: ruby 2.6.0dev (2018-04-20 trunk 63211) [x86_64-linux]
before,--jit: ruby 2.6.0dev (2018-04-20 trunk 63211) +JIT [x86_64-linux]
after,--jit: ruby 2.6.0dev (2018-04-20 trunk 63211) +JIT [x86_64-linux]
last_commit=_mjit_compile_send.erb: inline attr_reader call
Calculating -------------------------------------
                         before  before,--jit  after,--jit
               aread     54.597       122.894      218.574 i/s -      1.000k times in 18.316102s 8.137089s 4.575106s

Comparison:
                            aread
         after,--jit:       218.6 i/s
        before,--jit:       122.9 i/s - 1.78x  slower
              before:        54.6 i/s - 4.00x  slower

```

* Optcarrot

A little made faster?

fps: 71.35 -> 72.11

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@63212 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-04-20 13:42:08 +00:00
..
_attributes.erb redefinition of a typedef is a C11ism 2018-01-29 08:11:02 +00:00
_c_expr.erb delete tool/instruction.rb (2nd try) 2018-01-12 08:38:09 +00:00
_copyright.erb delete tool/instruction.rb (2nd try) 2018-01-12 08:38:09 +00:00
_insn_entry.erb also use sp_inc in vm core 2018-01-29 06:56:56 +00:00
_insn_len_info.erb delete tool/instruction.rb (2nd try) 2018-01-12 08:38:09 +00:00
_insn_name_info.erb Export some missing symbols for MJIT 2018-02-08 13:54:37 +00:00
_insn_operand_info.erb delete tool/instruction.rb (2nd try) 2018-01-12 08:38:09 +00:00
_insn_stack_increase.erb __VA_ARGS__ is a C99ism 2018-01-13 10:47:33 +00:00
_insn_type_chars.erb delete tool/instruction.rb (2nd try) 2018-01-12 08:38:09 +00:00
_mjit_compile_insn.erb _mjit_compile_pc_and_sp.erb: skip moving pc 2018-03-06 13:23:22 +00:00
_mjit_compile_insn_body.erb _mjit_compile_pc_and_sp.erb: skip moving pc 2018-03-06 13:23:22 +00:00
_mjit_compile_pc_and_sp.erb _mjit_compile_pc_and_sp.erb: skip moving pc 2018-03-06 13:23:22 +00:00
_mjit_compile_send.erb _mjit_compile_send.erb: inline attr_reader call 2018-04-20 13:42:08 +00:00
_mjit_compile_send_guard.erb _mjit_compile_send.erb: inline attr_reader call 2018-04-20 13:42:08 +00:00
_notice.erb delete tool/instruction.rb (2nd try) 2018-01-12 08:38:09 +00:00
_trace_instruction.erb delete tool/instruction.rb (2nd try) 2018-01-12 08:38:09 +00:00
insns.inc.erb delete tool/instruction.rb (2nd try) 2018-01-12 08:38:09 +00:00
insns_info.inc.erb delete tool/instruction.rb (2nd try) 2018-01-12 08:38:09 +00:00
mjit_compile.inc.erb mjit_compile.c: use local variables for stack 2018-03-04 07:04:40 +00:00
opt_sc.inc.erb delete tool/instruction.rb (2nd try) 2018-01-12 08:38:09 +00:00
optinsn.inc.erb tool/ruby_vm support for pre-2.3 BASERUBY 2018-01-12 08:38:10 +00:00
optunifs.inc.erb delete tool/instruction.rb (2nd try) 2018-01-12 08:38:09 +00:00
vm.inc.erb delete tool/instruction.rb (2nd try) 2018-01-12 08:38:09 +00:00
vmtc.inc.erb delete tool/instruction.rb (2nd try) 2018-01-12 08:38:09 +00:00