diff --git a/ChangeLog b/ChangeLog index 9cc3ce46bd..12c2283032 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,7 @@ +Wed Nov 6 07:13:18 2013 Koichi Sasada + + * gc.c (Init_GC): add GC::OPTS to show options. + Wed Nov 6 07:12:17 2013 Koichi Sasada * benchmark/gc/gcbench.rb: add some options to make quiet. diff --git a/gc.c b/gc.c index 1356702fa1..9583ec1715 100644 --- a/gc.c +++ b/gc.c @@ -6827,4 +6827,23 @@ Init_GC(void) rb_define_singleton_method(rb_mGC, "malloc_allocated_size", gc_malloc_allocated_size, 0); rb_define_singleton_method(rb_mGC, "malloc_allocations", gc_malloc_allocations, 0); #endif + + /* ::GC::OPTS, which shows GC build options */ + { + VALUE opts; + rb_define_const(rb_mGC, "OPTS", opts = rb_ary_new()); +#define OPT(o) if (o) rb_ary_push(opts, rb_str_new2(#o)) + OPT(GC_DEBUG); + OPT(USE_RGENGC); + OPT(RGENGC_DEBUG); + OPT(RGENGC_CHECK_MODE); + OPT(RGENGC_PROFILE); + OPT(RGENGC_THREEGEN); + OPT(RGENGC_ESTIMATE_OLDSPACE); + OPT(GC_PROFILE_MORE_DETAIL); + OPT(GC_ENABLE_LAZY_SWEEP); + OPT(CALC_EXACT_MALLOC_SIZE); + OPT(CALC_EXACT_MALLOC_SIZE_CHECK_OLD_SIZE); +#undef OPT + } }