Skip to content

Commit dccc1c0

Browse files
committed
Bring back rb_mark_generic_ivar for mmtk compat
1 parent 3d74202 commit dccc1c0

3 files changed

Lines changed: 12 additions & 4 deletions

File tree

gc.c

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3087,10 +3087,7 @@ rb_gc_mark_children(void *objspace, VALUE obj)
30873087
struct gc_mark_classext_foreach_arg foreach_args;
30883088

30893089
if (rb_obj_exivar_p(obj)) {
3090-
VALUE fields_obj = rb_obj_fields_no_ractor_check(obj);
3091-
if (fields_obj) {
3092-
gc_mark_internal(fields_obj);
3093-
}
3090+
rb_mark_generic_ivar(obj);
30943091
}
30953092

30963093
switch (BUILTIN_TYPE(obj)) {

internal/variable.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,7 @@ void rb_obj_field_set(VALUE obj, shape_id_t target_shape_id, ID field_name, VALU
5656

5757
RUBY_SYMBOL_EXPORT_BEGIN
5858
/* variable.c (export) */
59+
void rb_mark_generic_ivar(VALUE obj);
5960
VALUE rb_const_missing(VALUE klass, VALUE name);
6061
bool rb_class_ivar_set(VALUE klass, ID vid, VALUE value);
6162
void rb_fields_tbl_copy(VALUE dst, VALUE src);

variable.c

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1211,6 +1211,16 @@ rb_generic_fields_tbl_get(void)
12111211
return generic_fields_tbl_;
12121212
}
12131213

1214+
void
1215+
rb_mark_generic_ivar(VALUE obj)
1216+
{
1217+
VALUE data;
1218+
// Bypass ASSERT_vm_locking() check because marking may happen concurrently with mmtk
1219+
if (st_lookup(generic_fields_tbl_, (st_data_t)obj, (st_data_t *)&data)) {
1220+
rb_gc_mark_movable(data);
1221+
}
1222+
}
1223+
12141224
VALUE
12151225
rb_obj_fields(VALUE obj, ID field_name)
12161226
{

0 commit comments

Comments
 (0)