Skip to content

Commit

Permalink
Fix givtbl handling
Browse files Browse the repository at this point in the history
  • Loading branch information
wks committed Dec 14, 2023
1 parent 96df681 commit ff02d2e
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 11 deletions.
2 changes: 1 addition & 1 deletion internal/mmtk.h
Original file line number Diff line number Diff line change
Expand Up @@ -187,7 +187,7 @@ void mmtk_register_ppp(MMTk_ObjectReference object);

void mmtk_register_ppps(const MMTk_ObjectReference *objects, size_t len);

void *mmtk_get_givtbl(MMTk_ObjectReference object);
void *mmtk_get_givtbl_during_gc(MMTk_ObjectReference object);

size_t mmtk_get_vo_bit_log_region_size(void);

Expand Down
12 changes: 5 additions & 7 deletions mmtk_support.c
Original file line number Diff line number Diff line change
Expand Up @@ -1506,13 +1506,11 @@ rb_mmtk_scan_roots_in_mutator_thread(MMTk_VMMutatorThread mutator, MMTk_VMWorker
static void*
rb_mmtk_get_original_givtbl(MMTk_ObjectReference object) {
VALUE obj = (VALUE)object;
if (FL_TEST(obj, FL_EXIVAR)) {
struct gen_ivtbl *ivtbl;
if (rb_gen_ivtbl_get(obj, 0, &ivtbl)) {
return ivtbl;
} else {
return NULL;
}

RUBY_ASSERT(FL_TEST(obj, FL_EXIVAR));
struct gen_ivtbl *ivtbl;
if (rb_gen_ivtbl_get(obj, 0, &ivtbl)) {
return ivtbl;
} else {
return NULL;
}
Expand Down
19 changes: 16 additions & 3 deletions variable.c
Original file line number Diff line number Diff line change
Expand Up @@ -1100,17 +1100,19 @@ void
rb_mark_generic_ivar(VALUE obj)
{
struct gen_ivtbl *ivtbl;
int r = 0;

#if USE_MMTK
int r = 0;
if (rb_mmtk_enabled_p()) {
ivtbl = mmtk_get_givtbl((MMTk_ObjectReference)obj);
ivtbl = mmtk_get_givtbl_during_gc((MMTk_ObjectReference)obj);
r = (ivtbl != NULL);
} else {
r = rb_gen_ivtbl_get(obj, 0, &ivtbl);
}
#endif
if (r) {
#else
if (rb_gen_ivtbl_get(obj, 0, &ivtbl)) {
#endif
if (rb_shape_obj_too_complex(obj)) {
rb_mark_tbl_no_pin(ivtbl->as.complex.table);
}
Expand All @@ -1127,7 +1129,18 @@ rb_ref_update_generic_ivar(VALUE obj)
{
struct gen_ivtbl *ivtbl;

#if USE_MMTK
int r = 0;
if (rb_mmtk_enabled_p()) {
ivtbl = mmtk_get_givtbl_during_gc((MMTk_ObjectReference)obj);
r = (ivtbl != NULL);
} else {
r = rb_gen_ivtbl_get(obj, 0, &ivtbl);
}
if (r) {
#else
if (rb_gen_ivtbl_get(obj, 0, &ivtbl)) {
#endif
if (rb_shape_obj_too_complex(obj)) {
rb_gc_ref_update_table_values_only(ivtbl->as.complex.table);
}
Expand Down

0 comments on commit ff02d2e

Please sign in to comment.