summaryrefslogtreecommitdiff
path: root/tool
diff options
context:
space:
mode:
authork0kubun <k0kubun@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2018-10-14 13:25:21 (GMT)
committerk0kubun <k0kubun@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2018-10-14 13:25:21 (GMT)
commit83e1b361c8388187b7e86b7bb046694d7f96b72b (patch)
tree82e5a5c012decacd24d11f4b75d8c8fcd1d5aaa8 /tool
parent3ac55870aa6c88f55b651221caea714dee502056 (diff)
_mjit_compile_ivar.erb: optimize setivar as well
mjit_compile.inc.erb: ditto common.mk: update dependency for the rename from getivar.erb === Optcarrot benchmark === ``` $ benchmark-driver benchmark.yml --rbenv '2.0.0::2.0.0-p648 --disable-gems;before::before --disable-gems;before+JIT::before --disable-gems --jit;after::after --disable-gems;after+JIT::after --disable-gems --jit' -v --repeat-count 24 2.0.0: ruby 2.0.0p648 (2015-12-16 revision 53162) [x86_64-linux] before: ruby 2.6.0dev (2018-10-14 trunk 65074) [x86_64-linux] before+JIT: ruby 2.6.0dev (2018-10-14 trunk 65074) +JIT [x86_64-linux] after: ruby 2.6.0dev (2018-10-14 trunk 65074) [x86_64-linux] after+JIT: ruby 2.6.0dev (2018-10-14 trunk 65074) +JIT [x86_64-linux] Calculating ------------------------------------- 2.0.0 before before+JIT after after+JIT Optcarrot Lan_Master.nes 34.434 53.125 84.782 53.321 86.812 fps Comparison: Optcarrot Lan_Master.nes after+JIT: 86.8 fps before+JIT: 84.8 fps - 1.02x slower after: 53.3 fps - 1.63x slower before: 53.1 fps - 1.63x slower 2.0.0: 34.4 fps - 2.52x slower ``` git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@65076 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'tool')
-rw-r--r--tool/ruby_vm/views/_mjit_compile_ivar.erb (renamed from tool/ruby_vm/views/_mjit_compile_getivar.erb)8
-rw-r--r--tool/ruby_vm/views/mjit_compile.inc.erb4
2 files changed, 10 insertions, 2 deletions
diff --git a/tool/ruby_vm/views/_mjit_compile_getivar.erb b/tool/ruby_vm/views/_mjit_compile_ivar.erb
index 934ea47..2496607 100644
--- a/tool/ruby_vm/views/_mjit_compile_getivar.erb
+++ b/tool/ruby_vm/views/_mjit_compile_ivar.erb
@@ -24,10 +24,18 @@
fprintf(f, " VALUE obj = GET_SELF();\n");
fprintf(f, " const rb_serial_t ic_serial = (rb_serial_t)%"PRI_SERIALT_PREFIX"u;\n", ic->ic_serial);
fprintf(f, " const st_index_t index = %lu;\n", ic->ic_value.index);
+% if insn.name == 'setinstancevariable'
+ fprintf(f, " VALUE val = stack[%d];\n", b->stack_size - 1);
+% end
%
% # JIT: cache hit path of vm_getivar, or cancel JIT.
fprintf(f, " if (LIKELY(RB_TYPE_P(obj, T_OBJECT) && ic_serial == RCLASS_SERIAL(RBASIC(obj)->klass) && index < ROBJECT_NUMIV(obj))) {\n");
+% if insn.name == 'setinstancevariable'
+ fprintf(f, " VALUE *ptr = ROBJECT_IVPTR(obj);\n");
+ fprintf(f, " RB_OBJ_WRITE(obj, &ptr[index], val);\n");
+% else
fprintf(f, " stack[%d] = ROBJECT_IVPTR(obj)[index];\n", b->stack_size);
+% end
fprintf(f, " }\n");
fprintf(f, " else {\n");
fprintf(f, " reg_cfp->pc = original_body_iseq + %d;\n", pos);
diff --git a/tool/ruby_vm/views/mjit_compile.inc.erb b/tool/ruby_vm/views/mjit_compile.inc.erb
index d211c57..b2ba3ca 100644
--- a/tool/ruby_vm/views/mjit_compile.inc.erb
+++ b/tool/ruby_vm/views/mjit_compile.inc.erb
@@ -52,8 +52,8 @@ switch (insn) {
<%= render 'mjit_compile_send', locals: { insn: insn } -%>
% when 'opt_aref' # experimental. TODO: increase insns and make the list automatically by finding DISPATCH_ORIGINAL_INSN
<%= render 'mjit_compile_send', locals: { insn: opt_send_without_block } -%>
-% when 'getinstancevariable'
-<%= render 'mjit_compile_getivar', locals: { insn: insn } -%>
+% when 'getinstancevariable', 'setinstancevariable'
+<%= render 'mjit_compile_ivar', locals: { insn: insn } -%>
% when 'leave'
if (b->stack_size != 1) {
if (mjit_opts.warnings || mjit_opts.verbose)