[前][次][番号順一覧][スレッド一覧]

ruby-changes:55340

From: k0kubun <ko1@a...>
Date: Sun, 14 Apr 2019 17:53:23 +0900 (JST)
Subject: [ruby-changes:55340] k0kubun:r67548 (trunk): Detect send-compatible opt insns automatically

k0kubun	2019-04-14 17:53:19 +0900 (Sun, 14 Apr 2019)

  New Revision: 67548

  https://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=revision&revision=67548

  Log:
    Detect send-compatible opt insns automatically

  Modified files:
    trunk/tool/ruby_vm/views/mjit_compile.inc.erb
Index: tool/ruby_vm/views/mjit_compile.inc.erb
===================================================================
--- tool/ruby_vm/views/mjit_compile.inc.erb	(revision 67547)
+++ tool/ruby_vm/views/mjit_compile.inc.erb	(revision 67548)
@@ -26,6 +26,11 @@ https://github.com/ruby/ruby/blob/trunk/tool/ruby_vm/views/mjit_compile.inc.erb#L26
 %   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) { https://github.com/ruby/ruby/blob/trunk/tool/ruby_vm/views/mjit_compile.inc.erb#L55
 %   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))) {

--
ML: ruby-changes@q...
Info: http://www.atdot.net/~ko1/quickml/

[前][次][番号順一覧][スレッド一覧]