Skip to content

Commit

Permalink
Merge remote-tracking branch 'eileencodes/minor-refactoring' into mmtk
Browse files Browse the repository at this point in the history
  • Loading branch information
wks committed May 9, 2024
2 parents 8973e65 + 2118467 commit 4a469c7
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 13 deletions.
19 changes: 8 additions & 11 deletions gc.c
Original file line number Diff line number Diff line change
Expand Up @@ -2666,10 +2666,6 @@ gc_event_hook_body(rb_execution_context_t *ec, rb_objspace_t *objspace, const rb

#define gc_event_hook(objspace, event, data) gc_event_hook_prep(objspace, event, data, (void)0)

#if USE_MMTK

#endif

static inline VALUE
newobj_init(VALUE klass, VALUE flags, int wb_protected, rb_objspace_t *objspace, VALUE obj)
{
Expand Down Expand Up @@ -3341,7 +3337,8 @@ cvar_table_free_i(VALUE value, void *ctx)
#define ZOMBIE_OBJ_KEPT_FLAGS (FL_SEEN_OBJ_ID | FL_FINALIZE)

#if USE_MMTK
static inline void rb_mmtk_push_final_job(struct MMTk_FinalJob *job)
static inline void
rb_mmtk_push_final_job(struct MMTk_FinalJob *job)
{
rb_objspace_t *objspace = &rb_objspace;

Expand Down Expand Up @@ -7524,15 +7521,15 @@ gc_mark_children(rb_objspace_t *objspace, VALUE obj)
if (any->as.match.str) {
gc_mark(objspace, any->as.match.str);
}
#if USE_MMTK
#if USE_MMTK
if (rb_mmtk_enabled_p()) {
// If GC is triggered when the mutator is resizing the following buffers, we retain
// them because their contents need to be copied to the new buffers after GC.
rb_mmtk_scan_offsetted_strbuf_field((char**)&RMATCH_EXT(any)->char_offset, false);
rb_mmtk_scan_offsetted_strbuf_field((char**)&RMATCH_EXT(any)->regs.beg, false);
rb_mmtk_scan_offsetted_strbuf_field((char**)&RMATCH_EXT(any)->regs.end, false);
}
#endif
#endif
break;

case T_RATIONAL:
Expand Down Expand Up @@ -10321,7 +10318,7 @@ gc_sort_heap_by_compare_func(rb_objspace_t *objspace, gc_compact_compare_func co

#if USE_MMTK
static void
gc_ref_update_string(rb_objspace_t * objspace, VALUE str)
rb_mmtk_gc_ref_update_string(rb_objspace_t * objspace, VALUE str)
{
if (STR_EMBED_P(str)) {
// Embedded strings don't point into any buffer.
Expand Down Expand Up @@ -10851,7 +10848,7 @@ gc_update_object_references(rb_objspace_t *objspace, VALUE obj)
{
#if USE_MMTK
if (rb_mmtk_enabled_p()) {
gc_ref_update_string(objspace, obj);
rb_mmtk_gc_ref_update_string(objspace, obj);
break;
}
#endif
Expand Down Expand Up @@ -10926,15 +10923,15 @@ gc_update_object_references(rb_objspace_t *objspace, VALUE obj)
UPDATE_IF_MOVED(objspace, any->as.match.str);
}

#if USE_MMTK
#if USE_MMTK
if (rb_mmtk_enabled_p()) {
// If GC is triggered when the mutator is resizing the following buffers, we retain
// them because their contents need to be copied to the new buffers after GC.
rb_mmtk_scan_offsetted_strbuf_field((char**)&RMATCH_EXT(any)->char_offset, true);
rb_mmtk_scan_offsetted_strbuf_field((char**)&RMATCH_EXT(any)->regs.beg, true);
rb_mmtk_scan_offsetted_strbuf_field((char**)&RMATCH_EXT(any)->regs.end, true);
}
#endif
#endif

break;

Expand Down
4 changes: 2 additions & 2 deletions imemo.c
Original file line number Diff line number Diff line change
Expand Up @@ -241,7 +241,7 @@ cc_table_mark_i(ID id, VALUE ccs_ptr, void *data)

#if USE_MMTK
static enum rb_id_table_iterator_result
cc_table_mark_i_no_id(VALUE ccs_ptr, void *data_ptr)
rb_mmtk_cc_table_mark_i_no_id(VALUE ccs_ptr, void *data_ptr)
{
return cc_table_mark_i(0, ccs_ptr, data_ptr);
}
Expand All @@ -257,7 +257,7 @@ rb_cc_table_mark(VALUE klass)
// Note: rb_id_table_foreach will look up the ID from keys by accessing
// arrays in the heap during key2id, but the id is only used for
// assertion which fails with an evacuating GC (such as Immix) anyway.
rb_id_table_foreach_values(cc_tbl, cc_table_mark_i_no_id, (void *)klass);
rb_id_table_foreach_values(cc_tbl, rb_mmtk_cc_table_mark_i_no_id, (void *)klass);
} else {
#endif
rb_id_table_foreach(cc_tbl, cc_table_mark_i, (void *)klass);
Expand Down

0 comments on commit 4a469c7

Please sign in to comment.