summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAaron Patterson <tenderlove@ruby-lang.org>2020-09-22 15:57:48 (GMT)
committerAaron Patterson <tenderlove@ruby-lang.org>2020-09-22 15:57:48 (GMT)
commit8b41e9b6e77b74ba7b90774dc1ff1959b95ca61a (patch)
treefbb8a9c03c94ee22e4116e35a57c428a4ec2bba7
parentdf14c758fc705c49c2aaf4c9276a8f7229438fbf (diff)
Revert "Pin values in the finalizer table"
If an object has a finalizer flag set on it, prevent it from moving. This partially reverts commit 1a9dd31910699c7cd69f2a84c94af20eacd5875c.
-rw-r--r--gc.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/gc.c b/gc.c
index aa63cdb..5e84f51 100644
--- a/gc.c
+++ b/gc.c
@@ -7860,6 +7860,11 @@ gc_is_moveable_obj(rb_objspace_t *objspace, VALUE obj)
case T_RATIONAL:
case T_NODE:
case T_CLASS:
+ if (FL_TEST(obj, FL_FINALIZE)) {
+ if (st_is_member(finalizer_table, obj)) {
+ return FALSE;
+ }
+ }
return RVALUE_MARKED(obj) && !RVALUE_PINNED(obj);
default:
@@ -8757,6 +8762,7 @@ gc_update_references(rb_objspace_t * objspace)
gc_update_tbl_refs(objspace, objspace->obj_to_id_tbl);
gc_update_table_refs(objspace, objspace->id_to_obj_tbl);
gc_update_table_refs(objspace, global_symbols.str_sym);
+ gc_update_table_refs(objspace, finalizer_table);
}
static VALUE type_sym(size_t type);