diff options
author | k0kubun <k0kubun@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2019-04-14 08:53:19 +0000 |
---|---|---|
committer | k0kubun <k0kubun@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2019-04-14 08:53:19 +0000 |
commit | c5570cf9bde992f3d14a6382f1038fb422182f45 (patch) | |
tree | 35766aac6c6946edb2bad15cde3fcf92aa416bcc /tool | |
parent | b75bb06e00ab4d8b77ebd9b476ecf945f8b7f72a (diff) | |
download | ruby-c5570cf9bde992f3d14a6382f1038fb422182f45.tar.gz |
Detect send-compatible opt insns automatically
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@67548 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'tool')
-rw-r--r-- | tool/ruby_vm/views/mjit_compile.inc.erb | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/tool/ruby_vm/views/mjit_compile.inc.erb b/tool/ruby_vm/views/mjit_compile.inc.erb index f6d52d692e..0f74b47f20 100644 --- a/tool/ruby_vm/views/mjit_compile.inc.erb +++ b/tool/ruby_vm/views/mjit_compile.inc.erb @@ -26,6 +26,11 @@ % raise 'opt_send_without_block not found' % end % +% send_compatible_opt_insns = RubyVM::BareInstructions.to_a.select do |insn| +% insn.name.start_with?('opt_') && opt_send_without_block.opes == insn.opes && +% insn.expr.expr.lines.any? { |l| l.match?(/\A\s+CALL_SIMPLE_METHOD\(\);\s+\z/) } +% end.map(&:name) +% % # Available variables and macros in JIT-ed function: % # ec: the first argument of _mjitXXX % # reg_cfp: the second argument of _mjitXXX @@ -50,7 +55,7 @@ switch (insn) { % case insn.name % when 'opt_send_without_block', 'send' <%= render 'mjit_compile_send', locals: { insn: insn } -%> -% when 'opt_aref', 'opt_aset', 'opt_mod' # TODO: automatically find them with CALL_SIMPLE_METHOD +% when *send_compatible_opt_insns % # To avoid cancel, just emit `opt_send_without_block` instead of `opt_*` insn if call cache is populated. % cc_index = insn.opes.index { |o| o.fetch(:type) == 'CALL_CACHE' } if (has_valid_method_type(status->cc_entries + ((CALL_CACHE)operands[<%= cc_index %>] - body->cc_entries))) { |