summaryrefslogtreecommitdiff
path: root/gc.c
diff options
context:
space:
mode:
Diffstat (limited to 'gc.c')
-rw-r--r--gc.c11
1 files changed, 10 insertions, 1 deletions
diff --git a/gc.c b/gc.c
index 44db3570af..96df60e81d 100644
--- a/gc.c
+++ b/gc.c
@@ -1934,6 +1934,9 @@ object_id(VALUE obj)
// in different namespaces, so we cannot store the object id
// in fields.
return class_object_id(obj);
+ case T_IMEMO:
+ rb_bug("T_IMEMO can't have an object_id");
+ break;
default:
break;
}
@@ -1960,6 +1963,8 @@ build_id2ref_i(VALUE obj, void *data)
st_insert(id2ref_tbl, RCLASS(obj)->object_id, obj);
}
break;
+ case T_IMEMO:
+ break;
default:
if (rb_shape_obj_has_id(obj)) {
st_insert(id2ref_tbl, rb_obj_id(obj), obj);
@@ -2007,6 +2012,10 @@ object_id_to_ref(void *objspace_ptr, VALUE object_id)
static inline void
obj_free_object_id(VALUE obj)
{
+ if (RB_BUILTIN_TYPE(obj) == T_IMEMO) {
+ return;
+ }
+
VALUE obj_id = 0;
if (RB_UNLIKELY(id2ref_tbl)) {
switch (BUILTIN_TYPE(obj)) {
@@ -2210,7 +2219,7 @@ rb_obj_id(VALUE obj)
bool
rb_obj_id_p(VALUE obj)
{
- return rb_shape_obj_has_id(obj);
+ return !RB_TYPE_P(obj, T_IMEMO) && rb_shape_obj_has_id(obj);
}
static enum rb_id_table_iterator_result