diff options
| author | Yukihiro "Matz" Matsumoto <[email protected]> | 2020-06-11 16:02:27 +0900 |
|---|---|---|
| committer | Yukihiro "Matz" Matsumoto <[email protected]> | 2020-06-11 16:18:52 +0900 |
| commit | 742117e7a3855efe98ed1ce96b5f71fa45a8f172 (patch) | |
| tree | 61bf67c6e0e09f65a696c8bc5b9b15da84648640 | |
| parent | 15ceb35e058a078f632a1ff7d0d424c59d48cd80 (diff) | |
| download | mruby-742117e7a3855efe98ed1ce96b5f71fa45a8f172.tar.gz mruby-742117e7a3855efe98ed1ce96b5f71fa45a8f172.zip | |
Reorganize gray mark functions in GC.
| -rw-r--r-- | src/gc.c | 9 |
1 files changed, 5 insertions, 4 deletions
@@ -960,13 +960,12 @@ root_scan_phase(mrb_state *mrb, mrb_gc *gc) } } +/* rough estimation of number of GC marks (non recursive) */ static size_t -gc_gray_mark(mrb_state *mrb, mrb_gc *gc, struct RBasic *obj) +gc_gray_counts(mrb_state *mrb, mrb_gc *gc, struct RBasic *obj) { size_t children = 0; - gc_mark_children(mrb, gc, obj); - switch (obj->tt) { case MRB_TT_ICLASS: children++; @@ -1064,7 +1063,9 @@ incremental_marking_phase(mrb_state *mrb, mrb_gc *gc, size_t limit) size_t tried_marks = 0; while (gc->gray_list && tried_marks < limit) { - tried_marks += gc_gray_mark(mrb, gc, gc->gray_list); + struct RBasic *obj = gc->gray_list; + gc_mark_children(mrb, gc, obj); + tried_marks += gc_gray_counts(mrb, gc, obj); } return tried_marks; |
