aboutsummaryrefslogtreecommitdiffstats
path: root/vm_insnhelper.c
diff options
context:
space:
mode:
Diffstat (limited to 'vm_insnhelper.c')
-rw-r--r--vm_insnhelper.c7
1 files changed, 6 insertions, 1 deletions
diff --git a/vm_insnhelper.c b/vm_insnhelper.c
index 30177b7a19..3d2667dfa7 100644
--- a/vm_insnhelper.c
+++ b/vm_insnhelper.c
@@ -2667,9 +2667,14 @@ vm_call_bmethod_body(rb_execution_context_t *ec, struct rb_calling_info *calling
rb_proc_t *proc;
VALUE val;
const struct rb_callcache *cc = cd->cc;
+ const rb_callable_method_entry_t *cme = vm_cc_cme(cc);
+
+ if (cme->def->body.bmethod.defined_ractor != rb_ec_ractor_ptr(ec)->self) {
+ rb_raise(rb_eRuntimeError, "defined in a different Ractor");
+ }
/* control block frame */
- GetProcPtr(vm_cc_cme(cc)->def->body.bmethod.proc, proc);
+ GetProcPtr(cme->def->body.bmethod.proc, proc);
val = rb_vm_invoke_bmethod(ec, proc, calling->recv, calling->argc, argv, calling->kw_splat, calling->block_handler, vm_cc_cme(cc));
return val;