From 8c6157e048db72e42f898e8c9e08ee9ceed8fe1c Mon Sep 17 00:00:00 2001 From: ko1 Date: Tue, 5 Nov 2013 22:13:51 +0000 Subject: [PATCH] * gc.c (Init_GC): add GC::OPTS to show options. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@43544 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- ChangeLog | 4 ++++ gc.c | 19 +++++++++++++++++++ 2 files changed, 23 insertions(+) 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 + } }