summaryrefslogtreecommitdiff
path: root/gc/default/default.c
diff options
context:
space:
mode:
authorPeter Zhu <[email protected]>2025-03-12 09:25:51 -0400
committerPeter Zhu <[email protected]>2025-03-13 10:12:24 -0400
commitbdb25959fb047af0358f33d7327b7752dca14aa4 (patch)
treea87ad9658cd4b20f2fc891faf9c8eaca09b0da2c /gc/default/default.c
parent3d4c7c38020fa4de420e927e0b579aeff62b54ba (diff)
Move object_id to flags for ObjectSpace dumps
Moving object_id dumping from ObjectSpace to the GC flags allows ObjectSpace to not assume the FL_SEEN_OBJ_ID flag and instead move it to the responsibility of the GC.
Notes
Notes: Merged: https://github.com/ruby/ruby/pull/12915
Diffstat (limited to 'gc/default/default.c')
-rw-r--r--gc/default/default.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/gc/default/default.c b/gc/default/default.c
index 919df03440..76987c92fe 100644
--- a/gc/default/default.c
+++ b/gc/default/default.c
@@ -6197,7 +6197,7 @@ rb_gc_impl_object_metadata(void *objspace_ptr, VALUE obj)
{
rb_objspace_t *objspace = objspace_ptr;
size_t n = 0;
- static ID ID_wb_protected, ID_age, ID_old, ID_uncollectible, ID_marking, ID_marked, ID_pinned;
+ static ID ID_wb_protected, ID_age, ID_old, ID_uncollectible, ID_marking, ID_marked, ID_pinned, ID_object_id;
if (!ID_marked) {
#define I(s) ID_##s = rb_intern(#s);
@@ -6208,6 +6208,7 @@ rb_gc_impl_object_metadata(void *objspace_ptr, VALUE obj)
I(marking);
I(marked);
I(pinned);
+ I(object_id);
#undef I
}
@@ -6225,6 +6226,7 @@ rb_gc_impl_object_metadata(void *objspace_ptr, VALUE obj)
if (RVALUE_MARKING(objspace, obj)) SET_ENTRY(marking, Qtrue);
if (RVALUE_MARKED(objspace, obj)) SET_ENTRY(marked, Qtrue);
if (RVALUE_PINNED(objspace, obj)) SET_ENTRY(pinned, Qtrue);
+ if (FL_TEST(obj, FL_SEEN_OBJ_ID)) SET_ENTRY(object_id, rb_obj_id(obj));
object_metadata_entries[n].name = 0;
object_metadata_entries[n].val = 0;