From c5570cf9bde992f3d14a6382f1038fb422182f45 Mon Sep 17 00:00:00 2001 From: k0kubun Date: Sun, 14 Apr 2019 08:53:19 +0000 Subject: Detect send-compatible opt insns automatically git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@67548 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- tool/ruby_vm/views/mjit_compile.inc.erb | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) (limited to 'tool') 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))) { -- cgit v1.2.3