summaryrefslogtreecommitdiff
path: root/tool/ruby_vm
diff options
context:
space:
mode:
Diffstat (limited to 'tool/ruby_vm')
-rw-r--r--tool/ruby_vm/views/_mjit_compile_send.erb6
-rw-r--r--tool/ruby_vm/views/mjit_compile.inc.erb8
2 files changed, 10 insertions, 4 deletions
diff --git a/tool/ruby_vm/views/_mjit_compile_send.erb b/tool/ruby_vm/views/_mjit_compile_send.erb
index 71efae9497..8c1c1c094d 100644
--- a/tool/ruby_vm/views/_mjit_compile_send.erb
+++ b/tool/ruby_vm/views/_mjit_compile_send.erb
@@ -20,13 +20,13 @@
const CALL_INFO ci = cd->ci;
int kw_splat = IS_ARGS_KW_SPLAT(ci) > 0;
extern bool rb_splat_or_kwargs_p(const struct rb_callinfo *restrict ci);
- if (!status->compile_info->disable_send_cache && (
+ if (!status->compile_info->disable_send_cache && has_valid_method_type(captured_cc) && (
% # `CC_SET_FASTPATH(cd->cc, vm_call_cfunc_with_frame, ...)` in `vm_call_cfunc`
- (has_valid_method_type(captured_cc, VM_METHOD_TYPE_CFUNC)
+ (vm_cc_cme(captured_cc)->def->type == VM_METHOD_TYPE_CFUNC
&& !rb_splat_or_kwargs_p(ci) && !kw_splat)
% # `CC_SET_FASTPATH(cc, vm_call_iseq_setup_func(...), vm_call_iseq_optimizable_p(...))` in `vm_callee_setup_arg`,
% # and support only non-VM_CALL_TAILCALL path inside it
- || (has_valid_method_type(captured_cc, VM_METHOD_TYPE_ISEQ)
+ || (vm_cc_cme(captured_cc)->def->type == VM_METHOD_TYPE_ISEQ
&& fastpath_applied_iseq_p(ci, captured_cc, iseq = def_iseq_ptr(vm_cc_cme(captured_cc)->def))
&& !(vm_ci_flag(ci) & VM_CALL_TAILCALL))
)) {
diff --git a/tool/ruby_vm/views/mjit_compile.inc.erb b/tool/ruby_vm/views/mjit_compile.inc.erb
index ea145e5b87..b399b7f583 100644
--- a/tool/ruby_vm/views/mjit_compile.inc.erb
+++ b/tool/ruby_vm/views/mjit_compile.inc.erb
@@ -29,6 +29,12 @@
% insn.expr.expr.lines.any? { |l| l.match(/\A\s+CALL_SIMPLE_METHOD\(\);\s+\z/) }
% end.map(&:name)
%
+% # These insns cache cfunc in cc under optimized circumstances. They don't generate opt_send when cfunc is cached.
+% cfunc_insns = [
+% 'opt_nil_p',
+% 'opt_not',
+% ]
+%
% # Available variables and macros in JIT-ed function:
% # ec: the first argument of _mjitXXX
% # reg_cfp: the second argument of _mjitXXX
@@ -56,7 +62,7 @@ switch (insn) {
% when *send_compatible_opt_insns
% # To avoid cancel, just emit `opt_send_without_block` instead of `opt_*` insn if call cache is populated.
% cd_index = insn.opes.index { |o| o.fetch(:type) == 'CALL_DATA' }
- if (has_valid_method_type(captured_cc_entries(status)[call_data_index((CALL_DATA)operands[<%= cd_index %>], body)], VM_METHOD_TYPE_ISEQ)) {
+ if (has_cache_for_send(captured_cc_entries(status)[call_data_index((CALL_DATA)operands[<%= cd_index %>], body)], <%= cfunc_insns.include?(insn.name) %>)) {
<%= render 'mjit_compile_send', locals: { insn: opt_send_without_block } -%>
<%= render 'mjit_compile_insn', locals: { insn: opt_send_without_block } -%>
break;