summaryrefslogtreecommitdiff
path: root/ext/objspace
diff options
context:
space:
mode:
authorPeter Zhu <[email protected]>2024-05-03 12:00:24 -0400
committerPeter Zhu <[email protected]>2024-07-03 09:03:40 -0400
commit51bd816517941798c63e587a5a9f3caf69cd510e (patch)
treec0ad93459be4e0ae63f3e8ed3f56f93bda581a0c /ext/objspace
parent9aa62bda46bf7f9de91a95c31fa09dafd23def37 (diff)
[Feature #20470] Split GC into gc_impl.c
This commit splits gc.c into two files: - gc.c now only contains code not specific to Ruby GC. This includes code to mark objects (which the GC implementation may choose not to use) and wrappers for internal APIs that the implementation may need to use (e.g. locking the VM). - gc_impl.c now contains the implementation of Ruby's GC. This includes marking, sweeping, compaction, and statistics. Most importantly, gc_impl.c only uses public APIs in Ruby and a limited set of functions exposed in gc.c. This allows us to build gc_impl.c independently of Ruby and plug Ruby's GC into itself.
Diffstat (limited to 'ext/objspace')
-rw-r--r--ext/objspace/objspace.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/ext/objspace/objspace.c b/ext/objspace/objspace.c
index 24d7bd419f..e3269b5cd9 100644
--- a/ext/objspace/objspace.c
+++ b/ext/objspace/objspace.c
@@ -577,7 +577,7 @@ reachable_object_from_i(VALUE obj, void *data_ptr)
VALUE key = obj;
VALUE val = obj;
- if (rb_objspace_markable_object_p(obj)) {
+ if (!rb_objspace_garbage_object_p(obj)) {
if (NIL_P(rb_hash_lookup(data->refs, key))) {
rb_hash_aset(data->refs, key, Qtrue);
@@ -643,7 +643,7 @@ collect_values(st_data_t key, st_data_t value, st_data_t data)
static VALUE
reachable_objects_from(VALUE self, VALUE obj)
{
- if (rb_objspace_markable_object_p(obj)) {
+ if (!RB_SPECIAL_CONST_P(obj)) {
struct rof_data data;
if (rb_typeddata_is_kind_of(obj, &iow_data_type)) {
@@ -690,7 +690,7 @@ reachable_object_from_root_i(const char *category, VALUE obj, void *ptr)
rb_hash_aset(data->categories, category_str, category_objects);
}
- if (rb_objspace_markable_object_p(obj) &&
+ if (!rb_objspace_garbage_object_p(obj) &&
obj != data->categories &&
obj != data->last_category_objects) {
if (rb_objspace_internal_object_p(obj)) {