From 8b8e186688b4f84665aac0afeef0abc7deec57c5 Mon Sep 17 00:00:00 2001 From: "Yukihiro \"Matz\" Matsumoto" Date: Tue, 6 Jun 2023 11:26:35 +0900 Subject: [PATCH] gc.h: rename `majorgc_old_threashold` to `oldgen_threashold` This field means that if you have more old generation objects than this value, major GC mode will be turned on. --- include/mruby/gc.h | 2 +- src/gc.c | 8 ++++---- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/include/mruby/gc.h b/include/mruby/gc.h index ba56cefd7..b5e49d8d6 100644 --- a/include/mruby/gc.h +++ b/include/mruby/gc.h @@ -82,7 +82,7 @@ typedef struct mrb_gc { mrb_bool full :1; mrb_bool generational :1; mrb_bool out_of_memory :1; - size_t majorgc_old_threshold; + size_t oldgen_threshold; } mrb_gc; MRB_API mrb_bool mrb_object_dead_p(struct mrb_state *mrb, struct RBasic *object); diff --git a/src/gc.c b/src/gc.c index 83d64486f..1c46723a9 100644 --- a/src/gc.c +++ b/src/gc.c @@ -1276,7 +1276,7 @@ mrb_incremental_gc(mrb_state *mrb) gc->full = FALSE; if (threshold < MAJOR_GC_TOOMANY) { - gc->majorgc_old_threshold = threshold; + gc->oldgen_threshold = threshold; } else { /* too many objects allocated during incremental GC, */ @@ -1285,7 +1285,7 @@ mrb_incremental_gc(mrb_state *mrb) } } else if (is_minor_gc(gc)) { - if (gc->live > gc->majorgc_old_threshold) { + if (gc->live > gc->oldgen_threshold) { clear_all_old(mrb, gc); gc->full = TRUE; } @@ -1316,7 +1316,7 @@ mrb_full_gc(mrb_state *mrb) gc->threshold = (gc->live_after_mark/100) * gc->interval_ratio; if (is_generational(gc)) { - gc->majorgc_old_threshold = gc->live_after_mark/100 * MAJOR_GC_INC_RATIO; + gc->oldgen_threshold = gc->live_after_mark/100 * MAJOR_GC_INC_RATIO; gc->full = FALSE; } @@ -1521,7 +1521,7 @@ change_gen_gc_mode(mrb_state *mrb, mrb_gc *gc, mrb_bool enable) } else if (!is_generational(gc) && enable) { incremental_gc_finish(mrb, gc); - gc->majorgc_old_threshold = gc->live_after_mark/100 * MAJOR_GC_INC_RATIO; + gc->oldgen_threshold = gc->live_after_mark/100 * MAJOR_GC_INC_RATIO; gc->full = FALSE; } gc->generational = enable;