diff options
| author | John Hawthorn <john@hawthorn.email> | 2025-10-30 12:05:25 -0700 |
|---|---|---|
| committer | John Hawthorn <john@hawthorn.email> | 2025-12-04 13:25:45 -0800 |
| commit | 1d3fe2c382fd543bf12b2e12c2633162ea4b3a0a (patch) | |
| tree | 853316dc1d4fd4b3c5ce101359347117a2d96a2f /vm_method.c | |
| parent | de2c2bd60fdce52cc7ba38a25f3e9436442af604 (diff) | |
Change bmethod defined_ractor to use id instead
When defining a bmethod, we recorded the current Ractor's object in the
method. However that was never marked and so could be GC'd and reused by
a future Ractor. Instead we can use the Ractor's id, which we expect to
be unique forever.
Co-authored-by: Luke Gruber <luke.gru@gmail.com>
Diffstat (limited to 'vm_method.c')
| -rw-r--r-- | vm_method.c | 3 |
1 files changed, 1 insertions, 2 deletions
diff --git a/vm_method.c b/vm_method.c index 179deb749d..c4f391b5af 100644 --- a/vm_method.c +++ b/vm_method.c @@ -1020,7 +1020,7 @@ rb_method_definition_set(const rb_method_entry_t *me, rb_method_definition_t *de } case VM_METHOD_TYPE_BMETHOD: RB_OBJ_WRITE(me, &def->body.bmethod.proc, (VALUE)opts); - RB_OBJ_WRITE(me, &def->body.bmethod.defined_ractor, rb_ractor_self(GET_RACTOR())); + def->body.bmethod.defined_ractor_id = rb_ractor_id(rb_ec_ractor_ptr(GET_EC())); return; case VM_METHOD_TYPE_NOTIMPLEMENTED: setup_method_cfunc_struct(UNALIGNED_MEMBER_PTR(def, body.cfunc), (VALUE(*)(ANYARGS))rb_f_notimplement_internal, -1); @@ -1060,7 +1060,6 @@ method_definition_reset(const rb_method_entry_t *me) break; case VM_METHOD_TYPE_BMETHOD: RB_OBJ_WRITTEN(me, Qundef, def->body.bmethod.proc); - RB_OBJ_WRITTEN(me, Qundef, def->body.bmethod.defined_ractor); /* give up to check all in a list */ if (def->body.bmethod.hooks) rb_gc_writebarrier_remember((VALUE)me); break; |
