Skip to content

Commit

Permalink
Remove unused rb_gc_id2ref_obj_tbl
Browse files Browse the repository at this point in the history
  • Loading branch information
peterzhu2118 committed Feb 28, 2024
1 parent 49aa8d6 commit dcc976a
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 19 deletions.
21 changes: 3 additions & 18 deletions gc.c
Expand Up @@ -4424,20 +4424,6 @@ rb_gc_is_ptr_to_obj(const void *ptr)
return is_pointer_to_heap(objspace, ptr);
}

VALUE
rb_gc_id2ref_obj_tbl(VALUE objid)
{
rb_objspace_t *objspace = &rb_objspace;

VALUE orig;
if (st_lookup(objspace->id_to_obj_tbl, objid, &orig)) {
return orig;
}
else {
return Qundef;
}
}

/*
* call-seq:
* ObjectSpace._id2ref(object_id) -> an_object
Expand All @@ -4463,7 +4449,6 @@ id2ref(VALUE objid)
#endif
rb_objspace_t *objspace = &rb_objspace;
VALUE ptr;
VALUE orig;
void *p0;

objid = rb_to_int(objid);
Expand All @@ -4485,9 +4470,9 @@ id2ref(VALUE objid)
}
}

if (!UNDEF_P(orig = rb_gc_id2ref_obj_tbl(objid)) &&
is_live_object(objspace, orig)) {

VALUE orig;
if (st_lookup(objspace->id_to_obj_tbl, objid, &orig) &&
is_live_object(objspace, orig)) {
if (!rb_multi_ractor_p() || rb_ractor_shareable_p(orig)) {
return orig;
}
Expand Down
1 change: 0 additions & 1 deletion internal/gc.h
Expand Up @@ -242,7 +242,6 @@ size_t rb_gc_obj_slot_size(VALUE obj);
bool rb_gc_size_allocatable_p(size_t size);
int rb_objspace_garbage_object_p(VALUE obj);
bool rb_gc_is_ptr_to_obj(const void *ptr);
VALUE rb_gc_id2ref_obj_tbl(VALUE objid);
VALUE rb_define_finalizer_no_check(VALUE obj, VALUE block);

void rb_gc_mark_and_move(VALUE *ptr);
Expand Down

0 comments on commit dcc976a

Please sign in to comment.