mirror of
https://github.com/ruby/ruby.git
synced 2026-10-28 16:36:20 +08:00
Ractor: mark a terminated Ractor's join value through one function
rb_ractor_mark_in_flight_for_single_objspace marked r->sync.legacy and nothing else once the pin machinery went away, which is what rb_ractor_mark_terminated_join_value next to it already does -- two functions over the same field, and the surviving one names it correctly. Call that one from the single-objspace branch and drop the other. It also pins, which the plain rb_gc_mark did not. sync.legacy is a C-struct slot with no compaction update hook anywhere, so pinning is the treatment the field needs; the comment on rb_ractor_mark_terminated_join_value says so. The name had stopped describing the function: "in flight" meant the sending basket and the pinned copy snapshot it used to mark, and both are gone. The word is also the GC-cycle sense elsewhere in this code, which is why the wrapper it sat next to is now rb_gc_rest. Only the ractor.c translation unit used it -- ractor.c includes ractor_sync.c -- so the ractor_core.h declaration goes too. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
This commit is contained in:
1 parent
93a5504fce
commit
0541de372f
3 files changed
+3
-13
Notes:
git
2026-08-20 04:49:26 +00:00
No files matched your search
@@ -306,11 +306,11 @@ ractor_mark(void *ptr)
|
||||
* both the set and zombie_objspaces (orphan-merged) this marker is its only cover. */
|
||||
rb_gc_mark(r->sync.default_port_value);
|
||||
/* A single-objspace impl (mmtk) has no zombie_objspaces and no pin/shref bits, so
|
||||
* the root scan cannot reach a terminated Ractor's legacy value, queue or in-flight
|
||||
* payloads; and no shref rule forbids following them from the wrapper. */
|
||||
* the root scan cannot reach a terminated Ractor's queue, in-flight payloads or
|
||||
* join value; and no shref rule forbids following them from the wrapper. */
|
||||
if (!rb_gc_multi_objspace_p()) {
|
||||
ractor_mark_unshareable_parts(r);
|
||||
rb_ractor_mark_in_flight_for_single_objspace(r);
|
||||
rb_ractor_mark_terminated_join_value(r);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -159,7 +159,6 @@ struct rb_ractor_struct {
|
||||
/* Mark the GC roots held in Ractor r's C structs (from the root scan in gc.c). */
|
||||
void rb_ractor_mark_local_roots(rb_ractor_t *r);
|
||||
void rb_ractor_mark_terminated_join_value(rb_ractor_t *r);
|
||||
void rb_ractor_mark_in_flight_for_single_objspace(rb_ractor_t *r);
|
||||
|
||||
/* Move src's registered_marks to dst and leave src empty (on join or when an orphan
|
||||
* is absorbed). An absorb can run during a GC sweep, so the implementation uses raw
|
||||
|
||||
@@ -825,15 +825,6 @@ ractor_sync_mark(rb_ractor_t *r)
|
||||
}
|
||||
}
|
||||
|
||||
/* A single-objspace impl (mmtk) has no pin or shref bits and no zombie_objspaces, so
|
||||
* plain marking from the wrapper keeps these alive; the default GC covers the same set
|
||||
* with its pins and its zombie scan. */
|
||||
void
|
||||
rb_ractor_mark_in_flight_for_single_objspace(rb_ractor_t *r)
|
||||
{
|
||||
rb_gc_mark(r->sync.legacy);
|
||||
}
|
||||
|
||||
static int
|
||||
ractor_sync_free_ports_i(st_data_t _key, st_data_t val, st_data_t _args)
|
||||
{
|
||||
|
||||
Reference in new issue
Block a user