Skip to content

Commit 742117e

Browse files
committed
Reorganize gray mark functions in GC.
1 parent 15ceb35 commit 742117e

1 file changed

Lines changed: 5 additions & 4 deletions

File tree

src/gc.c

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -960,13 +960,12 @@ root_scan_phase(mrb_state *mrb, mrb_gc *gc)
960960
}
961961
}
962962

963+
/* rough estimation of number of GC marks (non recursive) */
963964
static size_t
964-
gc_gray_mark(mrb_state *mrb, mrb_gc *gc, struct RBasic *obj)
965+
gc_gray_counts(mrb_state *mrb, mrb_gc *gc, struct RBasic *obj)
965966
{
966967
size_t children = 0;
967968

968-
gc_mark_children(mrb, gc, obj);
969-
970969
switch (obj->tt) {
971970
case MRB_TT_ICLASS:
972971
children++;
@@ -1064,7 +1063,9 @@ incremental_marking_phase(mrb_state *mrb, mrb_gc *gc, size_t limit)
10641063
size_t tried_marks = 0;
10651064

10661065
while (gc->gray_list && tried_marks < limit) {
1067-
tried_marks += gc_gray_mark(mrb, gc, gc->gray_list);
1066+
struct RBasic *obj = gc->gray_list;
1067+
gc_mark_children(mrb, gc, obj);
1068+
tried_marks += gc_gray_counts(mrb, gc, obj);
10681069
}
10691070

10701071
return tried_marks;

0 commit comments

Comments
 (0)