1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00

Check mjit_call_p only when interrupted

for leaf_without_check_ints insns.

$ benchmark-driver -v --rbenv 'before --jit;after --jit' --repeat-count=12 --alternate --output=all benchmark.yml
before --jit: ruby 3.0.0dev (2020-12-20T05:02:18Z master 02b3555874) +JIT [x86_64-linux]
after --jit: ruby 3.0.0dev (2020-12-20T05:36:00Z master 3f58de4eab) +JIT [x86_64-linux]
last_commit=Check mjit_call_p only when interrupted
Calculating -------------------------------------
                                 before --jit           after --jit
Optcarrot Lan_Master.nes    84.50647332260259     85.85057800433144 fps
                            91.17796644338372     92.09930605656054
                            91.29346683444497     93.01336611323687
                            91.50322318568884     93.07234029037433
                            91.66560903214686     93.22773241529644
                            91.82315142636172     93.37032901061119
                            92.15066379608260     93.83701526141679
                            92.37897097456643     93.86032792681507
                            92.53049815524908     93.91211970920320
                            92.78414507914283     94.09109196967890
                            92.90299756525958     94.40107239595325
                            93.70279428858790     95.01326369371263
This commit is contained in:
Takashi Kokubun 2020-12-19 21:35:59 -08:00
parent ae1cc3fd4e
commit 7d0144e055
No known key found for this signature in database
GPG key ID: 6FFC433B12EE23DD
2 changed files with 8 additions and 2 deletions

View file

@ -59,7 +59,8 @@
% end
%
% # JIT: We should evaluate ISeq modified for TracePoint if it's enabled. Note: This is slow.
% unless insn.always_leaf?
% # leaf insn may not cancel JIT. leaf_without_check_ints is covered in RUBY_VM_CHECK_INTS of _mjit_compile_insn_body.erb.
% unless insn.always_leaf? || insn.leaf_without_check_ints?
fprintf(f, " if (UNLIKELY(!mjit_call_p)) {\n");
fprintf(f, " reg_cfp->sp = vm_base_ptr(reg_cfp) + %d;\n", b->stack_size + (int)<%= insn.call_attribute('sp_inc') %>);
if (!pc_moved_p) {

View file

@ -48,10 +48,15 @@
% # TODO: support combination of following macros in the same line
% case line
% when /\A\s+RUBY_VM_CHECK_INTS\(ec\);\s+\z/
% if insn.leaf_without_check_ints? # lazily move PC here
% if insn.leaf_without_check_ints? # lazily move PC and optionalize mjit_call_p here
fprintf(f, " if (UNLIKELY(RUBY_VM_INTERRUPTED_ANY(ec))) {\n");
fprintf(f, " reg_cfp->pc = original_body_iseq + %d;\n", next_pos); /* ADD_PC(INSN_ATTR(width)); */
fprintf(f, " rb_threadptr_execute_interrupts(rb_ec_thread_ptr(ec), 0);\n");
fprintf(f, " if (UNLIKELY(!mjit_call_p)) {\n");
fprintf(f, " reg_cfp->sp = vm_base_ptr(reg_cfp) + %d;\n", b->stack_size);
fprintf(f, " RB_DEBUG_COUNTER_INC(mjit_cancel_invalidate_all);\n");
fprintf(f, " goto cancel;\n");
fprintf(f, " }\n");
fprintf(f, " }\n");
% else
fprintf(f, <%= to_cstr.call(line) %>);