Allow falling back to non-inlined opt_send_without_block

for opt_aref with inline cache to minimize the possibility of JIT cancel.

Also opt_aset and opt_mod are added for the targets.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@67547 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
k0kubun 2019-04-14 08:33:43 +00:00
Родитель 18b5148215
Коммит b75bb06e00
1 изменённых файлов: 13 добавлений и 7 удалений

Просмотреть файл

@ -50,16 +50,22 @@ switch (insn) {
% case insn.name
% when 'opt_send_without_block', 'send'
<%= 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 'opt_aref', 'opt_aset', 'opt_mod' # TODO: automatically find them with CALL_SIMPLE_METHOD
% # 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))) {
<%= render 'mjit_compile_send', locals: { insn: opt_send_without_block } -%>
<%= render 'mjit_compile_insn', locals: { insn: opt_send_without_block } -%>
break;
}
% when 'getinstancevariable', 'setinstancevariable'
<%= render 'mjit_compile_ivar', locals: { insn: insn } -%>
% when 'leave'
if (b->stack_size != 1) {
if (mjit_opts.warnings || mjit_opts.verbose)
fprintf(stderr, "MJIT warning: Unexpected JIT stack_size on leave: %d\n", b->stack_size);
status->success = false;
}
if (b->stack_size != 1) {
if (mjit_opts.warnings || mjit_opts.verbose)
fprintf(stderr, "MJIT warning: Unexpected JIT stack_size on leave: %d\n", b->stack_size);
status->success = false;
}
% end
%
% # Main insn implementation generated by insns.def