summaryrefslogtreecommitdiff
path: root/tool
diff options
context:
space:
mode:
authork0kubun <k0kubun@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2019-04-14 08:33:43 +0000
committerk0kubun <k0kubun@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2019-04-14 08:33:43 +0000
commitb75bb06e00ab4d8b77ebd9b476ecf945f8b7f72a (patch)
treec4914bbe4b479a1eb11069eeb050bad374d41b68 /tool
parent18b5148215df99cebb0ba27f45f0dc7e0599737a (diff)
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
Diffstat (limited to 'tool')
-rw-r--r--tool/ruby_vm/views/mjit_compile.inc.erb20
1 files changed, 13 insertions, 7 deletions
diff --git a/tool/ruby_vm/views/mjit_compile.inc.erb b/tool/ruby_vm/views/mjit_compile.inc.erb
index 77dd7f442b..f6d52d692e 100644
--- a/tool/ruby_vm/views/mjit_compile.inc.erb
+++ b/tool/ruby_vm/views/mjit_compile.inc.erb
@@ -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