Skip to content

Commit

Permalink
Also update id_to_obj_tbl in rb_mmtk_update_obj_id_tables
Browse files Browse the repository at this point in the history
  • Loading branch information
peterzhu2118 committed Oct 17, 2024
1 parent ea31274 commit 88479de
Showing 1 changed file with 15 additions and 3 deletions.
18 changes: 15 additions & 3 deletions gc/mmtk.c
Original file line number Diff line number Diff line change
Expand Up @@ -399,12 +399,23 @@ rb_mmtk_update_table_i(VALUE val, void *data)
}

static int
rb_mmtk_update_obj_id_tables_i(st_data_t key, st_data_t val, st_data_t data)
rb_mmtk_update_obj_id_tables_obj_to_id_i(st_data_t key, st_data_t val, st_data_t data)
{
RUBY_ASSERT(RB_FL_TEST(key, FL_SEEN_OBJ_ID));

if (!mmtk_is_reachable((MMTk_ObjectReference)key)) {
RB_FL_UNSET(key, FL_SEEN_OBJ_ID);
return ST_DELETE;
}

return ST_CONTINUE;
}

static int
rb_mmtk_update_obj_id_tables_id_to_obj_i(st_data_t key, st_data_t val, st_data_t data)
{
RUBY_ASSERT(RB_FL_TEST(val, FL_SEEN_OBJ_ID));

if (!mmtk_is_reachable((MMTk_ObjectReference)val)) {
return ST_DELETE;
}

Expand All @@ -416,7 +427,8 @@ rb_mmtk_update_obj_id_tables(void)
{
struct objspace *objspace = rb_gc_get_objspace();

st_foreach(objspace->obj_to_id_tbl, rb_mmtk_update_obj_id_tables_i, 0);
st_foreach(objspace->obj_to_id_tbl, rb_mmtk_update_obj_id_tables_obj_to_id_i, 0);
st_foreach(objspace->id_to_obj_tbl, rb_mmtk_update_obj_id_tables_id_to_obj_i, 0);
}

static int
Expand Down

0 comments on commit 88479de

Please sign in to comment.