summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPeter Zhu <peter@peterzhu.ca>2024-08-28 11:18:43 -0400
committerPeter Zhu <peter@peterzhu.ca>2024-08-29 09:11:40 -0400
commitddd2b1784512aa8ac1efbe546635d21415d8a452 (patch)
tree8b39e4e6b6d757192cfbc5ebfaacd078ef5eb655
parentd33e3d47b84a73b38644f2a3d41881ce9be6ef18 (diff)
Move marking code together in gc.c
Notes
Notes: Merged: https://github.com/ruby/ruby/pull/11478
-rw-r--r--gc.c74
1 files changed, 38 insertions, 36 deletions
diff --git a/gc.c b/gc.c
index 916b654e12..bc76f84534 100644
--- a/gc.c
+++ b/gc.c
@@ -2034,6 +2034,44 @@ ruby_stack_check(void)
return stack_check(GET_EC(), STACKFRAME_FOR_CALL_CFUNC);
}
+/* ==================== Marking ==================== */
+
+void
+rb_gc_mark_movable(VALUE obj)
+{
+ rb_gc_impl_mark(rb_gc_get_objspace(), obj);
+}
+
+void
+rb_gc_mark_and_move(VALUE *ptr)
+{
+ rb_gc_impl_mark_and_move(rb_gc_get_objspace(), ptr);
+}
+
+void
+rb_gc_mark(VALUE obj)
+{
+ rb_gc_impl_mark_and_pin(rb_gc_get_objspace(), obj);
+}
+
+void
+rb_gc_mark_maybe(VALUE obj)
+{
+ rb_gc_impl_mark_maybe(rb_gc_get_objspace(), obj);
+}
+
+void
+rb_gc_mark_weak(VALUE *ptr)
+{
+ rb_gc_impl_mark_weak(rb_gc_get_objspace(), ptr);
+}
+
+void
+rb_gc_remove_weak(VALUE parent_obj, VALUE *ptr)
+{
+ rb_gc_impl_remove_weak(rb_gc_get_objspace(), parent_obj, ptr);
+}
+
ATTRIBUTE_NO_ADDRESS_SAFETY_ANALYSIS(static void each_location(void *objspace, register const VALUE *x, register long n, void (*cb)(void *objspace, VALUE)));
static void
each_location(void *objspace, register const VALUE *x, register long n, void (*cb)(void *objspace, VALUE))
@@ -2343,12 +2381,6 @@ rb_mark_tbl_no_pin(st_table *tbl)
gc_mark_tbl_no_pin(rb_gc_get_objspace(), tbl);
}
-void
-rb_gc_mark_maybe(VALUE obj)
-{
- rb_gc_impl_mark_maybe(rb_gc_get_objspace(), obj);
-}
-
static enum rb_id_table_iterator_result
mark_cvc_tbl_i(VALUE cvc_entry, void *objspace)
{
@@ -2371,36 +2403,6 @@ mark_cvc_tbl(void *objspace, VALUE klass)
}
}
-void
-rb_gc_mark_movable(VALUE obj)
-{
- rb_gc_impl_mark(rb_gc_get_objspace(), obj);
-}
-
-void
-rb_gc_mark(VALUE obj)
-{
- rb_gc_impl_mark_and_pin(rb_gc_get_objspace(), obj);
-}
-
-void
-rb_gc_mark_and_move(VALUE *ptr)
-{
- rb_gc_impl_mark_and_move(rb_gc_get_objspace(), ptr);
-}
-
-void
-rb_gc_mark_weak(VALUE *ptr)
-{
- rb_gc_impl_mark_weak(rb_gc_get_objspace(), ptr);
-}
-
-void
-rb_gc_remove_weak(VALUE parent_obj, VALUE *ptr)
-{
- rb_gc_impl_remove_weak(rb_gc_get_objspace(), parent_obj, ptr);
-}
-
static bool
gc_declarative_marking_p(const rb_data_type_t *type)
{