summaryrefslogtreecommitdiff
path: root/tool
diff options
context:
space:
mode:
authorTakashi Kokubun <takashikkbn@gmail.com>2020-07-10 00:42:43 -0700
committerTakashi Kokubun <takashikkbn@gmail.com>2020-07-10 00:44:02 -0700
commit7fa3c71becd6d9b11d1574b3537a3b2993a7046c (patch)
tree4cab3c6b23d564deaa4271484c21baad35b59b95 /tool
parent4989987419c42b04fbf3b0634ddaeace49108689 (diff)
Make sure vm_call_cfunc uses inlined cc
which is checked by the first guard. When JIT-inlined cc and operand cd->cc are different, the JIT-ed code might wrongly dispatch cd->cc even while class check is done with another cc inlined by JIT. This fixes SEGV on railsbench.
Diffstat (limited to 'tool')
-rw-r--r--tool/ruby_vm/views/_mjit_compile_send.erb4
1 files changed, 2 insertions, 2 deletions
diff --git a/tool/ruby_vm/views/_mjit_compile_send.erb b/tool/ruby_vm/views/_mjit_compile_send.erb
index 6b271d4d74..2dff0165bd 100644
--- a/tool/ruby_vm/views/_mjit_compile_send.erb
+++ b/tool/ruby_vm/views/_mjit_compile_send.erb
@@ -75,8 +75,8 @@
if (vm_cc_cme(captured_cc)->def->type == VM_METHOD_TYPE_CFUNC) {
% # TODO: optimize this more
- fprintf(f, " CALL_DATA cd = (CALL_DATA)0x%"PRIxVALUE";\n", operands[0]);
- fprintf(f, " val = vm_call_cfunc_with_frame(ec, reg_cfp, &calling, cd);\n");
+ fprintf(f, " struct rb_call_data cc_cd = { .ci = (CALL_INFO)0x%"PRIxVALUE", .cc = cc };\n", (VALUE)ci); // creating local cd here because operand's cd->cc may not be the same as inlined cc.
+ fprintf(f, " val = vm_call_cfunc_with_frame(ec, reg_cfp, &calling, &cc_cd);\n");
}
else { // VM_METHOD_TYPE_ISEQ
% # fastpath_applied_iseq_p checks rb_simple_iseq_p, which ensures has_opt == FALSE